[cig-commits] r4106 - in cs/spatialdata-0.1/trunk: . applications libsrc libsrc/utils modulesrc/geocoords modulesrc/spatialdb modulesrc/utils spatialdata/geocoords spatialdata/spatialdb/generator spatialdata/utils tests/libtests tests/libtests/utils tests/libtests/utils/data tests/pytests/spatialdb tests/pytests/utils

baagaard at geodynamics.org baagaard at geodynamics.org
Tue Jul 25 17:39:46 PDT 2006


Author: baagaard
Date: 2006-07-25 17:39:45 -0700 (Tue, 25 Jul 2006)
New Revision: 4106

Added:
   cs/spatialdata-0.1/trunk/applications/
   cs/spatialdata-0.1/trunk/applications/Makefile.am
   cs/spatialdata-0.1/trunk/applications/gensimpledb.py
   cs/spatialdata-0.1/trunk/applications/pyconvert.py
   cs/spatialdata-0.1/trunk/libsrc/utils/
   cs/spatialdata-0.1/trunk/libsrc/utils/Makefile.am
   cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.cc
   cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh
   cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.icc
   cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe
   cs/spatialdata-0.1/trunk/spatialdata/utils/ChangeCoordSys.py
   cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py
   cs/spatialdata-0.1/trunk/tests/libtests/utils/
   cs/spatialdata-0.1/trunk/tests/libtests/utils/Makefile.am
   cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.cc
   cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.hh
   cs/spatialdata-0.1/trunk/tests/libtests/utils/data/
   cs/spatialdata-0.1/trunk/tests/libtests/utils/data/Makefile.am
   cs/spatialdata-0.1/trunk/tests/libtests/utils/data/TestPointsStream.dat
   cs/spatialdata-0.1/trunk/tests/libtests/utils/testutils.cc
Removed:
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/gensimpledb.py
Modified:
   cs/spatialdata-0.1/trunk/configure.ac
   cs/spatialdata-0.1/trunk/libsrc/Makefile.am
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe
   cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am
   cs/spatialdata-0.1/trunk/modulesrc/utils/utils.pyxe
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Makefile.am
   cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am
   cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py
   cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/testcpp.pyxe
Log:
Added objects for transforming points from one coordinate system to another.

Added: cs/spatialdata-0.1/trunk/applications/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/applications/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/applications/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,17 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+dist_bin_SCRIPTS = \
+	gensimpledb.py \
+	pyconvert.py
+
+# End of file 

Copied: cs/spatialdata-0.1/trunk/applications/gensimpledb.py (from rev 4101, cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/gensimpledb.py)
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/gensimpledb.py	2006-07-25 00:23:33 UTC (rev 4101)
+++ cs/spatialdata-0.1/trunk/applications/gensimpledb.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file spatialdata/applications/gensimpledb.py
+## @brief Generic use of GenSimpleDBApp.
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+  from spatialdata.spatialdb.generator.GenSimpleDBApp import GenSimpleDBApp
+
+  app = GenSimpleDBApp()
+  app.run()
+
+
+# End of file 

