Skip to content

Commit

Permalink
Multi-version adjustment to r6954. To be truly pedantic, use int with…
Browse files Browse the repository at this point in the history
… GEOS 2.2 and size_t with GEOS 3.0.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6958 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed May 22, 2007
1 parent cf204a6 commit ee8e008
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ mDirtyGeos( rhs.mDirtyGeos )
if(multiPoly)
{
std::vector<GEOS_GEOM::Geometry*> polygonVector;
for(unsigned int i = 0; i < multiPoly->getNumGeometries(); ++i)
for(GEOS_SIZE_T i = 0; i < multiPoly->getNumGeometries(); ++i)
{
polygonVector.push_back((GEOS_GEOM::Geometry*)(multiPoly->getGeometryN(i)));
}
Expand Down Expand Up @@ -187,7 +187,7 @@ QgsGeometry & QgsGeometry::operator=( QgsGeometry const & rhs )
if(multiPoly)
{
std::vector<GEOS_GEOM::Geometry*> polygonVector;
for(unsigned int i = 0; i < multiPoly->getNumGeometries(); ++i)
for(GEOS_SIZE_T i = 0; i < multiPoly->getNumGeometries(); ++i)
{
polygonVector.push_back((GEOS_GEOM::Geometry*)(multiPoly->getGeometryN(i)));
}
Expand Down Expand Up @@ -2009,7 +2009,7 @@ double QgsGeometry::closestVertexWithContext(const QgsPoint& point,
GEOS_GEOM::CoordinateSequence* sequence = mGeos->getCoordinates();
if(sequence)
{
for(int i = 0; i < (int) sequence->getSize(); ++i)
for(GEOS_SIZE_T i = 0; i < sequence->getSize(); ++i)
{
double testDist = point.sqrDist(sequence->getAt(i).x, sequence->getAt(i).y);
if(testDist < sqrDist)
Expand Down Expand Up @@ -3453,7 +3453,7 @@ bool QgsGeometry::exportGeosToWkb()
geometrySize += sizeof(int);
geometrySize += theRing->getNumPoints()*2*sizeof(double);
}
for(int i = 0; i < (int) thePolygon->getNumInteriorRing(); ++i)
for(GEOS_SIZE_T i = 0; i < thePolygon->getNumInteriorRing(); ++i)
{
geometrySize += sizeof(int); //number of points in ring
theRing = thePolygon->getInteriorRingN(i);
Expand Down Expand Up @@ -3487,7 +3487,7 @@ bool QgsGeometry::exportGeosToWkb()
position += sizeof(int);
const GEOS_GEOM::CoordinateSequence* ringSequence = theRing->getCoordinatesRO();
//for(int j = 0; j < nPointsInRing; ++j)
for(int j = 0; j < (int) ringSequence->getSize(); ++j)
for(GEOS_SIZE_T j = 0; j < ringSequence->getSize(); ++j)
{
//x = theRing->getPointN(j)->getX();
x = ringSequence->getAt(j).x;
Expand All @@ -3501,7 +3501,7 @@ bool QgsGeometry::exportGeosToWkb()
}

//interior rings after
for(int i = 0; i < (int) thePolygon->getNumInteriorRing(); ++i)
for(GEOS_SIZE_T i = 0; i < thePolygon->getNumInteriorRing(); ++i)
{
theRing = thePolygon->getInteriorRingN(i);
if(theRing)
Expand Down Expand Up @@ -3553,7 +3553,7 @@ bool QgsGeometry::exportGeosToWkb()

//first determine size of geometry
int geometrySize = 1 + (2 * sizeof(int)); //endian, type, number of polygons
for(unsigned int i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
for(GEOS_SIZE_T i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
{
GEOS_GEOM::Polygon* thePoly = (GEOS_GEOM::Polygon*)(theMultiPolygon->getGeometryN(i));
geometrySize += (1 + (2 * sizeof(int))); //endian, type, number of rings
Expand All @@ -3563,7 +3563,7 @@ bool QgsGeometry::exportGeosToWkb()
geometrySize += (2*sizeof(double)*exRing->getNumPoints());

const GEOS_GEOM::LineString* intRing = 0;
for(unsigned int j = 0; j < thePoly->getNumInteriorRing(); ++j)
for(GEOS_SIZE_T j = 0; j < thePoly->getNumInteriorRing(); ++j)
{
geometrySize += sizeof(int); //number of points in ring
intRing = thePoly->getInteriorRingN(j);
Expand All @@ -3585,7 +3585,7 @@ bool QgsGeometry::exportGeosToWkb()
wkbPosition += sizeof(int);

//loop over polygons
for(unsigned int i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
for(GEOS_SIZE_T i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
{
GEOS_GEOM::Polygon* thePoly = (GEOS_GEOM::Polygon*)(theMultiPolygon->getGeometryN(i));
memcpy(&mGeometry[wkbPosition], &byteOrder, 1);
Expand Down Expand Up @@ -3618,7 +3618,7 @@ bool QgsGeometry::exportGeosToWkb()
}

//interior rings
for(unsigned int j = 0; j < thePoly->getNumInteriorRing(); ++j)
for(GEOS_SIZE_T j = 0; j < thePoly->getNumInteriorRing(); ++j)
{
theRing = thePoly->getInteriorRingN(j);
nPointsInRing = theRing->getNumPoints();
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ email : morb at ozemail dot com dot au
#define GEOS_GEOM geos
#define GEOS_IO geos
#define GEOS_UTIL geos
#define GEOS_SIZE_T int
#define COORD_SEQ_FACTORY DefaultCoordinateSequenceFactory
#else
#define GEOS_GEOM geos::geom
#define GEOS_IO geos::io
#define GEOS_UTIL geos::util
#define GEOS_SIZE_T size_t
#define COORD_SEQ_FACTORY CoordinateArraySequenceFactory
#endif

Expand Down

0 comments on commit ee8e008

Please sign in to comment.