[GRASS-dev] catch mouse click from MapDisplay

Maid,

There are already methods for capturing mouse clicks and drags in the several modules that control the display. This is clear given the fact that you can use a mouse to measure, zoom, profile, etc. Please do not add new ones. Use the existing classes and methods.

Michael Barton
School of Human Evolution &Social Change
Center for Social Dynamics & Complexity
Arizona State University

...Sent from my iPad

On Aug 15, 2011, at 1:04 PM, "grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org>" <grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org>> wrote:

Date: Mon, 15 Aug 2011 19:17:48 +0200
From: Margherita Di Leo <<mailto:dileomargherita@gmail.com>dileomargherita@gmail.com<mailto:dileomargherita@gmail.com>>
Subject: [GRASS-dev] catch mouse click from MapDisplay
To: <mailto:grass-dev@lists.osgeo.org> grass-dev@lists.osgeo.org<mailto:grass-dev@lists.osgeo.org>
Message-ID:
       <<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

Hi Devs,

For my GSoC project I am looking for a way to catch the coordinates of a
point by a mouse click over the Map Display. I was wondering if it's more
"wise" to edit the existing mapdisp_window.py file or define my own
OnLeftDown function in my code, which would override the one of class
BufferedWindow, or? As I am not allowed to edit the core source code, I ask
you devs what is better to do.

Thanks,

madi

--
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360<tel:+39-0971205360>

Hi Michael,

thanks for answering. I actually did not find a function to pick the coordinates of a point by a mouse click, could you please point me the function that I should use?

Thanks in advance,

madi

On Tue, Aug 16, 2011 at 2:47 AM, Michael Barton <Michael.Barton@asu.edu> wrote:

Maid,

There are already methods for capturing mouse clicks and drags in the several modules that control the display. This is clear given the fact that you can use a mouse to measure, zoom, profile, etc. Please do not add new ones. Use the existing classes and methods.

Michael Barton
School of Human Evolution &Social Change
Center for Social Dynamics & Complexity
Arizona State University

…Sent from my iPad

On Aug 15, 2011, at 1:04 PM, “grass-dev-request@lists.osgeo.orgmailto:[grass-dev-request@lists.osgeo.org](mailto:grass-dev-request@lists.osgeo.org)” <grass-dev-request@lists.osgeo.orgmailto:[grass-dev-request@lists.osgeo.org](mailto:grass-dev-request@lists.osgeo.org)> wrote:

Date: Mon, 15 Aug 2011 19:17:48 +0200
From: Margherita Di Leo <mailto:[dileomargherita@gmail.com](mailto:dileomargherita@gmail.com)dileomargherita@gmail.commailto:[dileomargherita@gmail.com](mailto:dileomargherita@gmail.com)>
Subject: [GRASS-dev] catch mouse click from MapDisplay
To: mailto:[grass-dev@lists.osgeo.org](mailto:grass-dev@lists.osgeo.org) grass-dev@lists.osgeo.orgmailto:[grass-dev@lists.osgeo.org](mailto:grass-dev@lists.osgeo.org)
Message-ID:
<mailto:[CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com](mailto:CA%2BV6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com)CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.commailto:[CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com](mailto:CA%2BV6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com)>
Content-Type: text/plain; charset=“utf-8”

Hi Devs,

For my GSoC project I am looking for a way to catch the coordinates of a
point by a mouse click over the Map Display. I was wondering if it’s more
“wise” to edit the existing mapdisp_window.py file or define my own
OnLeftDown function in my code, which would override the one of class
BufferedWindow, or? As I am not allowed to edit the core source code, I ask
you devs what is better to do.

Thanks,

madi


Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360tel:+39-0971205360


Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360

Hi Madi,
in method such a BufferedWindow::LeftDown(self, event) event is
MouseEvent and you can get cursor position:

coorPx = event.GetPositionTuple()[:] # coordinates in pixels
coorMU = self.Pixel2Cell(coorPx) # real world coordinates (E,N)

# or:
e1, n1 = self.Pixel2Cell(coorPx) # easting nording

Is it what you are looking for?

Vasek

On 16 August 2011 14:32, Margherita Di Leo <dileomargherita@gmail.com> wrote:

Hi Michael,

thanks for answering. I actually did not find a function to pick the
coordinates of a point by a mouse click, could you please point me the
function that I should use?

Thanks in advance,

madi

On Tue, Aug 16, 2011 at 2:47 AM, Michael Barton <Michael.Barton@asu.edu>
wrote:

Maid,

