Forráskód Böngészése

wxGUI: save and load wxnviz rotation in workspace

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61938 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 éve
szülő
commit
b67388d2c0
1 módosított fájl, 10 hozzáadás és 1 törlés
  1. 10 1
      gui/wxpython/core/workspace.py

+ 10 - 1
gui/wxpython/core/workspace.py

@@ -655,7 +655,12 @@ class ProcessWorkspaceFile:
             iview['dir']['y'] = -1
             iview['dir']['z'] = -1
             iview['dir']['use'] = False
-        
+        node_rot = node_view.find('rotation')
+        if node_rot is not None:
+            rotation = node_rot.text
+            if rotation:
+                iview['rotation'] = [float(item) for item in rotation.split(',')]
+
         view['background'] = {}
         color = self.__processLayerNvizNode(node_view, 'background_color', str)
         view['background']['color'] = tuple(map(int, color.split(':')))
@@ -1226,6 +1231,10 @@ class WriteWorkspaceFile(object):
         self.file.write('%s<z>%d</z>\n' % (' ' * self.indent, iview['focus']['z']))
         self.indent -= 4
         self.file.write('%s</focus>\n' % (' ' * self.indent))
+        # rotation
+        rotation = ','.join([str(i) for i in iview['rotation']]) if iview['rotation'] else ''
+        self.file.write('%s<rotation>%s</rotation>\n' % (' ' * self.indent, rotation))
+
         # background
         self.__writeTagWithValue('background_color', view['background']['color'][:3], format = 'd:%d:%d')