浏览代码

Transform the method of the vector abstract class into a function

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55453 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 年之前
父节点
当前提交
9f817e6ac1
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      lib/python/pygrass/vector/abstract.py

+ 8 - 2
lib/python/pygrass/vector/abstract.py

@@ -13,6 +13,13 @@ from grass.pygrass import functions
 from grass.pygrass.errors import GrassError, OpenError, must_be_open
 from grass.pygrass.errors import GrassError, OpenError, must_be_open
 from table import DBlinks, Link
 from table import DBlinks, Link
 
 
+
+def is_open(c_mapinfo):
+    """Return if the Vector is open"""
+    return (c_mapinfo.contents.open != 0 and
+            c_mapinfo.contents.open != libvect.VECT_CLOSED_CODE)
+
+
 #=============================================
 #=============================================
 # VECTOR ABSTRACT CLASS
 # VECTOR ABSTRACT CLASS
 #=============================================
 #=============================================
@@ -259,8 +266,7 @@ class Info(object):
 
 
     def is_open(self):
     def is_open(self):
         """Return if the Vector is open"""
         """Return if the Vector is open"""
-        return (self.c_mapinfo.contents.open != 0 and
-                self.c_mapinfo.contents.open != libvect.VECT_CLOSED_CODE)
+        return is_open(self.c_mapinfo)
 
 
     def open(self, mode='r', layer=1, overwrite=None,
     def open(self, mode='r', layer=1, overwrite=None,
              # parameters valid only if mode == 'w'
              # parameters valid only if mode == 'w'