[geos-commits] r3275 - in trunk: include/geos/simplify src/index/chain src/simplify

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Mar 26 10:02:33 EDT 2011


Author: strk
Date: 2011-03-26 07:02:32 -0700 (Sat, 26 Mar 2011)
New Revision: 3275

Modified:
   trunk/include/geos/simplify/TaggedLineString.h
   trunk/src/index/chain/MonotoneChainBuilder.cpp
   trunk/src/simplify/DouglasPeuckerLineSimplifier.cpp
   trunk/src/simplify/TaggedLineString.cpp
   trunk/src/simplify/TaggedLineStringSimplifier.cpp
Log:
fix missing size_t with gcc 4.6

Modified: trunk/include/geos/simplify/TaggedLineString.h
===================================================================
--- trunk/include/geos/simplify/TaggedLineString.h	2011-03-26 14:02:20 UTC (rev 3274)
+++ trunk/include/geos/simplify/TaggedLineString.h	2011-03-26 14:02:32 UTC (rev 3275)
@@ -71,11 +71,11 @@
 	typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
 
 	TaggedLineString(const geom::LineString* nParentLine,
-			size_t minimumSize=2);
+			std::size_t minimumSize=2);
 
 	~TaggedLineString();
 
-	size_t getMinimumSize() const;
+	std::size_t getMinimumSize() const;
 
 	const geom::LineString* getParent() const;
 
@@ -83,11 +83,11 @@
 
 	CoordSeqPtr getResultCoordinates() const;
 
-	size_t getResultSize() const;
+	std::size_t getResultSize() const;
 
-	TaggedLineSegment* getSegment(std::size_t);
+	TaggedLineSegment* getSegment(std::size_t i);
 
-	const TaggedLineSegment* getSegment(std::size_t) const;
+	const TaggedLineSegment* getSegment(std::size_t i) const;
 
 	std::vector<TaggedLineSegment*>& getSegments();
 
@@ -109,7 +109,7 @@
 	// TaggedLineSegments owned by this object
 	std::vector<TaggedLineSegment*> resultSegs;
 
-	size_t minimumSize;
+	std::size_t minimumSize;
 
 	void init();
 

