[GRASS-dev] catch mouse click from MapDisplay

Wenzeslaus wenzeslaus at gmail.com
Tue Aug 16 10:07:37 EDT 2011


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 at 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 at 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 at lists.osgeo.org<mailto:grass-dev-request at lists.osgeo.org>"
>> <grass-dev-request at lists.osgeo.org<mailto:grass-dev-request at lists.osgeo.org>>
>> wrote:
>>
>> Date: Mon, 15 Aug 2011 19:17:48 +0200
>> From: Margherita Di Leo
>> <<mailto:dileomargherita at gmail.com>dileomargherita at gmail.com<mailto:dileomargherita at gmail.com>>
>> Subject: [GRASS-dev] catch mouse click from MapDisplay
>> To: <mailto:grass-dev at lists.osgeo.org>
>> grass-dev at lists.osgeo.org<mailto:grass-dev at lists.osgeo.org>
>> Message-ID:
>>
>> <<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA at mail.gmail.com>CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA at mail.gmail.com<mailto:CA+V6ZhWFsG3TzDFDu-0YPV5WPDRw9mQw_NNrn3cKNi1DDgOYbA at 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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>


More information about the grass-dev mailing list