[geos-commits] r3436 - in trunk: include/geos/planargraph src/planargraph

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Jul 20 04:46:43 EDT 2011


Author: strk
Date: 2011-07-20 01:46:43 -0700 (Wed, 20 Jul 2011)
New Revision: 3436

Modified:
   trunk/include/geos/planargraph/DirectedEdge.h
   trunk/src/planargraph/DirectedEdge.cpp
Log:
Add output operator for planargraph::DirectedEdge class

Modified: trunk/include/geos/planargraph/DirectedEdge.h
===================================================================
--- trunk/include/geos/planargraph/DirectedEdge.h	2011-07-20 08:46:34 UTC (rev 3435)
+++ trunk/include/geos/planargraph/DirectedEdge.h	2011-07-20 08:46:43 UTC (rev 3436)
@@ -48,6 +48,8 @@
 
 public:
 
+  friend std::ostream& operator << (std::ostream&, const DirectedEdge&);
+
 	typedef std::list<DirectedEdge *> NonConstList;
 	typedef std::list<const DirectedEdge *> ConstList;
 	typedef std::vector<DirectedEdge *> NonConstVect;
@@ -226,6 +228,8 @@
 /// Strict Weak comparator function for containers
 bool pdeLessThan(DirectedEdge *first, DirectedEdge * second);
 
+/// Output operator 
+std::ostream& operator << (std::ostream&, const DirectedEdge&);
 
 
 } // namespace geos::planargraph

Modified: trunk/src/planargraph/DirectedEdge.cpp
===================================================================
--- trunk/src/planargraph/DirectedEdge.cpp	2011-07-20 08:46:34 UTC (rev 3435)
+++ trunk/src/planargraph/DirectedEdge.cpp	2011-07-20 08:46:43 UTC (rev 3436)
@@ -168,11 +168,16 @@
 DirectedEdge::print() const
 {
 	ostringstream s;
-	s<<typeid(*this).name()<<": "<<p0.toString()<<" - "<<p1.toString();
-	s<<" "<<quadrant<<":"<<angle;
+  s << *this;
 	return s.str();
 }
 
+std::ostream&
+operator << (std::ostream& s, const DirectedEdge& de)
+{
+	s << typeid(de).name() << ": " << de.p0 << " - " << de.p1;
+	s << " " << de.quadrant << ":" << de.angle;
+}
 
 } // namespace planargraph
 } // namespace geos



More information about the geos-commits mailing list