[geos-commits] [SCM] geos branch master updated. 281e59fc983f724b7a220531d4ea72f78fc7e5dd

git at osgeo.org git at osgeo.org
Fri Jun 30 06:14:12 PDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "geos".

The branch, master has been updated
       via  281e59fc983f724b7a220531d4ea72f78fc7e5dd (commit)
      from  8d171e4d47149666f1a10d4ee42ea445b8925c6e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 281e59fc983f724b7a220531d4ea72f78fc7e5dd
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri Jun 30 15:14:01 2017 +0200

    Add output operator for geom::Envelope class

diff --git a/include/geos/geom/Envelope.h b/include/geos/geom/Envelope.h
index 0052726..25900e1 100644
--- a/include/geos/geom/Envelope.h
+++ b/include/geos/geom/Envelope.h
@@ -26,6 +26,7 @@
 
 #include <string>
 #include <vector>
+#include <ostream> // for operator<<
 #include <memory>
 
 namespace geos {
@@ -54,6 +55,8 @@ class GEOS_DLL Envelope {
 
 public:
 
+	friend std::ostream& operator<< (std::ostream& os, const Envelope& cl);
+
 	typedef std::auto_ptr<Envelope> AutoPtr;
 
 	/** \brief
@@ -490,6 +493,9 @@ private:
 /// Checks if two Envelopes are equal (2D only check)
 GEOS_DLL bool operator==(const Envelope& a, const Envelope& b);
 
+/// Output operator
+GEOS_DLL std::ostream& operator<< (std::ostream& os, const Envelope& o);
+
 } // namespace geos::geom
 } // namespace geos
 
diff --git a/src/geom/Envelope.cpp b/src/geom/Envelope.cpp
index bce9098..6df01a9 100644
--- a/src/geom/Envelope.cpp
+++ b/src/geom/Envelope.cpp
@@ -332,12 +332,21 @@ Envelope::equals(const Envelope* other) const
 			other->getMaxY() == maxy;
 }
 
+/* public */
+std::ostream& operator<< (std::ostream& os, const Envelope& o)
+{
+	os << "Env[" << o.minx << ":" << o.maxx << ","
+		 << o.miny << ":" << o.maxy << "]";
+	return os;
+}
+
+
 /*public*/
 string
 Envelope::toString() const
 {
 	ostringstream s;
-	s<<"Env["<<minx<<":"<<maxx<<","<<miny<<":"<<maxy<<"]";
+	s<<*this;
 	return s.str();
 }
 

-----------------------------------------------------------------------

Summary of changes:
 include/geos/geom/Envelope.h |    6 ++++++
 src/geom/Envelope.cpp        |   11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
geos


More information about the geos-commits mailing list