jschuengel: thuban/Extensions/umn_mapserver mf_export.py,1.1,1.2
cvs@intevation.de
cvs at intevation.de
Thu Jul 1 16:37:31 CEST 2004
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv4179
Modified Files:
mf_export.py
Log Message:
Added the possibility to save a new mapfile or use the old one which is
imported or new created.
Added code to use the editing functions.
Remove some not needed import statements
Index: mf_export.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_export.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mf_export.py 23 Jun 2004 12:37:48 -0000 1.1
+++ mf_export.py 1 Jul 2004 14:37:29 -0000 1.2
@@ -25,7 +25,7 @@
#import os, sys
# mapscript
-from mapscript import mapObj, layerObj
+from mapscript import mapObj
# wxPython support
from wxPython.wx import wxFileDialog, \
@@ -46,7 +46,7 @@
from Thuban.UI.mainwindow import main_menu
# import Map Object for the Mapfile
-from mapfile import MF_Map, MF_Layer
+from mapfile import MF_Map
# ###################################
#
@@ -70,7 +70,6 @@
tb_bbox = tb_map.ProjectedBoundingBox()
# Size must be set before, because mapscript checks it
# when extent is set
- map.set_size(300,400)
map.set_extent(tb_bbox)
def thuban_to_map(tb_context, map):
@@ -86,7 +85,10 @@
def export_mapfile(context):
- theMap = MF_Map(mapObj(""))
+ if hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj"):
+ theMap = context.mainwindow.canvas.Map().extension_umn_mapobj
+ else:
+ theMap = MF_Map(mapObj(""))
dlg = wxFileDialog(context.mainwindow, "Save file as...", ".", "",
"UMN MapServer Mapfiles (*.map)|*.map|" \
@@ -103,7 +105,15 @@
# save the map with the integrated mapscript saver
theMap.save_map(path)
-
+
+ # remove alle added layers from the temporary mapobj
+ # this is necessary because the layers will add new on each save
+ tb_map =context.mainwindow.canvas.Map()
+ tb_layers = tb_map.Layers()
+
+ for nr in range(len(tb_layers)-1, -1, -1):
+ theMap.remove_layer(nr)
+
# ###################################
#
# Hook in MapServer Extension into Thuban
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)