[geos-commits] r4337 - in branches/3.6: . include/geos/geomgraph src/geomgraph

Sandro Santilli strk at kbt.io
Tue Feb 14 08:38:04 PST 2017


Author: strk
Date: 2017-02-14 08:38:04 -0800 (Tue, 14 Feb 2017)
New Revision: 4337

Modified:
   branches/3.6/NEWS
   branches/3.6/include/geos/geomgraph/DirectedEdge.h
   branches/3.6/include/geos/geomgraph/DirectedEdgeStar.h
   branches/3.6/src/geomgraph/DirectedEdge.cpp
   branches/3.6/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>
Closes #812 in 3.6 branch (for 3.6.2)

Modified: branches/3.6/NEWS
===================================================================
--- branches/3.6/NEWS	2017-02-14 16:37:03 UTC (rev 4336)
+++ branches/3.6/NEWS	2017-02-14 16:38:04 UTC (rev 4337)
@@ -6,6 +6,7 @@
   - Fix build with android-ndk and other compilers (#799)
   - Allows compiling with -Wpointer-bool-conversion (#638)
   - Fix unhandled exception on invalid fp operation (#811)
+  - Fix overloaded virtual print in DirectedEdge* (#812)
 
 Changes in 3.6.1
 2016-12-24

Modified: branches/3.6/include/geos/geomgraph/DirectedEdge.h
===================================================================
--- branches/3.6/include/geos/geomgraph/DirectedEdge.h	2017-02-14 16:37:03 UTC (rev 4336)
+++ branches/3.6/include/geos/geomgraph/DirectedEdge.h	2017-02-14 16:38:04 UTC (rev 4337)
@@ -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: branches/3.6/include/geos/geomgraph/DirectedEdgeStar.h
===================================================================
--- branches/3.6/include/geos/geomgraph/DirectedEdgeStar.h	2017-02-14 16:37:03 UTC (rev 4336)
+++ branches/3.6/include/geos/geomgraph/DirectedEdgeStar.h	2017-02-14 16:38:04 UTC (rev 4337)
@@ -132,7 +132,7 @@
 	 */
 	void computeDepths(DirectedEdge *de);
 
-	std::string print();
+	virtual std::string print() const;
 
 private:
 

Modified: branches/3.6/src/geomgraph/DirectedEdge.cpp
===================================================================
--- branches/3.6/src/geomgraph/DirectedEdge.cpp	2017-02-14 16:37:03 UTC (rev 4336)
+++ branches/3.6/src/geomgraph/DirectedEdge.cpp	2017-02-14 16:38:04 UTC (rev 4337)
@@ -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: branches/3.6/src/geomgraph/DirectedEdgeStar.cpp
===================================================================
--- branches/3.6/src/geomgraph/DirectedEdgeStar.cpp	2017-02-14 16:37:03 UTC (rev 4336)
+++ branches/3.6/src/geomgraph/DirectedEdgeStar.cpp	2017-02-14 16:38:04 UTC (rev 4337)
@@ -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