There are already methods for capturing mouse clicks and drags in the
several modules that control the display. This is clear given the fact that
you can use a mouse to measure, zoom, profile, etc. Please do not add new
ones. Use the existing classes and methods.

Michael Barton
School of Human Evolution &Social Change
Center for Social Dynamics & Complexity
Arizona State University

...Sent from my iPad

On Aug 15, 2011, at 1:04 PM,
"grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org>"
<grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org>>
wrote:

Date: Mon, 15 Aug 2011 19:17:48 +0200
From: Margherita Di Leo
<<mailto:dileomargherita@gmail.com>dileomargherita@gmail.com<mailto:dileomargherita@gmail.com>>
Subject: [GRASS-dev] catch mouse click from MapDisplay
To: <mailto:grass-dev@lists.osgeo.org>
grass-dev@lists.osgeo.org<mailto:grass-dev@lists.osgeo.org>
Message-ID:

<<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

Hi Devs,

For my GSoC project I am looking for a way to catch the coordinates of a
point by a mouse click over the Map Display. I was wondering if it's more
"wise" to edit the existing mapdisp_window.py file or define my own
OnLeftDown function in my code, which would override the one of class
BufferedWindow, or? As I am not allowed to edit the core source code, I
ask
you devs what is better to do.

Thanks,

madi

--
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360<tel:+39-0971205360>

--
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Search in mapdisp.py and mapdisp_window.py for the code for query. These handlers grab mouse screen coords and translate them into earth coords. Same for zoom and pan handlers.

Michael Barton
School of Human Evolution &Social Change
Center for Social Dynamics & Complexity
Arizona State University

...Sent from my iPad

On Aug 16, 2011, at 5:33 AM, "Margherita Di Leo" <dileomargherita@gmail.com<mailto:dileomargherita@gmail.com>> wrote:

Hi Michael,

thanks for answering. I actually did not find a function to pick the coordinates of a point by a mouse click, could you please point me the function that I should use?

Thanks in advance,

madi

On Tue, Aug 16, 2011 at 2:47 AM, Michael Barton <<mailto:Michael.Barton@asu.edu>Michael.Barton@asu.edu<mailto:Michael.Barton@asu.edu>> wrote:
Maid,

There are already methods for capturing mouse clicks and drags in the several modules that control the display. This is clear given the fact that you can use a mouse to measure, zoom, profile, etc. Please do not add new ones. Use the existing classes and methods.

Michael Barton
School of Human Evolution &Social Change
Center for Social Dynamics & Complexity
Arizona State University

...Sent from my iPad

On Aug 15, 2011, at 1:04 PM, "<mailto:grass-dev-request@lists.osgeo.org>grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org><mailto:grass-dev-request@lists.osgeo.org>grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org>>" <<mailto:grass-dev-request@lists.osgeo.org>grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org><mailto:grass-dev-request@lists.osgeo.org>grass-dev-request@lists.osgeo.org<mailto:grass-dev-request@lists.osgeo.org>>> wrote:

Date: Mon, 15 Aug 2011 19:17:48 +0200
From: Margherita Di Leo <<mailto:dileomargherita@gmail.com>dileomargherita@gmail.com<mailto:dileomargherita@gmail.com>><mailto:dileomargherita@gmail.com>dileomargherita@gmail.com<mailto:dileomargherita@gmail.com><mailto:dileomargherita@gmail.com>dileomargherita@gmail.com<mailto:dileomargherita@gmail.com>>>
Subject: [GRASS-dev] catch mouse click from MapDisplay
To: <mailto:grass-dev@lists.osgeo.org>grass-dev@lists.osgeo.org<mailto:grass-dev@lists.osgeo.org>> <mailto:grass-dev@lists.osgeo.org> grass-dev@lists.osgeo.org<mailto:grass-dev@lists.osgeo.org><mailto:grass-dev@lists.osgeo.org>grass-dev@lists.osgeo.org<mailto:grass-dev@lists.osgeo.org>>
Message-ID:
      <<mailto:CA%2BV6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>><mailto:CA%2BV6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com><mailto:CA%2BV6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA@mail.gmail.com>>>
Content-Type: text/plain; charset="utf-8"

Hi Devs,

For my GSoC project I am looking for a way to catch the coordinates of a
point by a mouse click over the Map Display. I was wondering if it's more
"wise" to edit the existing mapdisp_window.py file or define my own
OnLeftDown function in my code, which would override the one of class
BufferedWindow, or? As I am not allowed to edit the core source code, I ask
you devs what is better to do.

Thanks,

madi

--
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360<tel:%2B39-0971205360><tel:+39-0971205360<tel:%2B39-0971205360>>

--
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360