bernhard: thuban/Extensions/svgexport svgmapwriter.py,1.3,1.4

cvs@intevation.de cvs at intevation.de
Sat Sep 25 20:29:26 CEST 2004


Author: bernhard

Update of /thubanrepository/thuban/Extensions/svgexport
In directory doto:/tmp/cvs-serv7097/Extensions/svgexport

Modified Files:
	svgmapwriter.py 
Log Message:
Added Bernhard R. as Author.
(SetBaseID, SetID, make_id): Improved docstring comments to explain
the interaction of the three functions and the XML id contrains.


Index: svgmapwriter.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/svgexport/svgmapwriter.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- svgmapwriter.py	21 Sep 2004 21:30:36 -0000	1.3
+++ svgmapwriter.py	25 Sep 2004 18:29:24 -0000	1.4
@@ -1,6 +1,7 @@
 # Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH
 # Authors:
 #     Markus Rechtien <markus at intevation.de>
+#     Bernhard Reiter <bernhard at intevatin.de>
 #
 # This program is free software under the GPL (>=v2)
 # Read the file COPYING coming with Thuban for details.
@@ -489,11 +490,22 @@
             return (12,len(text) * 10)
     
     def SetID(self, id):
-        """Set the ID stored by the svg elements."""
+        """Set second part of ID stored by the svg elements.
+
+        Will be used in make_id() as first part of an XML attribute "id".
+        Read comments at SetBaseID() and make_id().
+
+        Common practice is to only set this to integer numbers.
+        """
         self.id = id
 
     def SetBaseID(self, id):
-        """Set the ID stored by the svg elements."""
+        """Set first part of ID stored by the svg elements.
+
+        Will be used in make_id() as first part of an XML attribute "id".
+        The second part is set by SetID().
+        Check comments at make_id().
+        """
         self.baseid = id
         
     def SetFont(self, font):
@@ -576,6 +588,19 @@
         """Return id= string for object out of currently set baseid and id.
         
         Return the empty string if no id was set.
+
+        In an XML file each id should be unique 
+        (see XML 1.0 section 3.3.1 Attribute Types, Validity constraint: ID)
+        So this function should only return a unique values.
+        which also coforms to the the XML "Name production" (section 3.2).
+
+        For this it completely depends 
+        on what has been set by SetBaseID() and SetID().
+        Only call this function if you have called them w unique values before
+        (or SetID(0) to get an empty result)
+
+        A check of uniqueness in this function might be time consuming,
+        because it would require to hold and search through a complete table.
         """
         if self.id < 0:
             return ''





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)