[cig-commits] r3978 - in cs/spatialdata-0.1/trunk: libsrc/geocoords
modulesrc/geocoords spatialdata/geocoords tests/pytests/geocoords
baagaard at geodynamics.org
baagaard at geodynamics.org
Thu Jul 6 16:58:43 PDT 2006
Author: baagaard
Date: 2006-07-06 16:58:43 -0700 (Thu, 06 Jul 2006)
New Revision: 3978
Modified:
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.icc
cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py
cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py
cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py
cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py
cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py
cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py
Log:
Worked on geocoords. Made Python tests more rigorous and fixed some bugs.
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc 2006-07-06 23:58:43 UTC (rev 3978)
@@ -65,17 +65,21 @@
} // copy constructor
// ----------------------------------------------------------------------
-// Set origin of local cartesian coordinate system.
+// Get origin of local cartesian coordinate system.
void
-spatialdata::geocoords::CSGeoLocalCart::origin(const double lon,
- const double lat,
- const double elev)
+spatialdata::geocoords::CSGeoLocalCart::origin(double* pLon,
+ double* pLat,
+ double* pElev)
{ // origin
- _originLon = lon;
- _originLat = lat;
- _originElev = elev;
+ assert(0 != pLon);
+ assert(0 != pLat);
+ assert(0 != pElev);
+ *pLon = _originLon;
+ *pLat = _originLat;
+ *pElev = _originElev;
} // origin
+
// ----------------------------------------------------------------------
// Initialize the coordinate system.
void
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh 2006-07-06 23:58:43 UTC (rev 3978)
@@ -66,6 +66,16 @@
const double lat,
const double elev);
+ /** Get origin of local cartesian coordinate system.
+ *
+ * @param pLon Pointer to longitude of origin (degrees)
+ * @param pLat Pointer to latitude of origin (degrees)
+ * @param pElev Pointer to elevation (wrt vertical datum) of origin
+ */
+ void origin(double* pLon,
+ double* pLat,
+ double* pElev);
+
/** Get proj form vertical datum.
*
* @returns Name of datum
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.icc 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.icc 2006-07-06 23:58:43 UTC (rev 3978)
@@ -28,6 +28,17 @@
return "ellipsoid";
}
+// Set origin of local cartesian coordinate system.
+inline
+void
+spatialdata::geocoords::CSGeoLocalCart::origin(const double lon,
+ const double lat,
+ const double elev) {
+ _originLon = lon;
+ _originLat = lat;
+ _originElev = elev;
+}
+
// version
// $Id$
Modified: cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe 2006-07-06 23:58:43 UTC (rev 3978)
@@ -245,6 +245,17 @@
CSGeoLocalCart_origin(self.thisptr, lon, lat, elev)
+ def getOrigin(self):
+ """Get origin of local cartesian coordinate system."""
+ # create shim for method 'origin'
+ #embed{ void CSGeoLocalCart_getOrigin(void* pObj, double* pLon, double* pLat, double* pElev)
+ ((spatialdata::geocoords::CSGeoLocalCart*) pObj)->origin(pLon, pLat, pElev);
+ #}embed
+ cdef double lon, lat, elev
+ CSGeoLocalCart_getOrigin(self.thisptr, &lon, &lat, &elev)
+ return (lon, lat, elev)
+
+
# ----------------------------------------------------------------------
cdef class CSGeoProj(CSGeo):
Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py 2006-07-06 23:58:43 UTC (rev 3978)
@@ -45,7 +45,7 @@
"""Initialize coordinate system."""
self.projector.initialize(self)
- self.cppHandle.projector = self.projector.cppHandle.handle
+ self.cppHandle.projector = self.projector.cppHandle
CSGeo.initialize(self)
return
Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py 2006-07-06 23:58:43 UTC (rev 3978)
@@ -19,6 +19,9 @@
cs = CSCart()
cs.units = "km"
cs.initialize()
+
+ self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
+
return
# version
Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py 2006-07-06 23:58:43 UTC (rev 3978)
@@ -22,6 +22,13 @@
cs.datumVert = "mean sea level"
cs.units = "km"
cs.initialize()
+
+ self.assertEqual(cs.ellipsoid, cs.cppHandle.ellipsoid)
+ self.assertEqual(cs.datumHoriz, cs.cppHandle.datumHoriz)
+ self.assertEqual(cs.datumVert, cs.cppHandle.datumVert)
+ self.assertEqual(cs.isGeocentric, cs.isGeocentric)
+ self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
+
return
# version
Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py 2006-07-06 23:58:43 UTC (rev 3978)
@@ -26,6 +26,18 @@
cs.datumVert = "mean sea level"
cs.units = "km"
cs.initialize()
+
+ self.assertEqual(cs.ellipsoid, cs.cppHandle.ellipsoid)
+ self.assertEqual(cs.datumHoriz, cs.cppHandle.datumHoriz)
+ self.assertEqual(cs.datumVert, cs.cppHandle.datumVert)
+ self.assertEqual(True, cs.isGeocentric)
+ self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
+
+ (lon, lat, elev) = cs.cppHandle.getOrigin()
+ self.assertAlmostEqual(cs.originLon, lon, 6)
+ self.assertAlmostEqual(cs.originLat, lat, 6)
+ self.assertAlmostEqual(cs.originElev.value, elev, 6)
+
return
# version
Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py 2006-07-06 23:58:43 UTC (rev 3978)
@@ -17,6 +17,9 @@
def test_initialize(self):
from spatialdata.geocoords.Projector import Projector
proj = Projector()
+ proj.projection = "aea"
+ proj.units = "m"
+ proj.projOptions = ""
proj.falseEasting = -100.0
proj.falseNorthing = 30.0
proj.scaleFactor = 0.9995
@@ -28,7 +31,14 @@
cs.datumVert = "mean sea level"
cs.units = "km"
cs.projector = proj
+ cs.initialize()
+ self.assertEqual(cs.ellipsoid, cs.cppHandle.ellipsoid)
+ self.assertEqual(cs.datumHoriz, cs.cppHandle.datumHoriz)
+ self.assertEqual(cs.datumVert, cs.cppHandle.datumVert)
+ self.assertEqual(cs.isGeocentric, cs.isGeocentric)
+ self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
+
return
# version
Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py 2006-07-06 23:20:42 UTC (rev 3977)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py 2006-07-06 23:58:43 UTC (rev 3978)
@@ -46,6 +46,12 @@
def test_initialize(self):
self.projector.initialize(self.cs)
+
+ proj = self.projector
+ self.assertEqual(proj.projection, proj.cppHandle.projection)
+ self.assertEqual(proj.units, proj.cppHandle.units)
+ self.assertEqual(proj.projOptions, proj.cppHandle.projOptions)
+
return
More information about the cig-commits
mailing list