jschuengel: thuban/Extensions/umn_mapserver mf_export.py,1.7,1.8
cvs@intevation.de
cvs at intevation.de
Mon Aug 9 13:39:39 CEST 2004
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv13333/Extensions/umn_mapserver
Modified Files:
mf_export.py
Log Message:
(tb_layer_to_map): Add all layers which are exists in thuban to the mapobj. All removed Layers will be removed from the mapobj.
Added comments to all functions.
(thuban_to_map): No layer will be removed here.
Index: mf_export.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_export.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mf_export.py 3 Aug 2004 11:56:08 -0000 1.7
+++ mf_export.py 9 Aug 2004 11:39:37 -0000 1.8
@@ -52,6 +52,9 @@
# ###################################
def tbproj_to_map(tb_map, map):
+ """
+ set the projection from thuban to the mapscript
+ """
# TODO: epsg code support
# epsg will convert to parameters at the moment
tb_proj = tb_map.GetProjection()
@@ -59,11 +62,34 @@
map.set_projection(tb_proj)
def tblayer_to_map(tb_map, map):
+ """
+ added all layers which are displayed in thuban to the mapscript
+ if the are new, else use the associated mapobjects.
+ All other layers will be removed
+ """
tb_layers = tb_map.Layers()
+ oldindex = map.get_layerorder()
+ indexlist = []
for layer in tb_layers:
map.add_thubanlayer(layer)
+ layind = layer.extension_umn_layerobj.get_index()
+ indexlist.append(layind)
+ bigint = 0
+ for rmnr in oldindex:
+ if rmnr > bigint:
+ bigint = rmnr
+ removelist = []
+ for rnr in range(0, bigint+1, 1):
+ if rnr not in indexlist:
+ removelist.append(rnr)
+ for i in removelist:
+ map.remove_layer(i)
+ map.set_layerorder(tuple(indexlist))
def thuban_to_map(tb_context, map):
+ """
+ add all context from thuban to the mapscript
+ """
# get the thuban map
tb_map = tb_context.mainwindow.canvas.Map()
# set the title
@@ -78,6 +104,9 @@
tblayer_to_map(tb_map, map)
def add_circle_symbol(map):
+ """
+ Added a circle object like the one shown in thuban
+ """
if map.get_symbolset().get_symbol(1):
return
else:
@@ -88,6 +117,10 @@
map.get_symbolset().add_symbol(new_symbol)
def write_creatorcomment(path,file):
+ """
+ Added a short comment to the created map file to show
+ that the file is generated automatic
+ """
thuban_umn_comment = "# \n" + \
"# Map file generated by Thuban (umn_mapserver Extension) \n" + \
"# \n \n"
@@ -104,11 +137,12 @@
def export_mapfile(context):
-
+ """
+ Exports an existing mapobj and set all stuff from thuban to
+ the mapobj
+ """
theMap = context.mainwindow.canvas.Map().extension_umn_mapobj
- theMap.remove_all_layers()
-
dlg = wxFileDialog(context.mainwindow, "Save file as...", ".", "",
"UMN MapServer Mapfiles (*.map)|*.map|" \
"All files (*.*)|*.*",
@@ -141,7 +175,6 @@
def _has_umn_mapobj(context):
"""Return true if a umn_mapobj exists"""
return hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj")
-
# ###################################
#
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)