|
@@ -8,12 +8,8 @@ Classes:
|
|
- statusbar::SbManager
|
|
- statusbar::SbManager
|
|
- statusbar::SbItem
|
|
- statusbar::SbItem
|
|
- statusbar::SbRender
|
|
- statusbar::SbRender
|
|
- - statusbar::SbShowRegion
|
|
|
|
- - statusbar::SbAlignExtent
|
|
|
|
- - statusbar::SbResolution
|
|
|
|
- statusbar::SbMapScale
|
|
- statusbar::SbMapScale
|
|
- statusbar::SbGoTo
|
|
- statusbar::SbGoTo
|
|
- - statusbar::SbProjection
|
|
|
|
- statusbar::SbTextItem
|
|
- statusbar::SbTextItem
|
|
- statusbar::SbDisplayGeometry
|
|
- statusbar::SbDisplayGeometry
|
|
- statusbar::SbCoordinates
|
|
- statusbar::SbCoordinates
|
|
@@ -298,12 +294,6 @@ class SbManager:
|
|
def OnToggleStatus(self, event):
|
|
def OnToggleStatus(self, event):
|
|
"""Toggle status text"""
|
|
"""Toggle status text"""
|
|
self.Update()
|
|
self.Update()
|
|
- if event.GetSelection() == 3 and self.HasProperty("region"):
|
|
|
|
- # show computation region extent by default
|
|
|
|
- self.statusbarItems["region"].SetValue(True)
|
|
|
|
- # redraw map if auto-rendering is enabled
|
|
|
|
- if self.mapFrame.IsAutoRendered():
|
|
|
|
- self.mapFrame.GetWindow().UpdateMap(render=False)
|
|
|
|
|
|
|
|
def SetMode(self, modeIndex):
|
|
def SetMode(self, modeIndex):
|
|
"""Sets current mode
|
|
"""Sets current mode
|
|
@@ -434,172 +424,6 @@ class SbRender(SbItem):
|
|
self.Show()
|
|
self.Show()
|
|
|
|
|
|
|
|
|
|
-class SbShowRegion(SbItem):
|
|
|
|
- """Checkbox to enable and disable showing of computational region.
|
|
|
|
-
|
|
|
|
- Requires MapFrame.OnRender, MapFrame.IsAutoRendered, MapFrame.GetWindow.
|
|
|
|
- """
|
|
|
|
-
|
|
|
|
- def __init__(self, mapframe, statusbar, position=0):
|
|
|
|
- SbItem.__init__(self, mapframe, statusbar, position)
|
|
|
|
- self.name = "region"
|
|
|
|
- self.label = _("Show comp. extent")
|
|
|
|
- self._properties = mapframe.mapWindowProperties
|
|
|
|
-
|
|
|
|
- self.widget = wx.CheckBox(
|
|
|
|
- parent=self.statusbar, id=wx.ID_ANY, label=_("Show computational extent")
|
|
|
|
- )
|
|
|
|
- self.widget.SetValue(self._properties.showRegion)
|
|
|
|
- self.widget.Hide()
|
|
|
|
- self.widget.SetToolTip(
|
|
|
|
- wx.ToolTip(
|
|
|
|
- _(
|
|
|
|
- "Show/hide computational "
|
|
|
|
- "region extent (set with g.region). "
|
|
|
|
- "Display region drawn as a blue box inside the "
|
|
|
|
- "computational region, "
|
|
|
|
- "computational region inside a display region "
|
|
|
|
- "as a red box)."
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
- self.widget.Bind(wx.EVT_CHECKBOX, self.OnToggleShowRegion)
|
|
|
|
- self._connectShowRegion()
|
|
|
|
-
|
|
|
|
- def _setValue(self, value):
|
|
|
|
- self.widget.SetValue(value)
|
|
|
|
-
|
|
|
|
- def _connectShowRegion(self):
|
|
|
|
- self._properties.showRegionChanged.connect(self._setValue)
|
|
|
|
-
|
|
|
|
- def _disconnectShowRegion(self):
|
|
|
|
- self._properties.showRegionChanged.disconnect(self._setValue)
|
|
|
|
-
|
|
|
|
- def OnToggleShowRegion(self, event):
|
|
|
|
- """Shows/Hides extent (comp. region) in map canvas.
|
|
|
|
-
|
|
|
|
- Shows or hides according to checkbox value.
|
|
|
|
-
|
|
|
|
- .. todo::
|
|
|
|
- needs refactoring
|
|
|
|
- """
|
|
|
|
- self._disconnectShowRegion()
|
|
|
|
- self._properties.showRegion = self.widget.GetValue()
|
|
|
|
- self._connectShowRegion()
|
|
|
|
-
|
|
|
|
- # redraw map if auto-rendering is enabled
|
|
|
|
- if self.mapFrame.IsAutoRendered():
|
|
|
|
- self.mapFrame.GetWindow().UpdateMap(render=False)
|
|
|
|
-
|
|
|
|
- def SetValue(self, value):
|
|
|
|
- self._disconnectShowRegion()
|
|
|
|
- self._properties.showRegion = value
|
|
|
|
- SbItem.SetValue(self, value)
|
|
|
|
- self._connectShowRegion()
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-class SbAlignExtent(SbItem):
|
|
|
|
- """Checkbox to select zoom behavior.
|
|
|
|
-
|
|
|
|
- Used by BufferedWindow (through MapFrame property).
|
|
|
|
- See tooltip for explanation.
|
|
|
|
- """
|
|
|
|
-
|
|
|
|
- def __init__(self, mapframe, statusbar, position=0):
|
|
|
|
- SbItem.__init__(self, mapframe, statusbar, position)
|
|
|
|
- self.name = "alignExtent"
|
|
|
|
- self.label = _("Display mode")
|
|
|
|
- self._properties = mapframe.mapWindowProperties
|
|
|
|
-
|
|
|
|
- self.widget = wx.CheckBox(
|
|
|
|
- parent=self.statusbar,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=_("Align region extent based on display size"),
|
|
|
|
- )
|
|
|
|
- self.widget.SetValue(self._properties.alignExtent)
|
|
|
|
- self.widget.Hide()
|
|
|
|
- self.widget.SetToolTip(
|
|
|
|
- wx.ToolTip(
|
|
|
|
- _(
|
|
|
|
- "Align region extent based on display "
|
|
|
|
- "size from center point. "
|
|
|
|
- "Default value for new map displays can "
|
|
|
|
- "be set up in 'User GUI settings' dialog."
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
- self._connectAlignExtent()
|
|
|
|
- self.widget.Bind(wx.EVT_CHECKBOX, self._onCheckbox)
|
|
|
|
-
|
|
|
|
- # TODO: these four methods are in many stitems
|
|
|
|
- # some generalization?
|
|
|
|
- # passing properties as stings and set/get attr would work, but it is nice?
|
|
|
|
- def _setValue(self, value):
|
|
|
|
- self.widget.SetValue(value)
|
|
|
|
-
|
|
|
|
- def _connectAlignExtent(self):
|
|
|
|
- self._properties.alignExtentChanged.connect(self._setValue)
|
|
|
|
-
|
|
|
|
- def _disconnectAlignExtent(self):
|
|
|
|
- self._properties.alignExtentChanged.disconnect(self._setValue)
|
|
|
|
-
|
|
|
|
- def _onCheckbox(self, event):
|
|
|
|
- self._disconnectAlignExtent()
|
|
|
|
- self._properties.alignExtent = self.widget.GetValue()
|
|
|
|
- self._connectAlignExtent()
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-class SbResolution(SbItem):
|
|
|
|
- """Checkbox to select used display resolution.
|
|
|
|
-
|
|
|
|
- Requires MapFrame.OnRender method.
|
|
|
|
- """
|
|
|
|
-
|
|
|
|
- def __init__(self, mapframe, statusbar, position=0):
|
|
|
|
- SbItem.__init__(self, mapframe, statusbar, position)
|
|
|
|
- self.name = "resolution"
|
|
|
|
- self.label = _("Display resolution")
|
|
|
|
- self._properties = self.mapFrame.mapWindowProperties
|
|
|
|
- self.widget = wx.CheckBox(
|
|
|
|
- parent=self.statusbar,
|
|
|
|
- id=wx.ID_ANY,
|
|
|
|
- label=_("Constrain display resolution to computational settings"),
|
|
|
|
- )
|
|
|
|
- self.widget.SetValue(self._properties.resolution)
|
|
|
|
- self.widget.Hide()
|
|
|
|
- self.widget.SetToolTip(
|
|
|
|
- wx.ToolTip(
|
|
|
|
- _(
|
|
|
|
- "Constrain display resolution "
|
|
|
|
- "to computational region settings. "
|
|
|
|
- "Default value for new map displays can "
|
|
|
|
- "be set up in 'User GUI settings' dialog."
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
- self.widget.Bind(wx.EVT_CHECKBOX, self.OnToggleUpdateMap)
|
|
|
|
- self._connectResolutionChange()
|
|
|
|
-
|
|
|
|
- def _setValue(self, value):
|
|
|
|
- self.widget.SetValue(value)
|
|
|
|
-
|
|
|
|
- def _connectResolutionChange(self):
|
|
|
|
- self._properties.resolutionChanged.connect(self._setValue)
|
|
|
|
-
|
|
|
|
- def _disconnectResolutionChange(self):
|
|
|
|
- self._properties.resolutionChanged.disconnect(self._setValue)
|
|
|
|
-
|
|
|
|
- def OnToggleUpdateMap(self, event):
|
|
|
|
- """Update display when toggle display mode"""
|
|
|
|
- self._disconnectResolutionChange()
|
|
|
|
- self._properties.resolution = self.widget.GetValue()
|
|
|
|
- self._connectResolutionChange()
|
|
|
|
- # redraw map if auto-rendering is enabled
|
|
|
|
- if self.mapFrame.IsAutoRendered():
|
|
|
|
- self.mapFrame.GetWindow().UpdateMap()
|
|
|
|
-
|
|
|
|
-
|
|
|
|
class SbMapScale(SbItem):
|
|
class SbMapScale(SbItem):
|
|
"""Editable combobox to get/set current map scale.
|
|
"""Editable combobox to get/set current map scale.
|
|
|
|
|
|
@@ -744,7 +568,9 @@ class SbGoTo(SbItem):
|
|
"""Go to position"""
|
|
"""Go to position"""
|
|
try:
|
|
try:
|
|
e, n = self.GetValue().split(";")
|
|
e, n = self.GetValue().split(";")
|
|
- e, n = self.ReprojectENToMap(e, n, self.mapFrame.GetProperty("projection"))
|
|
|
|
|
|
+ e, n = self.ReprojectENToMap(
|
|
|
|
+ e, n, self.mapFrame.GetProperty("useDefinedProjection")
|
|
|
|
+ )
|
|
self.mapFrame.GetWindow().GoTo(e, n)
|
|
self.mapFrame.GetWindow().GoTo(e, n)
|
|
self.widget.SetFocus()
|
|
self.widget.SetFocus()
|
|
except ValueError:
|
|
except ValueError:
|
|
@@ -790,7 +616,7 @@ class SbGoTo(SbItem):
|
|
group="projection", key="statusbar", subkey="proj4"
|
|
group="projection", key="statusbar", subkey="proj4"
|
|
)
|
|
)
|
|
|
|
|
|
- if self.mapFrame.GetProperty("projection"):
|
|
|
|
|
|
+ if self.mapFrame.GetProperty("useDefinedProjection"):
|
|
if not projection:
|
|
if not projection:
|
|
raise SbException(_("Projection not defined (check the settings)"))
|
|
raise SbException(_("Projection not defined (check the settings)"))
|
|
else:
|
|
else:
|
|
@@ -841,52 +667,6 @@ class SbGoTo(SbItem):
|
|
self.mapFrame.StatusbarEnableLongHelp(False)
|
|
self.mapFrame.StatusbarEnableLongHelp(False)
|
|
|
|
|
|
|
|
|
|
-class SbProjection(SbItem):
|
|
|
|
- """Checkbox to enable user defined projection (can be set in settings)"""
|
|
|
|
-
|
|
|
|
- def __init__(self, mapframe, statusbar, position=0):
|
|
|
|
- SbItem.__init__(self, mapframe, statusbar, position)
|
|
|
|
- self.name = "projection"
|
|
|
|
- self.label = _("Projection")
|
|
|
|
-
|
|
|
|
- self.defaultLabel = _("Use defined projection")
|
|
|
|
-
|
|
|
|
- self.widget = wx.CheckBox(
|
|
|
|
- parent=self.statusbar, id=wx.ID_ANY, label=self.defaultLabel
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
- self.widget.SetValue(False)
|
|
|
|
-
|
|
|
|
- # necessary?
|
|
|
|
- size = self.widget.GetSize()
|
|
|
|
- self.widget.SetMinSize((size[0] + 150, size[1]))
|
|
|
|
-
|
|
|
|
- self.widget.Hide()
|
|
|
|
- self.widget.SetToolTip(
|
|
|
|
- wx.ToolTip(
|
|
|
|
- _(
|
|
|
|
- "Reproject coordinates displayed "
|
|
|
|
- "in the statusbar. Projection can be "
|
|
|
|
- "defined in GUI preferences dialog "
|
|
|
|
- "(tab 'Projection')"
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
- def Update(self):
|
|
|
|
- self.statusbar.SetStatusText("")
|
|
|
|
- epsg = UserSettings.Get(group="projection", key="statusbar", subkey="epsg")
|
|
|
|
- if epsg:
|
|
|
|
- label = "%s (EPSG: %s)" % (self.defaultLabel, epsg)
|
|
|
|
- self.widget.SetLabel(label)
|
|
|
|
- else:
|
|
|
|
- self.widget.SetLabel(self.defaultLabel)
|
|
|
|
- self.Show()
|
|
|
|
-
|
|
|
|
- # disable long help
|
|
|
|
- self.mapFrame.StatusbarEnableLongHelp(False)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
class SbTextItem(SbItem):
|
|
class SbTextItem(SbItem):
|
|
"""Base class for items without widgets.
|
|
"""Base class for items without widgets.
|
|
|
|
|
|
@@ -966,7 +746,7 @@ class SbCoordinates(SbTextItem):
|
|
UserSettings.Get(group="projection", key="format", subkey="precision")
|
|
UserSettings.Get(group="projection", key="format", subkey="precision")
|
|
)
|
|
)
|
|
format = UserSettings.Get(group="projection", key="format", subkey="ll")
|
|
format = UserSettings.Get(group="projection", key="format", subkey="ll")
|
|
- projection = self.mapFrame.GetProperty("projection")
|
|
|
|
|
|
+ projection = self.mapFrame.GetProperty("useDefinedProjection")
|
|
try:
|
|
try:
|
|
e, n = self.mapFrame.GetWindow().GetLastEN()
|
|
e, n = self.mapFrame.GetWindow().GetLastEN()
|
|
self._basicValue = self.ReprojectENFromMap(
|
|
self._basicValue = self.ReprojectENFromMap(
|
|
@@ -1049,7 +829,7 @@ class SbRegionExtent(SbTextItem):
|
|
UserSettings.Get(group="projection", key="format", subkey="precision")
|
|
UserSettings.Get(group="projection", key="format", subkey="precision")
|
|
)
|
|
)
|
|
format = UserSettings.Get(group="projection", key="format", subkey="ll")
|
|
format = UserSettings.Get(group="projection", key="format", subkey="ll")
|
|
- projection = self.mapFrame.GetProperty("projection")
|
|
|
|
|
|
+ projection = self.mapFrame.GetProperty("useDefinedProjection")
|
|
region = self._getRegion()
|
|
region = self._getRegion()
|
|
try:
|
|
try:
|
|
regionReprojected = self.ReprojectRegionFromMap(
|
|
regionReprojected = self.ReprojectRegionFromMap(
|