From cvs at intevation.de Sun Aug 1 23:28:19 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Sun, 1 Aug 2004 23:28:19 +0200 (CEST)
Subject: jan: thuban/Doc/manual thuban-manual-de.xml,1.1,1.2
Message-ID: <20040801212819.3828513AB4@lists.intevation.de>
Author: jan
Update of /thubanrepository/thuban/Doc/manual
In directory doto:/tmp/cvs-serv5999
Modified Files:
thuban-manual-de.xml
Log Message:
(Chapter Session Management): translation completed.
Index: thuban-manual-de.xml
===================================================================
RCS file: /thubanrepository/thuban/Doc/manual/thuban-manual-de.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- thuban-manual-de.xml 31 Jul 2004 11:06:52 -0000 1.1
+++ thuban-manual-de.xml 1 Aug 2004 21:28:16 -0000 1.2
@@ -432,102 +432,118 @@
Die Legende kann durch Anwahl des X in der oberen rechten Ecke
geschlossen werden.
Um die Legenden-Ansicht wieder zu öffnen, wählen Sie
-
- Karte
- Legende
- .
- The legend is also dockable, which means that it can be detached
- from the main window by clicking on the small button next to the
- close button. It can be attached by clicking the same button
- again.
-
-
- The status bar displays different information depending on the
- current context. If the user is selecting an item from the menu
- then the status bar will display a short help message indicating
- what each menu item is for. If the user has a tool selected then
- the position of the cursor on the map is displayed.
-
-
- The tool bar provides quick access to the commonly needed tools.
- By hovering over each button the user can see a short messages
- describing what the tool does. The tools provided are Zoom In, Zoom
- Out, Pan, Full Extent, Full Layer Extent, Full Shape Extent, Identify,
- and Label. Each of the tools will be explained in further detail later
- in the manual.
-
-
+
+ Karte
+ Legende
+ .
+ Das Legenden-Fenster ist lösbar. Das bedeutet, dass sie vom Hauptfenster
+ abgelöst und dann als eigenständiges Fenster
+ positioniert werden kann. Dies wird durch den kleinen Schalter
+ neben dem X gemacht. Erneutes Anwählen des Schalters läßt das
+ Legenden-Fenster wieder in das Hauptfenster integrieren.
+
+
+ Die Status-Leiste zeigt verschiedene Informationen jeweils
+ abhängig vom Kontext. Wählt der Benutzer einen Menüpunkt
+ dann wird in der Status-Leiste ein Hilfetext zu dem jeweiligen
+ Menüpunkt angezeigt.
+ Ist eines der Werkzeuge aktiviert, so wird in der Status-Leiste
+ die Position angegeben über der der Maus-Cursor auf der Karte
+ steht.
+
+
+ Die Werkzeugleiste erlaubt direkten Zugriff auf häufig
+ benötigte Werkzeuge.
+ Schwebt der Maus-Zeiger über einem Knopf wird eine Kurz-Info
+ über das jeweilige Werkzeug gegeben.
+ Folgende Werzeuge stehen zur Verfügung: Hineinzoomen,
+ Herauszoomen, Verschieben, Zur vollen Kartenausdehnung zoomen,
+ Zur vollen Ebenenausdehnung zoomen, Zur vollen Auswahlausdehnung zoomen,
+ Identifizieren, Labels hinzufügen/entfernen.
+ Alle Werkzeuge werden in diesem Handbuch noch detaillierter beschrieben.
+
+
Session Management
- Starting a New Session
-
- A new session can be started from
-
- File
- New Session
- .
- If a session is already loaded and has been modified without
- being saved a prompt will ask if the current session should
- be saved. A new session consists of an empty map with no
- layers and no tables.
-
-
+ Eine neue Session beginnen
+
+ Eine neue Session wird gestartet über
+
+ Datei
+ Neue Session
+ .
+ Falls bereits eine Session geladen ist und seit der letzten
+ Speicherung verändert wurde, so wird nun nachgefragt, ob
+ diese Session zunächst gespeichert werden soll.
+ Eine neue Session besteht aus einer leeren Karte
+ ohne Ebenen, Tabellen und Projektion.
+
+
- Opening a Session
-
- A session can be opened from
-
- File
- Open Session
- . A dialog box will open allowing the user to browse
- for a Thuban Session file. Thuban session files end with
- .thuban. Selecting a file a clicking
- OK will load the session into Thuban.
+ Eine Session öffnen
+
+ Eine Session kann geöffnet werden über
+
+ Datei
+ Öffne Session
+ .
+ Es wird ein Dateiauswahl-Dialog geöffnet um eine
+ Thuban Session Datei auszuwählen. Diese Dateien enden
+ auf .thuban. Wird eine Datei ausgewählt und mit
+ OK bestätigt, so wird die entsprechende
+ Session in Thuban geladen.
- If a session is already loaded and has been modified without
- being saved a prompt will ask if the current session should
- be saved.
-
-
+ Ist bereits eine Session geladen und seit dem letzten Speichern modifiziert
+ worden, so wird nachgefragt, ob zunächst die alte Session gespeichert werden
+ soll.
+
+
- Saving a Session
-
- A session can be saved from
-
- File
- Save Session
- . A dialog box will open allowing the user to browse
- the file system and select a place to save the session. Thuban
- sessions should be saved under a name ending in
- .thuban. If the file already exists the user
- will be prompted to save under a different name or overwrite the
- existing file.
-
-
+ Eine Session speichern
+
+ Eine Session kann gepsiechert werden über
+
+ Datei
+ Session Speichern
+ .
+ Handelt es sich bei der aktuellen Session nicht um eine
+ neue und ungespeicherte, so wird die entsprechende Datei
+ mit den Daten der aktuellen Session überschrieben.
+ Im Falle einer neuen und noch nicht gespeicherten Session
+ wird ein Dateiauswahl-Dialog geöffnet um einen Namen
+ für die zu speicherende Session auszuwählen.
+ Thuban Session Dateien sollten mit der Endung
+ .thuban versehen werden.
+ Existiert bereits eine Datei mit dem gleichen Namen
+ wird der Benutzer gefragt ob diese überschrieben
+ oder ein neuer Name gewählt werden soll.
+
+
- The Session Info-Tree
-
-
- Session Info Tree
-
-
-
-
-
-
-
- The session info-tree is primarily intended for developers working
- with Thuban. It displays many of the internal values for the session,
- map, and layers. It can be opened from
-
- File
- Session Tree
- .
-
-
+ Der Session Info-Baum
+
+
+ Session Info-Baum
+
+
+
+
+
+
+
+ Der Session Info-Baum ist hauptsächlich für Software-Entwickler gedacht
+ die an Thuban arbeiten.
+ Er stellt eine Reihe von internen Daten zur Session, der Karte, den
+ Ebenen usw. dar. Er wird geöffnet über
+
+ Datei
+ Session Baum
+ .
+
+ Map Management
From cvs at intevation.de Sun Aug 1 23:31:33 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Sun, 1 Aug 2004 23:31:33 +0200 (CEST)
Subject: jan: thuban/Doc/manual thuban-manual.xml,1.26,1.27
Message-ID: <20040801213133.2202113AB4@lists.intevation.de>
Author: jan
Update of /thubanrepository/thuban/Doc/manual
In directory doto:/tmp/cvs-serv6051
Modified Files:
thuban-manual.xml
Log Message:
(Chapter Session Management): Fixed unprecise description for Save Session.
Index: thuban-manual.xml
===================================================================
RCS file: /thubanrepository/thuban/Doc/manual/thuban-manual.xml,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- thuban-manual.xml 31 Jul 2004 11:12:20 -0000 1.26
+++ thuban-manual.xml 1 Aug 2004 21:31:30 -0000 1.27
@@ -484,7 +484,7 @@
If a session is already loaded and has been modified without
being saved a prompt will ask if the current session should
be saved. A new session consists of an empty map with no
- layers and no tables.
+ layers, no tables and no projection.
@@ -511,7 +511,12 @@
FileSave Session
- . A dialog box will open allowing the user to browse
+ .
+ In the case the session is not a new and unsaved one,
+ the corresponding file is updated with the current session
+ data.
+ In the case the current session is a new one and yet unsaved
+ a dialog box will open allowing the user to browse
the file system and select a place to save the session. Thuban
sessions should be saved under a name ending in
.thuban. If the file already exists the user
From cvs at intevation.de Sun Aug 1 23:32:09 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Sun, 1 Aug 2004 23:32:09 +0200 (CEST)
Subject: jan: thuban ChangeLog,1.677,1.678
Message-ID: <20040801213209.CC99013B16@lists.intevation.de>
Author: jan
Update of /thubanrepository/thuban
In directory doto:/tmp/cvs-serv6075
Modified Files:
ChangeLog
Log Message:
further work in manuals
Index: ChangeLog
===================================================================
RCS file: /thubanrepository/thuban/ChangeLog,v
retrieving revision 1.677
retrieving revision 1.678
diff -u -d -r1.677 -r1.678
--- ChangeLog 31 Jul 2004 11:14:08 -0000 1.677
+++ ChangeLog 1 Aug 2004 21:32:07 -0000 1.678
@@ -1,3 +1,11 @@
+2004-08-01 Jan-Oliver Wagner
+
+ * Doc/manual/thuban-manual-de.xml (Chapter Session Management):
+ translation completed.
+
+ * Doc/manual/thuban-manual.xml (Chapter Session Management):
+ Fixed unprecise description for Save Session.
+
2004-07-31 Jan-Oliver Wagner
Started translation of Users Manual into german.
From cvs at intevation.de Tue Aug 3 13:46:02 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Tue, 3 Aug 2004 13:46:02 +0200 (CEST)
Subject: jschuengel: thuban/Extensions/umn_mapserver mapfile.py,1.9,1.10
Message-ID: <20040803114602.80D21139C8@lists.intevation.de>
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv14272
Modified Files:
mapfile.py
Log Message:
(MF_Metadata): Added a function to remove all metadata.
(MF_Layer): Added two functions to handle the group setting.
Removed the extra numlayers variable, used the mapscript parameter instead.
(MF_Map): Added a function to get the numlayers parameter.
Added a funtion to remove all layers.
(MF_Map.add_thubanlayer): Replaced the exception handling by a check if the object is an instance. Also added the annotation layer here to export, but only the layer is created in the mapfile.
Index: mapfile.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mapfile.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mapfile.py 28 Jul 2004 12:35:32 -0000 1.9
+++ mapfile.py 3 Aug 2004 11:46:00 -0000 1.10
@@ -42,6 +42,9 @@
from Thuban.Model.classification import ClassGroupDefault, \
ClassGroupSingleton, ClassGroupRange
+from Thuban.Model.layer import RasterLayer
+from Extensions.umn_mapserver.mf_import import AnnotationLayer
+
from mapscript import layerObj, classObj, colorObj, styleObj, rectObj, symbolObj, \
pointObj, lineObj
@@ -235,6 +238,12 @@
def __init__(self, mapobj):
self.mapobj = mapobj
+ def remove_allmetadata(self):
+ keylist = self.get_metadatakeys()
+ if keylist:
+ for key in keylist:
+ self.mapobj.removeMetaData(key)
+
def get_metadatakeys(self):
keylist = []
try:
@@ -557,6 +566,13 @@
return True
#return self._mf_layer.status
+ def get_group(self):
+ return self._mf_layer.group
+
+ def set_group(self, new_group):
+ self._mf_layer.group = new_group
+
+
def set_name(self, newname):
self._mf_layer.name = newname
@@ -601,7 +617,7 @@
def add_thubanclass(self, tb_class, type=""):
"""
Add a thuban class object
- """
+ """
new_class = MF_Class(classObj(self._mf_layer))
# set the class name to the Label form thuban if given,
# else set it to the value
@@ -843,9 +859,8 @@
# Initial Layer List
self._layers = []
- self._numlayers = self._mf_map.numlayers
self._i = 0
- while self._i < self._numlayers:
+ while self._i < self._mf_map.numlayers:
self._layers.append(MF_Layer(self._mf_map.getLayer(self._i)))
self._i += 1
@@ -857,7 +872,6 @@
# Create Metadata
self._metadata = MF_Metadata(self._mf_map)
-
def get_mappath(self):
return self._mf_map.mappath
@@ -865,7 +879,6 @@
def set_mappath(self, new_mappath):
self._mf_map.mappath = new_mappath
-
def get_outputformat(self):
return self._outputformat
@@ -908,6 +921,9 @@
def get_layers(self):
return self._layers
+ def get_numlayers(self):
+ return self._mf_map.numlayers
+
def get_projection(self):
return self._projection
@@ -924,10 +940,10 @@
def get_imagetype(self):
return self._mf_map.imagetype
-
+
def get_layerorder(self):
# shows the order of layer as list
- return self._mf_map.getLayerOrder()
+ return self._mf_map.getLayerOrder()
def get_size(self):
#returns the size
@@ -995,13 +1011,15 @@
# TODO: implement relative pathnames
# yet only absolute pathnames in the LayerObj are set
- try:
- new_layer.set_data(tb_layer.ShapeStore().FileName())
- except:
+ if isinstance(tb_layer, RasterLayer ):
new_layer.set_data(tb_layer.GetImageFilename(), type="raster")
new_layer.set_type("raster")
new_layer.set_status(tb_layer.Visible())
+ elif isinstance(tb_layer, AnnotationLayer):
+ new_layer.set_type("annotation")
+ new_layer.set_status(tb_layer.Visible())
else:
+ new_layer.set_data(tb_layer.ShapeStore().FileName())
new_layer.set_status(tb_layer.Visible())
new_layer.set_type(tb_layer.ShapeType())
@@ -1038,9 +1056,15 @@
self._layers.append(new_layer)
def remove_layer(self, nr):
+ #remove the last layer from the layer list and not the one which
+ # is removed in mapscript. This must be, becaus mapscript
+ # set the object links anew. Don't understand really :)
+ self._layers.pop()
self._mf_map.removeLayer(nr)
- self._numlayers -= 1
- self._layers.remove(self._layers[nr])
+
+ def remove_all_layers(self):
+ for i in range (self._mf_map.numlayers,0,-1):
+ self.remove_layer(i-1)
def save_map(self, filepath):
# save the Map
From cvs at intevation.de Tue Aug 3 13:56:11 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Tue, 3 Aug 2004 13:56:11 +0200 (CEST)
Subject: jschuengel: thuban/Extensions/umn_mapserver mf_export.py,1.6,1.7
Message-ID: <20040803115611.28FC3139C8@lists.intevation.de>
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv14431
Modified Files:
mf_export.py
Log Message:
Removed the check if a mapobj exist, because its not needed anymore. The export function is only available if a mapobj exist.
Added an extra function to remove all layers.
Index: mf_export.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_export.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mf_export.py 28 Jul 2004 12:36:27 -0000 1.6
+++ mf_export.py 3 Aug 2004 11:56:08 -0000 1.7
@@ -105,11 +105,9 @@
def export_mapfile(context):
- if hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj"):
- theMap = context.mainwindow.canvas.Map().extension_umn_mapobj
- else:
- theMap = MF_Map(mapObj(""))
- context.mainwindow.canvas.Map().extension_umn_mapobj = theMap
+ theMap = context.mainwindow.canvas.Map().extension_umn_mapobj
+
+ theMap.remove_all_layers()
dlg = wxFileDialog(context.mainwindow, "Save file as...", ".", "",
"UMN MapServer Mapfiles (*.map)|*.map|" \
@@ -137,14 +135,6 @@
# this funktion will write a commend to the generated mapfile
# that shows that the file is generated by thuban
write_creatorcomment(path,file)
-
- # 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)
# check if an mapobj exists, to control the menuitem is available or not
From cvs at intevation.de Tue Aug 3 13:56:55 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Tue, 3 Aug 2004 13:56:55 +0200 (CEST)
Subject: jschuengel: thuban/Extensions/umn_mapserver mf_handle.py,1.6,1.7
Message-ID: <20040803115655.B09F8139C8@lists.intevation.de>
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv14461
Modified Files:
mf_handle.py
Log Message:
Added a group option and the metadata button to the Layer dialog. The layer dialog is temporary disabled.
(Metadata_CustomDataTable): Added some funktions to show the grid correct.
Index: mf_handle.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_handle.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mf_handle.py 28 Jul 2004 12:37:28 -0000 1.6
+++ mf_handle.py 3 Aug 2004 11:56:53 -0000 1.7
@@ -25,7 +25,7 @@
import os, sys
# mapscript
-from mapscript import mapObj
+from mapscript import mapObj, layerObj
# wxPython support
# TODO: explicitly use from .. import
@@ -331,6 +331,12 @@
# get the web object
self.tb_layer = parent.current_layer()
+ if hasattr(self.tb_layer,"extension_umn_layerobj"):
+ self.umn_layer = self.tb_layer.extension_umn_layerobj
+ else:
+ newlayerobj = parent.canvas.Map().extension_umn_mapobj.create_new_layer()
+ self.tb_layer.extension_umn_layerobj = newlayerobj
+ self.umn_layer = self.tb_layer.extension_umn_layerobj
# create name
layer_name = wxBoxSizer(wxHORIZONTAL)
@@ -339,9 +345,23 @@
layer_name.Add(wxStaticText(self, -1, self.tb_layer.Title()), 0,
wxALL|wxALIGN_CENTER_VERTICAL, 4)
-##~ # metadata button
-##~ metadata_button = wxButton(self, ID_METADATA_CHANGE, _("Edit Metadata"))
-##~ EVT_BUTTON(self, ID_METADATA_CHANGE, self.OnChangeMetadata)
+ # metadata button
+ metadata_button = wxButton(self, ID_METADATA_CHANGE, _("Edit Metadata"))
+ EVT_BUTTON(self, ID_METADATA_CHANGE, self.OnChangeMetadata)
+
+ # Group
+ box_group = wxBoxSizer(wxHORIZONTAL)
+ if self.umn_layer.get_group():
+ umn_layer_group = self.umn_layer.get_group()
+ else:
+ umn_layer_group = ""
+ box_group.Add(wxStaticText(self, -1, _("Group:")), 0,
+ wxALL|wxALIGN_LEFT, 4)
+ self.text_group = wxTextCtrl(self, -1,
+ str(umn_layer_group))
+ self.text_group.SetSize((250,self.text_group.GetSize()[1]))
+ box_group.Add(self.text_group, 0,
+ wxALL|wxALIGN_CENTER_VERTICAL, 4)
# buttons
box_buttons = wxBoxSizer(wxHORIZONTAL)
@@ -356,8 +376,9 @@
# compose the final dialog
top = wxBoxSizer(wxVERTICAL)
#top.Add(box_template, 0, wxEXPAND |wxALL, 5)
- top.Add(layer_name, 0)
-##~ top.Add(metadata_button, 0, wxEXPAND)
+ top.Add(layer_name, 0, wxEXPAND|wxALL, 5)
+ top.Add(box_group, 0, wxEXPAND|wxALL, 5)
+ top.Add(metadata_button, 0, wxEXPAND|wxALL, 5)
top.Add(box_buttons, 0, wxALIGN_RIGHT)
# final layout settings
@@ -368,7 +389,7 @@
# set the umn_label for scalebar so the Label_Dialog can be used
self.umn_metadata= self.umn_layer.get_metadata()
dialog = Metadata_Dialog(self, -1, "Layer Metadata Settings",
- size=wxSize(350, 200),
+ size=wxSize(450, 200),
style = wxDEFAULT_DIALOG_STYLE
)
dialog.CenterOnScreen()
@@ -390,6 +411,10 @@
self.Show(False)
def OnOK(self, event):
+ if self.text_group.GetValue() == "":
+ self.umn_layer.set_group(None)
+ else:
+ self.umn_layer.set_group(self.text_group.GetValue())
self.result ="OK"
self.end_dialog(self.result)
@@ -1057,6 +1082,9 @@
class Metadata_CustomDataTable(wxPyGridTableBase):
"""
+ creates a custum Grid.
+
+ copied from the wx demo.
"""
def __init__(self, data):
wxPyGridTableBase.__init__(self)
@@ -1065,7 +1093,7 @@
self.dataTypes = [wxGRID_VALUE_STRING,
wxGRID_VALUE_STRING
]
-
+
if data:
self.data = data
else:
@@ -1076,10 +1104,7 @@
return len(self.data) + 1
def GetNumberCols(self):
- if self.data[0]:
- return len(self.data[0])
- else:
- return None
+ return len(self.data[0])
def IsEmptyCell(self, row, col):
try:
@@ -1102,6 +1127,7 @@
self.data[row][col] = value
except IndexError:
# add a new row
+
self.data.append([''] * self.GetNumberCols())
self.SetValue(row, col, value)
@@ -1112,10 +1138,36 @@
self.GetView().ProcessTableMessage(msg)
+ #--------------------------------------------------
+ # Some optional methods
+
+ # Called when the grid needs to display labels
+ def GetColLabelValue(self, col):
+ return self.colLabels[col]
+
+ # Called to determine the kind of editor/renderer to use by
+ # default, doesn't necessarily have to be the same type used
+ # natively by the editor/renderer if they know how to convert.
+ def GetTypeName(self, row, col):
+ return self.dataTypes[col]
+
+ # Called to determine how the data can be fetched and stored by the
+ # editor and renderer. This allows you to enforce some type-safety
+ # in the grid.
+ def CanGetValueAs(self, row, col, typeName):
+ colType = self.dataTypes[col].split(':')[0]
+ if typeName == colType:
+ return true
+ else:
+ return False
+
+ def CanSetValueAs(self, row, col, typeName):
+ return self.CanGetValueAs(row, col, typeName)
+
class Metadata_TableGrid(wxGrid):
def __init__(self, parent, data):
- wxGrid.__init__(self, parent, -1, size=(600,400))
+ wxGrid.__init__(self, parent, -1)
self.table = Metadata_CustomDataTable(data)
@@ -1125,9 +1177,11 @@
self.SetTable(self.table, true)
self.SetRowLabelSize(0)
+ self.SetColMinimalWidth(0,180)
+ self.SetColSize(0,180)
+ self.SetColMinimalWidth(1,250)
+ self.SetColSize(1,250)
self.SetMargins(0,0)
- self.AutoSizeColumns(False)
-
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
def get_table(self):
@@ -1204,17 +1258,14 @@
self.Show(False)
def OnOK(self, event):
- # added all metadatas to the mapobj
- # TODO: only add ne to the old Metadata
- #self.tb_map_metadata = MF_Metadata(self.tb_map.extension_umn_mapobj)
- for x in range(0, self.grid.get_table().GetNumberRows()-1,1):
+ # added all metadatas to the mapobj,
+ # first remove the old ones
+ self.umn_metadata.remove_allmetadata()
+ for x in range(self.grid.get_table().GetNumberRows()-2,-1, -1):
if self.grid.get_table().GetValue(x,0):
self.umn_metadata.add_metadata(str(self.grid.get_table().GetValue(x,0)),\
str(self.grid.get_table().GetValue(x,1)))
- else:
- delkey = self.umn_metadata.get_metadatakeys()[x]
- self.umn_metadata.remove_metadatabykey(delkey)
-
+
self.result ="OK"
self.end_dialog(self.result)
@@ -1226,7 +1277,7 @@
def metadatasettings(context):
win = Metadata_Dialog(context.mainwindow, -1, "Metadata Settings",
- size=wxSize(350, 200),
+ size=wxSize(450, 250),
style = wxDEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
@@ -1273,12 +1324,6 @@
style = wxDEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
-
-#create a new mapfile
-def create_new_mapfile(context):
- theMap = MF_Map(mapObj(""))
- context.mainwindow.canvas.Map().extension_umn_mapobj = theMap
-
# TODO: Maybe can be imported from another class
# check if an mapobj exists, to control the menuitem is available or not
@@ -1288,6 +1333,8 @@
def _has_umn_mapobj_and_selectedlayer(context):
"""Return true if a umn_mapobj exists"""
+ # temporary disabled
+ return False
if context.mainwindow.has_selected_layer():
return hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj")
else:
@@ -1306,17 +1353,10 @@
mapserver_menu = experimental_menu.FindOrInsertMenu("mapserver",
_("&MapServer"))
-# register the new command
-registry.Add(Command("create_new_mapfile", _("Create new mapfile"), \
- create_new_mapfile, \
- helptext = _("Create a new empty mapscript MapObj")))
-# finally add the new entry to the extensions menu
-mapserver_menu.InsertItem("create_new_mapfile", after = "import_mapfile" )
-
# find the MapServer menu and add a new submenu if found
mapserver_edit_menu = mapserver_menu.FindOrInsertMenu("edit_mapfile",
_("&Edit mapfile"), \
- after = "create_new_mapfile")
+ after = "import_layer_from_mapfile")
# register the new command (Map Settings Dialog)
registry.Add(Command("Map Settings", _("Map"), mapsettings,
From cvs at intevation.de Tue Aug 3 13:58:07 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Tue, 3 Aug 2004 13:58:07 +0200 (CEST)
Subject: jschuengel: thuban/Extensions/umn_mapserver mf_import.py,1.9,1.10
Message-ID: <20040803115807.24165139C8@lists.intevation.de>
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv14479
Modified Files:
mf_import.py
Log Message:
Added a Class and a function to show the Annotation layer in thuban. The layer don't do anything.
Its only to show the layer. Necessary to save the layer order.
Added a funtion to import only layers to thuban and not the other settings like projection or scalebar.
Moved the _has_umn_mapobj function and the create_new_mapfile functions from mf_handle.py to mf_import.py.
(select_layer2import): Moved the code for showing the number of layer from import_mapfile to this function.
Index: mf_import.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_import.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mf_import.py 28 Jul 2004 12:44:26 -0000 1.9
+++ mf_import.py 3 Aug 2004 11:58:05 -0000 1.10
@@ -47,7 +47,7 @@
from Thuban.Model.proj import Projection
# needed to add the new menu
-from Thuban.UI.mainwindow import main_menu
+from Thuban.UI.mainwindow import main_menu, wxID_CANCEL
from Thuban.Model.classification import ClassGroupSingleton, \
ClassGroupRange, \
@@ -67,6 +67,49 @@
# Mainpart of the Extension
#
# ###################################
+from Thuban.Model.layer import BaseLayer
+class AnnotationLayer(BaseLayer):
+ """
+ Class to show AnnontationLayer in Thuban.
+ This Class is temporary and has only the task
+ to indicate the layer in the layerlist.
+ """
+ def __init__(self, title, data, visible = False, projection = None):
+
+ BaseLayer.__init__(self, title,
+ visible = visible,
+ projection = projection)
+ self.store = None
+ self.SetShapeStore(data)
+
+ def SetShapeStore(self, store):
+ self.store = store
+
+ def ShapeStore(self):
+ return self.store
+
+ def ShapeType(self):
+ """Return the type of the shapes in the layer.
+ """
+ return "annotation"
+
+ def BoundingBox(self):
+ """Return the layer's bounding box in the intrinsic coordinate system.
+
+ If the layer has no shapes, return None.
+ """
+ return self.store.BoundingBox()
+
+ def LatLongBoundingBox(self):
+ """Return the layer's bounding box in lat/long coordinates.
+
+ Return None, if the layer doesn't contain any shapes.
+ """
+ bbox = self.BoundingBox()
+ if bbox is not None and self.projection is not None:
+ bbox = self.projection.InverseBBox(bbox)
+ return bbox
+
def set_projection_to_tb(tb_con, mapobj):
"""
@@ -195,6 +238,45 @@
else:
return (None,errorstring)
+def add_annotationlayer(context, tb_map, mapobj, maplayer):
+ """
+ add a polygonlayer to thuban
+
+ tb_map = context.mainwindow.canvas.Map()
+
+ mapobj = the Mapobject created from the mapfile
+
+ maplayer = layer obj to add to thuban
+ """
+ filepath = mapobj.get_mappath()
+ layertitle = maplayer.get_name()
+ if maplayer.get_data():
+ if os.path.isabs(maplayer.get_data()):
+ filename = maplayer.get_data() +".shp"
+ else:
+ filename = os.path.join(filepath, mapobj.get_shapepath(), \
+ maplayer.get_data())
+ filename = filename + ".shp"
+ # Normalize the pathname by collapses
+ # redundant separators and up-level references
+ filename = os.path.normpath(filename)
+ else:
+ context.mainwindow.RunMessageBox(_('Error Loading Layer'),
+ _("no shp file definied, maybe used a feature obj '%s'.") % layertitle)
+ # try to open the layer
+ try:
+ store = context.application.Session().OpenShapefile(filename)
+ except IOError:
+ # the layer couldn't be opened
+ context.mainwindow.RunMessageBox(_('Open Shapepath'),
+ _("Can't open the file '%s'.") % filename)
+ else:
+ # added an annotation layer as empty layer to thuban
+ # because thuban don't supports annotation.
+ layertitle = maplayer.get_name()
+ annotationlayer = AnnotationLayer(layertitle,store)
+ tb_map.AddLayer(annotationlayer)
+
def add_rasterlayer(context, tb_map, mapobj, maplayer):
"""
@@ -396,21 +478,27 @@
#add the projection if exists
set_projection_to_tb(layer, maplayer)
- # associate the maplayer object to the layer in thuban.
- layer.extension_umn_layerobj = maplayer
-
- #add the projection if exists
- set_projection_to_tb(layer, maplayer)
-
+ # associate a copy of the maplayer object to the layer in thuban.
+ # layer.extension_umn_layerobj =maplayer
#add the layer into thuban
tb_map.AddLayer(layer)
+
def select_layer2import(context, mapobj):
"""
shows a dialog to select the layers to import.
mapobj = the Mapobject created from the mapfile
"""
+ # Show number of Layer found in file
+ numlayers = len(mapobj.get_layers())
+ if numlayers == 0:
+ context.mainwindow.RunMessageBox(_('Loading Layer'),
+ _("No Layer found."))
+ else:
+ context.mainwindow.RunMessageBox(_('Loading Layer'),
+ _("%s Layer loaded from file.") % numlayers)
+ # Show a dialog to select layers to load into thuban only
lst = []
selectedlayer = []
numlayers = len(mapobj.get_layers())
@@ -430,17 +518,11 @@
selectedlayer = dlg.GetValue()
return selectedlayer
-
-def import_mapfile(context):
+def import_layer_from_mapfile(context):
"""
- Import the mapfile from a file given by the user. After that parse
- the mapfile with the mapscript parser to create all necessary objects.
-
- Loaded polygon layer like polygon, line or point into thuban.
- Raster layer are supported also.
-
- context - the thuban context
+ Import only the layers which are selectes from a mapfile
"""
+ # open a dialog to select the mapfile to import
dlg = wxFileDialog(context.mainwindow,
_("Select MapFile file"), ".", "",
_("UMN MapServer Mapfiles (*.map)|*.map|") +
@@ -451,10 +533,10 @@
dlg.Destroy()
else:
return
-
+
# Parse mapfile
mapobj = parse_mapfile(filename)
-
+
# Show number of Layer found in file
numlayers = len(mapobj.get_layers())
if numlayers == 0:
@@ -469,16 +551,36 @@
selectedlayer = select_layer2import(context,mapobj)
else:
selectedlayer = []
+
+def import_layer_from_mapfile(context):
+ """
+ import layers from a mapfile
+ """
+ # open a dialog to select the mapfile to import from
+ dlg = wxFileDialog(context.mainwindow,
+ _("Select MapFile file"), ".", "",
+ _("UMN MapServer Mapfiles (*.map)|*.map|") +
+ _("All Files (*.*)|*.*"),
+ wxOPEN|wxOVERWRITE_PROMPT)
+ if dlg.ShowModal() == wxID_OK:
+ filename = dlg.GetPath()
+ dlg.Destroy()
+ else:
+ return
+
+ # Parse mapfile
+ mapobj = parse_mapfile(filename)
+ oldmapobj = context.mainwindow.canvas.Map().extension_umn_mapobj
+
+ # shows a dialog to select layers to import
+ selectedlayer = select_layer2import(context,mapobj)
+
# counter to show the numer of layer loaded into Tuban
layer_count = 0
# import settings to thuban only if one layer is selected
if len(selectedlayer) != 0:
# thuban map context
tb_map = context.mainwindow.canvas.Map()
- # set the titel and projection
- tb_map.SetTitle(mapobj.get_name())
- set_projection_to_tb(tb_map,mapobj)
-
# Check for each Layer if it is possible to show in Thuban
for layernr in selectedlayer:
maplayer = mapobj.get_layers()[layernr]
@@ -495,27 +597,103 @@
(maplayer.get_type() == 'point')):
add_polygonlayer(context, tb_map, mapobj, maplayer)
layer_count += 1
-
- # remove alle layer from the mapobj, because the layer will be
- # created new in export, and the unused layers are not needed
- # TODO: Save the layers which are not used somewhere, to edit
- # them later and export it.
- for nr in range(len(mapobj.get_layers())-1, -1, -1):
- mapobj.remove_layer(nr)
-
- # add the map object to thuban, to use it later
- tb_map.extension_umn_mapobj = mapobj
+
+ if (maplayer.get_type() == 'annotation'):
+ add_annotationlayer(context, tb_map, mapobj, maplayer)
# show a message how many layer were loaded into thuban
# if the number of layers is not null
if layer_count != 0:
- # get the extent from the map and set it in thuban
- extentrect = mapobj.get_extent().get_rect()
- # fit the new map extent to the window
- context.mainwindow.canvas.FitRectToWindow(extentrect)
context.mainwindow.RunMessageBox(_('Layer loaded'),
_("%s Layer loaded into Thuban") % layer_count)
+def import_mapfile(context):
+ """
+ Import the mapfile from a file given by the user. After that parse
+ the mapfile with the mapscript parser to create all necessary objects.
+
+ Loaded polygon layer like polygon, line or point into thuban.
+ Raster layer are supported also.
+
+ context - the thuban context
+ """
+ # create a new session befor a mapfile is imported
+ if context.mainwindow.save_modified_session() != wxID_CANCEL:
+ context.application.SetSession(mainwindow.create_empty_session())
+
+ # context.mainwindow.NewSession()
+ # open a dialog to select the mapfile to import
+ dlg = wxFileDialog(context.mainwindow,
+ _("Select MapFile file"), ".", "",
+ _("UMN MapServer Mapfiles (*.map)|*.map|") +
+ _("All Files (*.*)|*.*"),
+ wxOPEN|wxOVERWRITE_PROMPT)
+ if dlg.ShowModal() == wxID_OK:
+ filename = dlg.GetPath()
+ dlg.Destroy()
+ else:
+ return
+
+ # Parse mapfile
+ mapobj = parse_mapfile(filename)
+
+ # shows a dialog to select layers to import
+ selectedlayer = select_layer2import(context,mapobj)
+
+ # counter to show the numer of layer loaded into Tuban
+ layer_count = 0
+ # import settings to thuban only if one layer is selected
+ if len(selectedlayer) != 0:
+ # thuban map context
+ tb_map = context.mainwindow.canvas.Map()
+ # set the titel and projection
+ tb_map.SetTitle(mapobj.get_name())
+ set_projection_to_tb(tb_map,mapobj)
+
+ selectedlayer = list(selectedlayer)
+
+ # Check for each Layer if it is possible to show in Thuban
+ for layernr in selectedlayer:
+
+ maplayer = mapobj.get_layers()[layernr]
+
+ #check if rasterlayer type
+ if maplayer.get_type() == 'raster':
+ add_rasterlayer(context, tb_map, mapobj, maplayer)
+ layer_count += 1
+
+ #check if polygonlayer type
+ if ((maplayer.get_type() == 'polygon') or
+ (maplayer.get_type() == 'line') or
+ (maplayer.get_type() == 'circle') or
+ (maplayer.get_type() == 'point')):
+ add_polygonlayer(context, tb_map, mapobj, maplayer)
+ layer_count += 1
+
+ if (maplayer.get_type() == 'annotation'):
+ add_annotationlayer(context, tb_map, mapobj, maplayer)
+ layer_count += 1
+
+ # remove alle layer from the mapobj, because the layer will be
+ # created new in export, and the unused layers are not needed
+ # TODO: Save the layers which are not used somewhere, to edit
+ # them later and export it.
+ ##~ for nr in range(len(mapobj.get_layers())-1, -1, -1):
+ ##~ mapobj.remove_layer(nr)
+
+ # add the map object to thuban, to use it later
+ tb_map.extension_umn_mapobj = mapobj
+
+ # show a message how many layer were loaded into thuban
+ # if the number of layers is not null
+ if layer_count != 0:
+ # get the extent from the map and set it in thuban
+ extentrect = mapobj.get_extent().get_rect()
+ # fit the new map extent to the window
+ context.mainwindow.canvas.FitRectToWindow(extentrect)
+ context.mainwindow.RunMessageBox(_('Layer loaded'),
+ _("%s Layer loaded into Thuban") % layer_count)
+
def parse_mapfile(filename):
"""
Parse the mapfile.
@@ -531,6 +709,15 @@
return MF_Map(theMap)
+# check if an mapobj exists, to control the menuitem is available or not
+def _has_umn_mapobj(context):
+ """Return true if a umn_mapobj exists"""
+ return hasattr(context.mainwindow.canvas.Map(), "extension_umn_mapobj")
+
+#create a new mapfile
+def create_new_mapfile(context):
+ theMap = MF_Map(mapObj(""))
+ context.mainwindow.canvas.Map().extension_umn_mapobj = theMap
# ###################################
#
@@ -538,14 +725,31 @@
#
# ###################################
-# register the new command
-registry.Add(Command("import_mapfile", _("Import mapfile"), import_mapfile,
- helptext = _("Import a mapfile")))
-
# find the extensions menu (create it anew if not found)
experimental_menu = main_menu.FindOrInsertMenu("experimental", _("Experimenta&l"))
# find the extension menu and add a new submenu if found
mapserver_menu = experimental_menu.FindOrInsertMenu("mapserver", _("&MapServer"))
+# register the new command
+registry.Add(Command("create_new_mapfile", _("Create new mapfile"), \
+ create_new_mapfile, \
+ helptext = _("Create a new empty mapscript MapObj")))
# finally add the new entry to the extensions menu
-mapserver_menu.InsertItem("import_mapfile")
+mapserver_menu.InsertItem("create_new_mapfile")
+
+# register the new command
+registry.Add(Command("import_mapfile", _("Import mapfile"), import_mapfile,
+ helptext = _("Import a mapfile")))
+# finally add the new entry to the extensions menu
+mapserver_menu.InsertItem("import_mapfile", after = "create_new_mapfile" )
+
+# register the new command
+registry.Add(Command("import_layer_from_mapfile", _("Import layer from mapfile"),
+ import_layer_from_mapfile,
+ helptext = _("Import a layer from a mapfile"),
+ sensitive = _has_umn_mapobj))
+# finally add the new entry to the extensions menu
+mapserver_menu.InsertItem("import_layer_from_mapfile",
+ after = "import_mapfile" )
+
+
From cvs at intevation.de Tue Aug 3 13:58:57 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Tue, 3 Aug 2004 13:58:57 +0200 (CEST)
Subject: jschuengel: thuban/Extensions/umn_mapserver/sample iceland.map, 1.4,
1.5
Message-ID: <20040803115857.13994139C8@lists.intevation.de>
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample
In directory doto:/tmp/cvs-serv14496
Modified Files:
iceland.map
Log Message:
Added the group parameter to the roads and cultural layers. Also added a new
Annotation Layer for the cultural points.
Index: iceland.map
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/sample/iceland.map,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- iceland.map 28 Jul 2004 12:41:06 -0000 1.4
+++ iceland.map 3 Aug 2004 11:58:55 -0000 1.5
@@ -103,6 +103,7 @@
LAYER
NAME "roads"
DATA roads-line
+ GROUP infrastructure
TYPE LINE
STATUS ON
CLASS
@@ -149,6 +150,7 @@
LAYER
NAME "cultural"
DATA cultural_landmark-point
+ GROUP infrastructure
TYPE POINT
STATUS ON
CLASSITEM 'CLPOINT_'
@@ -187,5 +189,32 @@
END
END
+LAYER
+ NAME "cultural_type"
+ TYPE ANNOTATION
+ DATA cultural_landmark-point
+ STATUS DEFAULT
+
+ LABELITEM "CLPTLABEL"
+ CLASSITEM "CLPTLABEL"
+ CLASS
+ EXPRESSION /./
+ # COLOR 232 232 232
+ LABEL
+ COLOR 0 0 0
+ # SHADOWCOLOR 218 218 218
+ # SHADOWSIZE 2 2
+ TYPE BITMAP
+ SIZE Small
+ POSITION AUTO
+ BUFFER 0
+ END
+ END
+
+ PROJECTION
+ proj=latlong
+ ellps=clrk66
+ END
+END
END
From cvs at intevation.de Tue Aug 3 13:59:32 2004
From: cvs at intevation.de (cvs@intevation.de)
Date: Tue, 3 Aug 2004 13:59:32 +0200 (CEST)
Subject: jschuengel: thuban/Extensions/umn_mapserver/sample iceland.html, 1.2,
1.3
Message-ID: <20040803115932.BA930139C8@lists.intevation.de>
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample
In directory doto:/tmp/cvs-serv14509
Modified Files:
iceland.html
Log Message:
Added the select option for the annotation layer.
Index: iceland.html
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/sample/iceland.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- iceland.html 28 Jul 2004 12:38:15 -0000 1.2
+++ iceland.html 3 Aug 2004 11:59:30 -0000 1.3
@@ -37,6 +37,7 @@