Explorar o código

wxGUI/vdigit: fix vdigit toolbar for simple features editing (work in progress)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59910 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa %!s(int64=11) %!d(string=hai) anos
pai
achega
a1153cb7d3
Modificáronse 2 ficheiros con 15 adicións e 15 borrados
  1. 4 2
      gui/wxpython/gui_core/dialogs.py
  2. 11 13
      gui/wxpython/vdigit/toolbars.py

+ 4 - 2
gui/wxpython/gui_core/dialogs.py

@@ -402,8 +402,9 @@ def CreateNewVector(parent, cmd, title = _('Create new vector map'),
     if showType:
         cmd[1]['type'] = dlg.GetFeatureType()
         
+    curMapset = grass.gisenv()['MAPSET']
     if isNative:
-        listOfVectors = grass.list_grouped('vect')[grass.gisenv()['MAPSET']]
+        listOfVectors = grass.list_grouped('vect')[curMapset]
     else:
         listOfVectors = RunCommand('v.external',
                                    quiet = True,
@@ -438,7 +439,8 @@ def CreateNewVector(parent, cmd, title = _('Create new vector map'),
         dlg.Destroy()
         return None
     
-    if not isNative:
+    if not isNative and \
+            not grass.find_file(outmap, element = 'vector', mapset = curMapset)['fullname']:
         # create link for OGR layers
         RunCommand('v.external',
                    overwrite = overwrite,

+ 11 - 13
gui/wxpython/vdigit/toolbars.py

@@ -365,9 +365,9 @@ class VDigitToolbar(BaseToolbar):
         menuItems = []
         if not self.tools or 'addArea' in self.tools:
             menuItems.append((self.icons["addArea"], self.OnAddArea))
-        if not self.tools or 'addBoundary' in self.tools:
+        if not self.fType and not self.tools or 'addBoundary' in self.tools:
             menuItems.append((self.icons["addBoundary"], self.OnAddBoundary))
-        if not self.tools or 'addCentroid' in self.tools:
+        if not self.fType and not self.tools or 'addCentroid' in self.tools:
             menuItems.append((self.icons["addCentroid"],  self.OnAddCentroid))
         
         self._onMenu(menuItems)
@@ -865,27 +865,25 @@ class VDigitToolbar(BaseToolbar):
             return False
         
         # check feature type (only for OGR layers)
-        fType = self.digit.GetFeatureType()
+        self.fType = self.digit.GetFeatureType()
         self.EnableAll()
         self.EnableUndo(False)
         self.EnableRedo(False)
         
-        if fType == 'point':
-            for tool in (self.addLine, self.addBoundary, self.addCentroid,
-                         self.addArea, self.moveVertex, self.addVertex,
+        if self.fType == 'point':
+            for tool in (self.addLine, self.addArea, self.moveVertex, self.addVertex,
                          self.removeVertex, self.editLine):
                 self.EnableTool(tool, False)
-        elif fType == 'linestring':
-            for tool in (self.addPoint, self.addBoundary, self.addCentroid,
-                         self.addArea):
+        elif self.fType == 'linestring':
+            for tool in (self.addPoint, self.addArea):
                 self.EnableTool(tool, False)
-        elif fType == 'polygon':
-            for tool in (self.addPoint, self.addLine, self.addBoundary, self.addCentroid):
+        elif self.fType == 'polygon':
+            for tool in (self.addPoint, self.addLine):
                 self.EnableTool(tool, False)
-        elif fType:
+        elif self.fType:
             GError(parent = self,
                    message = _("Unsupported feature type '%(type)s'. Unable to edit "
-                               "OGR layer <%(layer)s>.") % { 'type' : fType,
+                               "OGR layer <%(layer)s>.") % { 'type' : self.fType,
                                                              'layer' : mapLayer.GetName() })
             self.digit.CloseMap()
             self.mapLayer = None