[cig-commits] r5629 - in cs/spatialdata-0.1/trunk: .
libsrc/geocoords libsrc/spatialdb modulesrc/geocoords
modulesrc/spatialdb modulesrc/spatialdb/generator
modulesrc/utils tests/libtests/geocoords tests/libtests/spatialdb
brad at geodynamics.org
brad at geodynamics.org
Mon Jan 1 13:05:25 PST 2007
Author: brad
Date: 2007-01-01 13:05:23 -0800 (Mon, 01 Jan 2007)
New Revision: 5629
Added:
cs/spatialdata-0.1/trunk/CHANGES
Modified:
cs/spatialdata-0.1/trunk/README
cs/spatialdata-0.1/trunk/TODO
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.cc
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.hh
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.cc
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh
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/CSGeoProj.cc
cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.hh
cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc
cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh
cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh
cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh
cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh
cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h
cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h
cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe
cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe
cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe
cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeo.cc
cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoLocalCart.cc
cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoProj.cc
cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestConverter.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h
Log:
Eliminated use of pointers to pointers when passing around arrays when just a pointer will do. Makes user interface cleaner.
Added: cs/spatialdata-0.1/trunk/CHANGES
===================================================================
--- cs/spatialdata-0.1/trunk/CHANGES 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/CHANGES 2007-01-01 21:05:23 UTC (rev 5629)
@@ -0,0 +1,8 @@
+2007/01/01
+
+ Changed interface so that it no longer uses pointers to pointers
+ when passing arrays as arugments. You now pass just a pointer to
+ where the values are to be stored. This makes the user interface
+ cleaner.
+
+ Numpy version >= 1.0 is now required (previous changeset).
Modified: cs/spatialdata-0.1/trunk/README
===================================================================
--- cs/spatialdata-0.1/trunk/README 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/README 2007-01-01 21:05:23 UTC (rev 5629)
@@ -42,7 +42,7 @@
* @li Proj.4 cartographic projections library (http://proj.maptools.org)
*
* @section ops Optional software
- * @li pythia-0.8
+ * @li pythia-0.8 and NumPy (>= 1.0)
* @li CppUnit (for regression testing)
*
* @section notes Notes
Modified: cs/spatialdata-0.1/trunk/TODO
===================================================================
--- cs/spatialdata-0.1/trunk/TODO 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/TODO 2007-01-01 21:05:23 UTC (rev 5629)
@@ -1,3 +1,8 @@
+pytests are failing on Brad's Mac with numpy-0.9.8. Try updating to
+numpy-1.0 (simplearray was made compatible? with 1.0 on Brad's linux
+machine).
+
+
UTILS
Ignore comment lines in PointsStream.
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -12,7 +12,6 @@
#include <portinfo>
-#include "CoordSys.hh" // ISA Coordsys
#include "CSCart.hh" // implementation of class methods
#include <iostream> // USES std::istream, std::ostream
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSCart.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -20,6 +20,8 @@
#if !defined(spatialdata_geocoords_cscart_hh)
#define spatialdata_geocoords_cscart_hh
+#include "CoordSys.hh" // ISA CoordSys
+
namespace spatialdata {
namespace geocoords {
class CSCart;
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -12,16 +12,15 @@
#include <portinfo>
-#include "CoordSys.hh" // ISA Coordsys
#include "CSGeo.hh" // implementation of class methods
#include "Geoid.hh" // USES Geoid
#include <math.h> // USES M_PI
+#include <sstream> // USES std::ostringsgream
#include <iostream> // USES std::istream, std::ostream
#include <stdexcept> // USES std::runtime_error, std::exception
-#include <sstream> // USES std::ostringsgream
extern "C" {
#include "proj_api.h" // USES PROJ4
@@ -44,7 +43,8 @@
// Default destructor
spatialdata::geocoords::CSGeo::~CSGeo(void)
{ // destructor
- pj_free(_pCS);
+ if (0 != _pCS)
+ pj_free(_pCS);
_pCS = 0;
} // destructor
@@ -66,14 +66,18 @@
void
spatialdata::geocoords::CSGeo::initialize(void)
{ // initialize
- pj_free(_pCS);
- std::string csString = _projCSString();
- _pCS = pj_init_plus(csString.c_str());
+ if (0 != _pCS) {
+ pj_free(_pCS);
+ _pCS = 0;
+ } // if
+ assert(0 == _pCS);
+ const std::string& projString = _projCSString();
+ _pCS = pj_init_plus(projString.c_str());
if (0 == _pCS) {
std::ostringstream msg;
msg << "Error while initializing coordinate system:\n"
<< " " << pj_strerrno(pj_errno) << "\n"
- << " proj string: " << csString << "\n";
+ << " proj string: " << _projCSString() << "\n";
throw std::runtime_error(msg.str());
} // if
} // initialize
@@ -81,10 +85,12 @@
// ----------------------------------------------------------------------
// Convert coordinates to PROJ4 useable form.
void
-spatialdata::geocoords::CSGeo::toProjForm(double** ppCoords,
+spatialdata::geocoords::CSGeo::toProjForm(double* coords,
const int numLocs,
bool is2D) const
{ // toProjForm
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords) );
if (!_isGeocentric) {
// convert deg to rad
const int numCoords = (is2D) ? 2 : 3;
@@ -92,28 +98,30 @@
const double degToRad = M_PI / 180.0;
for (int i=0; i < size; i += numCoords) {
- (*ppCoords)[i ] *= degToRad;
- (*ppCoords)[i+1] *= degToRad;
+ coords[i ] *= degToRad;
+ coords[i+1] *= degToRad;
} // for
if (!is2D && _toMeters != 1.0)
for (int i=2; i < size; i += numCoords)
- (*ppCoords)[i] *= _toMeters;
+ coords[i] *= _toMeters;
} else {
const int numCoords = (is2D) ? 2 : 3;
const int size = numCoords * numLocs;
for (int i=0; i < size; ++i)
- (*ppCoords)[i] *= _toMeters;
+ coords[i] *= _toMeters;
} // else
} // toProjForm
// ----------------------------------------------------------------------
// Convert coordinates from PROJ4 form to form associated w/coordsys.
void
-spatialdata::geocoords::CSGeo::fromProjForm(double** ppCoords,
+spatialdata::geocoords::CSGeo::fromProjForm(double* coords,
const int numLocs,
bool is2D) const
{ // fromProjForm
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords) );
if (!_isGeocentric) {
// convert rad to deg
const int numCoords = (is2D) ? 2 : 3;
@@ -121,24 +129,24 @@
const double radToDeg = 180.0 / M_PI;
for (int i=0; i < size; i += numCoords) {
- (*ppCoords)[i ] *= radToDeg;
- (*ppCoords)[i+1] *= radToDeg;
+ coords[i ] *= radToDeg;
+ coords[i+1] *= radToDeg;
} // for
if (!is2D && _toMeters != 1.0)
for (int i=2; i < size; i += numCoords)
- (*ppCoords)[i] /= _toMeters;
+ coords[i] /= _toMeters;
} else {
const int numCoords = (is2D) ? 2 : 3;
const int size = numCoords * numLocs;
for (int i=0; i < size; ++i)
- (*ppCoords)[i] /= _toMeters;
+ coords[i] /= _toMeters;
} // else
} // fromProjForm
// ----------------------------------------------------------------------
// Get the PROJ4 string associated with the coordinate system.
-std::string
+std::string
spatialdata::geocoords::CSGeo::_projCSString(void) const
{ // _projCSString
// The common proj form uses meters so proj units are meters
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -20,6 +20,8 @@
#if !defined(spatialdata_geocoords_csgeo_hh)
#define spatialdata_geocoords_csgeo_hh
+#include "CoordSys.hh" // ISA CoordSys
+
namespace spatialdata {
namespace geocoords {
class CSGeo;
@@ -128,21 +130,21 @@
/** Convert coordinates to PROJ4 useable form.
*
- * @param ppCoords Pointer to array of coordinates [#locs*3]
+ * @param coords Array of coordinates [#locs*3]
* @param numLocs Number of locations
* @param is2D True if coordinates are 2D, false if 3D
*/
- virtual void toProjForm(double** ppCoords,
+ virtual void toProjForm(double* coords,
const int numLocs,
bool is2D) const;
/** Convert coordinates from PROJ4 form to form associated w/coordsys.
*
- * @param ppCoords Pointer to array of coordinates [#locs*3]
+ * @param coords Array of coordinates [#locs*3]
* @param numLocs Number of locations
* @param is2D True if coordinates are 2D, false if 3D
*/
- virtual void fromProjForm(double** ppCoords,
+ virtual void fromProjForm(double* coords,
const int numLocs,
bool is2D) const;
/** Get geoid.
@@ -172,15 +174,12 @@
*/
CSGeo(const CSGeo& cs);
-protected :
- // PROTECTED MEMBERS /////////////////////////////////////////////////
-
/** Get the PROJ4 string associated with the coordinate system.
*
* @returns string
*/
virtual std::string _projCSString(void) const;
-
+
private :
// PRIVATE MEMBERS ////////////////////////////////////////////////////
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -12,8 +12,6 @@
#include <portinfo>
-#include "CoordSys.hh" // ISA CoordSysGeo
-#include "CSGeo.hh" // implementation of class methods
#include "CSGeoLocalCart.hh" // implementation of class methods
extern "C" {
@@ -177,29 +175,30 @@
// ----------------------------------------------------------------------
// Convert coordinates to PROJ4 useable form.
void
-spatialdata::geocoords::CSGeoLocalCart::toProjForm(double** ppCoords,
+spatialdata::geocoords::CSGeoLocalCart::toProjForm(double* coords,
const int numLocs,
bool is2D) const
{ // toProjForm
- assert(0 != ppCoords);
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords));
assert(0 != _localOrientation);
const double scale = toMeters();
for (int iLoc=0, index=0; iLoc < numLocs; ++iLoc) {
// add origin to old to invert
- const double xOld = (*ppCoords)[index ]*scale + _originX;
- const double yOld = (*ppCoords)[index+1]*scale + _originY;
- const double zOld = (*ppCoords)[index+2]*scale + _originZ;
+ const double xOld = coords[index ]*scale + _originX;
+ const double yOld = coords[index+1]*scale + _originY;
+ const double zOld = coords[index+2]*scale + _originZ;
// multiply by transpose of direction cosines to invert
- (*ppCoords)[index++] =
+ coords[index++] =
_localOrientation[0]*xOld +
_localOrientation[3]*yOld +
_localOrientation[6]*zOld;
- (*ppCoords)[index++] =
+ coords[index++] =
_localOrientation[1]*xOld +
_localOrientation[4]*yOld +
_localOrientation[7]*zOld;
- (*ppCoords)[index++] =
+ coords[index++] =
_localOrientation[2]*xOld +
_localOrientation[5]*yOld +
_localOrientation[8]*zOld;
@@ -209,26 +208,27 @@
// ----------------------------------------------------------------------
// Convert coordinates from PROJ4 form to form associated w/coordsys.
void
-spatialdata::geocoords::CSGeoLocalCart::fromProjForm(double** ppCoords,
+spatialdata::geocoords::CSGeoLocalCart::fromProjForm(double* coords,
const int numLocs,
bool is2D) const
{ // fromProjForm
- assert(0 != ppCoords);
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords) );
assert(0 != _localOrientation);
for (int iLoc=0, index=0; iLoc < numLocs; ++iLoc) {
- const double xOld = (*ppCoords)[index ];
- const double yOld = (*ppCoords)[index+1];
- const double zOld = (*ppCoords)[index+2];
- (*ppCoords)[index++] =
+ const double xOld = coords[index ];
+ const double yOld = coords[index+1];
+ const double zOld = coords[index+2];
+ coords[index++] =
_localOrientation[0]*xOld +
_localOrientation[1]*yOld +
_localOrientation[2]*zOld - _originX;
- (*ppCoords)[index++] =
+ coords[index++] =
_localOrientation[3]*xOld +
_localOrientation[4]*yOld +
_localOrientation[5]*zOld - _originY;
- (*ppCoords)[index++] =
+ coords[index++] =
_localOrientation[6]*xOld +
_localOrientation[7]*yOld +
_localOrientation[8]*zOld - _originZ;
@@ -238,7 +238,7 @@
const int size = numLocs * numCoords;
const double scale = toMeters();
for (int i=0; i < size; ++i)
- (*ppCoords)[i] /= scale;
+ coords[i] /= scale;
} // fromProjForm
// ----------------------------------------------------------------------
@@ -253,10 +253,12 @@
{ // _geoToWGS84
assert(0 != pLonWGS84);
assert(0 != pLatWGS84);
+ assert(0 != ellipsoid);
+ assert(0 != datumHoriz);
// convert lon/lat in rad to lon/lat in rad in WGS84
if (0 != strcasecmp(datumHoriz, "WGS84") ||
- 0 != strcasecmp(ellipsoid, "WGS84")) {
+ 0 != strcasecmp(ellipsoid, "WGS84")) {
std::ostringstream projString;
projString
<< "+proj=latlong"
@@ -354,10 +356,9 @@
std::string
spatialdata::geocoords::CSGeoLocalCart::_projCSString(void) const
{ // _projCSString
- const char* projString =
- "+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m";
- return std::string(projString);
-} // initialize
+ const char* args = "+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m";
+ return std::string(args);
+} // _projCSString
// ----------------------------------------------------------------------
// Pickle coordinate system to ascii stream.
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -20,6 +20,8 @@
#if !defined(spatialdata_geocoords_csgeolocalcart_hh)
#define spatialdata_geocoords_csgeolocalcart_hh
+#include "CSGeo.hh" // ISA CSGeo
+
namespace spatialdata {
namespace geocoords {
class CSGeoLocalCart;
@@ -84,21 +86,21 @@
/** Convert coordinates to PROJ4 useable form.
*
- * @param ppCoords Pointer to array of coordinates [#locs*3]
+ * @param coords Array of coordinates [#locs*3]
* @param numLocs Number of locations
* @param is2D True if coordinates are 2D, false if 3D
*/
- void toProjForm(double** ppCoords,
+ void toProjForm(double* coords,
const int numLocs,
bool is2D =false) const;
/** Convert coordinates from PROJ4 form to form associated w/coordsys.
*
- * @param ppCoords Pointer to array of coordinates [#locs*3]
+ * @param coords Array of coordinates [#locs*3]
* @param numLocs Number of locations
* @param is2D True if coordinates are 2D, false if 3D
*/
- void fromProjForm(double** ppCoords,
+ void fromProjForm(double* coords,
const int numLocs,
bool is2D =false) const;
@@ -128,7 +130,7 @@
* @returns string
*/
std::string _projCSString(void) const;
-
+
private :
// PRIVATE METHODS ///////////////////////////////////////////////////
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -12,8 +12,6 @@
#include <portinfo>
-#include "CoordSys.hh" // ISA CoordSysGeo
-#include "CSGeo.hh" // implementation of class methods
#include "CSGeoProj.hh" // implementation of class methods
#include "Projector.hh" // USES Projector
@@ -70,10 +68,12 @@
// ----------------------------------------------------------------------
// Convert coordinates to PROJ4 useable form.
void
-spatialdata::geocoords::CSGeoProj::toProjForm(double** ppCoords,
+spatialdata::geocoords::CSGeoProj::toProjForm(double* coords,
const int numLocs,
bool is2D) const
{ // toProjForm
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords));
assert(0 != _pProjector);
const int numCoords = (is2D) ? 2 : 3;
@@ -81,33 +81,35 @@
for (int i=0; i < size; i += numCoords) {
double lon = 0;
double lat = 0;
- _pProjector->invproject(&lon, &lat, (*ppCoords)[i ], (*ppCoords)[i+1]);
- (*ppCoords)[i ] = lon;
- (*ppCoords)[i+1] = lat;
+ _pProjector->invproject(&lon, &lat, coords[i ], coords[i+1]);
+ coords[i ] = lon;
+ coords[i+1] = lat;
} // for
- CSGeo::toProjForm(ppCoords, numLocs, is2D);
+ CSGeo::toProjForm(coords, numLocs, is2D);
} // toProjForm
// ----------------------------------------------------------------------
// Convert coordinates from PROJ4 form to form associated w/coordsys.
void
-spatialdata::geocoords::CSGeoProj::fromProjForm(double** ppCoords,
+spatialdata::geocoords::CSGeoProj::fromProjForm(double* coords,
const int numLocs,
bool is2D) const
{ // fromProjForm
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords));
assert(0 != _pProjector);
- CSGeo::fromProjForm(ppCoords, numLocs, is2D);
+ CSGeo::fromProjForm(coords, numLocs, is2D);
const int numCoords = (is2D) ? 2 : 3;
const int size = numCoords * numLocs;
for (int i=0; i < size; i += numCoords) {
double x = 0;
double y = 0;
- _pProjector->project(&x, &y, (*ppCoords)[i ], (*ppCoords)[i+1]);
- (*ppCoords)[i ] = x;
- (*ppCoords)[i+1] = y;
+ _pProjector->project(&x, &y, coords[i ], coords[i+1]);
+ coords[i ] = x;
+ coords[i+1] = y;
} // for
} // fromProjForm
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -20,6 +20,8 @@
#if !defined(spatialdata_geocoords_csgeoproj_hh)
#define spatialdata_geocoords_csgeoproj_hh
+#include "CSGeo.hh" // ISA CSGeo
+
namespace spatialdata {
namespace geocoords {
class CSGeoProj;
@@ -62,21 +64,21 @@
/** Convert coordinates to PROJ4 useable form.
*
- * @param ppCoords Pointer to array of coordinates [#locs*3]
+ * @param coords Array of coordinates [#locs*3]
* @param numLocs Number of locations
* @param is2D True if coordinates are 2D, false if 3D
*/
- void toProjForm(double** ppCoords,
+ void toProjForm(double* coords,
const int numLocs,
bool is2D =false) const;
/** Convert coordinates from PROJ4 form to form associated w/coordsys.
*
- * @param ppCoords Pointer to array of coordinates [#locs*3]
+ * @param coords Array of coordinates [#locs*3]
* @param numLocs Number of locations
* @param is2D True if coordinates are 2D, false if 3D
*/
- void fromProjForm(double** ppCoords,
+ void fromProjForm(double* coords,
const int numLocs,
bool is2D =false) const;
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -32,14 +32,14 @@
// Convert coordinates from source coordinate system to destination
// coordinate system.
void
-spatialdata::geocoords::Converter::convert(double** ppCoords,
+spatialdata::geocoords::Converter::convert(double* coords,
const int numLocs,
const CoordSys* pCSDest,
const CoordSys* pCSSrc,
bool is2D)
{ // convert
- assert(0 != ppCoords);
- assert(0 != *ppCoords);
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords));
assert(0 != pCSDest);
assert(0 != pCSSrc);
@@ -53,14 +53,14 @@
{ // GEOGRAPHIC
const CSGeo* pGeoDest = dynamic_cast<const CSGeo*>(pCSDest);
const CSGeo* pGeoSrc = dynamic_cast<const CSGeo*>(pCSSrc);
- _convert(ppCoords, numLocs, *pGeoDest, *pGeoSrc, is2D);
+ _convert(coords, numLocs, *pGeoDest, *pGeoSrc, is2D);
break;
} // GEOGRAPHIC
case spatialdata::geocoords::CoordSys::CARTESIAN :
{ // GEOGRAPHIC
const CSCart* pCartDest = dynamic_cast<const CSCart*>(pCSDest);
const CSCart* pCartSrc = dynamic_cast<const CSCart*>(pCSSrc);
- _convert(ppCoords, numLocs, *pCartDest, *pCartSrc, is2D);
+ _convert(coords, numLocs, *pCartDest, *pCartSrc, is2D);
break;
} // GEOGRAPHIC
default :
@@ -72,21 +72,21 @@
// Convert coordinates from source geographic coordinate system to
// destination geographic coordinate system.
void
-spatialdata::geocoords::Converter::_convert(double** ppCoords,
+spatialdata::geocoords::Converter::_convert(double* coords,
const int numLocs,
const CSGeo& csDest,
const CSGeo& csSrc,
bool is2D)
{ // convert
- assert(0 != ppCoords);
- assert(0 != *ppCoords);
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords));
- csSrc.toProjForm(ppCoords, numLocs, is2D);
+ csSrc.toProjForm(coords, numLocs, is2D);
const int numCoords = is2D ? 2 : 3;
- double* pX = (*ppCoords) + 0; // lon
- double* pY = (*ppCoords) + 1; // lat
- double* pZ = (is2D) ? 0 : (*ppCoords) + 2;
+ double* pX = coords + 0; // lon
+ double* pY = coords + 1; // lat
+ double* pZ = (is2D) ? 0 : coords + 2;
const char* srcDatumVert = csSrc.projDatumVert();
const char* destDatumVert = csDest.projDatumVert();
@@ -127,8 +127,8 @@
const int size = numLocs * numCoords;
for (int i=0; i < size; i+=3) {
const double geoidHt =
- CSGeo::geoid().elevation((*ppCoords)[i], (*ppCoords)[i+1]);
- (*ppCoords)[i+2] += (isMSLToWGS84) ? geoidHt : -geoidHt;
+ CSGeo::geoid().elevation(coords[i], coords[i+1]);
+ coords[i+2] += (isMSLToWGS84) ? geoidHt : -geoidHt;
} // for
pjerrno = pj_transform(csWGS84, csDest.projCoordSys(),
@@ -153,27 +153,27 @@
} // if
} // else
- csDest.fromProjForm(ppCoords, numLocs, is2D);
+ csDest.fromProjForm(coords, numLocs, is2D);
} // convert
// ----------------------------------------------------------------------
// Convert coordinates from source Cartesian coordinate system to
// destination Cartesian coordinate system.
void
-spatialdata::geocoords::Converter::_convert(double** ppCoords,
+spatialdata::geocoords::Converter::_convert(double* coords,
const int numLocs,
const CSCart& csDest,
const CSCart& csSrc,
bool is2D)
{ // convert
- assert(0 != ppCoords);
- assert(0 != *ppCoords);
+ assert( (0 < numLocs && 0 != coords) ||
+ (0 == numLocs && 0 == coords));
const int numCoords = is2D ? 2 : 3;
const int size = numLocs*numCoords;
const double scale = csSrc.toMeters() / csDest.toMeters();
for (int i=0; i < size; ++i)
- (*ppCoords)[i] *= scale;
+ coords[i] *= scale;
} // convert
// version
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -38,13 +38,13 @@
/** Convert coordinates from source coordinate system to destination
* coordinate system.
*
- * @param ppCoords Pointer to array of coordinates
+ * @param coords Array of coordinates
* @param numLocs Number of location
* @param pCSDest Pointer to destination coordinate system
* @param pCSSrc Pointer to source coordinate system
* @param is2D True if 2D, false if 3D
*/
- static void convert(double** ppCoords,
+ static void convert(double* coords,
const int numLocs,
const CoordSys* pCSDest,
const CoordSys* pCSSrc,
@@ -56,13 +56,13 @@
/** Convert coordinates from source geographic coordinate system to
* destination geographic coordinate system.
*
- * @param ppCoords Pointer to array of coordinates
+ * @param coords Array of coordinates
* @param numLocs Number of location
* @param csDest Destination coordinate system
* @param csSrc Source coordinate system
* @param is2D True if 2D, false if 3D
*/
- static void _convert(double** ppCoords,
+ static void _convert(double* coords,
const int numLocs,
const CSGeo& csDest,
const CSGeo& csSrc,
@@ -71,13 +71,13 @@
/** Convert coordinates from source Cartesian coordinate system to
* destination Cartesian coordinate system.
*
- * @param ppCoords Pointer to array of coordinates
+ * @param coords Array of coordinates
* @param numLocs Number of location
* @param csDest Destination coordinate system
* @param csSrc Source coordinate system
* @param is2D True if 2D, false if 3D
*/
- static void _convert(double** ppCoords,
+ static void _convert(double* coords,
const int numLocs,
const CSCart& csDest,
const CSCart& csSrc,
Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -24,7 +24,7 @@
#include <iostream> // USES std::istream, std::ostream
#include <stdexcept> // USES std::runtime_error, std::exception
-#include <sstream> // USES std::ostringsgream
+#include <sstream> // USES std::ostringstream
#include <assert.h> // USES assert()
// ----------------------------------------------------------------------
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -131,7 +131,7 @@
// ----------------------------------------------------------------------
// Query the database.
int
-spatialdata::spatialdb::SimpleDB::query(double** pVals,
+spatialdata::spatialdb::SimpleDB::query(double* vals,
const int numVals,
const double x,
const double y,
@@ -153,9 +153,9 @@
<< "Database query aborted.";
throw std::runtime_error(msg.str());
} // if
- _pQuery->query(pVals, numVals, x, y, z, pCSQuery);
+ _pQuery->query(vals, numVals, x, y, z, pCSQuery);
} catch(const OutOfBounds& err) {
- std::fill(*pVals, *pVals+numVals, 0);
+ std::fill(vals, vals+numVals, 0);
return 1;
} catch(std::exception& err) {
throw std::runtime_error(err.what());
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -83,7 +83,7 @@
/** Set values to be returned by queries.
*
- * @pre Must call Open() before QueryVals()
+ * @pre Must call open() before queryVals()
*
* @param names Names of values to be returned in queries
* @param numVals Number of values to be returned in queries
@@ -99,9 +99,10 @@
/** Query the database.
*
- * @pre Must call Open() before Query()
+ * @pre Must call open() before query()
*
- * @param pVals Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query), vals
+ * must be allocated BEFORE calling query().
* @param numVals Number of values expected (size of pVals array)
* @param x X coordinate of location for query
* @param y Y coordinate of location for query
@@ -111,7 +112,7 @@
* @returns 0 on success, 1 on failure (i.e., could not interpolate
* so values set to 0)
*/
- int query(double** pVals,
+ int query(double* vals,
const int numVals,
const double x,
const double y,
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -100,7 +100,7 @@
// ----------------------------------------------------------------------
// Query the database.
void
-spatialdata::spatialdb::SimpleDBQuery::query(double** pVals,
+spatialdata::spatialdb::SimpleDBQuery::query(double* vals,
const int numVals,
const double x,
const double y,
@@ -125,23 +125,22 @@
} // if
const int numLocs = 1;
- double* pCoords = new double[3];
- pCoords[0] = x;
- pCoords[1] = y;
- pCoords[2] = z;
- spatialdata::geocoords::Converter::convert(&pCoords, numLocs, _db._pCS, pCSQuery);
- _q[0] = pCoords[0];
- _q[1] = pCoords[1];
- _q[2] = pCoords[2];
- delete[] pCoords; pCoords = 0;
+ double coords[3];
+ coords[0] = x;
+ coords[1] = y;
+ coords[2] = z;
+ spatialdata::geocoords::Converter::convert(coords, numLocs, _db._pCS, pCSQuery);
+ _q[0] = coords[0];
+ _q[1] = coords[1];
+ _q[2] = coords[2];
switch (_queryType)
{ // switch
case SimpleDB::LINEAR :
- _queryLinear(pVals, numVals);
+ _queryLinear(vals, numVals);
break;
case SimpleDB::NEAREST :
- _queryNearest(pVals, numVals);
+ _queryNearest(vals, numVals);
break;
default :
throw std::runtime_error("Could not find requested query type.");
@@ -151,10 +150,11 @@
// ----------------------------------------------------------------------
// Query database using nearest neighbor algorithm.
void
-spatialdata::spatialdb::SimpleDBQuery::_queryNearest(double** pVals,
+spatialdata::spatialdb::SimpleDBQuery::_queryNearest(double* vals,
const int numVals)
{ // _queryNearest
- assert(0 != pVals);
+ assert( (0 < numVals && 0 != vals) ||
+ (0 == numVals && 0 == vals) );
assert(0 != _db._pData);
assert(numVals == _querySize);
@@ -173,16 +173,17 @@
const double* nearVals = SimpleDBTypes::dataVals(*_db._pData, iNear);
const int querySize = _querySize;
for (int iVal=0; iVal < querySize; ++iVal)
- (*pVals)[iVal] = nearVals[_queryVals[iVal]];
+ vals[iVal] = nearVals[_queryVals[iVal]];
} // _queryNearest
// ----------------------------------------------------------------------
// Query database using linear interpolation algorithm.
void
-spatialdata::spatialdb::SimpleDBQuery::_queryLinear(double** pVals,
+spatialdata::spatialdb::SimpleDBQuery::_queryLinear(double* vals,
const int numVals)
{ // _queryLinear
- assert(0 != pVals);
+ assert( (0 < numVals && 0 != vals) ||
+ (0 == numVals && 0 == vals) );
assert(0 != _db._pData);
assert(numVals == _querySize);
@@ -191,7 +192,7 @@
const double* nearVals = SimpleDBTypes::dataVals(*_db._pData, index);
const int querySize = _querySize;
for (int iVal=0; iVal < querySize; ++iVal)
- (*pVals)[iVal] = nearVals[_queryVals[iVal]];
+ vals[iVal] = nearVals[_queryVals[iVal]];
} else { // else
// Find nearest locations in database
_findNearest();
@@ -210,7 +211,7 @@
const double* locVals = SimpleDBTypes::dataVals(*_db._pData, iLoc);
val += weights[iWt].wt * locVals[_queryVals[iVal]];
} // for
- (*pVals)[iVal] = val;
+ vals[iVal] = val;
} // for
} // else
} // _queryLinear
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -60,14 +60,14 @@
/** Query the database.
*
- * @param pValues Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
* @param x X coordinate of location for query
* @param y Y coordinate of location for query
* @param z Z coordinate of location for query
* @param pCSQuery Coordinate system of coordinates
*/
- void query(double** pVals,
+ void query(double* vals,
const int numVals,
const double x,
const double y,
@@ -91,20 +91,20 @@
* Values at location are equal to values at nearest location in
* database.
*
- * @param pValues Pointer to computed values (output from query)
+ * @param values Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
*/
- void _queryNearest(double** pVals,
+ void _queryNearest(double* vals,
const int numVals);
/** Query database using linear interpolation algorithm.
*
* Values at location are interpolation from locations in database.
*
- * @param pValues Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
*/
- void _queryLinear(double** pVals,
+ void _queryLinear(double* vals,
const int numVals);
/// Find locations in database nearest query location.
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh 2007-01-01 21:05:23 UTC (rev 5629)
@@ -80,7 +80,8 @@
*
* @pre Must call open() before query()
*
- * @param pVals Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query), must be
+ * allocated BEFORE calling query().
* @param numVals Number of values expected (size of pVals array)
* @param x X coordinate of location for query
* @param y Y coordinate of location for query
@@ -89,7 +90,7 @@
*
* @returns 0 on success, 1 on failure (i.e., could not interpolate)
*/
- virtual int query(double** pVals,
+ virtual int query(double* vals,
const int numVals,
const double x,
const double y,
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -25,7 +25,7 @@
extern "C"
int
spatialdb_query(void* db,
- double** pVals,
+ double* vals,
const int numVals,
const double x,
const double y,
@@ -38,7 +38,7 @@
(const spatialdata::geocoords::CoordSys*) cs;
assert(0 != pDB);
assert(0 != pCS);
- return pDB->query(pVals, numVals, x, y, z, pCS);
+ return pDB->query(vals, numVals, x, y, z, pCS);
} // spatialdb_query
// version
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h 2007-01-01 21:05:23 UTC (rev 5629)
@@ -16,7 +16,8 @@
/** Call SpatialDB:Query().
*
* @param db Pointer to SpatialDB
- * @param pVals Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query), must be
+ * allocated BEFORE calling spatialdb_query*()
* @param numVals Number of values expected (size of pVals array)
* @param x C coordinate of location for query
* @param y Y coordinate of location for query
@@ -26,7 +27,7 @@
* @returns 0 on success, 1 on failure (i.e., values not set)
*/
int spatialdb_query(void* db,
- double** pVals,
+ double* vals,
const int numVals,
const double x,
const double y,
@@ -35,7 +36,4 @@
#endif /* spatialdata_cspatialdb_h */
-/* version */
-/* $Id$ */
-
/* End of file */
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -25,7 +25,7 @@
// Call SpatialDB:Query().
extern "C"
void spatialdb_query_f(void* db,
- double* pVals,
+ double* vals,
const int* numVals,
const double* x,
const double* y,
@@ -43,7 +43,7 @@
assert(0 != y);
assert(0 != z);
assert(0 != ok);
- *ok = pDB->query(&pVals, *numVals, *x, *y, *z, pCS);
+ *ok = pDB->query(vals, *numVals, *x, *y, *z, pCS);
} // spatialdb_query_f
// version
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h 2007-01-01 21:05:23 UTC (rev 5629)
@@ -21,7 +21,7 @@
/** Call SpatialDB:Query().
*
* @param db Pointer to SpatialDB
- * @param pVals Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query)
* @param addrF Fortran address used to access values
* @param addrOffset Offset used to access values from Fortran
* @param x Pointer to x coordinate of location for query
@@ -32,7 +32,7 @@
*/
extern "C"
void spatialdb_query_f(void* db,
- double* pVals,
+ double* vals,
const int* numVals,
const double* x,
const double* y,
@@ -42,7 +42,4 @@
#endif /* spatialdata_spatialdb_f77spatialdb_h */
-// version
-// $Id$
-
// End of file
Modified: cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe 2007-01-01 21:05:23 UTC (rev 5629)
@@ -55,7 +55,7 @@
#embed{ void CoordSys_initialize(void* pObj)
((spatialdata::geocoords::CoordSys*) pObj)->initialize();
#}embed
-
+
CoordSys_initialize(self.thisptr)
return
@@ -272,6 +272,9 @@
(spatialdata::geocoords::Projector*) pProjObj;
((spatialdata::geocoords::CSGeoProj*) pObj)->projector(*pProj);
#}embed
+ if not proj.name == "spatialdata_geocoords_Projector":
+ raise TypeError, \
+ "Argument must be extension module type 'Projector'."
CSGeoProj_projector(self.thisptr, ptrFromHandle(proj))
@@ -418,12 +421,12 @@
# ----------------------------------------------------------------------
# create shim for Converter method 'convert'
-#embed{ void CppConverter_convert(double** ppCoords, int numLocs, void* pCSDestObj, void* pCSSrcObj, int is2D)
+#embed{ void CppConverter_convert(double* coords, int numLocs, void* pCSDestObj, void* pCSSrcObj, int is2D)
spatialdata::geocoords::CoordSys* pCSDest =
(spatialdata::geocoords::CoordSys*) pCSDestObj;
spatialdata::geocoords::CoordSys* pCSSrc =
(spatialdata::geocoords::CoordSys*) pCSSrcObj;
-spatialdata::geocoords::Converter::convert(ppCoords, numLocs,
+spatialdata::geocoords::Converter::convert(coords, numLocs,
pCSDest, pCSSrc, is2D);
#}embed
@@ -456,10 +459,9 @@
elif 2 == numCoords:
is2D = 1
- cdef double* pVals
- pVals = <double*> PyCObject_AsVoidPtr(coordsSrc.data)
-
- CppConverter_convert(&pVals, numLocs,
+ cdef double* vals
+ vals = <double*> PyCObject_AsVoidPtr(coordsSrc.data)
+ CppConverter_convert(vals, numLocs,
ptrFromHandle(csDest), ptrFromHandle(csSrc),
is2D)
return
Modified: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe 2007-01-01 21:05:23 UTC (rev 5629)
@@ -156,17 +156,16 @@
(spatialdata::geocoords::CoordSys*) pCSObj;
double* pFilterData = (locCount > 0) ? new double[locCount] : 0;
- double* pVal = new double;
+ double val = 0;
int err = 0;
for (int iLoc=0, index=0; iLoc < locCount; ++iLoc, index += 3) {
- err = pDB->query(&pVal, 1,
+ err = pDB->query(&val, 1,
pLocs[index], pLocs[index+1], pLocs[index+2],
pCS);
if (0 != err)
- *pVal = defaultValue;
- pFilterData[iLoc] = *pVal;
+ val = defaultValue;
+ pFilterData[iLoc] = val;
} // for
- delete pVal; pVal = 0;
if (0 == strcasecmp("add", operand))
for (int iLoc=0; iLoc < locCount; ++iLoc)
pValue[iLoc] += pFilterData[iLoc];
Modified: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe 2007-01-01 21:05:23 UTC (rev 5629)
@@ -122,10 +122,10 @@
def query(self, locs, cs, nvals):
"""Query db to get values at locations."""
# create shim for method 'query'
- #embed{ void SpatialDB_query(void* pObj, double** pVals, int nvals, double x, double y, double z, void* csObj)
+ #embed{ void SpatialDB_query(void* pObj, double* vals, int nvals, double x, double y, double z, void* csObj)
spatialdata::geocoords::CoordSys* pCS =
(spatialdata::geocoords::CoordSys*) csObj;
- ((spatialdata::spatialdb::SpatialDB*) pObj)->query(pVals, nvals, x, y, z,
+ ((spatialdata::spatialdb::SpatialDB*) pObj)->query(vals, nvals, x, y, z,
pCS);
#}embed
@@ -160,7 +160,7 @@
valbuffer = <double*> malloc(nvals*sizeof(double))
for iloc from 0 <= iloc < nlocs:
- SpatialDB_query(self.thisptr, &valbuffer, nvals,
+ SpatialDB_query(self.thisptr, valbuffer, nvals,
pLocs[ncoords*iloc ],
pLocs[ncoords*iloc+1],
pLocs[ncoords*iloc+2], ptrFromHandle(cs))
Modified: cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/modulesrc/utils/simplearray.pyxe 2007-01-01 21:05:23 UTC (rev 5629)
@@ -310,7 +310,6 @@
"""Constuctor."""
SimpleArray.__init__(self)
-
# Array interface version 2 (numpy < 1.0?)
#shape = pyarray.__array_shape__ # Array interface version 2
#typestring = pyarray.__array_typestr__
Modified: cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeo.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeo.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeo.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -113,57 +113,57 @@
const bool is2D = true;
const int numLocs = 4;
const int numCoords = 2;
- const double pCoords[] = { 28.0, 23.0,
+ const double coords[] = { 28.0, 23.0,
42.0, 34.0,
-12.0, 65.7,
64.3, -163.0 };
cs.isGeocentric(true);
const int size = numLocs * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.toProjForm(&pVals, numLocs, is2D);
+ double* vals = new double[size];
+ memcpy(vals, coords, size*sizeof(double));
+ cs.toProjForm(vals, numLocs, is2D);
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/coords[i], tolerance);
cs.isGeocentric(false);
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.toProjForm(&pVals, numLocs, is2D);
+ memcpy(vals, coords, size*sizeof(double));
+ cs.toProjForm(vals, numLocs, is2D);
const double degToRad = M_PI / 180.0;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/(pCoords[i]*degToRad),
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/(coords[i]*degToRad),
tolerance);
- delete[] pVals; pVals = 0;
+ delete[] vals; vals = 0;
} // 2D
{ // 3D
const bool is2D = false;
const int numLocs = 4;
const int numCoords = 3;
- const double pCoords[] = { 28.0, 23.0, 3.4,
+ const double coords[] = { 28.0, 23.0, 3.4,
42.0, 34.0, 3.5,
-12.0, 65.7, 12.6,
64.3, -163.0, -1.5 };
cs.isGeocentric(true);
const int size = numLocs * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.toProjForm(&pVals, numLocs, is2D);
+ double* vals = new double[size];
+ memcpy(vals, coords, size*sizeof(double));
+ cs.toProjForm(vals, numLocs, is2D);
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/coords[i], tolerance);
cs.isGeocentric(false);
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.toProjForm(&pVals, numLocs, is2D);
+ memcpy(vals, coords, size*sizeof(double));
+ cs.toProjForm(vals, numLocs, is2D);
const double degToRad = M_PI / 180.0;
for (int i=0; i < size; i += 3) {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/(pCoords[i]*degToRad),
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/(coords[i]*degToRad),
tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i+1]/(pCoords[i+1]*degToRad),
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i+1]/(coords[i+1]*degToRad),
tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i+2]/pCoords[i+2],
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i+2]/coords[i+2],
tolerance);
} // for
- delete[] pVals; pVals = 0;
+ delete[] vals; vals = 0;
} // 3D
} // testToProjForm
@@ -180,57 +180,57 @@
const bool is2D = true;
const int numLocs = 4;
const int numCoords = 2;
- const double pCoords[] = { 28.0, 23.0,
+ const double coords[] = { 28.0, 23.0,
42.0, 34.0,
-12.0, 65.7,
64.3, -163.0 };
cs.isGeocentric(true);
const int size = numLocs * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.fromProjForm(&pVals, numLocs, is2D);
+ double* vals = new double[size];
+ memcpy(vals, coords, size*sizeof(double));
+ cs.fromProjForm(vals, numLocs, is2D);
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/coords[i], tolerance);
cs.isGeocentric(false);
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.fromProjForm(&pVals, numLocs, is2D);
+ memcpy(vals, coords, size*sizeof(double));
+ cs.fromProjForm(vals, numLocs, is2D);
const double radToDeg = 180.0 / M_PI;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/(pCoords[i]*radToDeg),
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/(coords[i]*radToDeg),
tolerance);
- delete[] pVals; pVals = 0;
+ delete[] vals; vals = 0;
} // 2D
{ // 3D
const bool is2D = false;
const int numLocs = 4;
const int numCoords = 3;
- const double pCoords[] = { 28.0, 23.0, 3.4,
+ const double coords[] = { 28.0, 23.0, 3.4,
42.0, 34.0, 3.5,
-12.0, 65.7, 12.6,
64.3, -163.0, -1.5 };
cs.isGeocentric(true);
const int size = numLocs * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.fromProjForm(&pVals, numLocs, is2D);
+ double* vals = new double[size];
+ memcpy(vals, coords, size*sizeof(double));
+ cs.fromProjForm(vals, numLocs, is2D);
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/coords[i], tolerance);
cs.isGeocentric(false);
- memcpy(pVals, pCoords, size*sizeof(double));
- cs.fromProjForm(&pVals, numLocs, is2D);
+ memcpy(vals, coords, size*sizeof(double));
+ cs.fromProjForm(vals, numLocs, is2D);
const double radToDeg = 180.0 / M_PI;
for (int i=0; i < size; i += 3) {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/(pCoords[i]*radToDeg),
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/(coords[i]*radToDeg),
tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i+1]/(pCoords[i+1]*radToDeg),
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i+1]/(coords[i+1]*radToDeg),
tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i+2]/pCoords[i+2],
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i+2]/coords[i+2],
tolerance);
} // for
- delete[] pVals; pVals = 0;
+ delete[] vals; vals = 0;
} // 3D
} // testFromProjForm
Modified: cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoLocalCart.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoLocalCart.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoLocalCart.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -82,13 +82,13 @@
const int numCoords = 3;
const int size = _NUMLOCS * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, _XYZLOCAL, size*sizeof(double));
- cs.toProjForm(&pVals, _NUMLOCS);
+ double* vals = new double[size];
+ memcpy(vals, _XYZLOCAL, size*sizeof(double));
+ cs.toProjForm(vals, _NUMLOCS);
const double tolerance = 1.0e-6;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/_XYZECEF[i], tolerance);
- delete[] pVals; pVals = 0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/_XYZECEF[i], tolerance);
+ delete[] vals; vals = 0;
} // testToProjForm
// ----------------------------------------------------------------------
@@ -106,13 +106,13 @@
const int numCoords = 3;
const int size = _NUMLOCS * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, _XYZECEF, size*sizeof(double));
- cs.fromProjForm(&pVals, _NUMLOCS);
+ double* vals = new double[size];
+ memcpy(vals, _XYZECEF, size*sizeof(double));
+ cs.fromProjForm(vals, _NUMLOCS);
const double tolerance = 1.0e-6;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/_XYZLOCAL[i], tolerance);
- delete[] pVals; pVals = 0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/_XYZLOCAL[i], tolerance);
+ delete[] vals; vals = 0;
} // testFromProjForm
// ----------------------------------------------------------------------
Modified: cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoProj.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoProj.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestCSGeoProj.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -75,22 +75,22 @@
const int numCoords = 3;
const int size = _NUMLOCS * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, _XYZ, size*sizeof(double));
- cs.toProjForm(&pVals, _NUMLOCS);
+ double* vals = new double[size];
+ memcpy(vals, _XYZ, size*sizeof(double));
+ cs.toProjForm(vals, _NUMLOCS);
const double degToRad = M_PI / 180.0;
const double tolerance = 1.0e-5;
for (int i=0; i < size; i+=3) {
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0,
- pVals[i ]/(_LONLATNAD27ELEV[i ]*degToRad),
+ vals[i ]/(_LONLATNAD27ELEV[i ]*degToRad),
tolerance);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0,
- pVals[i+1]/(_LONLATNAD27ELEV[i+1]*degToRad),
+ vals[i+1]/(_LONLATNAD27ELEV[i+1]*degToRad),
tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i+2]/_LONLATNAD27ELEV[i+2],
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i+2]/_LONLATNAD27ELEV[i+2],
tolerance);
} // for
- delete[] pVals; pVals = 0;
+ delete[] vals; vals = 0;
} // testToProjForm
// ----------------------------------------------------------------------
@@ -113,20 +113,20 @@
const int numCoords = 3;
const int size = _NUMLOCS * numCoords;
- double* pVals = new double[size];
- memcpy(pVals, _LONLATNAD27ELEV, size*sizeof(double));
+ double* vals = new double[size];
+ memcpy(vals, _LONLATNAD27ELEV, size*sizeof(double));
const double degToRad = M_PI / 180.0;
for (int i=0; i < size; i+=3) {
- pVals[i ] *= degToRad;
- pVals[i+1] *= degToRad;
+ vals[i ] *= degToRad;
+ vals[i+1] *= degToRad;
} // for
- cs.fromProjForm(&pVals, _NUMLOCS);
+ cs.fromProjForm(vals, _NUMLOCS);
const double tolerance = 1.0e-6;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[i]/_XYZ[i], tolerance);
- delete[] pVals; pVals = 0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/_XYZ[i], tolerance);
+ delete[] vals; vals = 0;
} // testFromProjForm
// ----------------------------------------------------------------------
Modified: cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestConverter.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestConverter.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestConverter.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -49,17 +49,17 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double [size];
- memcpy(pCoords, _LONLATNAD27ELEV, size*sizeof(double));
+ double* coords = new double [size];
+ memcpy(coords, _LONLATNAD27ELEV, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _LONLATWGS84GEOID;
+ const double* valsE = _LONLATWGS84GEOID;
const double tolerance = 1.0e-06;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/pValsE[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/valsE[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // testNAD27ToWGS84
// ----------------------------------------------------------------------
@@ -82,17 +82,17 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double [size];
- memcpy(pCoords, _LONLATWGS84GEOID, size*sizeof(double));
+ double* coords = new double [size];
+ memcpy(coords, _LONLATWGS84GEOID, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _LONLATNAD27ELEV;
+ const double* valsE = _LONLATNAD27ELEV;
const double tolerance = 1.0e-06;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/pValsE[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/valsE[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // testWGS84ToNAD27
// ----------------------------------------------------------------------
@@ -116,17 +116,17 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double[size];
- memcpy(pCoords, _LONLATWGS84GEOID, size*sizeof(double));
+ double* coords = new double[size];
+ memcpy(coords, _LONLATWGS84GEOID, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _XYZECEF;
+ const double* valsE = _XYZECEF;
const double tolerance = 1.0e-06;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/pValsE[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/valsE[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // testWGS84ToECEF
// ----------------------------------------------------------------------
@@ -150,17 +150,17 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double[size];
- memcpy(pCoords, _XYZECEF, size*sizeof(double));
+ double* coords = new double[size];
+ memcpy(coords, _XYZECEF, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _LONLATWGS84GEOID;
+ const double* valsE = _LONLATWGS84GEOID;
const double tolerance = 1.0e-06;
for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/pValsE[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/valsE[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // testECEFToWGS84
// ----------------------------------------------------------------------
@@ -184,20 +184,20 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double [size];
- memcpy(pCoords, _LONLATNAD27ELEV, size*sizeof(double));
+ double* coords = new double [size];
+ memcpy(coords, _LONLATNAD27ELEV, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _XYZLOCAL;
+ const double* valsE = _XYZLOCAL;
const double tolerance = 1.0e-06;
for (int i=0; i < size; ++i)
- if (fabs(pValsE[i]) > tolerance)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/pValsE[i], tolerance);
+ if (fabs(valsE[i]) > tolerance)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/valsE[i], tolerance);
else
- CPPUNIT_ASSERT_DOUBLES_EQUAL(pValsE[i], pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valsE[i], coords[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // TestNAD27ToLocal
// ----------------------------------------------------------------------
@@ -221,20 +221,20 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double [size];
- memcpy(pCoords, _XYZLOCAL, size*sizeof(double));
+ double* coords = new double [size];
+ memcpy(coords, _XYZLOCAL, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _LONLATNAD27ELEV;
+ const double* valsE = _LONLATNAD27ELEV;
const double tolerance = 1.0e-06;
for (int i=0; i < size; ++i)
- if (fabs(pValsE[i]) > tolerance)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/pValsE[i], tolerance);
+ if (fabs(valsE[i]) > tolerance)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/valsE[i], tolerance);
else
- CPPUNIT_ASSERT_DOUBLES_EQUAL(pValsE[i], pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valsE[i], coords[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // TestLocalToNAD27
// ----------------------------------------------------------------------
@@ -256,22 +256,22 @@
const int numLocs = _NUMLOCS;
const int numCoords = 3;
const int size = numLocs*numCoords;
- double* pCoords = new double [size];
- memcpy(pCoords, _XYZLOCAL, size*sizeof(double));
+ double* coords = new double [size];
+ memcpy(coords, _XYZLOCAL, size*sizeof(double));
- Converter::convert(&pCoords, numLocs, &csDest, &csSrc);
+ Converter::convert(coords, numLocs, &csDest, &csSrc);
- const double* pValsE = _XYZLOCAL;
+ const double* valsE = _XYZLOCAL;
const double tolerance = 1.0e-06;
const double scale = srcToMeters / destToMeters;
for (int i=0; i < size; ++i)
- if (fabs(pValsE[i]) > tolerance)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pCoords[i]/(pValsE[i]*scale),
+ if (fabs(valsE[i]) > tolerance)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coords[i]/(valsE[i]*scale),
tolerance);
else
- CPPUNIT_ASSERT_DOUBLES_EQUAL((pValsE[i]*scale), pCoords[i], tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((valsE[i]*scale), coords[i], tolerance);
- delete[] pCoords; pCoords = 0;
+ delete[] coords; coords = 0;
} // TestCartToCart
// version
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -134,7 +134,7 @@
valNames[numVals-i-1] = _names()[i];
_pDB->queryVals(valNames, numVals);
- double* pVals = (0 < numVals) ? new double[numVals] : 0;
+ double* vals = (0 < numVals) ? new double[numVals] : 0;
const double tolerance = 1.0e-06;
const int numQueries = _numQueries();
@@ -143,17 +143,17 @@
for (int iQuery=0; iQuery < numQueries; ++iQuery) {
const double* qCoords = &queryData[iQuery*locSize];
const double* qVals = &queryData[iQuery*locSize+3];
- const int err = _pDB->query(&pVals, numVals,
+ const int err = _pDB->query(vals, numVals,
qCoords[0], qCoords[1], qCoords[2], &csCart);
if (0 != queryErrFlags)
CPPUNIT_ASSERT(err == queryErrFlags[iQuery]);
else
CPPUNIT_ASSERT(0 == err);
for (int iVal=0; iVal < numVals; ++iVal)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pVals[iVal]/qVals[numVals-iVal-1],
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[iVal]/qVals[numVals-iVal-1],
tolerance);
} // for
- delete[] pVals; pVals = 0;
+ delete[] vals; vals = 0;
} // CheckQuery
// version
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc 2007-01-01 21:05:23 UTC (rev 5629)
@@ -67,25 +67,25 @@
const char* units[] = {"m", "m"};
const int numVals = 2;
const double queryLoc[] = { 1.0, 2.0, 3.0 };
- const double pVals[] = { 6.3, 4.7 };
+ const double vals[] = { 6.3, 4.7 };
const int errFlags[] = { 0 };
_pDB->queryVals(names, numVals);
- double* pValsQ = (0 < numVals) ? new double[numVals] : 0;
+ double* valsQ = (0 < numVals) ? new double[numVals] : 0;
spatialdata::geocoords::CSCart csCart;
csCart.initialize();
- const int err = _pDB->query(&pValsQ, numVals,
+ const int err = _pDB->query(valsQ, numVals,
queryLoc[0], queryLoc[1], queryLoc[2],
&csCart);
CPPUNIT_ASSERT(err == errFlags[0]);
const double tolerance = 1.0e-06;
for (int iVal=0; iVal < numVals; ++iVal)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(pValsQ[iVal]/pVals[numVals-iVal-1],
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valsQ[iVal]/vals[numVals-iVal-1],
1.0, tolerance);
- delete[] pValsQ; pValsQ = 0;
+ delete[] valsQ; valsQ = 0;
_pDB->close();
} // testDB
@@ -100,26 +100,26 @@
const char* units[] = {"m", "m"};
const int numVals = 2;
const double queryLoc[] = { 1.0, 2.0, 3.0 };
- const double pVals[] = { 6.3, 4.7 };
+ const double vals[] = { 6.3, 4.7 };
const int errFlags[] = { 0 };
_pDB->queryVals(names, numVals);
- double* pValsQ = (0 < numVals) ? new double[numVals] : 0;
+ double* valsQ = (0 < numVals) ? new double[numVals] : 0;
spatialdata::geocoords::CSCart csCart;
csCart.initialize();
- const int err = testcquery((void*) _pDB, &pValsQ, numVals,
+ const int err = testcquery((void*) _pDB, valsQ, numVals,
queryLoc[0], queryLoc[1], queryLoc[2],
(void*) &csCart);
CPPUNIT_ASSERT(err == errFlags[0]);
const double tolerance = 1.0e-06;
for (int iVal=0; iVal < numVals; ++iVal)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(pValsQ[iVal]/pVals[numVals-iVal-1],
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valsQ[iVal]/vals[numVals-iVal-1],
1.0, tolerance);
- delete[] pValsQ; pValsQ = 0;
+ delete[] valsQ; valsQ = 0;
_pDB->close();
} // testDB_c
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c 2007-01-01 21:05:23 UTC (rev 5629)
@@ -16,14 +16,14 @@
/* ------------------------------------------------------------------- */
int
testcquery(void* db,
- double** pVals,
+ double* vals,
int numVals,
double x,
double y,
double z,
void* cs)
{ // testcquery
- return spatialdb_query(db, pVals, numVals, x, y, z, cs);
+ return spatialdb_query(db, vals, numVals, x, y, z, cs);
} // testcquery
/* End of file */
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h 2007-01-01 21:05:23 UTC (rev 5629)
@@ -16,7 +16,7 @@
/** Call spatialdb_query().
*
* @param db Pointer to SpatialDB
- * @param pVals Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
* @param x C coordinate of location for query
* @param y Y coordinate of location for query
@@ -26,7 +26,7 @@
* @returns 0 on success, 1 on failure (i.e., values not set)
*/
int testcquery(void* db,
- double** pVals,
+ double* vals,
int numVals,
double x,
double y,
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h 2006-12-23 02:02:34 UTC (rev 5628)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h 2007-01-01 21:05:23 UTC (rev 5629)
@@ -19,7 +19,7 @@
/** Call spatialdb_query_f().
*
* @param db Pointer to SpatialDB
- * @param pVals Pointer to computed values (output from query)
+ * @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
* @param x C coordinate of location for query
* @param y Y coordinate of location for query
@@ -29,7 +29,7 @@
* @returns 0 on success, 1 on failure (i.e., values not set)
*/
int testf77query(void* db,
- double** pVals,
+ double* vals,
int numVals,
double x,
double y,
More information about the cig-commits
mailing list