jan: thuban/Extensions/importAPR apr.py,1.4,1.5

cvs@intevation.de cvs at intevation.de
Mon Jun 27 23:36:36 CEST 2005


Author: jan

Update of /thubanrepository/thuban/Extensions/importAPR
In directory doto:/tmp/cvs-serv29012

Modified Files:
	apr.py 
Log Message:
(APR_BShSym): Extend by 'Stripple'.
APR_TClr.GetThubanColor): Fix bug in color interpretation.
Thanks to Frank Koormann who identified this problem.


Index: apr.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/importAPR/apr.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- apr.py	3 Oct 2004 22:00:35 -0000	1.4
+++ apr.py	27 Jun 2005 21:36:34 -0000	1.5
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004 by Intevation GmbH
+# Copyright (C) 2003-2005 by Intevation GmbH
 # Authors:
 # Jan-Oliver Wagner <jan at intevation.de>
 #
@@ -87,19 +87,23 @@
         return prop
 
 class APR_BShSym(ODBBaseObject):
-    """Polygon symbol object.
+    """Polygon symbol object, either filled with a single color or
+    with a pattern.
+    .
     Always references TClr objects via 'Color', 'OutlineColor' and 'BgColor'.
     Always has attributes 'OutlineWidth' and 'Outline'.
 
     OutlineColor is interpreted to be the Thuban line color, OutlineWidth
     as the Thuban line width.
     'Color' is interpreted to be the Thuban fill color.
-    'BgColor' is not interpreted and it is not clear what this color
-    defines.
+    'BgColor' is not interpreted and probably has something to do with
+    patterns (Stripple).
+    'Stripple' ist not interpreted in Thuban. It is a pattern definition
+    based on a bitpattern. Thuban has no Patterns yet.
 
     It is unclear what 'Outline' defines and thus is not used for Tuban.
     """
-    _obj_refs = [ 'Color', 'OutlineColor', 'BgColor' ]
+    _obj_refs = [ 'Color', 'OutlineColor', 'BgColor', 'Stripple' ]
     _values = [ 'OutlineWidth', 'Outline' ]
 
     def GetThubanProp(self):
@@ -202,8 +206,14 @@
             for color in [ 'Red', 'Green', 'Blue' ]:
                 if hasattr(self, color):
                     s = getattr(self, color)
-                    while len(s) < 6:
-                        s = s + '0'
+                    # It seems that ArcView sometimes uses only
+                    # 2 bytes for a color definition, eg. 0xff.
+                    # It is assumed that this is the same as
+                    # 0x00ff (and not the same as 0xff00). At
+                    # least color comparison shows this.
+                    # Thus we do not need to append "00" if length
+                    # of s is < 6. The following conversion does is
+                    # right even for the short strings.
                     rgb[color] = int(s, 16)/float(int('0xffff', 16))
             return Color(rgb['Red'], rgb['Green'], rgb['Blue'])
         elif hasattr(self, 'Name'):





More information about the Thuban-devel mailing list

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