[GRASS-SVN] r54613 - grass-addons/grass7/raster/r.agent/libagent

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 13 09:19:34 PST 2013


Author: mic
Date: 2013-01-13 09:19:33 -0800 (Sun, 13 Jan 2013)
New Revision: 54613

Added:
   grass-addons/grass7/raster/r.agent/libagent/grassland.py
Modified:
   grass-addons/grass7/raster/r.agent/libagent/playground.py
Log:
logically separate local from grass code

Added: grass-addons/grass7/raster/r.agent/libagent/grassland.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/grassland.py	                        (rev 0)
+++ grass-addons/grass7/raster/r.agent/libagent/grassland.py	2013-01-13 17:19:33 UTC (rev 54613)
@@ -0,0 +1,44 @@
+"""
+MODULE:       r.agent.*
+AUTHOR(S):    michael lustenberger inofix.ch
+PURPOSE:      library file for the r.agent.* suite
+COPYRIGHT:    (C) 2011 by Michael Lustenberger and the GRASS Development Team
+
+              This program is free software under the GNU General Public
+              License (>=v2). Read the file COPYING that comes with GRASS
+              for details.
+"""
+
+import grass.script as grass
+
+class GrassLand(playground.Playground):
+    """A GrassLand is a Playground and the interface to GRASS."""
+    def __init__(self):
+        """Create a Playground with all the relevant info by GRASS"""
+        self.layers = dict()
+        self.region = grass.region()
+        if self.region['ewres'] != self.region['nsres']:
+            raise error.DataError("r.agent::libagent.playground.Playground()",
+                                    "Only square raster cells make sense.")
+    def getregion(self):
+        """Return the region information"""
+        return self.region
+    def getbound(self, bound):
+        """Return the requested boundary, takes: 'n', 's', 'w', or 'e'"""
+        if bound == "n" or bound == "s" or bound == "w" or bound == "e":
+            return self.region[bound]
+    def setlayer(self, layername, layer, force=False):
+        """Put an existing map from GRASS to the layer collection"""
+        pass
+    def createlayer(self, layername, grassmap=False):
+        """Create a new layer and add it to the layer collection"""
+        pass
+    def getlayer(self, layername):
+        """Return a layer from the collection by its name"""
+        return []
+    def removelayer(self, layername):
+        """Remove the layer named from the layer collection"""
+        pass
+#    def writelayer(self, layername):
+#        pass
+

Modified: grass-addons/grass7/raster/r.agent/libagent/playground.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/playground.py	2013-01-13 16:46:05 UTC (rev 54612)
+++ grass-addons/grass7/raster/r.agent/libagent/playground.py	2013-01-13 17:19:33 UTC (rev 54613)
@@ -9,21 +9,15 @@
               for details.
 """
 
-import grass.script as grass
-
 class Playground(object):
     """A Playground is a major component of a World, defining
-       and organizing space, and the interface to GRASS."""
+       and organizing space."""
     def __init__(self):
         self.layers = dict()
-        self.region = grass.region()
-        if self.region['ewres'] != self.region['nsres']:
-            raise error.DataError("r.agent::libagent.playground.Playground()",
-                                    "Only square raster cells make sense.")
     def getregion(self):
-        return self.region
+        pass
     def getbound(self, bound):
-        return self.region[bound]
+        pass
     def setlayer(self, layername, layer, force=False):
         pass
     def createlayer(self, layername, grassmap=False):



More information about the grass-commit mailing list