Added: cs/spatialdata-0.1/trunk/applications/pyconvert.py
===================================================================
--- cs/spatialdata-0.1/trunk/applications/pyconvert.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/applications/pyconvert.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file applications/pyconvert.py
+## @brief Python convert application driver
+
+from pyre.components.Component import Component
+# Dummy class for empty component
+class Dummy(Component):
+  def __init__(self):
+    Component.__init__(self, name="dummy", facility="dummy")
+    return
+
+from pyre.applications.Script import Script
+# Convert class
+class Convert(Script):
+  """
+  Python Convert application driver.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Script.Inventory):
+    """
+    Python object for managing Convert facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing Convert facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b unpickler Unpickler to load data
+    ## @li \b converter Converter to convert data
+    ## @li \b pickler Pickler to dump data
+
+    import pyre.inventory
+
+    reader = pyre.inventory.facility("reader", factory=Dummy)
+    reader.meta['tip'] = "Reader to load data."
+
+    converter = pyre.inventory.facility("converter", factory=Dummy)
+    converter.meta['tip'] = "Converter to convert data."
+
+    writer = pyre.inventory.facility("writer", factory=Dummy)
+    writer.meta['tip'] = "Writer to dump data."
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def main(self, *args, **kwds):
+    """
+    Main entry point for application.
+    """
+    data = self.reader.read()
+    if not self.converter is None:
+      self.converter.convert(data)
+    self.writer.write(data)
+    return
+
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    Script.__init__(self, 'pyconvert')
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members using inventory.
+    """
+    
+    Script._configure(self)
+    if self.inventory.reader.name == "dummy":
+      raise UnboundLocalError, "convert needs a reader to load the data.\n" \
+            "Please specify an unpickler with --reader=myreader"
+    else:
+      self.reader = self.inventory.reader
+
+    if self.inventory.converter.name == "dummy":
+      self.converter = None
+    else:
+      self.converter = self.inventory.converter
+
+    if self.inventory.writer.name == "dummy":
+      self.writer = self.reader
+    else:
+      self.writer = self.inventory.writer
+      
+    return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+
+  app = Convert()
+  app.run()
+
+
+# End of file 

Modified: cs/spatialdata-0.1/trunk/configure.ac
===================================================================
--- cs/spatialdata-0.1/trunk/configure.ac	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/configure.ac	2006-07-26 00:39:45 UTC (rev 4106)
@@ -124,6 +124,7 @@
 	libsrc/geocoords/Makefile
 	libsrc/geocoords/data/Makefile
 	libsrc/spatialdb/Makefile
+	libsrc/utils/Makefile
 	modulesrc/Makefile
 	modulesrc/geocoords/Makefile
 	modulesrc/spatialdb/Makefile
@@ -140,11 +141,14 @@
 	tests/libtests/geocoords/data/Makefile
 	tests/libtests/spatialdb/Makefile
 	tests/libtests/spatialdb/data/Makefile
+	tests/libtests/utils/Makefile
+	tests/libtests/utils/data/Makefile
 	tests/pytests/Makefile
 	tests/pytests/geocoords/Makefile
 	tests/pytests/spatialdb/Makefile
 	tests/pytests/spatialdb/data/Makefile
 	tests/pytests/utils/Makefile
+	applications/Makefile
 	doc/Makefile])
 
 AC_OUTPUT

Modified: cs/spatialdata-0.1/trunk/libsrc/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/libsrc/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -12,7 +12,8 @@
 
 SUBDIRS = \
 	geocoords \
-	spatialdb
+	spatialdb \
+	utils
 
 # version
 # $Id$

Added: cs/spatialdata-0.1/trunk/libsrc/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/utils/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/libsrc/utils/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,37 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = utils
+include $(top_srcdir)/subpackage.am
+
+lib_LTLIBRARIES = libspatialdatautils.la
+
+libspatialdatautils_la_SOURCES = \
+	PointsStream.cc
+
+libspatialdatautils_la_LDFLAGS =
+
+subpkginclude_HEADERS = \
+	PointsStream.hh \
+	PointsStream.icc
+
+noinst_HEADERS =
+
+# export
+clean-local: clean-subpkgincludeHEADERS
+BUILT_SOURCES = export-subpkgincludeHEADERS
+CLEANFILES = export-subpkgincludeHEADERS
+
+# version
+# $Id$
+
+# End of file 

Added: cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.cc	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.cc	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "PointsStream.hh" // Implementation of class methods
+
+#include <iostream> // USES std::cout, std::cin
+#include <iomanip> // USES std::setprecision(), std::width()
+#include <vector> // USES std::vector
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor
+spatialdata::utils::PointsStream::PointsStream(void) :
+  _commentFlag("#"),
+  _fieldWidth(14),
+  _precision(5),
+  _pIn(&std::cin),
+  _pOut(&std::cout)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor
+spatialdata::utils::PointsStream::~PointsStream(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Set input stream.
+void
+spatialdata::utils::PointsStream::input(std::istream* pIn)
+{ // input
+  _pIn = pIn;
+} // input
+
+// ----------------------------------------------------------------------
+// Set output stream.
+void
+spatialdata::utils::PointsStream::output(std::ostream* pOut)
+{ // output
+  _pOut = pOut;
+} // output
+
+// ----------------------------------------------------------------------
+// Read points from stdin.
+void
+spatialdata::utils::PointsStream::read(double** ppPoints,
+				       int* pNumPts,
+				       int* pNumDims) const
+{ // read
+  assert(0 != _pIn);
+
+  size_t numPts = 0;
+  size_t numDims = 3;
+
+  const size_t initialCapacity = numDims*256;
+  std::vector<double> buffer(initialCapacity);
+
+  size_t capacity = initialCapacity;
+  size_t index = 0;
+  while(!_pIn->eof() && _pIn->good()) {
+    if (numPts*numDims >= capacity) {
+      capacity *= 2;
+      buffer.resize(capacity);
+    } // if
+    for (size_t iDim=0; iDim < numDims; ++iDim)
+      *_pIn >> buffer[index++];
+    if (_pIn->good())
+      ++numPts;
+  } // while
+
+  if (0 != ppPoints) {
+    const size_t size = numPts * numDims;
+    double* pPoints = (size > 0) ? new double[size] : 0;
+    for (int i=0; i < size; ++i)
+      pPoints[i] = buffer[i];
+    *ppPoints = pPoints;
+  } // if
+  if (0 != pNumPts)
+    *pNumPts = numPts;
+  if (0 != pNumDims)
+    *pNumDims = numDims;
+} // read
+
+// ----------------------------------------------------------------------
+// Write points to stdout.
+void
+spatialdata::utils::PointsStream::write(const double* pPoints,
+					const int numPts,
+					const int numDims) const
+{ // write
+  assert(0 != _pOut);
+
+  *_pOut
+    << std::resetiosflags(std::ios::fixed)
+    << std::setiosflags(std::ios::scientific)
+    << std::setprecision(_precision);
+
+  for (size_t iPoint=0, index=0; iPoint < numPts; ++iPoint) {
+    for (size_t iDim=0; iDim < numDims; ++iDim)
+      *_pOut << std::setw(_fieldWidth) << pPoints[index++];
+    *_pOut << "\n";
+  } // for
+
+} // write
+
+// End of file

Added: cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file libsrc/utils/PointsStream.hh
+ *
+ * @brief C++ PointsStream object.
+ *
+ * C++ object for reading/writing points to/from stdin/stdout.
+ */
+
+#if !defined(spatialdata_utils_pointsstream_hh)
+#define spatialdata_utils_pointsstream_hh
+
+namespace spatialdata {
+  namespace utils {
+    class PointsStream;
+    class TestPointsStream; // forward declaration
+  } // utils
+} // spatialdata
+
+#include <string> // HASA std::string
+#include <iosfwd> // USES std::istream, std::ostream
+
+/// C++ object for reading/writing points to/from stdin/stdout.
+class spatialdata::utils::PointsStream
+{ // class PointsStream
+  friend class TestPointsStream;
+
+ public :
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+
+  /// Default constructor
+  PointsStream(void);
+
+  /// Default destructor
+  ~PointsStream(void);
+
+  /** Set comment flag.
+   *
+   * @param flag String identifying comments.
+   */
+  void commentFlag(const char* flag);
+
+  /** Get comment flag.
+   *
+   * @returns String identifying comments.
+   */
+  const char* commentFlag(void) const;
+
+  /** Set field width.
+   *
+   * @returns Width of field.
+   */
+  void fieldWidth(const int width);
+
+  /** Get field width.
+   *
+   * @returns Width of field.
+   */
+  int fieldWidth(void) const;
+
+  /** Set precision.
+   *
+   * @returns Precision.
+   */
+  void precision(const int value);
+
+  /** Get precision.
+   *
+   * @returns Precision.
+   */
+  int precision(void) const;
+
+  /** Set input stream.
+   *
+   * @param pIn Pointer to input stream
+   */
+  void input(std::istream* pIn);
+
+  /** Set output stream.
+   *
+   * @param pOut Pointer to output stream
+   */
+  void output(std::ostream* pOut);
+
+  /** Read points from stdin.
+   *
+   * @param ppPoints Pointer to array of points
+   * @param pNumPts Pointer to number of points
+   * @param pNumDims Pointer to number of dimensions
+   */
+  void read(double** ppPoints,
+	    int* pNumPts,
+	    int* pNumDims) const;
+
+  /** Write points to stdout.
+   *
+   * @param pPoints Array of points
+   * @param numPts Number of points
+   * @param numDims Number of dimensions
+   */
+  void write(const double* pPoints,
+	     const int numPts,
+	     const int numDims) const;
+
+private :
+ // PRIVATE METHODS ////////////////////////////////////////////////////
+
+  PointsStream(const PointsStream& p); ///< Not implemented
+  const PointsStream& operator=(const PointsStream& p); ///< Not implemented
+
+private :
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
+
+  std::string _commentFlag; ///< String identifying comments in input
+  int _fieldWidth; ///< Width of field in output
+  int _precision; ///< Precision in floating point output
+
+  std::istream* _pIn; ///< Pointer to input stream
+  std::ostream* _pOut; ///< Pointer to output stream
+
+}; // class PointsStream
+
+#include "PointsStream.icc" // inline methods
+
+#endif // spatialdata_geocoodrs_csgeo_hh
+
+// version
+// $Id$
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.icc	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.icc	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(spatialdata_utils_pointsstream_hh)
+#error "PointsSTream.icc must only be included from PointsStream.hh"
+#else
+
+// Set comment flag.
+void
+spatialdata::utils::PointsStream::commentFlag(const char* flag) {
+  _commentFlag = flag;
+}
+
+// Get comment flag.
+const char*
+spatialdata::utils::PointsStream::commentFlag(void) const {
+  return _commentFlag.c_str();
+}
+
+// Set field width.
+void
+spatialdata::utils::PointsStream::fieldWidth(const int width) {
+  _fieldWidth = width;
+}
+
+// Get field width.
+int
+spatialdata::utils::PointsStream::fieldWidth(void) const {
+  return _fieldWidth;
+}
+
+// Set precision.
+void
+spatialdata::utils::PointsStream::precision(const int value) {
+  _precision = value;
+}
+
+// Get precision.
+int
+spatialdata::utils::PointsStream::precision(void) const {
+  return _precision;
+}
+
+#endif
+
+// End of file 

Modified: cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe	2006-07-26 00:39:45 UTC (rev 4106)
@@ -24,7 +24,6 @@
 cdef extern from "Python.h":
   object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
   void* PyCObject_AsVoidPtr(object)
-  object PyList_GetItem(object, int)
 
 cdef void* ptrFromHandle(obj):
   """Extract pointer from PyCObject."""
@@ -35,20 +34,12 @@
     void* malloc(size_t size)
     void free(void* mem)
 
-cdef double* pylistDoublePtr(values):
-    size = len(values)
-    cdef double* pVals
-    pVals = <double*> malloc(size*sizeof(double));
-    for i from 0 <= i < size:
-        pVals[i] = PyList_GetItem(values, i)
-    return pVals
-    
 # ----------------------------------------------------------------------
 cdef class CoordSys:
 
   cdef void* thisptr # Pointer to C++ object
   cdef readonly object handle # PyCObject holding pointer to C++ object
-  cdef readonly object name # Identifier for type of object
+  cdef readonly object name # Identifier for object base type
 
   def __init__(self):
     """Constructor."""
@@ -475,7 +466,4 @@
   return
 
 
-# version
-__id__ = "$Id$"
-
 # End of file 

Modified: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe	2006-07-26 00:39:45 UTC (rev 4106)
@@ -170,8 +170,8 @@
     free(<void*> valbuffer)
 
     dims = [nlocs, nvals]
-    import spatialdata.utils.utils
-    return spatialdata.utils.utils.SimpleCppArray(<object> pVals, dims, "double")
+    import spatialdata.utils.simplearray
+    return spatialdata.utils.simplearray.SimpleCppArray(<object> pVals, dims, "double")
 
 
   def _createHandle(self):

Modified: cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -13,17 +13,33 @@
 subpackage = utils
 include $(top_srcdir)/subpackage.am
 
-subpkgpyexec_LTLIBRARIES = utilsmodule.la
+subpkgpyexec_LTLIBRARIES = \
+	simplearraymodule.la \
+	utilsmodule.la
 
+INCLUDES += -I$(PYTHON_INCDIR)
+
+# simple array
+simplearraymodule_la_LDFLAGS = -module
+simplearraymodule_la_SOURCES = simplearray.pyxe
+nodist_simplearraymodule_la_SOURCES = \
+	simplearray.c simplearray_embed.cpp simplearray_embed.h
+
+# utils
 utilsmodule_la_LDFLAGS = -module
-
 utilsmodule_la_SOURCES = utils.pyxe
-
 nodist_utilsmodule_la_SOURCES = \
 	utils.c utils_embed.cpp utils_embed.h
+utilsmodule_la_LIBADD = \
+	$(top_builddir)/libsrc/utils/libspatialdatautils.la
 
-INCLUDES += -I$(PYTHON_INCDIR)
+# simple array targets
+simplearray.pyx simplearray_embed.cpp  simplearray_embed.h: simplearray.pyxe
+	cp $< . && pyrexembed.py simplearray.pyxe && rm -f simplearray.pyxe
+simplearray_embed.cpp: simplearray_embed.h
+simplearray_embed.h: simplearray.pyx
 
+# utils targets
 utils.pyx utils_embed.cpp  utils_embed.h: utils.pyxe
 	cp $< . && pyrexembed.py utils.pyxe && rm -f utils.pyxe
 utils_embed.cpp: utils_embed.h

Added: cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,366 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+
+
+# ----------------------------------------------------------------------
+cdef extern from "Python.h":
+  ctypedef int Py_intptr_t
+  void Py_INCREF(object)
+  void Py_DECREF(object)
+  long PyInt_AsLong(object)
+  object PyCObject_FromVoidPtr(void*, void (*func)(void*))
+  object PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc,
+                                      void (*func)(void*, void*))
+
+cdef extern from "stdlib.h":
+  ctypedef int size_t
+  ctypedef long intptr_t
+  void* malloc(size_t size)
+  void free(void* ptr)
+
+ctypedef struct PyArrayInterface:
+  int version
+  int nd
+  char typekind
+  int itemsize
+  int flags
+  Py_intptr_t* shape
+  Py_intptr_t* strides
+  void* data
+
+CONTIGUOUS = 0x01
+FORTRAN = 0x02
+ALIGNED = 0x100
+NOTSWAPPED = 0x200
+WRITEABLE = 0x400
+
+# Byte order used in PyArrayInterface
+byteorder = {'<': "little",
+             '>': "big"}
+import sys
+
+# ----------------------------------------------------------------------
+cdef void interface_destructor(void* ptr, void* array):
+  Py_DECREF(<object> array)
+
+# ----------------------------------------------------------------------
+cdef int _sanitylevel
+_sanitylevel = 2
+def sanitylevel(int level):
+  _sanitylevel = level
+  return
+
+# ----------------------------------------------------------------------
+cdef class SimpleArray:
+  """Abstract base class for generic multi-dimensional array holding
+  simple C/C++ datatypes that is compatible with NumPy, Numeric, and
+  numarray."""
+
+  cdef readonly object name # Identifier for type of object
+  cdef readonly int nd # Number of dimensions in array
+  cdef readonly object shape # Dimensions of array
+  cdef readonly object strides # Strides for array
+  cdef readonly object data # PyCObject holding pointer to data
+
+  cdef object _typeinfo # Dictionary containing information about type in array
+  cdef PyArrayInterface* _interface # Array interface
+  cdef Py_intptr_t* _cshape # C array for shape information
+  cdef Py_intptr_t* _cstrides # C array for strides information
+
+  def __init__(self):
+    """Constructor."""
+    self.name = "spatialdata_utils_SimpleArray"
+    self.nd = 0
+    self.shape = None
+    self.strides = None
+    self._typeinfo = None
+    self._interface = NULL
+    self._cshape = NULL
+    self._cstrides = NULL
+    return
+
+
+  def __dealloc__(self):
+    """Destructor."""
+    free(self._interface)
+    free(self._cshape)
+    free(self._cstrides)
+    return
+  
+
+  def isCompatible(self, nd=None, simpletype=None,
+                   writeable=None, contiguous=None, notswapped=None):
+    """Check compatibility with requested traits. Return True if
+    compatible, False if not."""
+
+    # Skip checks if sanity level < 1
+    if _sanitylevel < 1:
+      return True
+
+    if not nd is None:
+      if not nd == self.nd:
+        return False
+    if not simpletype is None:
+      if not simpletype == self._typeinfo['type']:
+        return False
+    flags = 0
+    if not writeable is None:
+      flags = flags | WRITEABLE
+    if not contiguous is None:
+      flags = flags | CONTIGUOUS
+    if not notswapped is None:
+      flags = flags | NOTSWAPPED
+    if not self._interface.flags & flags:
+      return False
+
+    if _sanitylevel > 1:
+      # make sure strides are compatible with
+      ndims = len(self.strides)
+      stride = self._typeinfo['size']
+      for i from 0 <= i < ndims:
+        j = ndims-i-1
+        if not self.strides[j] == stride:
+          return False
+        stride = stride * self.shape[j]
+    
+    return True  
+
+
+  cdef _setupInterface(self, void* data, int flags):
+    """Create array interface."""
+    self._syncCShape()
+    self._syncCStrides()
+    
+    cdef PyArrayInterface* interface
+    interface = <PyArrayInterface*> malloc(sizeof(PyArrayInterface))
+    if interface is NULL:
+      raise MemoryError("Could not allocate array interface.")
+    interface.version = 2
+    interface.nd = self.nd
+    interface.typekind = ord(self._typeinfo['kind'])
+    interface.itemsize = self._typeinfo['size']
+    interface.flags = flags
+    interface.strides = self._cstrides
+    interface.shape = self._cshape
+    interface.data = data
+    self._interface = interface
+    self.data = PyCObject_FromVoidPtr(data, NULL)
+    return
+
+
+  cdef _calcStrides(self):
+    """Calculate strides for contiguous storage in row major (C/C++) order."""
+    nd = self.nd
+    self.strides = [0]*nd
+    stride = self._typeinfo['size']
+    for i from 0 <= i < nd:
+      j = nd-i-1
+      self.strides[j] = stride
+      stride = stride * self.shape[j]
+    return
+
+
+  cdef _syncCShape(self):
+    """Synchronize C shape array with Python shape array."""
+    free(self._cshape)
+    self._cshape = NULL
+    nd = len(self.shape)
+    if nd > 0:
+      self._cshape = <Py_intptr_t*> malloc(nd*sizeof(Py_intptr_t))
+      if self._cshape is NULL:
+        raise MemoryError("Could not allocate shape array.")
+      for i from 0 <= i < nd:
+        self._cshape[i] = self.shape[i]
+    return
+
+
+  cdef _syncCStrides(self):
+    """Synchronize C strides array with Python strides array."""
+    free(self._cstrides)
+    self._cstrides = NULL
+    nd = len(self.strides)
+    if nd > 0:
+      self._cstrides = <Py_intptr_t*> malloc(nd*sizeof(Py_intptr_t))
+      if self._cstrides is NULL:
+        raise MemoryError("Could not allocate strides array.")
+      for i from 0 <= i < nd:
+        self._cstrides[i] = self.strides[i]
+    return
+
+
+# ----------------------------------------------------------------------
+cdef class SimpleCppArray(SimpleArray):
+  """Implementation of generic multi-dimensional array created from C++
+  array."""
+  
+  cdef void* arrayptr # Pointer to head of array
+
+  def __init__(self, data, shape, valuetype):
+    """Constructor."""
+    SimpleArray.__init__(self)
+
+
+    nd = len(shape)
+    self.arrayptr = <void*> data
+    self.nd = nd
+    self._typeinfo = self._sizeandtype(valuetype)
+  
+    self.shape = [0]*nd
+    for i in range(nd):
+      self.shape[i] = shape[i]
+
+    self._calcStrides()
+    
+    flags = NOTSWAPPED | ALIGNED | CONTIGUOUS | WRITEABLE
+    self._setupInterface(self.arrayptr, flags)
+    return
+
+
+  def __dealloc__(self):
+    """Destructor."""
+    # create shim for 'delete'
+    #embed{ void PyCppArray_deletedouble(void* pData)
+      double* pArray = (double*) pData;
+      delete[] pArray;
+    #}embed
+    #embed{ void PyCppArray_deletefloat(void* pData)
+      float* pArray = (float*) pData;
+      delete[] pArray;
+    #}embed
+    #embed{ void PyCppArray_deleteint(void* pData)
+      int* pArray = (int*) pData;
+      delete[] pArray;
+    #}embed
+    if self._typeinfo['type'] == "double":
+      PyCppArray_deletedouble(self.arrayptr)
+    elif self._typeinfo['type'] == "float":
+      PyCppArray_deletefloat(self.arrayptr)
+    elif self._typeinfo['type'] == "int":
+      PyCppArray_deleteint(self.arrayptr)
+    return
+    
+
+  property __array_struct__:
+    """Generic array structure property compatible with NumPy, Numeric,
+    and numarray."""
+    def __get__(self):
+      Py_INCREF(self)
+      obj = PyCObject_FromVoidPtrAndDesc(<void*> self._interface, <void*> self,
+                                         interface_destructor)
+      return obj
+
+
+  cdef _sizeandtype(self, valuetype):
+    """Get size and type information associated with C++ datatype."""
+    info = {'double': {'size': sizeof(double),
+                       'kind': 'f',
+                       'type': "double"},
+            'float': {'size': sizeof(float),
+                      'kind': 'f',
+                      'type': "float"},
+            'int': {'size': sizeof(int),
+                    'kind': 'i',
+                    'type': "int"}}
+    if not valuetype in info.keys():
+      raise ValueError("Unknown C type in setting up SimpleArray.")
+    return info[valuetype]
+
+
+# ----------------------------------------------------------------------
+cdef class SimplePyArray(SimpleArray):
+  """Implementation of generic multi-dimensional array created from Python
+  object with __array_struct__ property."""
+
+  cdef object _pyarray # Python object holding array data
+
+  def __init__(self, pyarray):
+    """Constuctor."""
+    SimpleArray.__init__(self)
+
+    shape = pyarray.__array_shape__
+    nd = len(shape)
+    self.nd = nd
+
+    self.shape = [0]*nd
+    for i in range(nd):
+      self.shape[i] = shape[i]
+
+    typestring = pyarray.__array_typestr__
+    self._typeinfo = self._sizeandtype(typestring[1:])
+
+    strides = pyarray.__array_strides__
+    if strides:
+      self.strides = [0]*nd
+      for i from 0 <= i < nd:
+        self.strides[i] = strides[i]
+    else:
+      self._calcStrides()
+
+    cdef void* data
+    address = int(pyarray.__array_data__[0], 16)
+    data = <void*> PyInt_AsLong(address)
+
+    readonly = pyarray.__array_data__[1]
+    flags = 0
+    if '|' == typestring[0]:
+      flags = flags | NOTSWAPPED
+    elif byteorder[typestring[0]] == sys.byteorder:
+      flags = flags | NOTSWAPPED
+    if not readonly:
+      flags = flags | WRITEABLE
+    self._setupInterface(data, flags)
+    self._pyarray = pyarray
+    return
+
+
+  def __dealloc__(self):
+    """Destructor."""
+    return
+    
+
+  property __array_struct__:
+    """Generic array structure property compatible with NumPy, Numeric,
+    and numarray."""
+    def __get__(self):
+      if hasattr(self._pyarray, '__array_struct__'):
+        return self._pyarray.__array_struct__
+      else:
+        Py_INCREF(self)
+        obj = PyCObject_FromVoidPtrAndDesc(<void*> self._interface,
+                                           <void*> self,
+                                           interface_destructor)
+      return obj
+
+
+  def _sizeandtype(self, typestring):
+    """Parse typestring into size and type information."""
+    assert(8 == sizeof(double))
+    assert(4 == sizeof(float))
+    assert(4 == sizeof(int))
+    info = {'f8': {'size': sizeof(double),
+                   'kind': 'f',
+                   'type': "double"},
+            'f4': {'size': sizeof(float),
+                      'kind': 'f',
+                      'type': "float"},
+            'i4': {'size': sizeof(int),
+                   'kind': 'i',
+                   'type': "int"}}
+    if not typestring in info.keys():
+      raise ValueError("Unknown C type '%s' in setting up SimplePyArray." \
+                       % typestring)
+    return info[typestring]
+
+
+# version
+__id__ = "$Id$"
+
+# End of file

Modified: cs/spatialdata-0.1/trunk/modulesrc/utils/utils.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/utils/utils.pyxe	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/modulesrc/utils/utils.pyxe	2006-07-26 00:39:45 UTC (rev 4106)
@@ -9,358 +9,163 @@
 #
 # ======================================================================
 
+#header{
+#include "spatialdata/utils/PointsStream.hh"
+#}header
 
 # ----------------------------------------------------------------------
 cdef extern from "Python.h":
-  ctypedef int Py_intptr_t
-  void Py_INCREF(object)
-  void Py_DECREF(object)
-  long PyInt_AsLong(object)
-  object PyCObject_FromVoidPtr(void*, void (*func)(void*))
-  object PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc,
-                                      void (*func)(void*, void*))
+  object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
+  void* PyCObject_AsVoidPtr(object)
 
+cdef void* ptrFromHandle(obj):
+  """Extract pointer from PyCObject."""
+  return PyCObject_AsVoidPtr(obj.handle)
+
 cdef extern from "stdlib.h":
-  ctypedef int size_t
-  ctypedef long intptr_t
-  void* malloc(size_t size)
-  void free(void* ptr)
+    ctypedef unsigned long size_t
 
-ctypedef struct PyArrayInterface:
-  int version
-  int nd
-  char typekind
-  int itemsize
-  int flags
-  Py_intptr_t* shape
-  Py_intptr_t* strides
-  void* data
-
-CONTIGUOUS = 0x01
-FORTRAN = 0x02
-ALIGNED = 0x100
-NOTSWAPPED = 0x200
-WRITEABLE = 0x400
-
-# Byte order used in PyArrayInterface
-byteorder = {'<': "little",
-             '>': "big"}
-import sys
-
 # ----------------------------------------------------------------------
-cdef void interface_destructor(void* ptr, void* array):
-  Py_DECREF(<object> array)
+cdef class PointsStream:
+  """
+  Wrapper for C++ PointsStream object.
+  """
 
-# ----------------------------------------------------------------------
-cdef int _sanitylevel
-_sanitylevel = 2
-def sanitylevel(int level):
-  _sanitylevel = level
-  return
+  cdef void* thisptr # Pointer to C++ object
+  cdef readonly object handle # PyCObject holding pointer to C++ object
+  cdef readonly object name # Identifier for object base type
 
-# ----------------------------------------------------------------------
-cdef class SimpleArray:
-  """Abstract base class for generic multi-dimensional array holding
-  simple C/C++ datatypes that is compatible with NumPy, Numeric, and
-  numarray."""
-
-  cdef readonly object name # Identifier for type of object
-  cdef readonly int nd # Number of dimensions in array
-  cdef readonly object shape # Dimensions of array
-  cdef readonly object strides # Strides for array
-  cdef readonly object data # PyCObject holding pointer to data
-
-  cdef object _typeinfo # Dictionary containing information about type in array
-  cdef PyArrayInterface* _interface # Array interface
-  cdef Py_intptr_t* _cshape # C array for shape information
-  cdef Py_intptr_t* _cstrides # C array for strides information
-
   def __init__(self):
-    """Constructor."""
-    self.name = "spatialdata_utils_SimpleArray"
-    self.nd = 0
-    self.shape = None
-    self.strides = None
-    self._typeinfo = None
-    self._interface = NULL
-    self._cshape = NULL
-    self._cstrides = NULL
+    """
+    Constructor.
+    """
+    self._handle = self._createHandle()
+    self.thisptr = NULL
+    self.name = "spatialdata_utils_PointsStream"
     return
 
+  property commentFlag:
+    def __set__(self, flag):
+      """
+      Set flag for comment lines.
+      """
+      # create shim for method 'commentFlag'
+      #embed{ void PointsStream_commentFlag_set(void* pObj, char* flag)
+      ((spatialdata::utils::PointsStream*) pObj)->commentFlag(flag);
+      #}embed
+      PointsStream_commentFlag_set(self.thisptr, flag)
 
-  def __dealloc__(self):
-    """Destructor."""
-    free(self._interface)
-    free(self._cshape)
-    free(self._cstrides)
-    return
-  
+    def __get__(self):
+      """
+      Get flag for comment lines.
+      """
+      # create shim for method 'commentFlag'
+      #embed{ char* PointsStream_commentFlag_get(void* pObj)
+      return (char*) ((spatialdata::utils::PointsStream*) pObj)->commentFlag();
+      #}embed
+      return PointsStream_commentFlag_get(self.thisptr)
 
-  def isCompatible(self, nd=None, simpletype=None,
-                   writeable=None, contiguous=None, notswapped=None):
-    """Check compatibility with requested traits. Return True if
-    compatible, False if not."""
 
-    # Skip checks if sanity level < 1
-    if _sanitylevel < 1:
-      return True
+  property fieldWidth:
+    def __set__(self, flag):
+      """
+      Set field width.
+      """
+      # create shim for method 'fieldWidth'
+      #embed{ void PointsStream_fieldWidth_set(void* pObj, int width)
+      ((spatialdata::utils::PointsStream*) pObj)->fieldWidth(width);
+      #}embed
+      PointsStream_fieldWidth_set(self.thisptr, width)
 
-    if not nd is None:
-      if not nd == self.nd:
-        return False
-    if not simpletype is None:
-      if not simpletype == self._typeinfo['type']:
-        return False
-    flags = 0
-    if not writeable is None:
-      flags = flags | WRITEABLE
-    if not contiguous is None:
-      flags = flags | CONTIGUOUS
-    if not notswapped is None:
-      flags = flags | NOTSWAPPED
-    if not self._interface.flags & flags:
-      return False
+    def __get__(self):
+      """
+      Get field width.
+      """
+      # create shim for method 'fieldWidth'
+      #embed{ int PointsStream_fieldWidth_get(void* pObj)
+      return ((spatialdata::utils::PointsStream*) pObj)->fieldWidth();
+      #}embed
+      return PointsStream_fieldWidth_get(self.thisptr)
 
-    if _sanitylevel > 1:
-      # make sure strides are compatible with
-      ndims = len(self.strides)
-      stride = self._typeinfo['size']
-      for i from 0 <= i < ndims:
-        j = ndims-i-1
-        if not self.strides[j] == stride:
-          return False
-        stride = stride * self.shape[j]
-    
-    return True  
 
+  property precision:
+    def __set__(self, flag):
+      """
+      Set precision.
+      """
+      # create shim for method 'precision'
+      #embed{ void PointsStream_precision_set(void* pObj, int precision)
+      ((spatialdata::utils::PointsStream*) pObj)->precision(precision);
+      #}embed
+      PointsStream_precision_set(self.thisptr, precision)
 
-  cdef _setupInterface(self, void* data, int flags):
-    """Create array interface."""
-    self._syncCShape()
-    self._syncCStrides()
-    
-    cdef PyArrayInterface* interface
-    interface = <PyArrayInterface*> malloc(sizeof(PyArrayInterface))
-    if interface is NULL:
-      raise MemoryError("Could not allocate array interface.")
-    interface.version = 2
-    interface.nd = self.nd
-    interface.typekind = ord(self._typeinfo['kind'])
-    interface.itemsize = self._typeinfo['size']
-    interface.flags = flags
-    interface.strides = self._cstrides
-    interface.shape = self._cshape
-    interface.data = data
-    self._interface = interface
-    self.data = PyCObject_FromVoidPtr(data, NULL)
-    return
+    def __get__(self):
+      """
+      Get flag for comment lines.
+      """
+      # create shim for method 'precision'
+      #embed{ int PointsStream_precision_get(void* pObj)
+      return ((spatialdata::utils::PointsStream*) pObj)->precision();
+      #}embed
+      return PointsStream_precision_get(self.thisptr)
 
 
-  cdef _calcStrides(self):
-    """Calculate strides for contiguous storage in row major (C/C++) order."""
-    nd = self.nd
-    self.strides = [0]*nd
-    stride = self._typeinfo['size']
-    for i from 0 <= i < nd:
-      j = nd-i-1
-      self.strides[j] = stride
-      stride = stride * self.shape[j]
-    return
+  def read(self):
+    """
+    Read points from stdin.
+    """
+    # create shim for method 'read'
+    #embed{ void PointsStream_read(void* pObj, double** ppVals, int* pNumPts, int* pNumDims)
+    ((spatialdata::utils::PointsStream*) pObj)->read(ppVals,
+                                                     pNumPts, pNumDims);
+    #}embed
+    cdef double* pVals
+    cdef int numPts
+    cdef int numDims
+    pVals = NULL
+    numPts = 0
+    numDims = 0
+    PointsStream_read(self.thisptr, &pVals, &numPts, &numDims)
+    import spatialdata.utils.simplearray
+    dims = [numPts, numDims]
+    return spatialdata.utils.simplearray.SimpleCppArray(<object> pVals,
+                                                        dims, "double")
 
 
-  cdef _syncCShape(self):
-    """Synchronize C shape array with Python shape array."""
-    free(self._cshape)
-    self._cshape = NULL
-    nd = len(self.shape)
-    if nd > 0:
-      self._cshape = <Py_intptr_t*> malloc(nd*sizeof(Py_intptr_t))
-      if self._cshape is NULL:
-        raise MemoryError("Could not allocate shape array.")
-      for i from 0 <= i < nd:
-        self._cshape[i] = self.shape[i]
-    return
-
-
-  cdef _syncCStrides(self):
-    """Synchronize C strides array with Python strides array."""
-    free(self._cstrides)
-    self._cstrides = NULL
-    nd = len(self.strides)
-    if nd > 0:
-      self._cstrides = <Py_intptr_t*> malloc(nd*sizeof(Py_intptr_t))
-      if self._cstrides is NULL:
-        raise MemoryError("Could not allocate strides array.")
-      for i from 0 <= i < nd:
-        self._cstrides[i] = self.strides[i]
-    return
-
-
-# ----------------------------------------------------------------------
-cdef class SimpleCppArray(SimpleArray):
-  """Implementation of generic multi-dimensional array created from C++
-  array."""
-  
-  cdef void* arrayptr # Pointer to head of array
-
-  def __init__(self, data, shape, valuetype):
-    """Constructor."""
-    SimpleArray.__init__(self)
-
-
-    nd = len(shape)
-    self.arrayptr = <void*> data
-    self.nd = nd
-    self._typeinfo = self._sizeandtype(valuetype)
-  
-    self.shape = [0]*nd
-    for i in range(nd):
-      self.shape[i] = shape[i]
-
-    self._calcStrides()
+  def write(self, points):
+    """
+    Write points to stdout.
+    """
+    # create shim for method 'write'
+    #embed{ void PointsStream_write(void* pObj, double* pVals, int numPts, int numDims)
+    ((spatialdata::utils::PointsStream*) pObj)->write(pVals, numPts, numDims);
+    #}embed
+    if not points.name == "spatialdata_utils_SimpleArray":
+      raise TypeError, \
+            "Argument 'coordsSrc' must be of type 'SimpleArray'."
+    if not coordsSrc.isCompatible(nd=2,
+                                  simpletype="double",
+                                  contiguous=True,
+                                  notswapped=True):
+      raise TypeError, \
+            "Argument 'points' must be a contiguous, 2-D array of type double."
     
-    flags = NOTSWAPPED | ALIGNED | CONTIGUOUS | WRITEABLE
-    self._setupInterface(self.arrayptr, flags)
+    (numPts, numDims) = points.shape
+    cdef double* pVals
+    pVals = <double*> PyCObject_AsVoidPtr(points.data)
+    PointsStream_write(self.thisptr, pVals, numPts, numDims)
     return
+      
 
-
-  def __dealloc__(self):
-    """Destructor."""
-    # create shim for 'delete'
-    #embed{ void PyCppArray_deletedouble(void* pData)
-      double* pArray = (double*) pData;
-      delete[] pArray;
+  def _createHandle(self):
+    """Wrap pointer to C++ object in PyCObject."""
+    # create shim for destructor
+    #embed{ void PointsStream_destructor(void* pObj)
+    spatialdata::utils::PointsStream* pStream =
+      (spatialdata::utils::PointsStream*) pObj;
+    delete pStream;
     #}embed
-    #embed{ void PyCppArray_deletefloat(void* pData)
-      float* pArray = (float*) pData;
-      delete[] pArray;
-    #}embed
-    #embed{ void PyCppArray_deleteint(void* pData)
-      int* pArray = (int*) pData;
-      delete[] pArray;
-    #}embed
-    if self._typeinfo['type'] == "double":
-      PyCppArray_deletedouble(self.arrayptr)
-    elif self._typeinfo['type'] == "float":
-      PyCppArray_deletefloat(self.arrayptr)
-    elif self._typeinfo['type'] == "int":
-      PyCppArray_deleteint(self.arrayptr)
-    return
-    
+    return PyCObject_FromVoidPtr(self.thisptr, PointsStream_destructor)
 
-  property __array_struct__:
-    """Generic array structure property compatible with NumPy, Numeric,
-    and numarray."""
-    def __get__(self):
-      Py_INCREF(self)
-      obj = PyCObject_FromVoidPtrAndDesc(<void*> self._interface, <void*> self,
-                                         interface_destructor)
-      return obj
 
-
-  cdef _sizeandtype(self, valuetype):
-    """Get size and type information associated with C++ datatype."""
-    info = {'double': {'size': sizeof(double),
-                       'kind': 'f',
-                       'type': "double"},
-            'float': {'size': sizeof(float),
-                      'kind': 'f',
-                      'type': "float"},
-            'int': {'size': sizeof(int),
-                    'kind': 'i',
-                    'type': "int"}}
-    if not valuetype in info.keys():
-      raise ValueError("Unknown C type in setting up SimpleArray.")
-    return info[valuetype]
-
-
-# ----------------------------------------------------------------------
-cdef class SimplePyArray(SimpleArray):
-  """Implementation of generic multi-dimensional array created from Python
-  object with __array_struct__ property."""
-
-  cdef object _pyarray # Python object holding array data
-
-  def __init__(self, pyarray):
-    """Constuctor."""
-    SimpleArray.__init__(self)
-
-    shape = pyarray.__array_shape__
-    nd = len(shape)
-    self.nd = nd
-
-    self.shape = [0]*nd
-    for i in range(nd):
-      self.shape[i] = shape[i]
-
-    typestring = pyarray.__array_typestr__
-    self._typeinfo = self._sizeandtype(typestring[1:])
-
-    strides = pyarray.__array_strides__
-    if strides:
-      self.strides = [0]*nd
-      for i from 0 <= i < nd:
-        self.strides[i] = strides[i]
-    else:
-      self._calcStrides()
-
-    cdef void* data
-    address = int(pyarray.__array_data__[0], 16)
-    data = <void*> PyInt_AsLong(address)
-
-    readonly = pyarray.__array_data__[1]
-    flags = 0
-    if '|' == typestring[0]:
-      flags = flags | NOTSWAPPED
-    elif byteorder[typestring[0]] == sys.byteorder:
-      flags = flags | NOTSWAPPED
-    if not readonly:
-      flags = flags | WRITEABLE
-    self._setupInterface(data, flags)
-    self._pyarray = pyarray
-    return
-
-
-  def __dealloc__(self):
-    """Destructor."""
-    return
-    
-
-  property __array_struct__:
-    """Generic array structure property compatible with NumPy, Numeric,
-    and numarray."""
-    def __get__(self):
-      if hasattr(self._pyarray, '__array_struct__'):
-        return self._pyarray.__array_struct__
-      else:
-        Py_INCREF(self)
-        obj = PyCObject_FromVoidPtrAndDesc(<void*> self._interface,
-                                           <void*> self,
-                                           interface_destructor)
-      return obj
-
-
-  def _sizeandtype(self, typestring):
-    """Parse typestring into size and type information."""
-    assert(8 == sizeof(double))
-    assert(4 == sizeof(float))
-    assert(4 == sizeof(int))
-    info = {'f8': {'size': sizeof(double),
-                   'kind': 'f',
-                   'type': "double"},
-            'f4': {'size': sizeof(float),
-                      'kind': 'f',
-                      'type': "float"},
-            'i4': {'size': sizeof(int),
-                   'kind': 'i',
-                   'type': "int"}}
-    if not typestring in info.keys():
-      raise ValueError("Unknown C type '%s' in setting up SimplePyArray." \
-                       % typestring)
-    return info[typestring]
-
-
-# version
-__id__ = "$Id$"
-
 # End of file

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -17,7 +17,7 @@
   """Convert coordinates from source coordinate system to destination
   coordinate system. Transformation is done in place."""
 
-  import spatialdata.utils.utils as simplearray
+  import spatialdata.utils.simplearray as simplearray
   coordsSrcArray = simplearray.SimplePyArray(coordsSrc)
 
   import spatialdata.geocoords.geocoords as bindings

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -13,9 +13,6 @@
 subpackage = spatialdb/generator
 include $(top_srcdir)/subpackage.am
 
-dist_bin_SCRIPTS = \
-	gensimpledb.py
-
 subpkgpyexec_PYTHON = \
 	Geometry.py \
 	Filter.py \

Deleted: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/gensimpledb.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/gensimpledb.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/gensimpledb.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file spatialdata/spatialdb/generator/gensimpledb.py
-## @brief Generic use of GenSimpleDBApp.
-
-# ----------------------------------------------------------------------
-# main
-if __name__ == '__main__':
-  from spatialdata.spatialdb.generator.GenSimpleDBApp import GenSimpleDBApp
-
-  app = GenSimpleDBApp()
-  app.run()
-
-# version
-__id__ = "$Id$"
-
-# End of file 

Added: cs/spatialdata-0.1/trunk/spatialdata/utils/ChangeCoordSys.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/ChangeCoordSys.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/ChangeCoordSys.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/utils/ChangeCoordSys.py
+## @brief Python object for changing coordinate system of points.
+
+from pyre.components.Component import Component
+
+# ChangeCoordSys class
+class ChangeCoordSys(Component):
+  """
+  Python object for changing coordinate system of points.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Component.Inventory):
+    """
+    Python object for managing ChangeCoordSys facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing ConvertMeshVertices facilities
+    ## and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b cs_src Source coordinate system
+    ## @li \b cs_dest Destination coordinate system
+
+    import pyre.inventory
+
+    from spatialdata.geocoords.CSCart import CSCart
+
+    csSrc = pyre.inventory.facility("cs_src", factory=CSCart)
+    csSrc.meta['tip'] = "Source coordinate system."
+
+    csDest = pyre.inventory.facility("cs_dest", factory=CSCart)
+    csDest.meta['tip'] = "Destination coordinate system."    
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def initialize(self):
+    """
+    Initialize converter.
+    """
+    self.csSrc.initialize()
+    self.csDest.initialize()
+    return
+
+
+  def convert(self, points):
+    """
+    Convert coordinates of vertices.
+    """
+
+    self.initialize()
+    
+    from spatialdata.geocoords.Converter import convert
+    convert(points, self.csDest, self.csSrc)
+    return
+
+
+  def __init__(self, name="convertcs"):
+    """
+    Constructor.
+    """
+    Converter.__init__(self, name)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members from inventory.
+    """
+    
+    self.csDest = self.inventory.csDest
+    self.csSrc = self.inventory.csSrc
+    return
+
+
+# End of file 

