From bh at intevation.de Tue Jun 1 15:00:31 2004 From: bh at intevation.de (Bernhard Herzog) Date: Tue, 01 Jun 2004 15:00:31 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources References: <20040415182050.GH1655@finlandia.infodrom.north.de> <20040419113029.GA10000@intevation.de> <20040519144813.GX716@finlandia.infodrom.north.de> <20040524162641.GQ716@finlandia.infodrom.north.de> <20040530162635.GA20524@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: > What about this one instead? > > def get_layer_properties_dialog(layer): > for cls, func in _layer_dialogs['properties']: > if isinstance(layer, cls): > return func > return None Yes, better. But see below for some other, general remarks. >> The logic that determines whether the dialog is already shown and either >> raises the existing one or creates a new one should be left in the >> mainwindow. Actually, it should be moved into its own mainwindow method >> as this logic has already been duplicated at least seven times in >> mainwindow.py, but that's for another patch. > > That would require a global logic for naming windows/dialogs. It would be local to the mainwindow. > We may also need some sort of registration for calculation functions. What exactly do you mean? The Panels in Thuban/UI/classgen.py? > Something like > > def OpenOrRaiseDialog(self, type, layer, group=None): > # type one of [layer,properties,information] > name = self.calculate_dialog_name(...) > > dialog = self.get_open_dialog(name) > > if dialog is None: > open_func = get_layer_properties_dialog(layer) > if open_func is None: > return None > dialog = open_func(self, layer, group) > parent.add_dialog(name, dialog) > dialog.Show(True) > else: > dialog.Raise() Well, it's still too get_layer_properties_dialog specific. I was thinking about something more like this: def OpenOrRaiseDialog(self, name, dialog_class, *args, *kw): dialog = self.get_open_dialog(name) if dialog is None: dialog = dialog_class(self, name, *args, **kw) parent.add_dialog(name, dialog) dialog.Show(True) else: dialog.Raise() The raise-or-open logic should be completely separate from the logic that determines which dialog to open. > we will probably handle show_table > and information similar to the properties dialog. Why do we need layer specific dialogs for show table? It may be necessary to make the existing code more flexible, so that it works for layers that are not sub-classes of Layer among others, but that shouldn't require different dialogs. > Apart from that, this method is executed quite often. We would > probably create a reasonable delay if it would be implemented that > way. In order to avoid this, I propose a hierarchical data structure > for layer_dialogs.py (attached). Well, the way you wrote the function, it returns the wrong results (see below) in some cases and probably isn't all that much faster. Anyway, I don't think we need the hierarchical approach yet. If the lookup is too slow there are lots of ways in can be made faster. E.g. instead of doing a linear search each time, we could build a dictionary on demand mapping layer classes to the appropriate dialog classes. One problem that will probably bite us some day is that with the current code (and the code in baserenderer.py for that matter) it can happen that settings for a base class override that of one of its subclasses. One way to solve it is to make sure the subclasses come before their base classes in the list of layer classes, i.e. keep the list topologically sorted, effectively. > def has_layer_dialog(type, layer_class): > return (type in _layer_dialogs and layer_class in _layer_dialogs[type]) This is will return false if a base class of layer_class is in layer_dialogs[type] but not layer_class itself. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From thuban-bugs at intevation.de Wed Jun 2 14:35:23 2004 From: thuban-bugs at intevation.de (Request Tracker) Date: Wed, 2 Jun 2004 14:35:23 +0200 (CEST) Subject: [bug #2453] (thuban) gns2shp.py crashes on GNS input files containing names > 40 car. Message-ID: <20040602123523.5E0ED13BA2@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=2453 ------------------------------------------------------------------------- Subject: gns2shp.py crashes on GNS input files containing names > 40 car. Operating System: MS Windows, XP Pro Thuban version: CVS, tarball available on the Web Python version: 2.2.2 gns2shp extension crashes on GNS files containing names (FULL_NAME and FULL_NAME_ND fields) longer than 40 characters. Just call the script on eg.txt (Egypt file) for example. You will get the following error stack: C:\dev\src\gns\data\gns>python gns2shp.py eg.txt eg.shp gns2shp.py $Revision: 1.3 $ Traceback (most recent call last): File "gns2shp.py", line 166, in ? no = gns2shp(sys.argv[1], sys.argv[2][:-4]) File "gns2shp.py", line 104, in gns2shp dbf.write_record(i, { 'RC': RC, 'UFI': UFI, 'UNI': UNI, 'UTM': UTM, File "c:\dev\Thuban\Lib\dbflib.py", line 33, in write_record val = apply(dbflibc.DBFFile_write_record,args) IOError: can't write field 18 of record 10 The solution I found is to add two tests on the length of FULL_NAME and FULL_NAME_ND fields. Just truncate them to max 40car. and it will works. Patch follows: 86a87 > trunc = 0 103a105,108 > if len(FULL_NAME) > 40: > FULL_NAME = FULL_NAME[:39] > trunc += 1 > if len(FULL_NAME_ND) > 40: FULL_NAME_ND = FULL_NAME_ND[:39] 117c122 < return i --- > return (i,trunc) 166c171 < no = gns2shp(sys.argv[1], sys.argv[2][:-4]) --- > (no,trunc) = gns2shp(sys.argv[1], sys.argv[2][:-4]) 167a173 > if trunc!=0: print '%d names truncated' % trunc Have a nice day! Pierre -------------------------------------------- Managed by Request Tracker From cvs at intevation.de Thu Jun 3 17:17:56 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 3 Jun 2004 17:17:56 +0200 (CEST) Subject: bh: thuban/Thuban/Model layer.py,1.57,1.58 Message-ID: <20040603151756.BCFC913B53@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/Model In directory doto:/tmp/cvs-serv19463/Thuban/Model Modified Files: layer.py Log Message: (Layer.TreeInfo): Convert the bounding box to a tuple before using it as arguments to the % operator. This fixes the formatting issue filed in RT#2239 on 2004-01-13 and reported today on thuban-list by Jan Schüngel Index: layer.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/layer.py,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- layer.py 27 Nov 2003 15:57:23 -0000 1.57 +++ layer.py 3 Jun 2004 15:17:54 -0000 1.58 @@ -1,4 +1,4 @@ -# Copyright (c) 2001, 2002, 2003 by Intevation GmbH +# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH # Authors: # Bernhard Herzog # Jonathan Coles @@ -289,7 +289,7 @@ bbox = self.LatLongBoundingBox() if bbox is not None: - items.append(_("Extent (lat-lon): (%g, %g, %g, %g)") % bbox) + items.append(_("Extent (lat-lon): (%g, %g, %g, %g)") % tuple(bbox)) else: items.append(_("Extent (lat-lon):")) items.append(_("Shapetype: %s") % shapetype_names[self.ShapeType()]) From cvs at intevation.de Thu Jun 3 17:18:09 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 3 Jun 2004 17:18:09 +0200 (CEST) Subject: bh: thuban/test test_layer.py,1.29,1.30 Message-ID: <20040603151809.C923713B53@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/test In directory doto:/tmp/cvs-serv19492/test Modified Files: test_layer.py Log Message: (TestLayerModification.setUp): Save the filename as an instance variable so we can refer to it in tests (TestLayerModification.test_tree_info): Uncomment this method again and make it work. This tests for the formatting issue filed in RT#2239 on 2004-01-13 Index: test_layer.py =================================================================== RCS file: /thubanrepository/thuban/test/test_layer.py,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- test_layer.py 28 Nov 2003 11:37:35 -0000 1.29 +++ test_layer.py 3 Jun 2004 15:18:07 -0000 1.30 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -355,9 +355,9 @@ """ self.clear_messages() self.session = Session("Test session for %s" % self.__class__) - filename = os.path.join("..", "Data", "iceland", "political.shp") + self.filename = os.path.join("..", "Data", "iceland", "political.shp") self.layer = Layer("Test Layer", - self.session.OpenShapefile(filename)) + self.session.OpenShapefile(self.filename)) self.layer.Subscribe(LAYER_LEGEND_CHANGED, self.subscribe_with_params, LAYER_LEGEND_CHANGED) self.layer.Subscribe(LAYER_VISIBILITY_CHANGED, @@ -416,20 +416,16 @@ self.failUnless(self.layer.WasModified()) -# -# the tree info now contains Color objects which are difficult to test -# -# def test_tree_info(self): -# """Test Layer.TreeInfo""" -# self.assertEquals(self.layer.TreeInfo(), -# ("Layer 'Test Layer'", -# ['Shown', -# 'Shapes: 156', -# ('Extent (lat-lon):' -# ' (-24.5465, 63.2868, -13.4958, 66.5638)'), -# 'Shapetype: Polygon', -# 'Fill: None', -# 'Outline: (0.000, 0.000, 0.000)'])) + def test_tree_info(self): + """Test Layer.TreeInfo""" + self.assertEquals(self.layer.TreeInfo(), + ("Layer 'Test Layer'", + ['Filename: %s' % os.path.abspath(self.filename), + 'Shown', + 'Shapes: 156', + 'Extent (lat-lon): (-24.5465, 63.2868, -13.4958, 66.5638)', + 'Shapetype: Polygon', + self.layer.GetClassification()])) if __name__ == "__main__": From cvs at intevation.de Thu Jun 3 17:18:27 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 3 Jun 2004 17:18:27 +0200 (CEST) Subject: bh: thuban ChangeLog,1.654,1.655 Message-ID: <20040603151827.E8E7E13B53@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv19508 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.654 retrieving revision 1.655 diff -u -d -r1.654 -r1.655 --- ChangeLog 28 May 2004 17:29:30 -0000 1.654 +++ ChangeLog 3 Jun 2004 15:18:25 -0000 1.655 @@ -1,3 +1,16 @@ +2004-06-03 Bernhard Herzog + + * Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box + to a tuple before using it as arguments to the % operator. This + fixes the formatting issue filed in RT#2239 on 2004-01-13 and + reported today on thuban-list by Jan Schüngel + + * test/test_layer.py (TestLayerModification.setUp): Save the + filename as an instance variable so we can refer to it in tests + (TestLayerModification.test_tree_info): Uncomment this method + again and make it work. This tests for the formatting issue + filed in RT#2239 on 2004-01-13 + 2004-05-28 Bernhard Herzog * Thuban/UI/baserenderer.py: Fix some typos. From cvs at intevation.de Thu Jun 3 17:29:18 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 3 Jun 2004 17:29:18 +0200 (CEST) Subject: bh: thuban/test test_layer.py,1.29,1.29.2.1 Message-ID: <20040603152918.3C27D13B7E@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/test In directory doto:/tmp/cvs-serv19718/test Modified Files: Tag: thuban-1-0-branch test_layer.py Log Message: Backport some fixes from HEAD: * Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box to a tuple before using it as arguments to the % operator. This fixes the formatting issue filed in RT#2239 on 2004-01-13 and reported today on thuban-list by Jan Schüngel * test/test_layer.py (TestLayerModification.setUp): Save the filename as an instance variable so we can refer to it in tests (TestLayerModification.test_tree_info): Uncomment this method again and make it work. This tests for the formatting issue filed in RT#2239 on 2004-01-13 Index: test_layer.py =================================================================== RCS file: /thubanrepository/thuban/test/test_layer.py,v retrieving revision 1.29 retrieving revision 1.29.2.1 diff -u -d -r1.29 -r1.29.2.1 --- test_layer.py 28 Nov 2003 11:37:35 -0000 1.29 +++ test_layer.py 3 Jun 2004 15:29:16 -0000 1.29.2.1 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -355,9 +355,9 @@ """ self.clear_messages() self.session = Session("Test session for %s" % self.__class__) - filename = os.path.join("..", "Data", "iceland", "political.shp") + self.filename = os.path.join("..", "Data", "iceland", "political.shp") self.layer = Layer("Test Layer", - self.session.OpenShapefile(filename)) + self.session.OpenShapefile(self.filename)) self.layer.Subscribe(LAYER_LEGEND_CHANGED, self.subscribe_with_params, LAYER_LEGEND_CHANGED) self.layer.Subscribe(LAYER_VISIBILITY_CHANGED, @@ -416,20 +416,16 @@ self.failUnless(self.layer.WasModified()) -# -# the tree info now contains Color objects which are difficult to test -# -# def test_tree_info(self): -# """Test Layer.TreeInfo""" -# self.assertEquals(self.layer.TreeInfo(), -# ("Layer 'Test Layer'", -# ['Shown', -# 'Shapes: 156', -# ('Extent (lat-lon):' -# ' (-24.5465, 63.2868, -13.4958, 66.5638)'), -# 'Shapetype: Polygon', -# 'Fill: None', -# 'Outline: (0.000, 0.000, 0.000)'])) + def test_tree_info(self): + """Test Layer.TreeInfo""" + self.assertEquals(self.layer.TreeInfo(), + ("Layer 'Test Layer'", + ['Filename: %s' % os.path.abspath(self.filename), + 'Shown', + 'Shapes: 156', + 'Extent (lat-lon): (-24.5465, 63.2868, -13.4958, 66.5638)', + 'Shapetype: Polygon', + self.layer.GetClassification()])) if __name__ == "__main__": From cvs at intevation.de Thu Jun 3 17:29:18 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 3 Jun 2004 17:29:18 +0200 (CEST) Subject: bh: thuban/Thuban/Model layer.py,1.57,1.57.2.1 Message-ID: <20040603152918.515BC13BDF@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/Model In directory doto:/tmp/cvs-serv19718/Thuban/Model Modified Files: Tag: thuban-1-0-branch layer.py Log Message: Backport some fixes from HEAD: * Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box to a tuple before using it as arguments to the % operator. This fixes the formatting issue filed in RT#2239 on 2004-01-13 and reported today on thuban-list by Jan Schüngel * test/test_layer.py (TestLayerModification.setUp): Save the filename as an instance variable so we can refer to it in tests (TestLayerModification.test_tree_info): Uncomment this method again and make it work. This tests for the formatting issue filed in RT#2239 on 2004-01-13 Index: layer.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/layer.py,v retrieving revision 1.57 retrieving revision 1.57.2.1 diff -u -d -r1.57 -r1.57.2.1 --- layer.py 27 Nov 2003 15:57:23 -0000 1.57 +++ layer.py 3 Jun 2004 15:29:16 -0000 1.57.2.1 @@ -289,7 +289,7 @@ bbox = self.LatLongBoundingBox() if bbox is not None: - items.append(_("Extent (lat-lon): (%g, %g, %g, %g)") % bbox) + items.append(_("Extent (lat-lon): (%g, %g, %g, %g)") % tuple(bbox)) else: items.append(_("Extent (lat-lon):")) items.append(_("Shapetype: %s") % shapetype_names[self.ShapeType()]) From cvs at intevation.de Thu Jun 3 17:29:19 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 3 Jun 2004 17:29:19 +0200 (CEST) Subject: bh: thuban ChangeLog,1.624.2.6,1.624.2.7 Message-ID: <20040603152919.F162F13BE0@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv19718 Modified Files: Tag: thuban-1-0-branch ChangeLog Log Message: Backport some fixes from HEAD: * Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box to a tuple before using it as arguments to the % operator. This fixes the formatting issue filed in RT#2239 on 2004-01-13 and reported today on thuban-list by Jan Schüngel * test/test_layer.py (TestLayerModification.setUp): Save the filename as an instance variable so we can refer to it in tests (TestLayerModification.test_tree_info): Uncomment this method again and make it work. This tests for the formatting issue filed in RT#2239 on 2004-01-13 Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.624.2.6 retrieving revision 1.624.2.7 diff -u -d -r1.624.2.6 -r1.624.2.7 --- ChangeLog 18 May 2004 21:23:58 -0000 1.624.2.6 +++ ChangeLog 3 Jun 2004 15:29:16 -0000 1.624.2.7 @@ -1,3 +1,18 @@ +2004-06-03 Bernhard Herzog + + Backport some fixes from HEAD: + + * Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box + to a tuple before using it as arguments to the % operator. This + fixes the formatting issue filed in RT#2239 on 2004-01-13 and + reported today on thuban-list by Jan Schüngel + + * test/test_layer.py (TestLayerModification.setUp): Save the + filename as an instance variable so we can refer to it in tests + (TestLayerModification.test_tree_info): Uncomment this method + again and make it work. This tests for the formatting issue + filed in RT#2239 on 2004-01-13 + 2004-05-18 Jan-Oliver Wagner * Extensions/gns2shp/gns2shp.py (gns2shp): Fixed a bug From bernhard at intevation.de Tue Jun 8 12:29:15 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Tue, 8 Jun 2004 12:29:15 +0200 Subject: [Freegis-list] GPS data processing In-Reply-To: <20040607183634.GB24517@intevation.de> References: <7648E205582D8A49A9F981145BE01EAB0162DC@gauss.zess.uni-siegen.de> <1086614242.1289.107.camel@localhost> <20040607165651.GB22529@intevation.de> <1086631251.1289.299.camel@localhost> <20040607183634.GB24517@intevation.de> Message-ID: <20040608102915.GA27045@intevation.de> On Mon, Jun 07, 2004 at 08:36:34PM +0200, Bernhard Reiter wrote: > On Mon, Jun 07, 2004 at 08:00:51PM +0200, Nils Faerber wrote: > > Am Mo, den 07.06.2004 schrieb Bernhard Reiter um 18:56: > > Concerning the polygons I searched for some solution to create those > > from GPS data. > > In most cases you will have GPS tracks that could be converted to > > polygons - at least in theory. The trick is the "how-to" which I have > > not yet found. > > Ah, now that question is a lot better, > because it goes more to the point. > It seems that somebody should make a shapefile backend for gpsbabel > or OGR to convert some of the GPS formats in GIS formats. > Usually the textfiles are so simple that for real purposes > someone would write a small import script, e.g. using pyshapelib. > > > Interestingly for example GRASS has a digitizer option for some misc > > graphics tablets but AFAIK no GPS data import. And I was also not able > > to find any tool to convert GPS track data of any form into something > > that some package like GRASS would be able to postprocess. > > There once was s.in.gps, but I did not look up what happend to it. You could try v.in.garmin.sh for GRASS 5.3. Check: http://grass.itc.it/gdp/html_grass5/html/v.in.garmin.sh.html Also Hamish seems to have development a real-time tracking: http://grass.itc.it/pipermail/grassuser/2003-November/010780.html (Further questions on that should better go to the GRASS lists. :) ) On my wishlist would be a plugin for Thuban to operate gpsbabel. Bernhard -- Professional Service around Free Software (intevation.net) Experts for complex webmapping! In business since 1999: http://intevation.net/services/gis/webmapping.en.html Pay for FreeGIS if you like it: http://freegis.org/about-paying.en.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040608/5d9c2398/attachment.bin From nils.faerber at kernelconcepts.de Tue Jun 8 12:57:34 2004 From: nils.faerber at kernelconcepts.de (Nils Faerber) Date: Tue, 08 Jun 2004 12:57:34 +0200 Subject: [Freegis-list] GPS data processing In-Reply-To: <20040608102915.GA27045@intevation.de> References: <7648E205582D8A49A9F981145BE01EAB0162DC@gauss.zess.uni-siegen.de> <1086614242.1289.107.camel@localhost> <20040607165651.GB22529@intevation.de> <1086631251.1289.299.camel@localhost> <20040607183634.GB24517@intevation.de> <20040608102915.GA27045@intevation.de> Message-ID: <1086692253.1286.323.camel@localhost> Am Di, den 08.06.2004 schrieb Bernhard Reiter um 12:29: > On Mon, Jun 07, 2004 at 08:36:34PM +0200, Bernhard Reiter wrote: > > On Mon, Jun 07, 2004 at 08:00:51PM +0200, Nils Faerber wrote: > > > Am Mo, den 07.06.2004 schrieb Bernhard Reiter um 18:56: [...] > > > Interestingly for example GRASS has a digitizer option for some misc > > > graphics tablets but AFAIK no GPS data import. And I was also not able > > > to find any tool to convert GPS track data of any form into something > > > that some package like GRASS would be able to postprocess. > > There once was s.in.gps, but I did not look up what happend to it. > > You could try v.in.garmin.sh for GRASS 5.3. > Check: http://grass.itc.it/gdp/html_grass5/html/v.in.garmin.sh.html Ah, cool, I'll try to check that out ASAIT (as soon as I have time :) > Also Hamish seems to have development a real-time tracking: > http://grass.itc.it/pipermail/grassuser/2003-November/010780.html > (Further questions on that should better go to the GRASS lists. :) ) :) > On my wishlist would be a plugin for Thuban to operate gpsbabel. Oh yes, that would be perfect! I am definitely a newbie to GIS processing and I have already stated my point of interest: Generate maps from GPS data. How this is deon is in general quite open. Thuban seems to me very interesting sind it can handle annotations what GRASS IMHO can not. If there would be a way to generate shape files for Thuban from GPS data that could be edited (split, merged and annotated) within Thuban, then Thuban would be the application of choice for my work! Sadly I am no Python programmer at all so your Python shapelib extension is no use for me. But the GPS-Babel approach seems promising! If I understand you correctly if gpsbabel would have an output module for shapefiles, which could itself be implemented by using shapelib, then those shapes could be imported and managed/edited by Thuban? > Bernhard CU nils faerber -- kernel concepts Tel: +49-271-771091-12 Dreisbachstr. 24 Fax: +49-271-771091-19 D-57250 Netphen Mob: +49-176-21024535 -- From bernhard at intevation.de Tue Jun 8 14:29:58 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Tue, 8 Jun 2004 14:29:58 +0200 Subject: [Freegis-list] GPS data processing In-Reply-To: <1086692253.1286.323.camel@localhost> References: <7648E205582D8A49A9F981145BE01EAB0162DC@gauss.zess.uni-siegen.de> <1086614242.1289.107.camel@localhost> <20040607165651.GB22529@intevation.de> <1086631251.1289.299.camel@localhost> <20040607183634.GB24517@intevation.de> <20040608102915.GA27045@intevation.de> <1086692253.1286.323.camel@localhost> Message-ID: <20040608122958.GB28210@intevation.de> On Tue, Jun 08, 2004 at 12:57:34PM +0200, Nils Faerber wrote: > Am Di, den 08.06.2004 schrieb Bernhard Reiter um 12:29: > > On Mon, Jun 07, 2004 at 08:36:34PM +0200, Bernhard Reiter wrote: > > On my wishlist would be a plugin for Thuban to operate gpsbabel. > > Oh yes, that would be perfect! > I am definitely a newbie to GIS processing and I have already stated my > point of interest: Generate maps from GPS data. How this is deon is in > general quite open. Thuban seems to me very interesting sind it can > handle annotations what GRASS IMHO can not. Both Thuban and GRASS can handle attributes. > If there would be a way to generate shape files for Thuban from GPS data > that could be edited (split, merged and annotated) within Thuban, then > Thuban would be the application of choice for my work! When you have shapefiles, you can also use many other packages. I will answer the more involved Thuban questions on the thuban-devel list (and send you a copy). > Sadly I am no Python programmer at all so your Python shapelib extension > is no use for me. But the GPS-Babel approach seems promising! > > If I understand you correctly if gpsbabel would have an output module > for shapefiles, which could itself be implemented by using shapelib, > then those shapes could be imported and managed/edited by Thuban? Thuban currently cannot do the more involved GIS operations like merging, editing and writing out shapefiles. There are some experimental extensions and having one using gpsbabel to create a shapefile looks like a short hack. That would enable someone to produce maps. Bernhard -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040608/dd842708/attachment.bin From bernhard at intevation.de Tue Jun 8 15:30:15 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Tue, 8 Jun 2004 15:30:15 +0200 Subject: GPS data processing In-Reply-To: <20040608122958.GB28210@intevation.de> References: <7648E205582D8A49A9F981145BE01EAB0162DC@gauss.zess.uni-siegen.de> <1086614242.1289.107.camel@localhost> <20040607165651.GB22529@intevation.de> <1086631251.1289.299.camel@localhost> <20040607183634.GB24517@intevation.de> <20040608102915.GA27045@intevation.de> <1086692253.1286.323.camel@localhost> <20040608122958.GB28210@intevation.de> Message-ID: <20040608133015.GH28210@intevation.de> On Tue, Jun 08, 2004 at 02:29:58PM +0200, Bernhard Reiter wrote: > There are some experimental > extensions and having one using gpsbabel to create a shapefile looks > like a short hack. That would enable someone to produce maps. This should be easily doable by taking the gns2shp Extension as an example. Someone could use an easy gpsbabel backend. The csv could be fine for this and make a gps2shp Extension. Jan estimates that a dirty hack would take 2 hours. http://www.intevation.de/cgi-bin/viewcvs-thuban.cgi/thuban/Extensions/gns2shp/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040608/4ee77f73/attachment.bin From joey at infodrom.org Wed Jun 9 17:39:05 2004 From: joey at infodrom.org (Martin Schulze) Date: Wed, 9 Jun 2004 17:39:05 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: References: <20040415182050.GH1655@finlandia.infodrom.north.de> <20040419113029.GA10000@intevation.de> <20040519144813.GX716@finlandia.infodrom.north.de> <20040524162641.GQ716@finlandia.infodrom.north.de> <20040530162635.GA20524@finlandia.infodrom.north.de> Message-ID: <20040609153905.GJ1019@finlandia.infodrom.north.de> Bernhard Herzog wrote: > >> The logic that determines whether the dialog is already shown and either > >> raises the existing one or creates a new one should be left in the > >> mainwindow. Actually, it should be moved into its own mainwindow method > >> as this logic has already been duplicated at least seven times in > >> mainwindow.py, but that's for another patch. > > > > That would require a global logic for naming windows/dialogs. > > It would be local to the mainwindow. Hmm, possibly. > > We may also need some sort of registration for calculation functions. > > What exactly do you mean? The Panels in Thuban/UI/classgen.py? If dialogs should not be opened multiple times, they need to be named and inserted into the dialog list. My idea is that when dialog creation is handled globally there needs to be a global logic for naming dialogs. I'm not yet able to oversee the global picture yet, so my ideas may not always make too much sense. In such cases, feel free to ignore them. > > Something like > > > > def OpenOrRaiseDialog(self, type, layer, group=None): > > # type one of [layer,properties,information] > > name = self.calculate_dialog_name(...) > > > > dialog = self.get_open_dialog(name) > > > > if dialog is None: > > open_func = get_layer_properties_dialog(layer) > > if open_func is None: > > return None > > dialog = open_func(self, layer, group) > > parent.add_dialog(name, dialog) > > dialog.Show(True) > > else: > > dialog.Raise() > > Well, it's still too get_layer_properties_dialog specific. I was > thinking about something more like this: > > def OpenOrRaiseDialog(self, name, dialog_class, *args, *kw): > dialog = self.get_open_dialog(name) > > if dialog is None: > dialog = dialog_class(self, name, *args, **kw) > parent.add_dialog(name, dialog) > dialog.Show(True) > else: > dialog.Raise() > > The raise-or-open logic should be completely separate from the logic > that determines which dialog to open. > > > > we will probably handle show_table > > and information similar to the properties dialog. > > Why do we need layer specific dialogs for show table? It may be > necessary to make the existing code more flexible, so that it works for > layers that are not sub-classes of Layer among others, but that > shouldn't require different dialogs. Maybe there is no need for different show table dialogs at the moment. I can't guarantee that there won't be one in the future. Hence, I would rather like to implement a general solution which could be used for other instances of the same problem class as well. > > Apart from that, this method is executed quite often. We would > > probably create a reasonable delay if it would be implemented that > > way. In order to avoid this, I propose a hierarchical data structure > > for layer_dialogs.py (attached). > > Well, the way you wrote the function, it returns the wrong results (see > below) in some cases and probably isn't all that much faster. Anyway, I > don't think we need the hierarchical approach yet. If the lookup is too > slow there are lots of ways in can be made faster. E.g. instead of > doing a linear search each time, we could build a dictionary on demand > mapping layer classes to the appropriate dialog classes. ok. Is the attached patch better? Regards, Joey -- Whenever you meet yourself you're in a time loop or in front of a mirror. -------------- next part -------------- Index: Extensions/wms/properties.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/wms/properties.py,v retrieving revision 1.1 diff -u -r1.1 properties.py --- Extensions/wms/properties.py 15 Apr 2004 16:14:51 -0000 1.1 +++ Extensions/wms/properties.py 9 Jun 2004 15:30:45 -0000 @@ -72,7 +72,7 @@ Representation for the WMS properties dialog """ - def __init__(self, parent, name, layer): + def __init__(self, parent, name, layer, group = None): """ Build the properties dialog """ Index: Extensions/wms/wms.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/wms/wms.py,v retrieving revision 1.9 diff -u -r1.9 wms.py --- Extensions/wms/wms.py 11 May 2004 22:34:49 -0000 1.9 +++ Extensions/wms/wms.py 9 Jun 2004 15:30:46 -0000 @@ -33,6 +33,7 @@ import Thuban.UI.baserenderer from layer import WMSLayer +from properties import wmsProperties class WMSExtension(Extension): @@ -57,6 +58,7 @@ return () Thuban.UI.baserenderer.add_renderer_extension(WMSLayer, render_wms_layer) +Thuban.UI.layer_dialogs.add_layer_dialog('properties', WMSLayer, wmsProperties) class SelectWMSServer(wxDialog): Index: Thuban/UI/classifier.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/classifier.py,v retrieving revision 1.65 diff -u -r1.65 classifier.py --- Thuban/UI/classifier.py 7 May 2004 20:20:43 -0000 1.65 +++ Thuban/UI/classifier.py 9 Jun 2004 15:30:50 -0000 @@ -38,6 +38,8 @@ from dialogs import NonModalNonParentDialog from messages import MAP_REPLACED +from Thuban.UI.layer_dialogs import add_layer_dialog + ID_CLASS_TABLE = 40011 @@ -685,7 +687,7 @@ FIELDTYPE_INT: _("Integer"), FIELDTYPE_DOUBLE: _("Decimal")} - def __init__(self, parent, name, map, layer, group = None): + def __init__(self, parent, name, layer, group = None): """Create a Properties/Classification dialog for a layer. The layer is part of map. If group is not None, select that group in the classification table. @@ -697,7 +699,7 @@ self.parent.Subscribe(MAP_REPLACED, self.map_replaced) self.layer = layer - self.map = map + self.map = parent.Map() self.map.Subscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) self.layer.Subscribe(LAYER_SHAPESTORE_REPLACED, @@ -1510,3 +1512,6 @@ def _OnLeftDClick(self, event): self.DoEdit() + +add_layer_dialog('properties', Layer, Classifier) +add_layer_dialog('properties', RasterLayer, Classifier) Index: Thuban/UI/mainwindow.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/mainwindow.py,v retrieving revision 1.132 diff -u -r1.132 mainwindow.py --- Thuban/UI/mainwindow.py 18 Apr 2004 20:37:01 -0000 1.132 +++ Thuban/UI/mainwindow.py 9 Jun 2004 15:30:54 -0000 @@ -53,6 +53,9 @@ import projdialog +from Extensions.wms.infodialog import wmsInfoDialog + +from Thuban.UI.layer_dialogs import get_layer_properties_class class MainWindow(DockFrame): @@ -349,6 +352,23 @@ """ self.SetStatusText(text) + def OpenOrRaiseDialog(self, name, dialog_class, *args, **kw): + """ + Open or raise a dialog. + + If a dialog with the denoted name does already exist it is + raised. Otherwise a new dialog, an instance of dialog_class, + is created, inserted into the main list and displayed. + """ + dialog = self.get_open_dialog(name) + + if dialog is None: + dialog = dialog_class(self, name, *args, **kw) + self.add_dialog(name, dialog) + dialog.Show(True) + else: + dialog.Raise() + def save_modified_session(self, can_veto = 1): """If the current session has been modified, ask the user whether to save it and do so if requested. Return the outcome of @@ -705,14 +742,18 @@ self.OpenLayerProperties(layer) def OpenLayerProperties(self, layer, group = None): - name = "layer_properties" + str(id(layer)) - dialog = self.get_open_dialog(name) + """ + Open or raise the properties dialog. - if dialog is None: - dialog = Classifier(self, name, self.Map(), layer, group) - self.add_dialog(name, dialog) - dialog.Show() - dialog.Raise() + This method opens or raises the properties dialog for the + currently selected layer if one is defined for this layer + type. + """ + dialog_class = get_layer_properties_class(layer) + + if dialog_class is not None: + name = "layer_properties" + str(id(layer)) + self.OpenOrRaiseDialog(name, dialog_class, layer, group = group) def LayerJoinTable(self): layer = self.canvas.SelectedLayer() -------------- next part -------------- A non-text attachment was scrubbed... Name: layer_dialogs.py Type: text/x-python Size: 811 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040609/f467246b/layer_dialogs.py -------------- next part -------------- A non-text attachment was scrubbed... Name: test_layer_dialogs.py Type: text/x-python Size: 643 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040609/f467246b/test_layer_dialogs.py From cvs at intevation.de Thu Jun 10 12:07:27 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 12:07:27 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver - New directory Message-ID: <20040610100727.2D407139FE@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv23530/umn_mapserver Log Message: Directory /thubanrepository/thuban/Extensions/umn_mapserver added to the repository From cvs at intevation.de Thu Jun 10 12:16:34 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 12:16:34 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/test - New directory Message-ID: <20040610101634.40A58139FE@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/test In directory doto:/tmp/cvs-serv23656/test Log Message: Directory /thubanrepository/thuban/Extensions/umn_mapserver/test added to the repository From cvs at intevation.de Thu Jun 10 12:20:46 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 12:20:46 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/test README,NONE,1.1 Message-ID: <20040610102046.9A7AF139AF@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/test In directory doto:/tmp/cvs-serv23700 Added Files: README Log Message: Describes how to run the tests. --- NEW FILE: README --- This directory contains tests of the umn_mapserver extension. Howto run test (assume thuban source is under ~/project): export PYTHONPATH=~/project/thuban:~/project/thuban/Lib:~/project/thuban/test python test_mapserver.py From cvs at intevation.de Thu Jun 10 12:29:02 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 12:29:02 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/test test.map, NONE, 1.1 Message-ID: <20040610102902.35C57139AF@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/test In directory doto:/tmp/cvs-serv23832 Added Files: test.map Log Message: This is a test .map-file for automated tests of the umn_mapserver extension of Thuban. --- NEW FILE: test.map --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Thu Jun 10 12:36:27 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 12:36:27 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver __init__.py,NONE,1.1 Message-ID: <20040610103627.E35B1139AF@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv23937 Added Files: __init__.py Log Message: Init to make this directory a package. --- NEW FILE: __init__.py --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Thu Jun 10 14:27:50 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 14:27:50 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mapfile.py,NONE,1.1 Message-ID: <20040610122750.C5CD313943@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv27589 Added Files: mapfile.py Log Message: Classes to represent '.map'-file objects. --- NEW FILE: mapfile.py --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Thu Jun 10 14:50:01 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 14:50:01 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mf_import.py,NONE,1.1 Message-ID: <20040610125001.9EBA413943@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv27755 Added Files: mf_import.py Log Message: This module extends Thuban with the possibility to handle UMN MapServer mapfiles. --- NEW FILE: mf_import.py --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Thu Jun 10 14:54:00 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 14:54:00 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/test test_mapserver.py, NONE, 1.1 Message-ID: <20040610125400.AFD4313943@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/test In directory doto:/tmp/cvs-serv27819 Added Files: test_mapserver.py Log Message: Tests for UMN Mapserver extension. --- NEW FILE: test_mapserver.py --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Thu Jun 10 14:57:39 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 10 Jun 2004 14:57:39 +0200 (CEST) Subject: jschuengel: thuban ChangeLog,1.655,1.656 Message-ID: <20040610125739.3151213A08@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv27938 Modified Files: ChangeLog Log Message: Initial version of new extension "umn_mapserver". This extension aims to manage configuration for the UMN MapServer application. This inital version just imports the .map-files and displays all, Thuban is capable of. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.655 retrieving revision 1.656 diff -u -d -r1.655 -r1.656 --- ChangeLog 3 Jun 2004 15:18:25 -0000 1.655 +++ ChangeLog 10 Jun 2004 12:57:36 -0000 1.656 @@ -1,3 +1,31 @@ +2004-06-10 Jan Schüngel + + Initial version of new extension "umn_mapserver". This extension aims + to manage configuration for the UMN MapServer application. This + inital version just imports the .map-files and displays all, Thuban is + capable of. + + * Extensions/umn_mapserver, Extensions/umn_mapserver/test: New. + + * Extensions/umn_mapserver/test/README: New. Describes how to run the + tests. + + * Extensions/umn_mapserver/test/test.map: New. This is a test + .map-file for automated tests of the umn_mapserver extension of + Thuban. + + * Extensions/umn_mapserver/test/test_mapserver.py: New. Tests for + UMN Mapserver classes. + + * Extensions/umn_mapserver/__init__.py: New. Init to make this + directory a package. + + * Extensions/umn_mapserver/mapfile.py: New. Classes to represent + '.map'-file objects. + + * Extensions/umn_mapserver/mf_import.py: New. This module extends + Thuban with the possibility to handle UMN MapServer mapfiles. + 2004-06-03 Bernhard Herzog * Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box From joey at infodrom.org Thu Jun 10 15:21:33 2004 From: joey at infodrom.org (Martin Schulze) Date: Thu, 10 Jun 2004 15:21:33 +0200 Subject: .py files became binary files? (was: jschuengel: thuban/Extensions/umn_mapserver mapfile.py, NONE, 1.1) In-Reply-To: <20040610122750.C5CD313943@lists.intevation.de> References: <20040610122750.C5CD313943@lists.intevation.de> Message-ID: <20040610132133.GV1019@finlandia.infodrom.north.de> cvs at intevation.de wrote: > --- NEW FILE: mapfile.py --- > (This appears to be a binary file; contents omitted.) This is a bit strange for .py files. I wonder if something went wrong and .pyc files were committed as .py files which are indeed binary files? Regards, Joey -- If nothing changes, everything will remain the same. -- Barne's Law From jan at intevation.de Thu Jun 10 15:35:35 2004 From: jan at intevation.de (Jan-Oliver Wagner) Date: Thu, 10 Jun 2004 15:35:35 +0200 Subject: [Thuban-devel] .py files became binary files? (was: jschuengel: thuban/Extensions/umn_mapserver mapfile.py, NONE, 1.1) In-Reply-To: <20040610132133.GV1019@finlandia.infodrom.north.de> References: <20040610122750.C5CD313943@lists.intevation.de> <20040610132133.GV1019@finlandia.infodrom.north.de> Message-ID: <20040610133535.GA6447@intevation.de> On Thu, Jun 10, 2004 at 03:21:33PM +0200, Martin Schulze wrote: > cvs at intevation.de wrote: > > --- NEW FILE: mapfile.py --- > > (This appears to be a binary file; contents omitted.) > > This is a bit strange for .py files. I wonder if something went wrong > and .pyc files were committed as .py files which are indeed binary > files? its not the pyc files. But the encoding seems to wrong. We'll look into it. Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ From bh at intevation.de Thu Jun 10 15:39:02 2004 From: bh at intevation.de (Bernhard Herzog) Date: Thu, 10 Jun 2004 15:39:02 +0200 Subject: [Thuban-devel] .py files became binary files? In-Reply-To: <20040610133535.GA6447@intevation.de> (Jan-Oliver Wagner's message of "Thu, 10 Jun 2004 15:35:35 +0200") References: <20040610122750.C5CD313943@lists.intevation.de> <20040610132133.GV1019@finlandia.infodrom.north.de> <20040610133535.GA6447@intevation.de> Message-ID: Jan-Oliver Wagner writes: > On Thu, Jun 10, 2004 at 03:21:33PM +0200, Martin Schulze wrote: >> cvs at intevation.de wrote: >> > --- NEW FILE: mapfile.py --- >> > (This appears to be a binary file; contents omitted.) >> >> This is a bit strange for .py files. I wonder if something went wrong >> and .pyc files were committed as .py files which are indeed binary >> files? > > its not the pyc files. > But the encoding seems to wrong. The files are fine, AFAICT. It's just that the name of the author contains an umlaut, and thus there is a non-ascii character in a comment near the start of the file. The encoding is specified correctly in the file so that Python > 2.3 and emacs (at least the emacs I use :) ) recognize it. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From bernhard at intevation.de Thu Jun 10 19:32:46 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Thu, 10 Jun 2004 19:32:46 +0200 Subject: [Thuban-devel] .py files became binary files? In-Reply-To: References: <20040610122750.C5CD313943@lists.intevation.de> <20040610132133.GV1019@finlandia.infodrom.north.de> <20040610133535.GA6447@intevation.de> Message-ID: <20040610173246.GF3585@intevation.de> On Thu, Jun 10, 2004 at 03:39:02PM +0200, Bernhard Herzog wrote: > Jan-Oliver Wagner writes: > > > On Thu, Jun 10, 2004 at 03:21:33PM +0200, Martin Schulze wrote: > >> cvs at intevation.de wrote: > >> > --- NEW FILE: mapfile.py --- > >> > (This appears to be a binary file; contents omitted.) > >> > >> This is a bit strange for .py files. I wonder if something went wrong > >> and .pyc files were committed as .py files which are indeed binary > >> files? > > > > its not the pyc files. > > But the encoding seems to wrong. > > The files are fine, AFAICT. It's just that the name of the author > contains an umlaut, and thus there is a non-ascii character in a comment > near the start of the file. The encoding is specified correctly in the > file so that Python > 2.3 and emacs (at least the emacs I use :) ) > recognize it. We could try a new version of syncmail at our site. :) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040610/84abef5a/attachment.bin From thuban-bugs at intevation.de Sun Jun 13 06:27:47 2004 From: thuban-bugs at intevation.de (Request Tracker) Date: Sun, 13 Jun 2004 06:27:47 +0200 (CEST) Subject: [bug #2482] (thuban) NameError: name 'wx' is not defined Message-ID: <20040613042747.21FD91395E@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=2482 ------------------------------------------------------------------------- Subject: NameError: name 'wx' is not defined Operating System: GNU/Linux, RedHat 9 Thuban version: other, 1.0.0 wxPython version: other, 2.5.1 Python version: 2.2.2 PySQLite version: other, 0.5.0 SQLite version: other, 2.8.14 GDAL version: 1.1.8 proj version: other, 4.4.8 $ thuban Traceback (most recent call last): File "/usr/local/bin/thuban", line 21, in ? import Thuban.UI.main File "/usr/local//lib/thuban/Thuban/UI/main.py", line 18, in ? from application import ThubanApplication File "/usr/local//lib/thuban/Thuban/UI/application.py", line 35, in ? import mainwindow File "/usr/local//lib/thuban/Thuban/UI/mainwindow.py", line 33, in ? from Thuban.UI.multiplechoicedialog import wxMultipleChoiceDialog File "/usr/local//lib/thuban/Thuban/UI/multiplechoicedialog.py", line 22, in ? class wxMultipleChoiceDialog(wx.wxDialog): NameError: name 'wx' is not defined $ I see directories wx and wxPython in /usr/lib/python2.2/site-packages Did you compile Thuban yourself? yes, from tarball -------------------------------------------- Managed by Request Tracker From cvs at intevation.de Mon Jun 14 12:15:05 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 14 Jun 2004 12:15:05 +0200 (CEST) Subject: bh: thuban/Thuban/UI multiplechoicedialog.py,1.1,1.2 Message-ID: <20040614101505.723791395E@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/UI In directory doto:/tmp/cvs-serv8457/Thuban/UI Modified Files: multiplechoicedialog.py Log Message: (__version__): Add missing import of wxPython.wx itself (as opposed to the contents of wxPython.wx). For some reason wxPython.wx is available as wxPython.wx.wx in at least some 2.4 releases. Fixes RT#2482 wrt. wxPython 2.4. Index: multiplechoicedialog.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/multiplechoicedialog.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- multiplechoicedialog.py 12 Jun 2003 12:14:19 -0000 1.1 +++ multiplechoicedialog.py 14 Jun 2004 10:15:03 -0000 1.2 @@ -1,4 +1,4 @@ -# Copyright (c) 2003 by Intevation GmbH +# Copyright (c) 2003, 2004 by Intevation GmbH # Authors: # Jan-Oliver Wagner # @@ -17,6 +17,7 @@ __version__ = "$Revision$" from wxPython.wx import * +from wxPython import wx from wxPython.lib.layoutf import Layoutf class wxMultipleChoiceDialog(wx.wxDialog): From cvs at intevation.de Mon Jun 14 12:15:05 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 14 Jun 2004 12:15:05 +0200 (CEST) Subject: bh: thuban ChangeLog,1.656,1.657 Message-ID: <20040614101505.AF33D139AD@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv8457 Modified Files: ChangeLog Log Message: (__version__): Add missing import of wxPython.wx itself (as opposed to the contents of wxPython.wx). For some reason wxPython.wx is available as wxPython.wx.wx in at least some 2.4 releases. Fixes RT#2482 wrt. wxPython 2.4. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.656 retrieving revision 1.657 diff -u -d -r1.656 -r1.657 --- ChangeLog 10 Jun 2004 12:57:36 -0000 1.656 +++ ChangeLog 14 Jun 2004 10:15:03 -0000 1.657 @@ -1,3 +1,11 @@ +2004-06-14 Bernhard Herzog + + * Thuban/UI/multiplechoicedialog.py (__version__): Add missing + import of wxPython.wx itself (as opposed to the contents of + wxPython.wx). For some reason wxPython.wx is available as + wxPython.wx.wx in at least some 2.4 releases. Fixes RT#2482 + wrt. wxPython 2.4. + 2004-06-10 Jan Schüngel Initial version of new extension "umn_mapserver". This extension aims From cvs at intevation.de Mon Jun 14 16:49:04 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 14 Jun 2004 16:49:04 +0200 (CEST) Subject: bernhard: thuban/libraries/thuban cpl_mfile.cpp, 1.1, 1.2 cpl_mfile.h, 1.1, 1.2 Message-ID: <20040614144904.CCF401393B@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/libraries/thuban In directory doto:/tmp/cvs-serv13672/libraries/thuban Modified Files: cpl_mfile.cpp cpl_mfile.h Log Message: * libraries/thuban/cpl_mfile.h: Added copyright header. * libraries/thuban/ cpl_mfile.cpp, cpl_mfile.h: Added non-protecting Free Software License so that it is most useful with gdalwarp and bmpdataset. Index: cpl_mfile.cpp =================================================================== RCS file: /thubanrepository/thuban/libraries/thuban/cpl_mfile.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cpl_mfile.cpp 19 Aug 2003 21:32:24 -0000 1.1 +++ cpl_mfile.cpp 14 Jun 2004 14:49:02 -0000 1.2 @@ -3,10 +3,28 @@ * * Project: CPL - Common Portability Library * Purpose: Implement MFILE interface for memory based files. - * Author: Jonathan Coles, jonathan at intevation.de + * Author: Jonathan Coles * ********************************************************************** * Copyright (c) 2003, Intevation GmbH + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. ********************************************************************** * */ Index: cpl_mfile.h =================================================================== RCS file: /thubanrepository/thuban/libraries/thuban/cpl_mfile.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cpl_mfile.h 19 Aug 2003 21:32:24 -0000 1.1 +++ cpl_mfile.h 14 Jun 2004 14:49:02 -0000 1.2 @@ -1,3 +1,34 @@ +/********************************************************************** + * $Id$ + * + * Project: CPL - Common Portability Library + * Purpose: Implement MFILE interface for memory based files. + * Author: Jonathan Coles + * + ********************************************************************** + * Copyright (c) 2003, Intevation GmbH + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ********************************************************************** + * + */ + #ifndef MFILE_H_INCLUDED #define MFILE_H_INCLUDED From cvs at intevation.de Mon Jun 14 16:49:04 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 14 Jun 2004 16:49:04 +0200 (CEST) Subject: bernhard: thuban ChangeLog,1.657,1.658 Message-ID: <20040614144904.E204813944@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv13672 Modified Files: ChangeLog Log Message: * libraries/thuban/cpl_mfile.h: Added copyright header. * libraries/thuban/ cpl_mfile.cpp, cpl_mfile.h: Added non-protecting Free Software License so that it is most useful with gdalwarp and bmpdataset. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.657 retrieving revision 1.658 diff -u -d -r1.657 -r1.658 --- ChangeLog 14 Jun 2004 10:15:03 -0000 1.657 +++ ChangeLog 14 Jun 2004 14:49:02 -0000 1.658 @@ -1,3 +1,11 @@ +2004-06-14 Bernhard Reiter + + * libraries/thuban/cpl_mfile.h: Added copyright header. + + * libraries/thuban/ cpl_mfile.cpp, cpl_mfile.h: Added non-protecting + Free Software License so that it is most useful with gdalwarp + and bmpdataset. + 2004-06-14 Bernhard Herzog * Thuban/UI/multiplechoicedialog.py (__version__): Add missing From thuban-bugs at intevation.de Mon Jun 14 17:01:38 2004 From: thuban-bugs at intevation.de (Request Tracker) Date: Mon, 14 Jun 2004 17:01:38 +0200 (CEST) Subject: [bug #2483] (thuban) Does not build with Debian's libgdal1-dev (1.2.0-1) Message-ID: <20040614150138.0A4911393B@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=2483 ------------------------------------------------------------------------- Subject: Does not build with Debian's libgdal1-dev (1.2.0-1) Operating System: GNU/Linux, Debian/ppc Thuban version: CVS, 20040614 17:00 GDAL version: other proj version: debian 1.2.0-1 Thuban fails to build: g++ -pthread -shared build/temp.linux-ppc-2.3/libraries/thuban/gdalwarp.o build/temp.linux-ppc-2.3/libraries/thuban/cpl_mfile.o build/temp.linux-ppc-2.3/libraries/thuban/bmpdataset.o -L/usr/lib -lgdal -o build/lib.linux-ppc-2.3/Lib/gdalwarp.so /usr/lib/libgdal.a(bmpdataset.o)(.text+0x34): In function `BMPRasterBand::BMPRasterBand[not-in-charge](BMPDataset*, int)': : multiple definition of `BMPRasterBand::BMPRasterBand[not-in-charge](BMPDataset*, int)' build/temp.linux-ppc-2.3/libraries/thuban/bmpdataset.o(.text+0x4):libraries/thuban/bmpdataset.cpp:318: first defined here /usr/bin/ld: Warning: size of symbol `BMPRasterBand::BMPRasterBand[not-in-charge](BMPDataset*, int)' changed from 260 in build/temp.linux-ppc-2.3/libraries/thuban/bmpdataset.o to 240 in /usr/lib/libgdal.a(bmpdataset.o) /usr/lib/libgdal.a(bmpdataset.o)(.text+0x124): In function `BMPRasterBand::BMPRasterBand[in-charge](BMPDataset*, int)': : multiple definition of `BMPRasterBand::BMPRasterBand[in-charge](BMPDataset*, int)' build/temp.linux-ppc-2.3/libraries/thuban/bmpdataset.o(.text+0x10c):libraries/thuban/bmpdataset.cpp:318: first defined here -------------------------------------------- Managed by Request Tracker From bh at intevation.de Mon Jun 14 22:01:42 2004 From: bh at intevation.de (Bernhard Herzog) Date: Mon, 14 Jun 2004 22:01:42 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources References: <20040415182050.GH1655@finlandia.infodrom.north.de> <20040419113029.GA10000@intevation.de> <20040519144813.GX716@finlandia.infodrom.north.de> <20040524162641.GQ716@finlandia.infodrom.north.de> <20040530162635.GA20524@finlandia.infodrom.north.de> <20040609153905.GJ1019@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: > If dialogs should not be opened multiple times, they need to be named > and inserted into the dialog list. My idea is that when dialog > creation is handled globally there needs to be a global logic for > naming dialogs. I don't think this is necessary in the current stage of Thuban's development, but it shouldn't hurt to establish some policy in this area. For some non-modal dialogs it is desirable that only one instance is shown. This could be one instance globally or one instance per e.g. session or layer. The mainwindow does this by determining a unique name for a dialog based on the kind of dialog and the objects it depends on. For instance the name of the layer properties dialog contains the id of the layer object. If the dialog is to be opened, the mainwindow uses its name to determine whether it is alrady open and only needs to be raised to the top or whether it has to be instantiated yet. The naming of standard dialogs is an implementation detail of the mainwindow. The only case in which code outside of the mainwindow needs to come up with a layer name is when it calls the OpenOrRaiseDialog directly. This will only be necessary for non-standard dialogs where the mainwindow can't determine the dialog class to use on its own. In such cases, you should use a name that contains a dot (".") and does not start with the string "Thuban.". For extensions it's a good idea to use the extension name as a prefix, e.g. "Extensions.myextension.server_config". >> > we will probably handle show_table >> > and information similar to the properties dialog. >> >> Why do we need layer specific dialogs for show table? It may be >> necessary to make the existing code more flexible, so that it works for >> layers that are not sub-classes of Layer among others, but that >> shouldn't require different dialogs. > > Maybe there is no need for different show table dialogs at the > moment. I can't guarantee that there won't be one in the future. Well, I can't guarantee it either, but I still don't think that we'll need it. The show table show tha tabular data associated with a layer. That tabular data is given as an object implementing the table interface. Now, I can think of cases where the current dialog may not be exactly right -- the table may need to contain as yet unsupported types of data, for instance -- but in such cases it's better to extend the current dialog and perhaps the table or layer interface. So, the flexibility we need for the layer property dialog is already provided for in the case of the table dialog through the table objects. > Hence, I would rather like to implement a general solution which could > be used for other instances of the same problem class as well. > >> > Apart from that, this method is executed quite often. We would >> > probably create a reasonable delay if it would be implemented that >> > way. In order to avoid this, I propose a hierarchical data structure >> > for layer_dialogs.py (attached). >> >> Well, the way you wrote the function, it returns the wrong results (see >> below) in some cases and probably isn't all that much faster. Anyway, I >> don't think we need the hierarchical approach yet. If the lookup is too >> slow there are lots of ways in can be made faster. E.g. instead of >> doing a linear search each time, we could build a dictionary on demand >> mapping layer classes to the appropriate dialog classes. > > ok. > > Is the attached patch better? Yes. > --- Extensions/wms/properties.py 15 Apr 2004 16:14:51 -0000 1.1 > +++ Extensions/wms/properties.py 9 Jun 2004 15:30:45 -0000 > @@ -72,7 +72,7 @@ > Representation for the WMS properties dialog > """ > > - def __init__(self, parent, name, layer): > + def __init__(self, parent, name, layer, group = None): I don't think we should have to add the group parameter to all layer property dialogs. See below. > --- Thuban/UI/mainwindow.py 18 Apr 2004 20:37:01 -0000 1.132 > +++ Thuban/UI/mainwindow.py 9 Jun 2004 15:30:54 -0000 [...] > @@ -705,14 +742,18 @@ > self.OpenLayerProperties(layer) > > def OpenLayerProperties(self, layer, group = None): We should get rid of this group parameter and replace it with a more generic **kw which are simply passed through to OpenOrRaiseDialog. This parameter is currently only provided by the legend and only makes sense for layers which have a classification. The code in legend.py probably needs to become a little smarter for this (pass the group argument as a keyword argument and only pass it for layers with classifications). > _layer_dialogs = {} > > > def add_layer_dialog(type, layer_class, dialog_class): > try: > _layer_dialogs[type].append((layer_class, dialog_class)) > except KeyError: > _layer_dialogs[type] = [(layer_class, dialog_class)] > > > def init_layer_dialogs(type): > try: > del _layer_dialogs[type][:] > except KeyError: > pass > > > def has_layer_dialog(type, layer_class): > for cls, dialog_class in _layer_dialogs[type]: > if cls == layer_class: > return True > return False > > > def get_layer_dialog_class(type, layer): > for layer_class, dialog_class in _layer_dialogs['properties']: > if isinstance(layer, layer_class): > return dialog_class > return None > > > def get_layer_properties_class(layer): > return get_layer_dialog_class('properties', layer) I'd prefer a different approach for different types of dialogs. There should be one class that implements the mapping from class instances to the objects associated with classes (in this case from layer instances to the property dialog classes). There would be one instance for the layer property dialogs and one for the renderers. If we need more layer type specific things we can create more instances. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From cvs at intevation.de Tue Jun 15 11:20:16 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 15 Jun 2004 11:20:16 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver README,NONE,1.1 Message-ID: <20040615092016.5B36A13944@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv2343 Added Files: README Log Message: Install instruction. --- NEW FILE: README --- UMN MapServer Extension for Thuban =================================== *** ATTENTION: *** The installation instructions here are detailed, so I hope everybody can install the extension. People who are experienced will know most of the commands, but everybody should be able to use this extension. Summary -------------------- This extension for Thuban allows you to handle UMN MapServer .map-files. Requirements -------------------- To use the UMN MapServer extension you need: UMN MapServer python-mapscript The extension was tested with UMN MapServer 4.0 and 4.2, older versions may not work. Installation -------------------- 1. You need to build and install python-mapscript if you haven't installed yet. Download the UMN MapServer (http://mapserver.gis.umn.edu/dload.html) or use one on your system. The mapscript is included in the source package. Unpack and compile the UMN MapServer with optional proj and gdal support. A detailed install instruction can be found on the UMN MapServer Homepage. (http://mapserver.gis.umn.edu/doc40/unix-install-howto.html) Go to the directory where the UMN MapServer source code tar-ball exists: tar -zxf mapserver-4.2.0.tar.gz Go to the new created directory: cd mapserver-4.2.0 Configure an make the UMN MapServer ./configure --with-gdal --with-proj make Now we can compile and install the python mapscript cd mapscript/python/ python setup.py build Some errors are ok during the build of python mapscript At last we musst install mapscript as root. python setup.py install 2. Add the umn_mapserver extension import statement to ~/.thuban/thubanstart.py if you run thuban directly from the source directory the statement is: import Extensions.umn_mapserver.mf_import More about how to use an extension see README in thuban/Examples/simple_extensions. 3. Start Thuban and use the extension. Usage -------------------- The usage of the extension is very intuitive, so you will see what you can do while you are using the extension ;) From cvs at intevation.de Tue Jun 15 11:22:03 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 15 Jun 2004 11:22:03 +0200 (CEST) Subject: jschuengel: thuban ChangeLog,1.658,1.659 Message-ID: <20040615092203.5BF5413944@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv2385 Modified Files: ChangeLog Log Message: added README for UMN MapServer Extension Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.658 retrieving revision 1.659 diff -u -d -r1.658 -r1.659 --- ChangeLog 14 Jun 2004 14:49:02 -0000 1.658 +++ ChangeLog 15 Jun 2004 09:22:01 -0000 1.659 @@ -1,3 +1,7 @@ +2004-06-10 Jan Schüngel + + * Extensions/umn_mapserver/README: New. Install instruction. + 2004-06-14 Bernhard Reiter * libraries/thuban/cpl_mfile.h: Added copyright header. From joey at infodrom.org Tue Jun 15 21:02:00 2004 From: joey at infodrom.org (Martin Schulze) Date: Tue, 15 Jun 2004 21:02:00 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: References: <20040419113029.GA10000@intevation.de> <20040519144813.GX716@finlandia.infodrom.north.de> <20040524162641.GQ716@finlandia.infodrom.north.de> <20040530162635.GA20524@finlandia.infodrom.north.de> <20040609153905.GJ1019@finlandia.infodrom.north.de> Message-ID: <20040615190159.GT1019@finlandia.infodrom.north.de> Bernhard Herzog wrote: > > _layer_dialogs = {} > > > > > > def add_layer_dialog(type, layer_class, dialog_class): > > try: > > _layer_dialogs[type].append((layer_class, dialog_class)) > > except KeyError: > > _layer_dialogs[type] = [(layer_class, dialog_class)] > > > > > > def init_layer_dialogs(type): > > try: > > del _layer_dialogs[type][:] > > except KeyError: > > pass > > > > > > def has_layer_dialog(type, layer_class): > > for cls, dialog_class in _layer_dialogs[type]: > > if cls == layer_class: > > return True > > return False > > > > > > def get_layer_dialog_class(type, layer): > > for layer_class, dialog_class in _layer_dialogs['properties']: > > if isinstance(layer, layer_class): > > return dialog_class > > return None > > > > > > def get_layer_properties_class(layer): > > return get_layer_dialog_class('properties', layer) > > > I'd prefer a different approach for different types of dialogs. There > should be one class that implements the mapping from class instances to > the objects associated with classes (in this case from layer instances > to the property dialog classes). There would be one instance for the > layer property dialogs and one for the renderers. If we need more layer > type specific things we can create more instances. Are you looking for something like this? class foo: def __init__(self): _mapping = [] def register_class_dialog(self, class, dlg_class): _mapping.append((class, dlg_class)) def get_dialog_class(self, instance): return proper_class def has_dialoc_class(self, instance): return true or false Regards, Joey -- MIME - broken solution for a broken design. -- Ralf Baechle From bh at intevation.de Tue Jun 15 21:15:56 2004 From: bh at intevation.de (Bernhard Herzog) Date: Tue, 15 Jun 2004 21:15:56 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: <20040615190159.GT1019@finlandia.infodrom.north.de> (Martin Schulze's message of "Tue, 15 Jun 2004 21:02:00 +0200") References: <20040419113029.GA10000@intevation.de> <20040519144813.GX716@finlandia.infodrom.north.de> <20040524162641.GQ716@finlandia.infodrom.north.de> <20040530162635.GA20524@finlandia.infodrom.north.de> <20040609153905.GJ1019@finlandia.infodrom.north.de> <20040615190159.GT1019@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: > Are you looking for something like this? > > class foo: > def __init__(self): > _mapping = [] > > def register_class_dialog(self, class, dlg_class): > _mapping.append((class, dlg_class)) > > def get_dialog_class(self, instance): > return proper_class > > def has_dialoc_class(self, instance): > return true or false Yes. Although the names shouldn't be specific to dialogs. The class should be usable for the renderes too. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From cvs at intevation.de Wed Jun 16 12:40:51 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:40:51 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/sample - New directory Message-ID: <20040616104051.8837B139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample In directory doto:/tmp/cvs-serv6492/sample Log Message: Directory /thubanrepository/thuban/Extensions/umn_mapserver/sample added to the repository From cvs at intevation.de Wed Jun 16 12:44:36 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:44:36 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mf_import.py,1.1,1.2 Message-ID: <20040616104436.E0AB4139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv6564 Modified Files: mf_import.py Log Message: Changed the wxPython.wx import from * to explicit used statements. Changed the Thuban.UI.mainwindow import phrase, too. (import_mapfile):Corrected a clerical mistake. Added wxCHANGE_DIR in OpenFile Dialog Added a MultipleChoiceDialog, to select the layers to load from mapfile into thuban. Thereby the projection is only set if one layer is selected. Added the possibility to handle relative pathnames which uses up-level references.Removed some doubled code. Corrected an error with integer values used as label in thuban ClassGroup. Index: mf_import.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_import.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mf_import.py 10 Jun 2004 12:49:58 -0000 1.1 +++ mf_import.py 16 Jun 2004 10:44:34 -0000 1.2 @@ -22,12 +22,14 @@ # # ################################### -import os, sys +import os#, sys from mapscript import mapObj -# TODO: explicitly use from .. import -from wxPython.wx import * +from wxPython.wx import wxFileDialog, wxCHANGE_DIR,\ + wxOPEN, wxOVERWRITE_PROMPT, wxID_OK + +from wxPython.lib.dialogs import wxMultipleChoiceDialog # use _() already now for all strings that may later be translated from Thuban import _ @@ -37,7 +39,7 @@ from Thuban.UI.command import registry, Command # The instance of the main menu of the Thuban application -import Thuban.UI.mainwindow +from Thuban.UI import mainwindow # The layer an projection from Thuban from Thuban.Model.layer import Layer, RasterLayer @@ -76,23 +78,50 @@ _("Select MapFile file"), ".", "", _("UMN MapServer Mapfiles (*.map)|*.map|") + _("All Files (*.*)|*.*"), - wxOPEN|wxOVERWRITE_PROMPT) + wxOPEN|wxOVERWRITE_PROMPT|wxCHANGE_DIR) if dlg.ShowModal() == wxID_OK: filename = dlg.GetPath() dlg.Destroy() else: return - + # get the path to the file - filepath = os.path.dirname(filename) - + mapfilepath = os.path.dirname(filename) # Parse mapfile mapobj = parse_mapfile(filename) - - # Show numer of Layer fond in file + # set the filepath empty if shapepath is absolute + if os.path.isabs(mapobj.get_shapepath()): + filepath = "" + else: + filepath = mapfilepath + # Show number of Layer found in file numlayers = len(mapobj.get_layers()) - context.mainwindow.RunMessageBox(_('Loading Layer'), - _("%s Layer loaded from File.") % numlayers) + if numlayers == 0: + context.mainwindow.RunMessageBox(_('Loading Layer'), + _("No Layer found.")) + return + else: + context.mainwindow.RunMessageBox(_('Loading Layer'), + _("%s Layer loaded from file.") % numlayers) + + # Show a dialog to select layers to load into thuban + lst = [] + for layernr in range(0, numlayers,1): + lst.append(mapobj.get_layers()[layernr].get_name() + + " (" + mapobj.get_layers()[layernr].get_type() +")" ) + + dlgsize = (300,130+len(lst)*20) + if dlgsize[1] >= 300: + dlgsize = (300,300) + dlg = wxMultipleChoiceDialog(context.mainwindow, + "Select the layers from the\n" + + "list to load into thuban.\n" + + "annotation not supported !", + "Select Layer.", lst, size = dlgsize) + if (dlg.ShowModal() == wxID_OK): + selectedlayer = dlg.GetValue() + else: + selectedlayer = [] # counter to show the numer of layer loaded into Tuban layer_count = 0 @@ -100,20 +129,21 @@ tb_map = context.mainwindow.canvas.Map() # set the name of the map in thuban tb_map.SetTitle(mapobj.get_name()) - - # set the projection in thuban - set_projection_to_tb(tb_map,mapobj) - + # set the projection in thuban only if one layer selected + if len(selectedlayer) != 0: + set_projection_to_tb(tb_map,mapobj) # Check for each Layer if it is possible to show in Thuban - for layernr in range(0, numlayers,1): + for layernr in selectedlayer: maplayer = mapobj.get_layers()[layernr] layertitle = maplayer.get_name() - #check if rasterlayer if maplayer.get_type() == 'raster': imgpath = maplayer.get_data() try: filename = filepath +"/" + mapobj.get_shapepath() +'/' + imgpath + # Normalize the pathname by collapses + # redundant separators and up-level references + filename = os.path.normpath(filename) except: context.mainwindow.RunMessageBox(_('Error Loading Raster Layer'), _("Can't open the rasterlayer '%s'.") % layertitle) @@ -125,7 +155,6 @@ # correctly, adding the raster layer will show an error # set_projection_to_tb(rasterlayer, maplayer) - #check if polygonlayer if ((maplayer.get_type() == 'polygon') or (maplayer.get_type() == 'line') or @@ -134,6 +163,9 @@ try: filename = filepath + "/" + mapobj.get_shapepath() + "/" + \ mapobj.get_layers()[layernr].get_data() +".shp" + # Normalize the pathname by collapses + # redundant separators and up-level references + filename = os.path.normpath(filename) except: context.mainwindow.RunMessageBox(_('Error Loading Layer'), _("no shp file definied, maybe used a feature obj '%s'.") % layertitle) @@ -224,13 +256,12 @@ (expressionstring[0] == '"')): expressionclassitem = maplayer.get_classitem().upper() layer.SetClassificationColumn(expressionclassitem) - theexpression = expressionstring[1:-1] try: theexpression = int(expressionstring[1:-1]) except: theexpression = expressionstring[1:-1] if clazz_name == 'none': - clazz_name = theexpression + clazz_name = str(theexpression) new_group = ClassGroupSingleton(value = theexpression, props = prop, label = clazz_name) @@ -286,7 +317,7 @@ """ theMap = mapObj(filename) - return MF_Map(theMap) + return MF_Map(theMap) From cvs at intevation.de Wed Jun 16 12:47:21 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:47:21 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/sample README, NONE, 1.1 Message-ID: <20040616104721.BE2FC139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample In directory doto:/tmp/cvs-serv6687 Added Files: README Log Message: Describes the usage of the sample files. --- NEW FILE: README --- Howto use the sample with thuban: iceland.map: start Thuban from the main CVS thuban directory. (the paths to the Iceland datafiles are relative and will work then) Howto view this sample in UMN MapServer (webserver): Copy the three files included in this directory to your webserver. To use the iceland data you must edit the data path in iceland.map, so that it matches to the directory where the data is. At the moment the data path is relative to this directory. iceland.html: the template for the mapfile. index.html: the initialisation file for the Iceland Application on web. From cvs at intevation.de Wed Jun 16 12:48:00 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:48:00 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/sample iceland.map, NONE, 1.1 Message-ID: <20040616104800.73D7C139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample In directory doto:/tmp/cvs-serv6718 Added Files: iceland.map Log Message: This is a suitable .map-file for the iceland data. --- NEW FILE: iceland.map --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Wed Jun 16 12:48:56 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:48:56 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/sample index.html, NONE, 1.1 Message-ID: <20040616104856.8E958139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample In directory doto:/tmp/cvs-serv6731 Added Files: index.html Log Message: The template for the mapfile. --- NEW FILE: index.html --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Wed Jun 16 12:49:49 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:49:49 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/sample iceland.html, NONE, 1.1 Message-ID: <20040616104949.25943139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/sample In directory doto:/tmp/cvs-serv6757 Added Files: iceland.html Log Message: Initialisation file for the Iceland Application on web. --- NEW FILE: iceland.html --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Wed Jun 16 12:50:54 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:50:54 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver README,1.1,1.2 Message-ID: <20040616105054.A216F139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv6808 Modified Files: README Log Message: Corrected a inaccuracy and added some details. Index: README =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README 15 Jun 2004 09:20:14 -0000 1.1 +++ README 16 Jun 2004 10:50:52 -0000 1.2 @@ -39,8 +39,9 @@ or use one on your system. The mapscript is included in the source package. Unpack and compile the UMN MapServer with optional proj and gdal support. + In some cases gdal is not necessary and mapscript can install without gdal support. A detailed install instruction can be found on the UMN MapServer Homepage. - (http://mapserver.gis.umn.edu/doc40/unix-install-howto.html) + (http://mapserver.gis.umn.edu) Go to the directory where the UMN MapServer source code tar-ball exists: @@ -60,7 +61,7 @@ cd mapscript/python/ python setup.py build - Some errors are ok during the build of python mapscript + Some warnings are ok during the build of python mapscript At last we musst install mapscript as root. From cvs at intevation.de Wed Jun 16 12:52:04 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 12:52:04 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver/test test_mapserver.py, 1.1, 1.2 Message-ID: <20040616105204.05E05139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver/test In directory doto:/tmp/cvs-serv6839 Modified Files: test_mapserver.py Log Message: (mapserver_import_Test_generalClasses.test_MF_Color): Corrected the thubancolor test. Index: test_mapserver.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/test/test_mapserver.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test_mapserver.py 10 Jun 2004 12:53:58 -0000 1.1 +++ test_mapserver.py 16 Jun 2004 10:52:01 -0000 1.2 @@ -51,16 +51,16 @@ # set Color with Thuban color obj testthubancolor = Color(0.5,1,0) - testcolor.set_color(testthubancolor) + testcolor.set_thubancolor(testthubancolor) eq(testcolor.get_red(),127) eq(testcolor.get_green(),255) eq(testcolor.get_blue(),0) # check if Thubancolor is set correct testtbcolor = testcolor.get_thubancolor() - eq(testtbcolor.red * 255, 127) - eq(testtbcolor.green * 255, 255) - eq(testtbcolor.blue * 255, 0) + eq(testtbcolor.red, 0.5) + eq(testtbcolor.green, 1) + eq(testtbcolor.blue, 0) def test_MF_Rectangle(self): From cvs at intevation.de Wed Jun 16 13:01:44 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 16 Jun 2004 13:01:44 +0200 (CEST) Subject: jschuengel: thuban ChangeLog,1.659,1.660 Message-ID: <20040616110144.5DE31139D2@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv7105 Modified Files: ChangeLog Log Message: Add a sample and make some changes. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.659 retrieving revision 1.660 diff -u -d -r1.659 -r1.660 --- ChangeLog 15 Jun 2004 09:22:01 -0000 1.659 +++ ChangeLog 16 Jun 2004 11:01:42 -0000 1.660 @@ -1,4 +1,43 @@ -2004-06-10 Jan Schüngel +2004-06-16 Jan Schüngel + + Add a sample and make some changes. + + * Extension/umn_mapserver/mf_import.py: Changed the wxPython.wx + import from * to explicit used statements. Changed the + Thuban.UI.mainwindow import phrase, too. + (import_mapfile):Corrected a clerical mistake. + Added wxCHANGE_DIR in OpenFile Dialog. + Added a MultipleChoiceDialog, to select the layers to load from + mapfile into thuban. Thereby the projection is only set if one layer + is selected. + Added the possibility to handle relative pathnames which uses + up-level references. + Removed some doubled code. + Corrected an error with integer values used as label in thuban + ClassGroup. + + * Extensions/umn_mapserver/sample: New. + + * Extensions/umn_mapserver/sample/README: New. Describes the + usage of the sample files. + + * Extensions/umn_mapserver/sample/iceland.map: New. This is + a suitable .map-file for the iceland data. + + * Extensions/umn_mapserver/sample/index.html: New. The template + for the mapfile. + + * Extensions/umn_mapserver/sample/iceland.html: New. Initialisation + file for the Iceland Application on web. + + * Extensions/umn_mapserver/README: Corrected a inaccuracy and added + some details. + + * Extensions/umn_mapserver/test/test_mapserver + (mapserver_import_Test_generalClasses.test_MF_Color): + Corrected the thubancolor test. + +2004-06-15 Jan Schüngel * Extensions/umn_mapserver/README: New. Install instruction. From bh at intevation.de Wed Jun 16 14:15:59 2004 From: bh at intevation.de (Bernhard Herzog) Date: Wed, 16 Jun 2004 14:15:59 +0200 Subject: jschuengel: thuban/Extensions/umn_mapserver mf_import.py,1.1,1.2 In-Reply-To: <20040616104436.E0AB4139D2@lists.intevation.de> (cvs@intevation.de's message of "Wed, 16 Jun 2004 12:44:36 +0200 (CEST)") References: <20040616104436.E0AB4139D2@lists.intevation.de> Message-ID: cvs at intevation.de writes: > Index: mf_import.py > =================================================================== > RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_import.py,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -d -r1.1 -r1.2 > --- mf_import.py 10 Jun 2004 12:49:58 -0000 1.1 > +++ mf_import.py 16 Jun 2004 10:44:34 -0000 1.2 > @@ -76,23 +78,50 @@ > _("Select MapFile file"), ".", "", > _("UMN MapServer Mapfiles (*.map)|*.map|") + > _("All Files (*.*)|*.*"), > - wxOPEN|wxOVERWRITE_PROMPT) > + wxOPEN|wxOVERWRITE_PROMPT|wxCHANGE_DIR) Please don't use wxCHANGE_DIR. Changing the current directory is a bad idea in almost all cases. The meaning of relative filenames changes as a result of a changed working directory and that may have undesirable consequences in other parts of the program. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From thuban-bugs at intevation.de Thu Jun 17 17:58:40 2004 From: thuban-bugs at intevation.de (Request Tracker) Date: Thu, 17 Jun 2004 17:58:40 +0200 (CEST) Subject: [bug #2491] (thuban) Shape layers over WMS layer fails Message-ID: <20040617155840.D96AB139D2@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=2491 ------------------------------------------------------------------------- Subject: Shape layers over WMS layer fails Thuban 1.1 cvs-20040617 ChangeLog 2004-06-16 wxPython 2.4.2.4 Python 2.2.1 PySQLite 0.4.1 SQLite 2.8.0 GDAL 1.1.8.0 psycopg 1.0.8 GTK 1.2.10 proj 4.4.5 Silke and myself analysed the problem that shape layers (or other WMS layers) can't be rendered ontop a WMS layer. An exception is thrown: Traceback (most recent call last): File "Thuban/UI/view.py", line 206, in _do_redraw if self.render_iter.next(): ValueError: generator already executing We tracked the source of this exeption down to the call of ThubanEndBusyCursor() in Extensions/wms/layer.py (WMSLayer.GetMapImg()). Commenting out the BusyCursor-frame solves the problem as a workaround ... -------------------------------------------- Managed by Request Tracker From thuban-bugs at intevation.de Fri Jun 18 11:12:43 2004 From: thuban-bugs at intevation.de (Request Tracker) Date: Fri, 18 Jun 2004 11:12:43 +0200 (CEST) Subject: [bug #2492] (thuban) Default projection for layers Message-ID: <20040618091243.91B9613B49@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=2492 ------------------------------------------------------------------------- Subject: Default projection for layers Thuban version: CVS, 17.06.2004 Regard the following situation: - the map has a projection - a layer is loaded -> no layer is seen. Zoom to full extent is not available. solution: assign a projection to the layer - now load a second layer - zoom to full extent a ZeroDivisionError is occuring (see traceback) My wish: - thuban should assign the map projection to layers which have no projection. This should solve the problem. Silke ------------------ Traceback ---------------- Eine unbehandelte Ausnahme ist aufgetreten: float division (please report to http://thuban.intevation.org/bugtracker.html) Traceback (most recent call last): File "/usr/src/thuban/thuban/Thuban/UI/mainwindow.py", line 282, in invoke_command command.Execute(self.Context()) File "/usr/src/thuban/thuban/Thuban/UI/command.py", line 121, in Execute apply(self.function, (context,) + self.args + args, kw) File "/usr/src/thuban/thuban/Thuban/UI/mainwindow.py", line 979, in call_method apply(getattr(context.mainwindow, methodname), args) File "/usr/src/thuban/thuban/Thuban/UI/mainwindow.py", line 884, in FullExtent self.canvas.FitMapToWindow() File "/usr/src/thuban/thuban/Thuban/UI/viewport.py", line 456, in FitMapToWindow self.FitRectToWindow(bbox) File "/usr/src/thuban/thuban/Thuban/UI/viewport.py", line 445, in FitRectToWindow self.set_view_transform(scale, (offx, offy)) File "/usr/src/thuban/thuban/Thuban/UI/view.py", line 350, in set_view_transform ViewPort.set_view_transform(self, scale, offset) File "/usr/src/thuban/thuban/Thuban/UI/viewport.py", line 395, in set_view_transform pcenterx = (wwidth/2 - offset[0]) / scale ZeroDivisionError: float division -------------------------------------------- Managed by Request Tracker From joey at infodrom.org Sat Jun 19 09:39:13 2004 From: joey at infodrom.org (Martin Schulze) Date: Sat, 19 Jun 2004 09:39:13 +0200 Subject: [bug #2491] (thuban) Shape layers over WMS layer fails In-Reply-To: <20040617155840.D96AB139D2@lists.intevation.de> References: <20040617155840.D96AB139D2@lists.intevation.de> Message-ID: <20040619073913.GH1019@finlandia.infodrom.north.de> Request Tracker wrote: > Silke and myself analysed the problem that shape layers (or other WMS layers) > can't be rendered ontop a WMS layer. > > An exception is thrown: > Traceback (most recent call last): > File "Thuban/UI/view.py", line 206, in _do_redraw > if self.render_iter.next(): > ValueError: generator already executing > > > We tracked the source of this exeption down to the > call of ThubanEndBusyCursor() > in Extensions/wms/layer.py (WMSLayer.GetMapImg()). > > Commenting out the BusyCursor-frame solves the problem as a workaround ... See also http://intevation.de/pipermail/thuban-devel/2004-April/000098.html Regards, Joey PS: Off to LinuxTag, see you there. -- MIME - broken solution for a broken design. -- Ralf Baechle From cvs at intevation.de Wed Jun 23 14:37:50 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 23 Jun 2004 14:37:50 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mf_export.py,NONE,1.1 Message-ID: <20040623123750.D6F441392D@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv1641 Added Files: mf_export.py Log Message: This module extents Thuban with the possibility to export the Thuban content. --- NEW FILE: mf_export.py --- (This appears to be a binary file; contents omitted.) From cvs at intevation.de Wed Jun 23 14:39:54 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 23 Jun 2004 14:39:54 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mapfile.py,1.1,1.2 Message-ID: <20040623123954.E22801392D@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv1684 Modified Files: mapfile.py Log Message: Expand the classes to use with the export module. Especially added the possibility to add thuban objects directly to the map objects. Index: mapfile.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mapfile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mapfile.py 10 Jun 2004 12:27:48 -0000 1.1 +++ mapfile.py 23 Jun 2004 12:39:52 -0000 1.2 @@ -30,8 +30,12 @@ # # ################################################## +import os -from Thuban.Model.color import Color +from Thuban.Model.color import Color, Transparent + +from mapscript import layerObj, classObj, colorObj, styleObj, rectObj, \ + colorObj # ################################### # @@ -56,7 +60,7 @@ # ################################################## # ################################################## -# General Classes that are not explicitly defined through +# General Classes that are not all explicitly defined through # a mapfile, but rather some helper-classes. class MF_Rectangle: @@ -78,7 +82,15 @@ def get_maxy(self): return self._rect.maxy + + def get_rect(self): + return (self._rect.minx,self._rect.miny,self._rect.maxx,self._rect.maxy) + def set_rect(self, minx, miny, maxx, maxy): + self._rect.minx = minx + self._rect.miny = miny + self._rect.maxx = maxx + self._rect.maxy = maxy class MF_Color: """ @@ -95,7 +107,7 @@ not add any capability. color is definied as RGB 0..255 - """ + """ def __init__(self, mf_color): self._color = mf_color @@ -116,15 +128,19 @@ def get_blue(self): return self._color.blue + + def get_mfcolor(self): + return self._color def get_thubancolor(self): - return self._thubancolor + return self._thubancolor def set_thubancolor(self, thuban_color): - self._color.red = int(thuban_color.red * 255) - self._color.green = int(thuban_color.green * 255) - self._color.blue = int(thuban_color.blue * 255) - self._thubancolor = thuban_color + if thuban_color != Transparent: + self._color.red = int(thuban_color.red * 255) + self._color.green = int(thuban_color.green * 255) + self._color.blue = int(thuban_color.blue * 255) + self._thubancolor = thuban_color class MF_Size: @@ -143,6 +159,10 @@ def get_height(self): return self._height + + def set_size(self, newwidth, newheight): + self._width = newwidth + self._height = newheight class MF_Metadata: @@ -182,17 +202,45 @@ def add_metadata(self, key, data): self.data[key] = data - # ################################################## # Classes for MapServer Objects as they are -# explicitly defined in a mapfile. +# explicitly defined in a mapfile + +class MF_Symbol: + """ + defines a single symbol which is used in the Symbolset + + name, type, sizex, sizey, points, numpoints, filled, stylelength, + style, imagepath, transparent, transparentcolor, character, antialias, + font, gap, position, linecap, linejoin, linejoinmaxsize, setPoints(), + getPoints(), setStyle() + """ + + def __init__(self, mf_symbol): + print "nothing" + +class MF_SymbolSet: + """ + defines a set of symbols, may be there can only be one + + filename, imagecachesize, numsymbols, symbol, getSymbol(), + getSymbolByName(), index(), appendSymbol(), removeSymbol(), + save() + """ + + # TODO: include the symbolset, but found only the possibility to + # create an extra symbol file and not to include it direct to the + # mapfile itself + def __init__(self, mf_symbolset): + print "nothing" + class MF_Class: """ The following parameters and functions, which the mapscript style obj contains, are used: styles, numstyles, name, - getExpressionString(), getMetaData(), getFirstMetaDataKey(), + getExpressionString(), setExpression(), getMetaData(), getFirstMetaDataKey(), getNextMetaDataKey(), getStyle() The following parameters and functions are not used: @@ -202,7 +250,6 @@ createLegendIcon(), insertStyle(), removeStyle(), moveStyleUp(), moveStyleDown() """ - def __init__(self, mf_class): """ Initialized a class from them given mapscript Class Object @@ -216,7 +263,6 @@ for i in range(0,self._numstyles,1): self._styles.append(MF_Style(mf_class.getStyle(i))) - if self._clazz.getExpressionString() == '"(null)"': self._expression = None else: @@ -244,6 +290,27 @@ def get_expressionstring(self): return self._expression + + def set_name(self, newname): + self._clazz.name = newname + + def set_expressionstring(self, newstring): + self._clazz.setExpression(newstring) + self._expression = self._clazz.getExpressionString() + + def add_thubanstyle(self, tb_style, type="default"): + new_styleobj = MF_Style(styleObj(self._clazz)) + if type == "line": + new_styleobj.set_color(tb_style.GetLineColor()) + elif type == "circle": + # set a default symbol to show circles not only a small dot + # symbol "circle" must create before + # TODO: create a Symbol (more see MF_SymbolSet) + new_styleobj.set_symbol('circle') + else: + new_styleobj.set_size(tb_style.GetLineWidth()) + new_styleobj.set_linecolor(tb_style.GetLineColor()) + new_styleobj.set_color(tb_style.GetFill()) class MF_Layer: @@ -253,11 +320,11 @@ classitem, numclasses, name, data, type getClass(), getProjection(), getExtent(), getMetaData(), - getFirstMetaDataKey(), getNextMetaDataKey() + getFirstMetaDataKey(), getNextMetaDataKey(), status, The following paramters and functions are not used: - index, map, header, footer, template, groupe, status, tolerance, + index, map, header, footer, template, groupe, tolerance, toleranceunits, symbolscale, minscale, maxscale, labelminscale labelmaxscale, sizeunits, maxfeatures, offsite, transform, labelcache postlabelcache, labelitem, labelsizeitem, labelangleitem, labelitemindex @@ -331,6 +398,66 @@ def get_projection(self): return self._projection + + def get_status(self): + # returns a integer value + # 0 = off, 1 = on, 2 = default(always on) + if self._mf_layer.status == 0: + return False + else: + return True + #return self._mf_layer.status + + def set_name(self, newname): + self._mf_layer.name = newname + + def set_data(self, newdata): + self._mf_layer.data = newdata[:-4] + + def set_status(self, newstatus): + # status can set to true or false from thuban. + # but mapserver supports the default value + self._mf_layer.status = newstatus + + def set_classitem(self, tb_field): + self._mf_layer.classitem = tb_field + + def set_type(self, tb_type): + # if type = arc its a in shapetype line + if tb_type == "arc": + self._mf_layer.type = 1 + if shp_type.has_key(tb_type): + self._mf_layer.type = tb_type + else: + for shp_paar_nr in shp_type: + if shp_type[shp_paar_nr] == tb_type: + self._mf_layer.type = shp_paar_nr + return + + def set_projection(self, newprojection): + self._mfnewprojstring = "" + if newprojection: + self._newparams = newprojection.GetAllParameters() + for field in self._newparams: + self._mfnewprojstring = self._mfnewprojstring+ "," + field + self._mf_layer.setProjection(self._mfnewprojstring[1:]) + self._projection.set_projection(newprojection) + else: + print "no projection" + + def add_thubanclass(self, tb_class): + new_class = MF_Class(classObj(self._mf_layer)) + new_class.set_name(tb_class.GetLabel()) + if self.get_type() == "line": + new_class.add_thubanstyle(tb_class.GetProperties(), type="line") + else: + new_class.add_thubanstyle(tb_class.GetProperties()) + if tb_class.GetDisplayText() == "DEFAULT": + return + #new_class.set_expressionstring('/./') + else: + new_class.set_expressionstring(str(tb_class.GetDisplayText())) + self._classes.append(new_class) class MF_Map: """ @@ -338,19 +465,20 @@ contains, are used: name, numlayers, extent, shapepath, imagecolor, imagetype, getLayer, - getProjection, getMetaData, getFirstMetaDataKey, getNextMetaDataKey + getProjection, getMetaData, getFirstMetaDataKey, getNextMetaDataKey, + save(), setExtent(), height, width, setProjection() The following parameters and functions are not used: - status, height, width, maxsize, layers, symbolset, fontset, labelcache, + status, maxsize, layers, symbolset, fontset, labelcache, transparent, interlace, imagequality, cellsize, units, debug, datapattern, templatepattern, configoptions zoomPoint(), zoomRectangle(), zoomScale(), getLayerOrder(), setLayerOrder(), - clone(), setExtent(), removeLayer(), getLayerByName(), getSymbolByName(), + clone(), removeLayer(), getLayerByName(), getSymbolByName(), prepareQuery(), prepareImage(), setImageType(), setOutputFormat(), draw(), drawQuery(), drawLegend(), drawScalebar(), embedLegend(), drawLabelCache(), nextLabel(), queryByPoint(), queryByRecht(), queryByFeatures(), queryByShape(), - setWKTProjection(), setProjection(), save(), saveQuery(), saveQueryASGML(), + setWKTProjection(), saveQuery(), saveQueryASGML(), setMetaData(), removeMetaData(), setSymbolSet(), getNumSymbols(), setFontSet(), saveMapContext(), loadMapContext(), moveLayerUp(), moveLayerDown(), getLayersDrawingOrder(), setLayersDrawingOrder(), setConfigOption(), @@ -361,7 +489,7 @@ def __init__(self, mf_map): """ - Create the map object from the mapfile mapobject witch is given. + Create the map object from the mapfile mapobject which is given. All layers in the mapfile will be written to an array. """ @@ -403,8 +531,7 @@ self._metakeydata = self._mf_map.getMetaData(self._metafkey) self._metadata.add_metadata(self._metafkey,self._metakeydata) self._metafkey = self._mf_map.getNextMetaDataKey(self._metafkey) - - + def get_extent(self): return self._extent @@ -422,12 +549,71 @@ def get_imagetype(self): return self._imagetype - + def get_layerorder(self): # shows the order of layer as list return self._mf_map.getLayerOrder() - - + + def set_name(self, newname): + # whitespace musst be replaced, either no + # mapfile will be shown in the mapserver + newname = newname.replace(" ","_") + self._name = newname + self._mf_map.name = newname + + def set_extent(self, newextent): + # TODO: add the shown extend here instead of the total + self._newrect = MF_Rectangle(rectObj()) + self._newrect.set_rect(newextent[0],newextent[1],newextent[2],newextent[3]) + self._mf_map.setExtent(newextent[0],newextent[1],newextent[2],newextent[3]) + + def set_size(self, newwidth, newheight): + self._mf_map.width = newwidth + self._mf_map.height = newheight + + def set_projection(self, projection): + self._mfnewprojstring = "" + self._newparams = projection.GetAllParameters() + for field in self._newparams: + self._mfnewprojstring = self._mfnewprojstring+ "," + field + self._mf_map.setProjection(self._mfnewprojstring[1:]) + self._projection.set_projection(projection) + + def add_thubanlayer(self, tb_layer): + new_layer = MF_Layer(layerObj(self._mf_map)) + new_layer.set_name(tb_layer.Title()) + + # TODO: implement relative pathnames + # yet only absolute pathnames in the LayerObj are set + new_layer.set_data(tb_layer.ShapeStore().FileName()) + + new_layer.set_status(tb_layer.Visible()) + new_layer.set_type(tb_layer.ShapeType()) + + # set the projection to the layer. + # if the layer has its own definition use is, else use the main projection + if tb_layer.GetProjection(): + new_layer.set_projection(tb_layer.GetProjection()) + else: + new_layer.set_projection(self._projection.get_projection()) + + if tb_layer.GetClassificationColumn(): + new_layer.set_classitem(tb_layer.GetClassificationColumn()) + if tb_layer.GetProjection(): + new_layer.set_projection(tb_layer.GetProjection()) + if tb_layer.GetClassification().GetNumGroups() > 0: + for group in range(0, tb_layer.GetClassification().GetNumGroups(), 1): + new_layer.add_thubanclass(tb_layer.GetClassification().GetGroup(group)) + new_layer.add_thubanclass(tb_layer.GetClassification().GetDefaultGroup()) + else: + new_layer.add_thubanclass(tb_layer.GetClassification().GetDefaultGroup()) + self._layers.append(new_layer) + + def save_map(self, filepath): + # save the Map + # maybe an own saver can implement here + self._mf_map.save(filepath) + class MF_Projection: """ The following parameter, which the mapscript style obj contains is used: @@ -443,6 +629,7 @@ be splitted and an array with the parameters will be creaded. """ self._mfprojstring = mf_projection + self._projstring = self._mfprojstring self._epsgcode = None self._params = None if self._mfprojstring: @@ -489,17 +676,27 @@ def get_epsgproj(self): # get an epsg projectionobject return self.epsg_code_to_projection(self._epsgcode) - + + def get_projection(self): + return self._projstring + + def set_projection(self, newprojection): + self._projstring = newprojection + self._params = newprojection.GetAllParameters() + self._mfnewprojstring = "" + for field in self._params: + self._mfnewprojstring = self._mfnewprojstring+ "+" + field + self._mfprojstring = self._mfnewprojstring class MF_Style: """ The following parameters, which the mapscript style obj contains, are used: - color, backgroundcolor, outlinecolor, size + color, backgroundcolor, outlinecolor, size, symbolname The following are not used: - symbol, symbolname, sizescaled, minsize, maxsize, offsetx, offsety, + symbol, sizescaled, minsize, maxsize, offsetx, offsety, antialias """ @@ -513,10 +710,10 @@ """ self._style = mf_style if self._style.color.red == -1: - self._color = None + self._maincolor = None else: - self._color = MF_Color(self._style.color) - self._backgroundcolor = MF_Color(self._style.backgroundcolor) + self._maincolor = MF_Color(self._style.color) + self._color = MF_Color(self._style.color) if self._style.outlinecolor.red == -1: self._outlinecolor = None else: @@ -530,3 +727,25 @@ def get_size(self): return self._style.size + + def set_linecolor(self, tb_color): + self._color = tb_color + new_linecolor = MF_Color(colorObj()) + new_linecolor.set_thubancolor(tb_color) + self._outlinecolor = new_linecolor + self._style.outlinecolor = new_linecolor.get_mfcolor() + + def set_color(self, tb_color): + self._color = tb_color + new_color = MF_Color(colorObj()) + new_color.set_thubancolor(tb_color) + self._color = new_color + self._style.color = new_color.get_mfcolor() + + def set_size(self, newsize): + self._style.size = newsize + + def set_symbolname(self, newsymbol): + # its possible to use stringnames instead of numbers + self._style.symbolname = 'circle' + From cvs at intevation.de Wed Jun 23 14:40:47 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 23 Jun 2004 14:40:47 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mf_import.py,1.2,1.3 Message-ID: <20040623124047.8ECCA1392D@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv1727 Modified Files: mf_import.py Log Message: Removed the wxCHANGE_DIR, because of the hint from Bernhard Herzog. Corrected the handling of absolute pathnames. Changed the Text of the Menu-Item, now the beginning is upper case. Index: mf_import.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_import.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mf_import.py 16 Jun 2004 10:44:34 -0000 1.2 +++ mf_import.py 23 Jun 2004 12:40:45 -0000 1.3 @@ -22,11 +22,11 @@ # # ################################### -import os#, sys +import os from mapscript import mapObj -from wxPython.wx import wxFileDialog, wxCHANGE_DIR,\ +from wxPython.wx import wxFileDialog, \ wxOPEN, wxOVERWRITE_PROMPT, wxID_OK from wxPython.lib.dialogs import wxMultipleChoiceDialog @@ -78,7 +78,7 @@ _("Select MapFile file"), ".", "", _("UMN MapServer Mapfiles (*.map)|*.map|") + _("All Files (*.*)|*.*"), - wxOPEN|wxOVERWRITE_PROMPT|wxCHANGE_DIR) + wxOPEN|wxOVERWRITE_PROMPT) if dlg.ShowModal() == wxID_OK: filename = dlg.GetPath() dlg.Destroy() @@ -140,7 +140,10 @@ if maplayer.get_type() == 'raster': imgpath = maplayer.get_data() try: - filename = filepath +"/" + mapobj.get_shapepath() +'/' + imgpath + if os.path.isabs(mapobj.get_shapepath()): + filename = mapobj.get_shapepath() +'/' + imgpath + else: + filename = filepath +"/" + mapobj.get_shapepath() +'/' + imgpath # Normalize the pathname by collapses # redundant separators and up-level references filename = os.path.normpath(filename) @@ -161,7 +164,10 @@ (maplayer.get_type() == 'circle') or (maplayer.get_type() == 'point')): try: - filename = filepath + "/" + mapobj.get_shapepath() + "/" + \ + if os.path.isabs(mapobj.get_layers()[layernr].get_data()): + filename = mapobj.get_layers()[layernr].get_data() +".shp" + else: + filename = filepath + "/" + mapobj.get_shapepath() + "/" + \ mapobj.get_layers()[layernr].get_data() +".shp" # Normalize the pathname by collapses # redundant separators and up-level references @@ -196,8 +202,6 @@ map_clazz = map_clazzes[map_clazznr] layer_style = map_clazz.get_styles()[0] clazz_name = map_clazz.get_name() - if not clazz_name: - clazz_name = "none" clazz = layer.GetClassification() prop = ClassGroupProperties() @@ -328,7 +332,7 @@ # ################################### # register the new command -registry.Add(Command("import_mapfile", _("import Mapfile"), import_mapfile, +registry.Add(Command("import_mapfile", _("Import Mapfile"), import_mapfile, helptext = _("Import a mapfile"))) # find the extensions menu (create it anew if not found) From cvs at intevation.de Wed Jun 23 14:41:21 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 23 Jun 2004 14:41:21 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver README,1.2,1.3 Message-ID: <20040623124121.A901F1392D@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv1742 Modified Files: README Log Message: Added the --with-tiff statement. Index: README =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- README 16 Jun 2004 10:50:52 -0000 1.2 +++ README 23 Jun 2004 12:41:19 -0000 1.3 @@ -38,7 +38,12 @@ Download the UMN MapServer (http://mapserver.gis.umn.edu/dload.html) or use one on your system. The mapscript is included in the source package. - Unpack and compile the UMN MapServer with optional proj and gdal support. + Unpack and compile the UMN MapServer and use the following optional parameters: + + proj: include projection support + gdal: include raster support + tiff: include tiff support + In some cases gdal is not necessary and mapscript can install without gdal support. A detailed install instruction can be found on the UMN MapServer Homepage. (http://mapserver.gis.umn.edu) @@ -53,7 +58,7 @@ Configure an make the UMN MapServer - ./configure --with-gdal --with-proj + ./configure --with-gdal --with-proj --with-tiff make Now we can compile and install the python mapscript From cvs at intevation.de Wed Jun 23 14:42:56 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 23 Jun 2004 14:42:56 +0200 (CEST) Subject: jschuengel: thuban ChangeLog,1.660,1.661 Message-ID: <20040623124256.7A84B1392D@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv1770 Modified Files: ChangeLog Log Message: Add the export function to the umn_mapserver extension. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.660 retrieving revision 1.661 diff -u -d -r1.660 -r1.661 --- ChangeLog 16 Jun 2004 11:01:42 -0000 1.660 +++ ChangeLog 23 Jun 2004 12:42:54 -0000 1.661 @@ -1,3 +1,21 @@ +2004-06-23 Jan Schüngel + + Add the export function to the umn_mapserver extension. + + * Extension/umn_mapserver/mf_export.py: New. This module extents + Thuban with the possibility to export the Thuban content. + + * Extensions/umn_mapserver/mapfile.py: Expand the classes to use + with the export module. Especially added the possibility to + add thuban objects directly to the map objects. + + * Extensions/umn_mapserver/mf_import.py: Removed the wxCHANGE_DIR, + because of the hint from Bernhard Herzog. + Corrected the handling of absolute pathnames. + Changed the Text of the Menu-Item, now the beginning is upper case. + + * Extensions/umn_mapserver/README: Added the --with-tiff statement. + 2004-06-16 Jan Schüngel Add a sample and make some changes. From cvs at intevation.de Mon Jun 28 12:55:13 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 28 Jun 2004 12:55:13 +0200 (CEST) Subject: bernhard: thuban/Extensions/svgexport/test test_svgmapwriter.py, 1.2, 1.3 Message-ID: <20040628105513.E732F1393B@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Extensions/svgexport/test In directory doto:/tmp/cvs-serv23092/Extensions/svgexport/test Modified Files: test_svgmapwriter.py Log Message: * Extensions/svgexport/test/test_svgmapwriter.py: Removed class VFile and used standard StringIO instead. Index: test_svgmapwriter.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/test/test_svgmapwriter.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test_svgmapwriter.py 20 Feb 2004 15:49:36 -0000 1.2 +++ test_svgmapwriter.py 28 Jun 2004 10:55:10 -0000 1.3 @@ -14,6 +14,7 @@ import os import sys +import StringIO import unittest # If run directly as a script, add Thuban's test directory to the path. @@ -34,23 +35,6 @@ # We use xmlsupport to verify the SVG output import xmlsupport -class VFile: - '''A virtual file to show which contents would have been - written to a file.''' - - def open(self, filename, mode="w"): - '''Compatibility function - initializes an empty string.''' - self.str = "" - - def write(self, string): - '''The file.write function to capture all input.''' - if hasattr(self, "str"): - self.str += string - else: - self.str = "" - self.str += string - - class TestVirtualDC(unittest.TestCase): '''Tests the VirtualDC class that imitates a wxDC and writes SVGRenderer instead.''' @@ -70,12 +54,12 @@ def test_clippath(self): '''Define a clipping region and close it afterwards.''' data = '\n' - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.BeginClipPath('testid') dc.EndClipPath() self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_polygon_closed(self): '''Set drawing properties and draw a polygon onto the dc.''' @@ -83,14 +67,14 @@ 'stroke-width:3; stroke-linecap:round; fill:#00ff00" ' 'meta="Object:test; Label:nothing" d="M 5.6 5.5 ' 'L 95.4 5.3 L 95.2 95.1 L 5.0 95.0 L 5.0 5.0 Z"/>') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.SetPen(self.solid_pen) dc.SetMeta(self.meta) dc.SetBrush(self.solid_brush) dc.DrawPolygon(self.polygon, 1) self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_polygon_opened(self): '''Set drawing properties and draw a polygon onto the dc.''' @@ -98,14 +82,14 @@ 'stroke-width:3; stroke-linecap:round; fill:#00ff00" ' 'meta="Object:test; Label:nothing" d="M 5.6 5.5 ' 'L 95.4 5.3 L 95.2 95.1 L 5.0 95.0 L 5.0 5.0 "/>') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.SetPen(self.solid_pen) dc.SetMeta(self.meta) dc.SetBrush(self.solid_brush) dc.DrawPolygon(self.polygon, 0) self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_rect(self): '''Set drawing properties and draw a rectangle''' @@ -113,64 +97,64 @@ 'style="stroke-linejoin:round; stroke:#ff00ff; ' 'stroke-width:3; stroke-linecap:round; fill:none" ' 'meta="Object:test; Label:nothing"/>') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.SetPen(self.solid_pen) dc.SetMeta(self.meta) dc.SetBrush(self.trans_brush) dc.DrawRectangle(5.5, 5.4, 90.3, 90.2) self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_circle(self): '''Set drawing properties and draw a circle''' data = ('') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.SetPen(self.trans_pen) dc.SetMeta(self.meta) dc.SetBrush(self.solid_brush) dc.DrawCircle(5.5, 5.3, 90.1) self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_ellipse(self): '''Set drawing properties and draw a circle''' data = ('') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.SetPen(self.trans_pen) dc.SetMeta(self.meta) dc.SetBrush(self.solid_brush) dc.DrawEllipse(5.5, 5.3, 90.1, 100.321) self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_text(self): '''Set drawing properties and draw a circle''' data = ('Some text.') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.SetTextForeground(self.black) dc.SetFont(self.font) dc.DrawText('Some text.', 123.321, 1515.5151) self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) def test_document(self): '''Set up a document with a dimension and latin encoding''' data = ('\n\n') - file = VFile() + file = StringIO.StringIO() dc = VirtualDC(file) dc.BeginExport() dc.EndExport() self.assertEquals(xmlsupport.sax_eventlist(data = data), - xmlsupport.sax_eventlist(data = file.str)) + xmlsupport.sax_eventlist(data = file.getvalue())) if __name__ == "__main__": From cvs at intevation.de Mon Jun 28 12:55:13 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 28 Jun 2004 12:55:13 +0200 (CEST) Subject: bernhard: thuban ChangeLog,1.661,1.662 Message-ID: <20040628105513.F03F51399F@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv23092 Modified Files: ChangeLog Log Message: * Extensions/svgexport/test/test_svgmapwriter.py: Removed class VFile and used standard StringIO instead. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.661 retrieving revision 1.662 diff -u -d -r1.661 -r1.662 --- ChangeLog 23 Jun 2004 12:42:54 -0000 1.661 +++ ChangeLog 28 Jun 2004 10:55:10 -0000 1.662 @@ -1,3 +1,8 @@ +2004-06-26 Bernhard Reiter + + * Extensions/svgexport/test/test_svgmapwriter.py: + Removed class VFile and used standard StringIO instead. + 2004-06-23 Jan Schüngel Add the export function to the umn_mapserver extension.