[geos-commits] r4118 - in trunk: include/geos/geomgraph src/geomgraph
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Nov 16 02:53:09 PST 2015
Author: strk
Date: 2015-11-16 02:53:09 -0800 (Mon, 16 Nov 2015)
New Revision: 4118
Modified:
trunk/include/geos/geomgraph/EdgeEnd.h
trunk/include/geos/geomgraph/EdgeEndStar.h
trunk/src/geomgraph/EdgeEnd.cpp
trunk/src/geomgraph/EdgeEndStar.cpp
Log:
Fix output operator for EdgeEndStar
Modified: trunk/include/geos/geomgraph/EdgeEnd.h
===================================================================
--- trunk/include/geos/geomgraph/EdgeEnd.h 2015-11-13 19:10:05 UTC (rev 4117)
+++ trunk/include/geos/geomgraph/EdgeEnd.h 2015-11-16 10:53:09 UTC (rev 4118)
@@ -92,6 +92,8 @@
virtual geom::Coordinate& getCoordinate();
+ const geom::Coordinate& getCoordinate() const { return p0; }
+
virtual geom::Coordinate& getDirectedCoordinate();
virtual int getQuadrant();
@@ -126,7 +128,7 @@
virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
- virtual std::string print();
+ virtual std::string print() const;
protected:
Modified: trunk/include/geos/geomgraph/EdgeEndStar.h
===================================================================
--- trunk/include/geos/geomgraph/EdgeEndStar.h 2015-11-13 19:10:05 UTC (rev 4117)
+++ trunk/include/geos/geomgraph/EdgeEndStar.h 2015-11-16 10:53:09 UTC (rev 4118)
@@ -63,11 +63,10 @@
class GEOS_DLL EdgeEndStar {
public:
- friend std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
-
typedef std::set<EdgeEnd *, EdgeEndLT> container;
typedef container::iterator iterator;
+ typedef container::const_iterator const_iterator;
typedef container::reverse_iterator reverse_iterator;
EdgeEndStar();
@@ -88,6 +87,8 @@
*/
virtual geom::Coordinate& getCoordinate();
+ const geom::Coordinate& getCoordinate() const;
+
virtual std::size_t getDegree();
virtual iterator begin();
@@ -98,9 +99,12 @@
virtual reverse_iterator rend();
+ virtual const_iterator begin() const { return edgeMap.begin(); }
+
+ virtual const_iterator end() const { return edgeMap.end(); }
+
virtual container &getEdges();
-
virtual EdgeEnd* getNextCW(EdgeEnd *ee);
virtual void computeLabelling(std::vector<GeometryGraph*> *geomGraph);
@@ -114,7 +118,7 @@
//virtual int findIndex(EdgeEnd *eSearch);
virtual iterator find(EdgeEnd *eSearch);
- virtual std::string print();
+ virtual std::string print() const;
protected:
@@ -189,7 +193,7 @@
return edgeMap.find(eSearch);
}
-std::ostream& operator<< (std::ostream&, const EdgeEnd&);
+std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
} // namespace geos.geomgraph
} // namespace geos
Modified: trunk/src/geomgraph/EdgeEnd.cpp
===================================================================
--- trunk/src/geomgraph/EdgeEnd.cpp 2015-11-13 19:10:05 UTC (rev 4117)
+++ trunk/src/geomgraph/EdgeEnd.cpp 2015-11-16 10:53:09 UTC (rev 4118)
@@ -190,7 +190,7 @@
/*public*/
std::string
-EdgeEnd::print()
+EdgeEnd::print() const
{
std::ostringstream s;
Modified: trunk/src/geomgraph/EdgeEndStar.cpp
===================================================================
--- trunk/src/geomgraph/EdgeEndStar.cpp 2015-11-13 19:10:05 UTC (rev 4117)
+++ trunk/src/geomgraph/EdgeEndStar.cpp 2015-11-16 10:53:09 UTC (rev 4118)
@@ -29,6 +29,7 @@
#include <cassert>
#include <string>
#include <vector>
+#include <sstream>
#ifndef GEOS_DEBUG
#define GEOS_DEBUG 0
@@ -64,6 +65,13 @@
}
/*public*/
+const Coordinate&
+EdgeEndStar::getCoordinate() const
+{
+ return const_cast<EdgeEndStar*>(this)->getCoordinate();
+}
+
+/*public*/
EdgeEnd*
EdgeEndStar::getNextCW(EdgeEnd *ee)
{
@@ -338,22 +346,23 @@
/*public*/
std::string
-EdgeEndStar::print()
+EdgeEndStar::print() const
{
- std::string out="EdgeEndStar: " + getCoordinate().toString()+"\n";
- for (EdgeEndStar::iterator it=begin(), itEnd=end(); it!=itEnd; ++it)
- {
- EdgeEnd *e=*it;
- assert(e);
- out+=e->print();
- }
- return out;
+ std::ostringstream s;
+ s << *this;
+ return s.str();
}
std::ostream&
-operator<< (std::ostream& os, const EdgeEndStar& ee)
+operator<< (std::ostream& os, const EdgeEndStar& es)
{
- os << print();
+ os << "EdgeEndStar: " << es.getCoordinate() << "\n";
+ for (EdgeEndStar::const_iterator it=es.begin(), itEnd=es.end(); it!=itEnd; ++it)
+ {
+ const EdgeEnd *e=*it;
+ assert(e);
+ os << *e;
+ }
return os;
}
More information about the geos-commits
mailing list