Modified: cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -14,7 +14,9 @@
 include $(top_srcdir)/subpackage.am
 
 subpkgpyexec_PYTHON = \
-	__init__.py
+	__init__.py \
+	ChangeCoordSys.py \
+	PointsStream.py
 
 # version
 # $Id$

Added: cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,113 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/utils/PointsStream.py
+## @brief Python object for reading/writing points from stdin/stdout.
+
+from pyre.components.Component import Component
+
+# PointsStream class
+class PointsStream(Component):
+  """
+  Python object for reading/writing points from stdin/stdout.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Component.Inventory):
+    """
+    Python object for managing PointsStream facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing PointsStream facilities and properties.
+    ##
+    ## \b Properties (input)
+    ## @li \b commentFlag String identifying comment.
+    ##
+    ## \b Properties (output)
+    ## @li \b field_width Width of field for coordinates
+    ## @li \b precision Decimnal precision of coordinates
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+    commentFlag = pyre.inventory.str("comment_flag", default="#")
+    commentFlags.meta['tip'] = "String identifying comment."
+
+    fieldWidth = pyre.inventory.int("field_width", default=14)
+    fieldWidth.meta['tip'] = "Width of field for coordinates."
+    fieldWidth.validator = pyre.inventory.greater(0)
+
+    precision = pyre.inventory.int("precision", default=5)
+    precision.meta['tip'] = "Decimal precision of coordinates."
+    precision.validator = pyre.inventory.greaterEqual(0)
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def read(self):
+    """
+    Read points from stdin.
+    """
+    self._sync()
+    points = self.cppHandle.read()
+    return points
+
+
+  def write(self, points):
+    """
+    Write points to stdout.
+    """
+    self._sync()
+    self.cppHandle.write(points)
+    return
+
+
+  def __init__(self, name="pointsstream"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="pointsstream")
+    import spatialdata.utils.utils as bindings
+    self.cppHandle = bindings.PointsStream()
+    self.commentFlag = "#"
+    self.fieldWidth = 14
+    self.precision = 5
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based on inventory.
+    """
+    self.commentFlag = self.inventory.commentFlag
+    self.fieldWidth = self.inventory.fieldWidth
+    self.precision = self.inventory.precision
+    return
+
+
+  def _sync(self):
+    """
+    Synchronize with C++ object.
+    """
+    self.cppHandle.commentFlag = self.commentFlag
+    self.cppHandle.fieldWidth = self.fieldWidth
+    self.cppHandle.precision = self.precision
+    return
+  
+
+# End of file 

Modified: cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -13,7 +13,8 @@
 ## @file spatialdata/utils/__init__.py
 ## @brief Python spatialdata utils module initialization.
 
-__all__ = []
+__all__ = ['ChangeCoordSys',
+           'PointsStream']
 
 # version
 __id__ = "$Id$"

Modified: cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -12,7 +12,8 @@
 
 SUBDIRS = \
 	geocoords \
-	spatialdb
+	spatialdb \
+	utils
 
 # version
 # $Id$

Added: cs/spatialdata-0.1/trunk/tests/libtests/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/utils/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/utils/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,40 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = utils
+include $(top_srcdir)/subpackage.am
+
+SUBDIRS = data
+
+TESTS = testutils
+
+check_PROGRAMS = testutils
+
+testutils_SOURCES = \
+	TestPointsStream.cc \
+	testutils.cc
+
+noinst_HEADERS = \
+	TestPointsStream.hh
+
+testutils_LDFLAGS =
+
+INCLUDES +=
+
+testutils_LDADD = \
+	-lcppunit -ldl \
+	$(top_builddir)/libsrc/utils/libspatialdatautils.la
+
+# version
+# $Id$
+
+# End of file 

Added: cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.cc	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.cc	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestPointsStream.hh" // Implementation of class methods
+
+#include "spatialdata/utils/PointsStream.hh" // USES PointStream
+
+#include <sstream> // USES std::stringstream
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::utils::TestPointsStream );
+
+// ----------------------------------------------------------------------
+#include "data/TestPointsStream.dat"
+
+// ----------------------------------------------------------------------
+// Test commentFlag()
+void
+spatialdata::utils::TestPointsStream::testCommentFlag(void)
+{ // testCommentFlag
+  const char* flag = "%";
+  PointsStream s;
+  s.commentFlag(flag);
+  CPPUNIT_ASSERT(0 == strcmp(flag, s.commentFlag()));
+} // testCommentFlag
+
+// ----------------------------------------------------------------------
+// Test fieldWidth()
+void
+spatialdata::utils::TestPointsStream::testFieldWidth(void)
+{ // testFieldWidth
+  const int fieldWidth = 18;
+  PointsStream s;
+  s.fieldWidth(fieldWidth);
+  CPPUNIT_ASSERT_EQUAL(fieldWidth, s.fieldWidth());
+} // testFieldWidth
+
+// ----------------------------------------------------------------------
+// Test precision()
+void
+spatialdata::utils::TestPointsStream::testPrecision(void)
+{ // testPrecision
+  const int precision = 3;
+  PointsStream s;
+  s.precision(precision);
+  CPPUNIT_ASSERT_EQUAL(precision, s.precision());
+} // testPrecision
+
+// ----------------------------------------------------------------------
+// Test read()
+void
+spatialdata::utils::TestPointsStream::testRead(void)
+{ // testRead
+  std::stringstream buffer;
+
+  //buffer << "# This is a comment\n";
+  const int size = _NUMPTS * _NUMDIMS;
+  for (int i=0; i < size; ++i)
+    buffer << "  " << _POINTS[i];
+  buffer << "\n";
+
+  PointsStream s;
+  s.input(&buffer);
+  double* points = 0;
+  int numPts = 0;
+  int numDims = 0;
+  s.read(&points, &numPts, &numDims);
+
+  CPPUNIT_ASSERT_EQUAL(_NUMPTS, numPts);
+  CPPUNIT_ASSERT_EQUAL(_NUMDIMS, numDims);
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_EQUAL(_POINTS[i], points[i]);
+} // testRead
+
+// ----------------------------------------------------------------------
+// Test write()
+void
+spatialdata::utils::TestPointsStream::testWrite(void)
+{ // testWrite
+  std::stringstream buffer;
+
+  PointsStream s;
+  s.output(&buffer);
+  s.write(_POINTS, _NUMPTS, _NUMDIMS);
+
+  const int size = _NUMPTS * _NUMDIMS;
+  for (int i=0; i < size; ++i) {
+    double value;
+    buffer >> value;
+    CPPUNIT_ASSERT_EQUAL(_POINTS[i], value);
+  } // for
+} // testWrite
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.hh	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/utils/TestPointsStream.hh	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/utils/TestPointsStream.hh
+ *
+ * @brief C++ TestPointsStream object
+ *
+ * C++ unit testing for PointsStream.
+ */
+
+#if !defined(spatialdata_testpointsstream_hh)
+#define spatialdata_testpointsstream_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for spatialdata package
+namespace spatialdata {
+  namespace utils {
+    class TestPointsStream;
+  } // utils
+} // spatialdata
+
+/// C++ unit testing for PointsStream
+class spatialdata::utils::TestPointsStream : public CppUnit::TestFixture
+{ // class TestPointsStream
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestPointsStream );
+  CPPUNIT_TEST( testCommentFlag );
+  CPPUNIT_TEST( testFieldWidth );
+  CPPUNIT_TEST( testPrecision );
+  CPPUNIT_TEST( testRead );
+  CPPUNIT_TEST( testWrite );
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test commentFlag()
+  void testCommentFlag(void);
+
+  /// Test fieldWidth()
+  void testFieldWidth(void);
+
+  /// Test precision()
+  void testPrecision(void);
+
+  /// Test read()
+  void testRead(void);
+
+  /// Test write()
+  void testWrite(void);
+
+  // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+  static const double _POINTS[]; ///< Array of points
+  static const int _NUMPTS; ///< Number of points
+  static const int _NUMDIMS; ///< Number of dimensions
+
+}; // class TestPointsStream
+
+#endif // spatialdata_utils_testconverter_hh
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/tests/libtests/utils/data/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/utils/data/Makefile.am	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/utils/data/Makefile.am	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,19 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+noinst_HEADERS = \
+	TestPointsStream.dat
+
+# 'export' the input files by performing a mock install
+export_datadir = $(top_builddir)/tests/libtests/utils/data
+
+# End of file 

Added: cs/spatialdata-0.1/trunk/tests/libtests/utils/data/TestPointsStream.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/utils/data/TestPointsStream.dat	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/utils/data/TestPointsStream.dat	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+const double spatialdata::utils::TestPointsStream::_POINTS[] = {
+  1.0, 2.0, 3.0,
+  1.1, 2.1, 3.1,
+  1.2, 2.2, 3.2,
+  1.3, 2.3, 3.3
+};
+
+const int spatialdata::utils::TestPointsStream::_NUMPTS = 4;
+const int spatialdata::utils::TestPointsStream::_NUMDIMS = 3;
+
+// End of file

Added: cs/spatialdata-0.1/trunk/tests/libtests/utils/testutils.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/utils/testutils.cc	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/libtests/utils/testutils.cc	2006-07-26 00:39:45 UTC (rev 4106)
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TextOutputter.h>
+
+int
+main(int argc,
+     char* argv[])
+{ // main
+  // Create event manager and test controller
+  CppUnit::TestResult controller;
+
+  // Add listener to collect test results
+  CppUnit::TestResultCollector result;
+  controller.addListener(&result);
+
+  // Add listener to show progress as tests run
+  CppUnit::BriefTestProgressListener progress;
+  controller.addListener(&progress);
+
+  // Add top suite to test runner
+  CppUnit::TestRunner runner;
+  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+  runner.run(controller);
+
+  // Print tests
+  CppUnit::TextOutputter outputter(&result, std::cerr);
+  outputter.write();
+
+  return (result.wasSuccessful() ? 0 : 1);
+} // main
+
+// version
+// $Id$
+
+// End of file

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -13,7 +13,7 @@
 import unittest
 
 import numpy as numeric
-import spatialdata.utils.utils as simplearray
+import spatialdata.utils.simplearray as simplearray
 from spatialdata.geocoords.CSCart import CSCart
 
 class TestSpatialDB(unittest.TestCase):

Modified: cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py	2006-07-26 00:39:45 UTC (rev 4106)
@@ -13,7 +13,7 @@
 import unittest
 
 import numpy as numeric
-import spatialdata.utils.utils as simplearray
+import spatialdata.utils.simplearray as simplearray
 
 class TestSimpleArray(unittest.TestCase):
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/utils/testcpp.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/testcpp.pyxe	2006-07-26 00:38:10 UTC (rev 4105)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/testcpp.pyxe	2006-07-26 00:39:45 UTC (rev 4106)
@@ -26,15 +26,14 @@
       (*ppData)[i] = pVals[i];
   #}embed
 
-  #import spatialdata.utils.utils as simplearray
-  import utils as simplearray
+  import spatialdata.utils.simplearray
 
   cdef double* pData
   cdef int size
   pData = NULL
   cpparray_create(&pData, &size)
   dims = [2, 3]
-  return simplearray.SimpleCppArray(<object> pData, dims, "double")
+  return spatialdata.utils.simplearray.SimpleCppArray(<object> pData, dims, "double")
 
 
 def test(sarray):



More information about the cig-commits mailing list