Estoy codificando un addin que me permita utilizar 3 comboboxes para seleccionar regiones específicas dentro de un estado. Una vez seleccionadas todas en los comboboxes necesito un botón final para hacer zoom a la zona seleccionada, indicada por los comboboxes. No estoy seguro de cómo conseguir que las selecciones de los tres comboboxes se pasen al botón de zoom para que haga zoom a la región seleccionada correcta.
A continuación se muestra mi código:
import arcpy
import pythonaddins
class SectionComboBoxClass35(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox (ComboBox)"""
def __init__(self):
self.items = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10" ,"11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31",
"32", "33", "34", "35", "36"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class TownshipComboBoxClass36(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_1 (ComboBox)"""
def __init__(self):
self.items = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31","32", "32", "33", "34", "35"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class TownshipDirectionComboBoxClass37(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_2 (ComboBox)"""
def __init__(self):
self.items = ["N", "S", "E", "W"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class RangeComboBoxClass38(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_3 (ComboBox)"""
def __init__(self):
self.items = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31","32", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class RangeDirectionComboBoxClass39(object):
"""Implementation for SEC_TWN_RNG_2_addin.combobox_4 (ComboBox)"""
def __init__(self):
self.items = ["N", "S", "E", "W"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
class ZoomButtonClass40(object):
def onClick(self):
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
addLayer = arcpy.mapping.Layer(r'T:\Software\ESRI-GIS\toolbars\sec-twn-rng\KDAGISEDITOR.plss.lyr')
arcpy.mapping.AddLayer(df, addLayer, "AUTO_ARRANGE")
"""Implementation for Zoom.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
pass
# Implementation of OnClick method of Button's class
def onClick(self):
# Get the current map document and the first data frame.
mxd = arcpy.mapping.MapDocument('current')
df = arcpy.mapping.ListDataFrames(mxd)[0]
# Call the zoomToSelectedFeatures() method of the data frame class
df.zoomToSelectedFeatures()