소스 검색

wx.psmap moved from addons to the main repo
(author: Anna Kratochvilova)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46356 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 년 전
부모
커밋
abd97d4075

+ 207 - 0
gui/wxpython/docs/wxGUI.PsMap.html

@@ -0,0 +1,207 @@
+<h2>DESCRIPTION</h2>
+
+<b>Note:</b> <em>wxGUI Hardcopy Map Utility is currently under
+development.</em>
+
+<p>
+<b>wxGUI Hardcopy Map Utility</b> also called <em>wx.psmap</em> is
+a <em><a href="wxGUI.html">wxGUI</a></em> extension which allows the
+user to create interactively hardcopy map outputs. This tool
+generates <em><a href="ps.map.html">ps.map</a></em> configuration file
+and then runs <em><a href="ps.map.html">ps.map</a></em> to create
+PostScript output. There are two modes - <em>Draft mode</em> for map
+composing and <em>Preview mode</em> to see how the result will look
+like. In draft mode map features (like legend or scalebar) are
+represented by a colored rectangle with a label.</p>
+
+<p>
+Possible output files:</p>
+<ul>
+  <li> <em><a href="ps.map.html">ps.map</a></em> instructions file
+  <li> PostScript/EPS file
+  <li> PDF (using ps2pdf)
+</ul>
+
+<p>
+Hardcopy Map Utility enables to load in saved instructions file. It
+works better with files created by wx.psmap (more tested).</p>
+
+<p>
+Currently supported <em><a href="ps.map.html">ps.map</a></em> instructions:</p>
+
+<ul>
+  <li> paper
+  <li> maploc
+  <li> scale
+  <li> border
+  <li> raster
+  <li> colortable
+  <li> vpoints
+  <li> vlines
+  <li> vareas
+  <li> vlegend
+  <li> text
+  <li> scalebar
+  <li> mapinfo
+</ul>
+
+
+<h3>HARDCOPY MAP UTILITY TOOLBAR</h3>
+<dl>
+  <dt><img src="icons/script-save.png">&nbsp;
+    <em>Generate instructions file</em></dt>
+  <dd>Generates and saves text file with mapping instructions.</dd>
+  
+  <dt><img src="icons/script-load.png">&nbsp;
+    <em>Load instructions file</em></dt>
+  <dd>Load text file with mapping instructions.</dd>
+  
+  <dt><img src="icons/page-settings.png">&nbsp;
+    <em>Page setup</em></dt>
+  <dd>Specify paper size, margins and orientation.</dd>
+  
+  <dt><img src="icons/pointer.png">&nbsp;
+    <em>Pointer</em></dt>
+  <dd>Select object on the paper by clicking, drag the cursor while pressing the left mouse button to move it or resize object (currently only map frame) by clicking on a small black box in its bottom right corner. Double click to show object properties dialog</dd>
+    
+  <dt><img src="icons/pan.png">&nbsp;
+    <em>Pan</em></dt>
+  <dd>Drag the pan cursor while pressing the left mouse button to move your view. </dd>
+
+
+  <dt><img src="icons/zoom-in.png">&nbsp;
+    <em>Zoom in</em></dt>
+  <dd>Interactive zooming with the mouse in both draft and preview mode. Drawing a box or just a left click with the mouse and zoom-in cursor causes the display to zoom in so that the area defined by the box fills the display.</dd>
+
+
+  <dt><img src="icons/zoom-out.png">&nbsp;
+    <em>Zoom out</em></dt>
+  <dd>Interactive zooming with the mouse in both draft and preview mode. Drawing a box or just a left click with the mouse and zoom-out cursor causes the display to zoom out so that the area displayed shrinks to fill the area defined by the box.</dd>
+  
+  <dt><img src="icons/zoom-extent.png">&nbsp;
+    <em>Zoom to page</em></dt>
+  <dd>Zoom to display the entire page </dd>
+  
+  
+  <dt><img src="icons/layer-add.png">&nbsp;
+    <em>Map frame</em></dt>
+  <dd>Click and drag to place map frame. If map frame is already drawn, open a dialog to set its properties. </dd>
+  
+  <dt><img src="icons/layer-raster-add.png">&nbsp;
+    <em>Raster map</em></dt>
+  <dd>Shows a dialog to add or change the raster map.</dd>
+  
+  <dt><img src="icons/layer-vector-add.png">&nbsp;
+    <em>Vector map</em></dt>
+  <dd>Shows a dialog to add or change current vector maps and their properties:
+    <dl>
+      <dt><em>Data selection</em></dt>
+        <dd>Select data to draw:
+        
+        <dl>
+          <dt><em>Feature type</em></dt>
+            <dd> Select which data type to draw. In case of point data, points or centroids
+            can be drawn, in case of line data, lines or boundaries. </dd>
+          <dt><em>Layer selection</em></dt>
+            <dd>Select layer and limit data by a SQL query or chose only certain categories.</dd>
+          <dt><em>Mask</em></dt>
+            <dd>Whether to use mask or not.</dd>
+        </dl> 
+        </dd>
+      
+      <dt><em>Colors</em></dt>
+        <dd>Color settings:
+                
+        <dl>
+          <dt><em>Outline</em></dt>
+            <dd> Select outline color and width in points. In case of lines, outline means highlighting.</dd>
+          <dt><em>Fill</em></dt>
+            <dd>Select fill color, one color for all vector elements or color from rgb column.</dd>
+        </dl> 
+      </dd>
+      <dt><em>Size and style</em></dt>
+        <dd>
+        Sets size, style, symbols, pattern; depends on data type:
+        
+        <dl>
+          <dt><em>Symbology</em></dt>
+            <dd> Available for point data. Choose symbol or EPS file to draw points with.</dd>
+          <dt><em>Line style</em></dt>
+            <dd>Available for line data. Select line style (solid, dashed, ...) and the look of the ends of the line (butt, round, ...)</dd>
+          <dt><em>Pattern</em></dt>
+          <dd> Available for areas. Choose pattern file and set the width of the pattern.</dd>
+          <dt><em>Size</em></dt>
+          <dd> Available for point data. Choose size (number of times larger than the size in the icon file) as a single value or take the size from a map table column.</dd>
+          <dt><em>Rotation</em></dt>
+          <dd> Available for point data. Rotate symbols counterclockwise with the given value or with the value from a map table column</dd>
+          <dt><em>Width</em></dt>
+          <dd> Available for line data. Set line width in points or take the value from a map table column.</dd>
+        </dl> 
+      </dd>
+  
+  
+    </dl>
+    </dd>
+  
+  
+   <dt><img src="icons/overlay-add.png">&nbsp;
+    <em>Add map elements</em></dt>
+   <dd>Add map elements: legend, scalebar, map info, text 
+    <dl>
+      <dt><img src="icons/legend-add.png">&nbsp;
+        <em>Add legend</em></dt>
+      <dd>Add raster or vector legend or edit their properties.</dd>
+      <dt><img src="icons/map-info.png">&nbsp;
+        <em>Add map info</em></dt>
+      <dd>Add information about region, grid and scale or edit map info properties.</dd>
+      <dt><img src="icons/scalebar-add.png">&nbsp;
+        <em>Add scalebar</em></dt>
+      <dd>Add scalebar or edit its properties.</dd>
+      <dt><img src="icons/text-add.png">&nbsp;
+        <em>Add text</em></dt>
+      <dd>Add text label.</dd>    
+    </dl>
+    </dd>
+  <dt><img src="icons/layer-remove.png">&nbsp;
+    <em>Remove selected element</em></dt>
+  <dd>Select an object and remove it. Pressing Delete key does the same. </dd>
+  
+  <dt><img src="icons/execute.png">&nbsp;
+    <em>Show preview</em></dt>
+  <dd> Generates output and switches to Preview mode to see the result. Be patient, it can take a while.</dd>
+  
+
+  <dt><img src="icons/ps-export.png">&nbsp;
+    <em>Generate hardcopy map output in PS</em></dt>
+  <dd> Generates hardcopy map output in PostScript/EPS file.</dd>
+   <dt><img src="icons/pdf-export.png">&nbsp;
+    <em>Generate hardcopy map output in PDF</em></dt>
+  <dd> Generates hardcopy map output in PDF using ps2pdf.</dd>
+  
+</dl>
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+  <a href="wxGUI.html">wxGUI</a>
+</em>
+
+<p>
+Other wxGUI components:<br>
+<em>
+  <a href="wxGUI.Vector_Digitizer.html">Vector Digitizer</a><br>
+  <a href="wxGUI.Attribute_Table_Manager.html">Attribute Table Manager</a><br>
+  <a href="wxGUI.Nviz.html">3D Viewer</a><br>
+  <a href="wxGUI.GCP_Manager.html">Manage Ground Control Points</a><br>
+</em>
+</p>
+<p>
+See also <a href="http://grass.osgeo.org/wiki/WxGUI_Hardcopy_Map_Output_Utility">wiki</a> page.
+</p>
+<h2>AUTHORS</h2>
+
+Anna Kratochvilova, Czech Technical Univesity (CTU) in Prague, Czech Republic (bachelor's final project 2011, mentor: Martin Landa)
+
+<p>
+<i>$Date$</i></p>

+ 15 - 0
gui/wxpython/gui_modules/menudata.py

@@ -7,6 +7,7 @@ Classes:
  - MenuData
  - ManagerData
  - ModelerData
+ - PsMapData
 
 Usage:
 @code
@@ -27,6 +28,7 @@ This program is free software under the GNU General Public License
 @author Yann Chemin <yann.chemin gmail.com>
 @author Martin Landa <landa.martin gmail.com>
 @author Glynn Clements
+@author Anna Kratochvilova <anna.kratochvilova fsv.cvut.cz>
 """
 
 import os
@@ -235,6 +237,19 @@ class ModelerData(MenuData):
         
         MenuData.__init__(self, filename)
 
+class PsMapData(MenuData):
+    def __init__(self, path = None):
+        """!Menu for Hardcopy Map Output Utility (psmap.py)
+        
+        @path path to XML to be read (None for menudata_psmap.xml)
+        """
+        if not path:
+            gisbase = os.getenv('GISBASE')
+            global etcwxdir
+        path = os.path.join(etcwxdir, 'xml', 'menudata_psmap.xml')
+        
+        MenuData.__init__(self, path)
+
 if __name__ == "__main__":
     import sys
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1654 - 0
gui/wxpython/gui_modules/psmap.py


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 5717 - 0
gui/wxpython/gui_modules/psmap_dialogs.py


+ 88 - 0
gui/wxpython/gui_modules/toolbars.py

@@ -15,6 +15,7 @@ Classes:
  - HistogramToolbar
  - LayerManagerToolbar
  - ToolsToolbar
+ - PsMapToolbar
 
 (C) 2007-2011 by the GRASS Development Team
 This program is free software under the GNU General Public License
@@ -23,6 +24,7 @@ This program is free software under the GNU General Public License
 @author Michael Barton
 @author Jachym Cepicky
 @author Martin Landa <landa.martin gmail.com>
+@author Anna Kratochvilova <anna.kratochvilova fsv.cvut.cz>
 """
 
 import os
@@ -1645,3 +1647,89 @@ class ToolsToolbar(AbstractToolbar):
                                       self.parent.OnPsMap)
                                      ))
     
