onMouseDownMap event with Line shape - Addin Tool

1537
10
09-07-2018 11:36 AM
YoavAbadi
New Contributor II

Hi,

I'm having issuses while developing a new addin - it seems that ALL mouse event handlers (except onMouseMove[Map]), doesn't work / blocked when I draw a line in on the map.

I really need that functionality, since my tool need to ignore certain points on the polyline, indicated by ctrl+left mouse click.

Does anybody knows how can I get thouse events while drawing a line?

Thanks,

Yoav.

P.S: There's a code example:

class DrawLine(object):
    """Implementation for SomeToolExample.drawline (Tool)"""
    def __init__(self):
        self.enabled = False
        self.shape = "Line"

    def onMouseDown(self, x, y, button, shift):
        # This DOESN'T work (blocked?) while a drawing a line
        pass

    def onMouseDownMap(self, x, y, button, shift):
        # This DOESN'T work (blocked?) while a drawing a line
        pass

    def onMouseUp(self, x, y, button, shift):
        # This DOESN'T work (blocked?) while a drawing a line
        pass

    def onMouseUpMap(self, x, y, button, shift):
        # This DOESN'T work (blocked?) while a drawing a line
        pass

    def onMouseMove(self, x, y, button, shift):
        # This is working while a drawing a line
        pass

    def onMouseMoveMap(self, x, y, button, shift):
        # This is working while a drawing a line
        pass

    def onDblClick(self):
        pass

    def onKeyDown(self, keycode, shift):
        # This DOESN'T work (blocked?) while a drawing a line
        pass

    def onKeyUp(self, keycode, shift):
        # This DOESN'T work (blocked?) while a drawing a line
        pass

    def deactivate(self):
        pass

    def onLine(self, line_geometry):
        # Main Logic here, not important for this example
        pass
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

Is this the help topic you are following?

Tool class—Help | ArcGIS Desktop 

0 Kudos
YoavAbadi
New Contributor II

Hi Mark, 

Thanks for replying.

What do you mean by following?

I did read all the documentations and every existing post here/gis-stockexcstock before I posted this .

But, i didn't see anywhere a mention about one event blocking the other.

I did see that by using None shape, you can utilize the on events handlers, but as I mentioned above, I must have a line drawing while using them 😕

I you have any idea what to do, it will be much appreciated!

Yoav.

0 Kudos
DanPatterson_Retired
MVP Emeritus

They need some more specific examples I suppose, but the way I read it, nothing will happen and no functions are called until the line is drawn first. There doesn't seem to be any example of drawing a line and skipping points

0 Kudos
YoavAbadi
New Contributor II

Do you know if there is something like that in arcobjects, in case illI have to rewrite everything in c# for skipping a point?

I want just the coords of the points whike there been drawn 😕

0 Kudos
DanPatterson_Retired
MVP Emeritus

I don't use arcobjects… my preference would be a right-click on a selection rather than trying to skip stuff during a drawing process

0 Kudos
YoavAbadi
New Contributor II

Yes, but that's what i have to do.. 😕

Thanks, Yoav.

0 Kudos
RandyBurton
MVP Alum

There is an example of onMouseDownMap on this page:  How To: Capture map coordinates with a mouse click using Python

0 Kudos
YoavAbadi
New Contributor II

Hi Randy,

Yes, I read that, as you see, this code uses None shape, and i need the mouse events to work while in line shape event.

Do you hace a solution to that?

Yoav.

0 Kudos
RandyBurton
MVP Alum

What code have you tried with the onMouseDownMap? Just 'pass'? Don't know if something like this would work, but have you tried saving the onMouseDownMap x, y, button and shift data in an array, and then checking the array when onLine is triggered?

0 Kudos