Zoom/Pan function in python addin tool

3386
2
03-20-2016 09:59 PM
Akhilkumar1
New Contributor

I have created one python addin tool which creates some points along a line, it works good.

my problem is when my tool gets activated i am not able able to zoom/pan the map. map view just get stuck wherever it was before clicking on that tool.

more elaborately when i am in the middle of creating a line map view get stuck.

using below code:

class PointAddressCreateClass(object😞
"""Implementation for PointAddressCreate_addin.tool (Tool)"""
def __init__(self😞
  self
.enabled = True
  self
.shape = "Line" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
def onMouseDown(self, x, y, button, shift😞
  
pass
def onMouseDownMap(self, x, y, button, shift😞
  
pass
def onMouseUp(self, x, y, button, shift😞
  
pass
def onMouseUpMap(self, x, y, button, shift😞
  
pass
def onMouseMove(self, x, y, button, shift😞
  
pass
def onMouseMoveMap(self, x, y, button, shift😞
  
pass
def onDblClick(self😞
  
pass
def onKeyDown(self, keycode, shift😞
  
pass
def onKeyUp(self, keycode, shift😞
  
pass
def deactivate(self😞
  
pass
def onCircle(self, circle_geometry😞
  
pass
def onLine(self, line_geometry😞
  
***Some Code HERE****

its main functionality lies in "def onLine(self, line_geometry)" function. so when i click on the map and start to create a line on map, i want zoom/pan functionality at that time.

i guess there should be a function to zoom/pan in active view by either mouse scrolling or may be any other method

0 Kudos
2 Replies
WesMiller
Regular Contributor III

Are you in an edit session have you tried using shortcut keys Keyboard shortcuts in ArcMap—Help | ArcGIS for Desktop

0 Kudos
Akhilkumar1
New Contributor

tool does not start edit session. it based on drawn line in map it creates points along line.

and i have tried short cut keys its not working

0 Kudos