[GRASS-SVN] r57700 - grass/trunk/lib/python/pygrass/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 16 04:07:00 PDT 2013


Author: zarch
Date: 2013-09-16 04:07:00 -0700 (Mon, 16 Sep 2013)
New Revision: 57700

Modified:
   grass/trunk/lib/python/pygrass/raster/__init__.py
Log:
Update and fix RasterSegment methods: get/put/get_row/put_row

Modified: grass/trunk/lib/python/pygrass/raster/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/__init__.py	2013-09-16 09:37:26 UTC (rev 57699)
+++ grass/trunk/lib/python/pygrass/raster/__init__.py	2013-09-16 11:07:00 UTC (rev 57700)
@@ -292,7 +292,7 @@
         for row in xrange(self._rows):
             libraster.Rast_get_row(
                 self._fd, row_buffer.p, row, self._gtype)
-            libseg.segment_put_row(ctypes.byref(self.segment.cseg),
+            libseg.segment_put_row(ctypes.byref(self.segment.c_seg),
                                    row_buffer.p, row)
 
     @must_be_open
@@ -301,7 +301,7 @@
         """
         row_buffer = Buffer((self._cols), self.mtype)
         for row in xrange(self._rows):
-            libseg.segment_get_row(ctypes.byref(self.segment.cseg),
+            libseg.segment_get_row(ctypes.byref(self.segment.c_seg),
                                    row_buffer.p, row)
             libraster.Rast_put_row(self._fd, row_buffer.p, self._gtype)
 
@@ -319,9 +319,7 @@
         """
         if row_buffer is None:
             row_buffer = Buffer((self._cols), self.mtype)
-        libseg.segment_get_row(
-            ctypes.byref(self.segment.cseg), row_buffer.p, row)
-        return row_buffer
+        return self.segment.get_row(row, row_buffer)
 
     @must_be_open
     def put_row(self, row, row_buffer):
@@ -335,8 +333,7 @@
         row_buffer: Buffer object
             Specify the Buffer object that will be write to the map.
         """
-        libseg.segment_put_row(ctypes.byref(self.segment.cseg),
-                               row_buffer.p, row)
+        self.segment.put_row(row, row_buffer)
 
     @must_be_open
     def get(self, row, col):
@@ -350,9 +347,7 @@
         col: integer
             Specify the column number.
         """
-        libseg.segment_get(ctypes.byref(self.segment.cseg),
-                           ctypes.byref(self.segment.val), row, col)
-        return self.segment.val.value
+        return self.segment.get(row, col)
 
     @must_be_open
     def put(self, row, col, val):
@@ -369,8 +364,7 @@
             Specify the value that will be write to the map cell.
         """
         self.segment.val.value = val
-        libseg.segment_put(ctypes.byref(self.segment.cseg),
-                           ctypes.byref(self.segment.val), row, col)
+        self.segment.put(row, col)
 
     def open(self, mode='r', mtype='DCELL', overwrite=False):
         """Open the map, if the map already exist: determine the map type



More information about the grass-commit mailing list