+class PsMapToolbar(AbstractToolbar):
+    def __init__(self, parent):
+        """!Toolbar Hardcopy Map Output Utility (psmap.py)
+        
+        @param parent parent window
+        """
+        AbstractToolbar.__init__(self, parent)
+        
+        self.InitToolbar(self._toolbarData())
+        
+        self.Realize()
+        
+        self.action = { 'id' : self.pointer }
+        self.defaultAction = { 'id' : self.pointer,
+                               'bind' : self.parent.OnPointer }
+        self.OnTool(None)
+        
+        from psmap import haveImage
+        if not haveImage:
+            self.EnableTool(self.preview, False)
+        
+    def _toolbarData(self):
+        """!Toolbar data
+        """
+        self.quit = wx.NewId()
+        self.pagesetup = wx.NewId()
+        self.pointer = wx.NewId()
+        self.zoomIn = wx.NewId()
+        self.zoomOut = wx.NewId()
+        self.zoomAll = wx.NewId()
+        self.addMap = wx.NewId()
+        self.addRaster = wx.NewId()
+        self.addVector = wx.NewId()
+        self.dec = wx.NewId()
+        self.delete = wx.NewId()
+        self.preview = wx.NewId()
+        self.instructionFile = wx.NewId()
+        self.generatePS = wx.NewId()
+        self.generatePDF = wx.NewId()
+        self.loadFile = wx.NewId()
+        self.pan = wx.NewId()
+        self.help = wx.NewId()
+
+        icons = Icons['psMap']
+        return self._getToolbarData(((self.loadFile, 'loadFile', icons['scriptLoad'],
+                                      self.parent.OnLoadFile),                                    
+                                     (self.instructionFile, 'psScript', icons['scriptSave'],
+                                      self.parent.OnInstructionFile),
+                                     (None, ),
+                                     (self.pagesetup, 'page setup', icons['pageSetup'],
+                                      self.parent.OnPageSetup),
+                                     (None, ),
+                                     (self.pointer, "pointer", Icons["displayWindow"]["pointer"],
+                                      self.parent.OnPointer, wx.ITEM_CHECK),
+                                     (self.pan, 'pan', Icons["displayWindow"]['pan'],
+                                      self.parent.OnPan, wx.ITEM_CHECK),
+                                     (self.zoomIn, "zoomin", Icons["displayWindow"]["zoomIn"],
+                                      self.parent.OnZoomIn, wx.ITEM_CHECK),
+                                     (self.zoomOut, "zoomout", Icons["displayWindow"]["zoomOut"],
+                                      self.parent.OnZoomOut, wx.ITEM_CHECK),
+                                     (self.zoomAll, 'full extent', icons['fullExtent'],
+                                      self.parent.OnZoomAll),
+                                     (None, ),
+                                     (self.addMap, 'add map', icons['addMap'],
+                                      self.parent.OnAddMap, wx.ITEM_CHECK),
+                                     (self.addRaster, 'add raster', icons['addRast'],
+                                      self.parent.OnAddRaster),
+                                     (self.addVector, 'add vect', icons['addVect'],
+                                      self.parent.OnAddVect),
+                                     (self.dec, "overlay", Icons["displayWindow"]["overlay"],
+                                      self.parent.OnDecoration),
+                                     (self.delete, "delete", icons["deleteObj"],
+                                      self.parent.OnDelete),
+                                     (None, ),
+                                     (self.preview, "preview", icons["preview"],
+                                      self.parent.OnPreview),
+                                     (self.generatePS, 'generatePS', icons['psExport'],
+                                      self.parent.OnPSFile),
+                                    ( self.generatePDF, 'generatePDF', icons['pdfExport'],
+                                      self.parent.OnPDFFile),
+                                     (None, ),
+                                     (self.help, "help", Icons['misc']['help'],
+                                      self.parent.OnHelp),
+                                     (self.quit, 'quit', icons['quit'],
+                                      self.parent.OnCloseWindow))
+                                    )

