[cig-commits] r6155 -
cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator
brad at geodynamics.org
brad at geodynamics.org
Thu Mar 1 20:38:18 PST 2007
Author: brad
Date: 2007-03-01 20:38:18 -0800 (Thu, 01 Mar 2007)
New Revision: 6155
Modified:
cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Filter.py
Log:
Name change.
Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Filter.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Filter.py 2007-03-02 03:04:51 UTC (rev 6154)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Filter.py 2007-03-02 04:38:18 UTC (rev 6155)
@@ -10,70 +10,75 @@
# ----------------------------------------------------------------------
#
-## @file spatialdata/spatialdb/generator/Filter.py
-
+## @file spatialdata/spatialdb/generator/Shaper.py
+##
## @brief Python manager for shaping spatial distribution of data
## while generating database.
+##
+## Factory: shaper
from pyre.components.Component import Component
import numpy
-# Filter class
-class Filter(Component):
+# Shaper class
+class Shaper(Component):
"""
Python manager for shaping spatial distribution of data while
generating database.
+
+ Factory: shaper
"""
# INVENTORY //////////////////////////////////////////////////////////
class Inventory(Component.Inventory):
"""
- Python object for managing Filter facilities and properties.
+ Python object for managing Shaper facilities and properties.
"""
## @class Inventory
- ## Python object for managing Filter facilities and properties.
+ ## Python object for managing Shaper facilities and properties.
##
## \b Properties
- ## @li \b db_value Name of value in supplied spatial database filter
- ## @li \b operand Operand to use in applying filter
+ ## @li \b db_value Name of value in supplied in spatial database.
+ ## @li \b operand Operand to use in applying shaper.
##
## \b Facilities
- ## @li \b db Database containing value defining filter
+ ## @li \b db Database containing value defining shaper.
import pyre.inventory
default = pyre.inventory.float("default", default=0.0)
- default.meta['tip'] = "Default value for filter."
+ default.meta['tip'] = "Default value for shaper."
dbValue = pyre.inventory.str("db_value", default="")
- dbValue.meta['tip'] = "Name of value supplied in filter spatial database."
+ dbValue.meta['tip'] = "Name of value supplied in spatial database."
operand = pyre.inventory.str("operand", default="multiply")
operand.validator = pyre.inventory.choice(["add", "subtract",
"multiply", "divide"])
- operand.meta['tip'] = "Operand to use in applying filter."
+ operand.meta['tip'] = "Operand to use in applying shaper."
from spatialdata.spatialdb.SimpleDB import SimpleDB
- db = pyre.inventory.facility("db", factory=SimpleDB)
- db.meta['tip'] = "Database containing value defining filter."
+ db = pyre.inventory.facility("db", family="spatial_database",
+ factory=SimpleDB)
+ db.meta['tip'] = "Database containing value defining shaper."
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, name="filter"):
+ def __init__(self, name="shaper"):
"""
Constructor.
"""
- Component.__init__(self, name, facility="filter")
+ Component.__init__(self, name, facility="shaper")
return
def initialize(self):
"""
- Initialize filter.
+ Initialize shaper.
"""
self.db.initialize()
self.db.open()
@@ -82,7 +87,7 @@
def finalize(self):
"""
- Cleanup.
+ Cleanup shaper.
"""
self.db.close()
return
@@ -90,7 +95,7 @@
def apply(self, value, locs, cs):
"""
- Apply filter to data.
+ Shape value.
"""
self.db.queryVals([self.dbValue])
(vals, err) = self.db.query(locs, cs, numvals=1)
@@ -124,7 +129,7 @@
Component._configure(self)
if self.inventory.dbValue == "":
raise ValueError, \
- "Name of value in spatial database must be set for Filter '%s'." %\
+ "Name of value in spatial database must be set for shaper '%s'." %\
self.name
self.dbValue = self.inventory.dbValue
self.operand = self.inventory.operand
@@ -133,4 +138,13 @@
return
-# End of file
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def shaper():
+ """
+ Factory associated with SimpleDB.
+ """
+ return Shaper()
+
+
+# End of file
More information about the cig-commits
mailing list