[GRASS-SVN] r54370 - grass/trunk/lib/python/pygrass/vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Dec 23 02:43:37 PST 2012
Author: zarch
Date: 2012-12-23 02:43:37 -0800 (Sun, 23 Dec 2012)
New Revision: 54370
Modified:
grass/trunk/lib/python/pygrass/vector/geometry.py
Log:
Fix access to table attributes
Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py 2012-12-23 10:43:29 UTC (rev 54369)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py 2012-12-23 10:43:37 UTC (rev 54370)
@@ -200,7 +200,7 @@
self.c_cats = c_cats
# set the attributes
- if table:
+ if table and self.id:
self.attrs = Attrs(self.id, table, writable)
def is_with_topology(self):
@@ -1088,9 +1088,18 @@
def __init__(self, boundary=None, centroid=None, isles=[], **kargs):
super(Area, self).__init__(**kargs)
- self.boundary = self.points()
- self.centroid = self.centroid()
- self.isles = self.get_isles()
+ if self.id is not None and self.c_mapinfo:
+ self.boundary = self.points()
+ self.centroid = self.centroid()
+ self.isles = self.get_isles()
+ elif boundary and centroid:
+ self.boundary = boundary
+ self.centroid = centroid
+ self.isles = isles
+ else:
+ str_err = "To instantiate an Area you need at least: Boundary and Centroid"
+ raise GrassError(str_err)
+
# geometry type
self.gtype = libvect.GV_AREA
More information about the grass-commit
mailing list