Modified: trunk/src/index/chain/MonotoneChainBuilder.cpp
===================================================================
--- trunk/src/index/chain/MonotoneChainBuilder.cpp	2011-03-26 14:02:20 UTC (rev 3274)
+++ trunk/src/index/chain/MonotoneChainBuilder.cpp	2011-03-26 14:02:32 UTC (rev 3275)
@@ -56,13 +56,13 @@
 MonotoneChainBuilder::getChains(const CoordinateSequence* pts, void* context,
                                 vector<MonotoneChain*>& mcList)
 {
-	vector<size_t> startIndex;
+	vector<std::size_t> startIndex;
 	getChainStartIndices(*pts, startIndex);
-	size_t nindexes = startIndex.size();
+	std::size_t nindexes = startIndex.size();
 	if (nindexes > 0)
 	{
-		size_t n = nindexes - 1;
-		for(size_t i = 0; i < n; i++)
+		std::size_t n = nindexes - 1;
+		for(std::size_t i = 0; i < n; i++)
 		{
 			MonotoneChain* mc = new MonotoneChain(*pts, startIndex[i], startIndex[i+1], context);
 			mcList.push_back(mc);
@@ -73,16 +73,16 @@
 /* static public */
 void
 MonotoneChainBuilder::getChainStartIndices(const CoordinateSequence& pts,
-                                           vector<size_t>& startIndexList)
+                                           vector<std::size_t>& startIndexList)
 {
 	// find the startpoint (and endpoints) of all monotone chains
 	// in this edge
-	size_t start = 0;
+	std::size_t start = 0;
 	startIndexList.push_back(start);
-	const size_t n = pts.getSize() - 1;
+	const std::size_t n = pts.getSize() - 1;
 	do
 	{
-		size_t last = findChainEnd(pts, start);
+		std::size_t last = findChainEnd(pts, start);
 		startIndexList.push_back(last);
 		start = last;
 	} while (start < n);
@@ -90,17 +90,17 @@
 }
 
 /* private static */
-size_t
-MonotoneChainBuilder::findChainEnd(const CoordinateSequence& pts, size_t start)
+std::size_t
+MonotoneChainBuilder::findChainEnd(const CoordinateSequence& pts, std::size_t start)
 {
 
-	const size_t npts = pts.getSize(); // cache
+	const std::size_t npts = pts.getSize(); // cache
 
 	assert(start < npts);
 	assert(npts); // should be implied by the assertion above,
 	              // 'start' being unsigned
 
-	size_t safeStart = start;
+	std::size_t safeStart = start;
 
         // skip any zero-length segments at the start of the sequence
         // (since they cannot be used to establish a quadrant)
@@ -119,7 +119,7 @@
 	// (which is the starting quadrant)
 	int chainQuad = Quadrant::quadrant(pts[safeStart],
 	                                   pts[safeStart + 1]);
-	size_t last = start + 1;
+	std::size_t last = start + 1;
 	while (last < npts)
 	{
 		// skip zero-length segments, but include them in the chain

Modified: trunk/src/simplify/DouglasPeuckerLineSimplifier.cpp
===================================================================
--- trunk/src/simplify/DouglasPeuckerLineSimplifier.cpp	2011-03-26 14:02:20 UTC (rev 3274)
+++ trunk/src/simplify/DouglasPeuckerLineSimplifier.cpp	2011-03-26 14:02:32 UTC (rev 3275)
@@ -68,7 +68,7 @@
 	usePt = BoolVectAutoPtr(new BoolVect(pts.size(), true));
 	simplifySection(0, pts.size() - 1);
 
-	for (size_t i=0, n=pts.size(); i<n; ++i)
+	for (std::size_t i=0, n=pts.size(); i<n; ++i)
 	{
 		if ( usePt->operator[](i) )
 		{
@@ -84,17 +84,17 @@
 /*private*/
 void
 DouglasPeuckerLineSimplifier::simplifySection(
-		size_t i,
-		size_t j)
+		std::size_t i,
+		std::size_t j)
 {
 	if ( (i+1) == j ) return;
 
 	geos::geom::LineSegment seg(pts[i], pts[j]);
 	double maxDistance = -1.0;
 
-	size_t maxIndex = i;
+	std::size_t maxIndex = i;
 
-	for (size_t k=i+1; k<j; k++)
+	for (std::size_t k=i+1; k<j; k++)
 	{
 		double distance = seg.distance(pts[k]);
 		if (distance > maxDistance) {
@@ -103,7 +103,7 @@
 		}
 	}
 	if (maxDistance <= distanceTolerance) {
-		for(size_t k =i+1; k<j; k++)
+		for(std::size_t k =i+1; k<j; k++)
 		{
 			usePt->operator[](k) = false;
 		}

Modified: trunk/src/simplify/TaggedLineString.cpp
===================================================================
--- trunk/src/simplify/TaggedLineString.cpp	2011-03-26 14:02:20 UTC (rev 3274)
+++ trunk/src/simplify/TaggedLineString.cpp	2011-03-26 14:02:32 UTC (rev 3275)
@@ -44,7 +44,7 @@
 
 /*public*/
 TaggedLineString::TaggedLineString(const geom::LineString* nParentLine,
-			size_t nMinimumSize)
+			std::size_t nMinimumSize)
 	:
 	parentLine(nParentLine),
 	minimumSize(nMinimumSize)
@@ -60,10 +60,10 @@
 	     << endl;
 #endif
 
-	for (size_t i=0, n=segs.size(); i<n; i++)
+	for (std::size_t i=0, n=segs.size(); i<n; i++)
 		delete segs[i];
 
-	for (size_t i=0, n=resultSegs.size(); i<n; i++)
+	for (std::size_t i=0, n=resultSegs.size(); i<n; i++)
 		delete resultSegs[i];
 }
 
@@ -81,7 +81,7 @@
 
 	segs.reserve(pts->size()-1);
 
-	for (size_t i=0, n=pts->size()-1; i<n; i++)
+	for (std::size_t i=0, n=pts->size()-1; i<n; i++)
 	{
 		TaggedLineSegment* seg = new TaggedLineSegment(
 				pts->getAt(i),
@@ -100,7 +100,7 @@
 }
 
 /*public*/
-size_t
+std::size_t
 TaggedLineString::getMinimumSize() const
 {
 	return minimumSize;
@@ -155,7 +155,7 @@
 	cerr << __FUNCTION__ << " segs.size: " << segs.size() << endl;
 #endif
 
-	size_t i=0, size=segs.size();
+	std::size_t i=0, size=segs.size();
 
 	assert(size);
 
@@ -173,7 +173,7 @@
 }
 
 /*public*/
-size_t
+std::size_t
 TaggedLineString::getResultSize() const
 {
 	unsigned resultSegsSize = resultSegs.size();
@@ -182,14 +182,14 @@
 
 /*public*/
 TaggedLineSegment*
-TaggedLineString::getSegment(size_t i) 
+TaggedLineString::getSegment(std::size_t i) 
 {
 	return segs[i];
 }
 
 /*public*/
 const TaggedLineSegment*
-TaggedLineString::getSegment(size_t i) const
+TaggedLineString::getSegment(std::size_t i) const
 {
 	return segs[i];
 }

Modified: trunk/src/simplify/TaggedLineStringSimplifier.cpp
===================================================================
--- trunk/src/simplify/TaggedLineStringSimplifier.cpp	2011-03-26 14:02:20 UTC (rev 3274)
+++ trunk/src/simplify/TaggedLineStringSimplifier.cpp	2011-03-26 14:02:32 UTC (rev 3275)
@@ -83,8 +83,8 @@
 
 /*private*/
 void
-TaggedLineStringSimplifier::simplifySection(size_t i,
-		size_t j, size_t depth)
+TaggedLineStringSimplifier::simplifySection(std::size_t i,
+		std::size_t j, std::size_t depth)
 {
 	depth += 1;
 
@@ -94,7 +94,7 @@
 	          << std::endl;
 #endif
 
-	vector<size_t> sectionIndex(2);
+	vector<std::size_t> sectionIndex(2);
 
 	if((i+1) == j)
 	{
@@ -124,7 +124,7 @@
 	 */
 	if (line->getResultSize() < line->getMinimumSize())
 	{
-		size_t worstCaseSize = depth + 1;
+		std::size_t worstCaseSize = depth + 1;
 		if (worstCaseSize < line->getMinimumSize())
 			isValidToSimplify = false;
 	}
@@ -132,7 +132,7 @@
 	double distance;
 
 	// pass distance by ref
-	size_t furthestPtIndex = findFurthestPoint(linePts, i, j, distance);
+	std::size_t furthestPtIndex = findFurthestPoint(linePts, i, j, distance);
 
 #if GEOS_DEBUG
 	std::cerr << "furthest point " << furthestPtIndex 
@@ -176,7 +176,7 @@
 
 /*private*/
 auto_ptr<TaggedLineSegment>
-TaggedLineStringSimplifier::flatten(size_t start, size_t end)
+TaggedLineStringSimplifier::flatten(std::size_t start, std::size_t end)
 {
 	// make a new segment for the simplified geometry
 	const Coordinate& p0 = linePts->getAt(start);
@@ -192,7 +192,7 @@
 bool
 TaggedLineStringSimplifier::hasBadIntersection(
 		const TaggedLineString* parentLine,
-		const vector<size_t>& sectionIndex,
+		const vector<std::size_t>& sectionIndex,
 		const LineSegment& candidateSeg)
 {
 	if (hasBadOutputIntersection(candidateSeg))
@@ -242,7 +242,7 @@
 bool
 TaggedLineStringSimplifier::hasBadInputIntersection(
 		const TaggedLineString* parentLine,
-		const vector<size_t>& sectionIndex,
+		const vector<std::size_t>& sectionIndex,
 		const LineSegment& candidateSeg)
 {
 	auto_ptr< vector<LineSegment*> > querySegs =
@@ -278,14 +278,14 @@
 bool
 TaggedLineStringSimplifier::isInLineSection(
 		const TaggedLineString* line,
-		const vector<size_t>& sectionIndex,
+		const vector<std::size_t>& sectionIndex,
 		const TaggedLineSegment* seg)
 {
 	// not in this line
 	if (seg->getParent() != line->getParent())
 		return false;
 
-	size_t segIndex = seg->getIndex();
+	std::size_t segIndex = seg->getIndex();
 	if (segIndex >= sectionIndex[0] && segIndex < sectionIndex[1])
 		return true;
 
@@ -295,13 +295,13 @@
 /*private*/
 void
 TaggedLineStringSimplifier::remove(const TaggedLineString* line,
-		size_t start,
-		size_t end)
+		std::size_t start,
+		std::size_t end)
 {
 	assert(end <= line->getSegments().size() );
 	assert(start < end); // I'm not sure this should always be true
 
-	for (size_t i = start; i < end; i++)
+	for (std::size_t i = start; i < end; i++)
 	{
 		const TaggedLineSegment* seg = line->getSegment(i);
 		inputIndex->remove(seg);
@@ -309,10 +309,10 @@
 }
 
 /*private static*/
-size_t
+std::size_t
 TaggedLineStringSimplifier::findFurthestPoint(
 		const geom::CoordinateSequence* pts,
-		size_t i, size_t j,
+		std::size_t i, std::size_t j,
 		double& maxDistance)
 {
 	LineSegment seg(pts->getAt(i), pts->getAt(j));
@@ -321,8 +321,8 @@
 	          << std::endl;
 #endif
 	double maxDist = -1.0;
-	size_t maxIndex = i;
-	for (size_t k = i + 1; k < j; k++)
+	std::size_t maxIndex = i;
+	for (std::size_t k = i + 1; k < j; k++)
 	{
 		const Coordinate& midPt = pts->getAt(k);
 		double distance = seg.distance(midPt);



More information about the geos-commits mailing list