[geos-commits] r4336 - in trunk: include/geos/geomgraph src/geomgraph

Sandro Santilli strk at kbt.io
Tue Feb 14 08:37:03 PST 2017


Author: strk
Date: 2017-02-14 08:37:03 -0800 (Tue, 14 Feb 2017)
New Revision: 4336

Modified:
   trunk/include/geos/geomgraph/DirectedEdge.h
   trunk/include/geos/geomgraph/DirectedEdgeStar.h
   trunk/src/geomgraph/DirectedEdge.cpp
   trunk/src/geomgraph/DirectedEdgeStar.cpp
Log:
Fix overloaded virtual print in DirectedEdge*.

- Make print() method of child classes also const
- Make getDepthDelta() const
- Add virtual.  For C++11 and newer this eventually should be overload.

e.g.
geos::geomgraph::DirectedEdge::print' hides overloaded virtual function [-Woverloaded-virtual]

Patch by Kurt Schwehr <schwehr at google.com>
Fixes #812 in trunk (3.7.0)

Modified: trunk/include/geos/geomgraph/DirectedEdge.h
===================================================================
--- trunk/include/geos/geomgraph/DirectedEdge.h	2017-02-14 16:36:11 UTC (rev 4335)
+++ trunk/include/geos/geomgraph/DirectedEdge.h	2017-02-14 16:37:03 UTC (rev 4336)
@@ -81,7 +81,7 @@
 
 	void setDepth(int position, int newDepth);
 
-	int getDepthDelta();
+	int getDepthDelta() const;
 
 	/// Marks both DirectedEdges attached to a given Edge.
 	//
@@ -142,7 +142,7 @@
 	 */
 	void setEdgeDepths(int position, int newDepth);
 
-	std::string print();
+	virtual std::string print() const;
 
 	std::string printEdge();
 

Modified: trunk/include/geos/geomgraph/DirectedEdgeStar.h
===================================================================
--- trunk/include/geos/geomgraph/DirectedEdgeStar.h	2017-02-14 16:36:11 UTC (rev 4335)
+++ trunk/include/geos/geomgraph/DirectedEdgeStar.h	2017-02-14 16:37:03 UTC (rev 4336)
@@ -132,7 +132,7 @@
 	 */
 	void computeDepths(DirectedEdge *de);
 
-	std::string print();
+	virtual std::string print() const;
 
 private:
 

Modified: trunk/src/geomgraph/DirectedEdge.cpp
===================================================================
--- trunk/src/geomgraph/DirectedEdge.cpp	2017-02-14 16:36:11 UTC (rev 4335)
+++ trunk/src/geomgraph/DirectedEdge.cpp	2017-02-14 16:37:03 UTC (rev 4336)
@@ -113,7 +113,7 @@
 
 /*public*/
 int
-DirectedEdge::getDepthDelta()
+DirectedEdge::getDepthDelta() const
 {
 	int depthDelta=edge->getDepthDelta();
 	if (!isForwardVar) depthDelta=-depthDelta;
@@ -185,7 +185,7 @@
 
 /*public*/
 std::string
-DirectedEdge::print()
+DirectedEdge::print() const
 {
 	std::stringstream ss;
 	ss << EdgeEnd::print();

Modified: trunk/src/geomgraph/DirectedEdgeStar.cpp
===================================================================
--- trunk/src/geomgraph/DirectedEdgeStar.cpp	2017-02-14 16:36:11 UTC (rev 4335)
+++ trunk/src/geomgraph/DirectedEdgeStar.cpp	2017-02-14 16:37:03 UTC (rev 4336)
@@ -449,7 +449,7 @@
 
 /*public*/
 std::string
-DirectedEdgeStar::print()
+DirectedEdgeStar::print() const
 {
 	std::string out="DirectedEdgeStar: " + getCoordinate().toString();
 



More information about the geos-commits mailing list