|
@@ -55,8 +55,10 @@ from dbmgr.vinfo import VectorDBInfo
|
|
|
from gui_core.widgets import GNotebook
|
|
|
from gui_core.goutput import GConsoleWindow
|
|
|
from gui_core.gselect import Select, LayerSelect, ColumnSelect
|
|
|
-from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
|
|
|
- StaticBox, TextCtrl, ListCtrl, BitmapFromImage
|
|
|
+from gui_core.wrap import (
|
|
|
+ BitmapButton, BitmapFromImage, Button, CheckBox, ComboBox, ListCtrl,
|
|
|
+ Panel, ScrolledPanel, SpinCtrl, StaticBox, StaticText, TextCtrl
|
|
|
+)
|
|
|
|
|
|
from vnet.widgets import PointsList
|
|
|
from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar
|
|
@@ -124,7 +126,7 @@ class VNETDialog(wx.Dialog):
|
|
|
#
|
|
|
self._mgr = wx.aui.AuiManager(self)
|
|
|
|
|
|
- self.mainPanel = wx.Panel(parent=self)
|
|
|
+ self.mainPanel = Panel(parent=self)
|
|
|
self.notebook = GNotebook(parent=self.mainPanel,
|
|
|
style=FN.FNB_FANCY_TABS | FN.FNB_BOTTOM |
|
|
|
FN.FNB_NO_X_BUTTON)
|
|
@@ -155,12 +157,15 @@ class VNETDialog(wx.Dialog):
|
|
|
# Stores data which are needed for attribute table browser of analysis
|
|
|
# input map layers
|
|
|
self.inpDbMgrData = {}
|
|
|
- self._createInputDbMgrPage()
|
|
|
+ self._checkSelectedVectorMap()
|
|
|
|
|
|
# Stores data which are need for attribute table browser of analysis
|
|
|
# result map layers
|
|
|
self.resultDbMgrData = {}
|
|
|
- self._createResultDbMgrPage()
|
|
|
+ if self.tmp_result:
|
|
|
+ self.resultDbMgrData['input'] = self.tmp_result.GetVectMapName()
|
|
|
+ else:
|
|
|
+ self.resultDbMgrData['input'] = None
|
|
|
|
|
|
self.notebook.Bind(
|
|
|
FN.EVT_FLATNOTEBOOK_PAGE_CHANGED,
|
|
@@ -224,9 +229,9 @@ class VNETDialog(wx.Dialog):
|
|
|
|
|
|
def _createPointsPage(self):
|
|
|
"""Tab with points list and analysis settings"""
|
|
|
- pointsPanel = wx.Panel(parent=self)
|
|
|
- anSettingsPanel = wx.Panel(parent=pointsPanel)
|
|
|
- maxDistPanel = wx.Panel(parent=anSettingsPanel)
|
|
|
+ pointsPanel = Panel(parent=self)
|
|
|
+ anSettingsPanel = Panel(parent=pointsPanel)
|
|
|
+ maxDistPanel = Panel(parent=anSettingsPanel)
|
|
|
maxValue = 1e8
|
|
|
|
|
|
listBox = StaticBox(parent=pointsPanel, id=wx.ID_ANY,
|
|
@@ -252,18 +257,20 @@ class VNETDialog(wx.Dialog):
|
|
|
parent=maxDistPanel, id=wx.ID_ANY,
|
|
|
label=_("Maximum distance of point to the network:"))
|
|
|
self.anSettings["max_dist"] = SpinCtrl(
|
|
|
- parent=maxDistPanel, id=wx.ID_ANY, min=0, max=maxValue)
|
|
|
+ parent=maxDistPanel, id=wx.ID_ANY, min=0, max=maxValue,
|
|
|
+ size=(150, -1),
|
|
|
+ )
|
|
|
self.anSettings["max_dist"].Bind(
|
|
|
wx.EVT_SPINCTRL, lambda event: self.MaxDist())
|
|
|
self.anSettings["max_dist"].SetValue(100000) # TODO init val
|
|
|
self.MaxDist()
|
|
|
|
|
|
- #showCutPanel = wx.Panel(parent = anSettingsPanel)
|
|
|
- # self.anSettings["show_cut"] = wx.CheckBox(parent = showCutPanel, id=wx.ID_ANY,
|
|
|
+ #showCutPanel = Panel(parent = anSettingsPanel)
|
|
|
+ # self.anSettings["show_cut"] = CheckBox(parent = showCutPanel, id=wx.ID_ANY,
|
|
|
# label = _("Show minimal cut"))
|
|
|
#self.anSettings["show_cut"].Bind(wx.EVT_CHECKBOX, self.OnShowCut)
|
|
|
|
|
|
- isoLinesPanel = wx.Panel(parent=anSettingsPanel)
|
|
|
+ isoLinesPanel = Panel(parent=anSettingsPanel)
|
|
|
isoLineslabel = StaticText(
|
|
|
parent=isoLinesPanel,
|
|
|
id=wx.ID_ANY,
|
|
@@ -345,7 +352,7 @@ class VNETDialog(wx.Dialog):
|
|
|
|
|
|
def _createOutputPage(self):
|
|
|
"""Tab with output console"""
|
|
|
- outputPanel = wx.Panel(parent=self)
|
|
|
+ outputPanel = Panel(parent=self)
|
|
|
self.notebook.AddPage(page=outputPanel,
|
|
|
text=_("Output"),
|
|
|
name='output')
|
|
@@ -362,7 +369,7 @@ class VNETDialog(wx.Dialog):
|
|
|
|
|
|
def _createParametersPage(self):
|
|
|
"""Tab for selection of data for analysis"""
|
|
|
- dataPanel = scrolled.ScrolledPanel(parent=self)
|
|
|
+ dataPanel = ScrolledPanel(parent=self)
|
|
|
self.notebook.AddPage(page=dataPanel,
|
|
|
text=_('Parameters'),
|
|
|
name='parameters')
|
|
@@ -378,7 +385,7 @@ class VNETDialog(wx.Dialog):
|
|
|
['node_column', "", ColumnSelect],
|
|
|
]
|
|
|
|
|
|
- # self.useTurns = wx.CheckBox(parent = dataPanel, id=wx.ID_ANY,
|
|
|
+ # self.useTurns = CheckBox(parent = dataPanel, id=wx.ID_ANY,
|
|
|
# label = _('Use turns'))
|
|
|
|
|
|
box = StaticBox(dataPanel, -1, "Vector map and layers for analysis")
|
|
@@ -388,7 +395,7 @@ class VNETDialog(wx.Dialog):
|
|
|
selPanels = {}
|
|
|
|
|
|
for dataSel in dataSelects:
|
|
|
- selPanels[dataSel[0]] = wx.Panel(parent=dataPanel)
|
|
|
+ selPanels[dataSel[0]] = Panel(parent=dataPanel)
|
|
|
if dataSel[0] == 'input':
|
|
|
self.inputData[
|
|
|
dataSel[0]] = dataSel[2](
|
|
@@ -503,25 +510,28 @@ class VNETDialog(wx.Dialog):
|
|
|
border=5)
|
|
|
return selSizer
|
|
|
|
|
|
- def _createInputDbMgrPage(self):
|
|
|
- """Tab with attribute tables of analysis input layers"""
|
|
|
- self.inpDbMgrData['dbMgr'] = DbMgrBase()
|
|
|
-
|
|
|
+ def _checkSelectedVectorMap(self):
|
|
|
+ """Check selected vector map"""
|
|
|
selMapName = None
|
|
|
# if selected vector map is in layer tree then set it
|
|
|
layer = self.giface.GetLayerList().GetSelectedLayer()
|
|
|
if layer is not None and layer.type == 'vector':
|
|
|
selMapName = layer.maplayer.name
|
|
|
-
|
|
|
- self.inpDbMgrData['browse'] = self.inpDbMgrData[
|
|
|
- 'dbMgr'].CreateDbMgrPage(parent=self.notebook, pageName='browse')
|
|
|
- self.inpDbMgrData['browse'].SetTabAreaColour(globalvar.FNPageColor)
|
|
|
+ self._createInputDbMgrPage()
|
|
|
|
|
|
self.inpDbMgrData['input'] = None
|
|
|
if selMapName:
|
|
|
self.inputData['input'].SetValue(selMapName)
|
|
|
self.OnVectSel(None)
|
|
|
|
|
|
+ def _createInputDbMgrPage(self):
|
|
|
+ """Tab with attribute tables of analysis input layers"""
|
|
|
+ self.inpDbMgrData['dbMgr'] = DbMgrBase()
|
|
|
+
|
|
|
+ self.inpDbMgrData['browse'] = self.inpDbMgrData[
|
|
|
+ 'dbMgr'].CreateDbMgrPage(parent=self.notebook, pageName='browse')
|
|
|
+ self.inpDbMgrData['browse'].SetTabAreaColour(globalvar.FNPageColor)
|
|
|
+
|
|
|
def _updateInputDbMgrPage(self, show):
|
|
|
"""Show or hide input tables tab"""
|
|
|
if show and self.notebook.GetPageIndexByName('inputDbMgr') == -1:
|
|
@@ -538,11 +548,6 @@ class VNETDialog(wx.Dialog):
|
|
|
'dbMgr'].CreateDbMgrPage(parent=self.notebook, pageName='browse')
|
|
|
self.resultDbMgrData['browse'].SetTabAreaColour(globalvar.FNPageColor)
|
|
|
|
|
|
- if self.tmp_result:
|
|
|
- self.resultDbMgrData['input'] = self.tmp_result.GetVectMapName()
|
|
|
- else:
|
|
|
- self.resultDbMgrData['input'] = None
|
|
|
-
|
|
|
def _updateResultDbMgrPage(self):
|
|
|
"""Show or Hide Result tables tab"""
|
|
|
# analysis, which created result
|
|
@@ -553,6 +558,7 @@ class VNETDialog(wx.Dialog):
|
|
|
analysis)["resultProps"]["dbMgr"]
|
|
|
|
|
|
if haveDbMgr and self.notebook.GetPageIndexByName('resultDbMgr') == -1:
|
|
|
+ self._createResultDbMgrPage()
|
|
|
self.notebook.AddPage(page=self.resultDbMgrData['browse'],
|
|
|
text=_('Result tables'),
|
|
|
name='resultDbMgr')
|
|
@@ -756,7 +762,10 @@ class VNETDialog(wx.Dialog):
|
|
|
self.inputData['node_layer'].SetSelection(iItem)
|
|
|
|
|
|
self.addToTreeBtn.Enable()
|
|
|
- if hasattr(self, 'inpDbMgrData'):
|
|
|
+ if 'browse' in self.inpDbMgrData:
|
|
|
+ self._updateInputDbMgrPage(show=True)
|
|
|
+ else:
|
|
|
+ self._createInputDbMgrPage()
|
|
|
self._updateInputDbMgrPage(show=True)
|
|
|
|
|
|
self.OnALayerSel(event)
|
|
@@ -1230,7 +1239,7 @@ class SettingsDialog(wx.Dialog):
|
|
|
id=wx.ID_ANY,
|
|
|
label=_('Color table style %s:') %
|
|
|
'(v.net.flow)')
|
|
|
- self.settings['color_table'] = wx.ComboBox(
|
|
|
+ self.settings['color_table'] = ComboBox(
|
|
|
parent=self, id=wx.ID_ANY, choices=rules.split(),
|
|
|
style=wx.CB_READONLY, size=(180, -1))
|
|
|
|
|
@@ -1242,7 +1251,7 @@ class SettingsDialog(wx.Dialog):
|
|
|
if i != wx.NOT_FOUND:
|
|
|
self.settings['color_table'].Select(i)
|
|
|
|
|
|
- self.settings["invert_colors"] = wx.CheckBox(
|
|
|
+ self.settings["invert_colors"] = CheckBox(
|
|
|
parent=self,
|
|
|
id=wx.ID_ANY,
|
|
|
label=_('Invert colors %s:') %
|
|
@@ -1502,7 +1511,7 @@ class CreateTtbDialog(wx.Dialog):
|
|
|
selPanels = {}
|
|
|
|
|
|
for dataSel in dataSelects:
|
|
|
- selPanels[dataSel[0]] = wx.Panel(parent=self)
|
|
|
+ selPanels[dataSel[0]] = Panel(parent=self)
|
|
|
if dataSel[0] in ['input', 'output']:
|
|
|
self.inputData[
|
|
|
dataSel[0]] = dataSel[2](
|
|
@@ -1631,7 +1640,7 @@ class OutputVectorDialog(wx.Dialog):
|
|
|
"""Save analysis result"""
|
|
|
wx.Dialog.__init__(self, parent, id, title=_(title), style=style)
|
|
|
|
|
|
- self.panel = wx.Panel(parent=self)
|
|
|
+ self.panel = Panel(parent=self)
|
|
|
box = StaticBox(parent=self.panel, id=wx.ID_ANY,
|
|
|
label="Vector map")
|
|
|
|
|
@@ -1797,7 +1806,7 @@ class DefGlobalTurnsDialog(wx.Dialog):
|
|
|
self.btnAdd = Button(parent=self, id=wx.ID_ANY, label="Add")
|
|
|
self.btnRemove = Button(parent=self, id=wx.ID_ANY, label="Remove")
|
|
|
self.btnClose = Button(parent=self, id=wx.ID_CLOSE)
|
|
|
- self.useUTurns = wx.CheckBox(
|
|
|
+ self.useUTurns = CheckBox(
|
|
|
parent=self, id=wx.ID_ANY, label="Use U-turns")
|
|
|
|
|
|
self.btnAdd.Bind(wx.EVT_BUTTON, self.OnAddButtonClick)
|