+ 40 - 0
gui/wxpython/icons/icon.py

@@ -16,6 +16,7 @@ License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
 @author Martin Landa <landa.martin gmail.com>
+@author Anna Kratochvilova <anna.kratochvilova fsv.cvut.cz>
 """
 
 import os
@@ -396,6 +397,45 @@ Icons = {
                           label = _('Show help page')),
         'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
                           label = _('Quit')),
+        },
+    'psMap' : {
+        'scriptSave' : MetaIcon(img = iconSet['script-save'],
+                                label = _('Generate text file with mapping instructions')),
+        'scriptLoad' : MetaIcon(img = iconSet['script-load'],
+                                label = _('Load text file with mapping instructions')),                           
+        'psExport'   : MetaIcon(img = iconSet['ps-export'],
+                                label = _('Generate PostScript output')),
+        'pdfExport'  : MetaIcon(img = iconSet['pdf-export'],
+                                label = _('Generate PDF output')),
+        'pageSetup'  : MetaIcon(img = iconSet['page-settings'],
+                                label = _('Page setup'),
+                                desc = _('Specify paper size, margins and orientation')),
+        'fullExtent' : MetaIcon(img = iconSet['zoom-extent'],
+                                label = _("Full extent"),
+                                desc = _("Zoom to full extent")),
+        'addMap'     : MetaIcon(img = iconSet['layer-add'],
+                                label = _("Map frame"),
+                                desc = _("Click and drag to place map frame")),
+        'addRast'    : MetaIcon(img = iconSet['layer-raster-add'],
+                                label = _("Raster map"),
+                                desc = _("Add raster map")),
+        'addVect'    : MetaIcon(img = iconSet['layer-vector-add'],
+                                label = _("Vector map"),
+                                desc = _("Add vector map")),
+        'deleteObj'  : MetaIcon(img = iconSet['layer-remove'],
+                                label = _("Delete selected object")),
+        'preview'    : MetaIcon(img = iconSet['execute'],
+                                label = _("Show preview")),
+        'quit'       : MetaIcon(img = iconSet['quit'],
+                                label = _('Quit Hardcopy Map Utility')),
+        'addText'    : MetaIcon(img = iconSet['text-add'],
+                                label = _('Add text')),
+        'addMapinfo' : MetaIcon(img = iconSet['map-info'],
+                                label = _('Add map info')),
+        'addLegend'  : MetaIcon(img = iconSet['legend-add'],
+                                label = _('Add legend')),
+        'addScalebar' : MetaIcon(img = iconSet['scalebar-add'],
+                                 label = _('Add scale bar')),
         }
     }
 

+ 117 - 0
gui/wxpython/xml/menudata_psmap.xml

@@ -0,0 +1,117 @@
+<menudata>
+  <menubar>
+    <menu>
+      <label>&amp;File</label>
+      <items>
+      	<menuitem>
+	  <label>Page setup</label>
+	  <help>Specify paper size, margins and orientation</help>
+	  <handler>OnPageSetup</handler>
+	  <shortcut>Ctrl+P</shortcut>
+	</menuitem>
+	<separator/>
+	<menuitem>
+	  <label>Load instruction file</label>
+	  <help>Load text file with mapping instructions</help>
+	  <handler>OnLoadFile</handler>
+	  <shortcut>Ctrl+O</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Export instruction file</label>
+	  <help>Generate text file with mapping instructions</help>
+	  <handler>OnInstructionFile</handler>
+	  <shortcut>Ctrl+Shift+E</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Export to PostScript</label>
+	  <help>Generate PostScript output</help>
+	  <handler>OnPSFile</handler>
+	  <shortcut>Ctrl+E</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Export to PDF</label>
+	  <help>Generate PDF output</help>
+	  <handler>OnPDFFile</handler>
+	  <shortcut>Ctrl+F</shortcut>
+	</menuitem>
+	<separator/>
+	<menuitem>
+	  <label>Quit</label>
+	  <help>Close Hardcopy Map Output Utility</help>
+	  <handler>OnCloseWindow</handler>
+	  <shortcut>Ctrl+W</shortcut>
+	</menuitem>
+      </items>
+    </menu>
+    <menu>
+      <label>&amp;Insert</label>
+      <items>
+	<menuitem>
+	  <label>Map frame</label>
+	  <help>Add or edit map frame</help>
+	  <handler>OnAddMap</handler>
+	  <shortcut>Ctrl+M</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Raster map</label>
+	  <help>Add or edit raster map</help>
+	  <handler>OnAddRaster</handler>
+	  <shortcut>Ctrl+R</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Vector map</label>
+	  <help>Add or edit vector map</help>
+	  <handler>OnAddVect</handler>
+	  <shortcut>Ctrl+V</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Map legend</label>
+	  <help>Add or edit raster and vector legend</help>
+	  <handler>OnAddLegend</handler>
+	  <shortcut>Ctrl+L</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Map info</label>
+	  <help>Add or edit map info</help>
+	  <handler>OnAddMapinfo</handler>
+	  <shortcut>Ctrl+I</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Scale bar</label>
+	  <help>Add or edit scale bar</help>
+	  <handler>OnAddScalebar</handler>
+	  <shortcut>Ctrl+B</shortcut>
+	</menuitem>
+	<menuitem>
+	  <label>Text</label>
+	  <help>Add text</help>
+	  <handler>OnAddText</handler>
+	  <shortcut>Ctrl+T</shortcut>
+	</menuitem>
+	<separator/>
+	<menuitem>
+	  <label>Delete</label>
+	  <help>Delete selected object</help>
+	  <handler>OnDelete</handler>
+	  <shortcut>Delete</shortcut>
+	</menuitem>
+      </items>
+    </menu>
+    <menu>
+      <label>&amp;Help</label>
+      <items>
+	<menuitem>
+	  <label>Help</label>
+	  <help>Display the HTML man pages of Hardcopy Map Output Utility</help>
+	  <handler>OnHelp</handler>
+	</menuitem>
+	<separator />
+	<menuitem>
+	  <label>About Hardcopy Map Output Utility</label>
+	  <help>Display information about Hardcopy Map Output Utility</help>
+	  <handler>OnAbout</handler>
+	</menuitem>
+      </items>
+    </menu>
+  </menubar>
+</menudata>