[geos-commits] r3242 - in trunk: include/geos/operation/buffer src/operation/buffer

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Feb 23 10:45:51 EST 2011


Author: strk
Date: 2011-02-23 07:45:51 -0800 (Wed, 23 Feb 2011)
New Revision: 3242

Modified:
   trunk/include/geos/operation/buffer/OffsetCurveSetBuilder.h
   trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp
Log:
Don't bother adding ring if it is "flat" and will disappear in the output (from TS r261)

Modified: trunk/include/geos/operation/buffer/OffsetCurveSetBuilder.h
===================================================================
--- trunk/include/geos/operation/buffer/OffsetCurveSetBuilder.h	2011-02-23 15:45:40 UTC (rev 3241)
+++ trunk/include/geos/operation/buffer/OffsetCurveSetBuilder.h	2011-02-23 15:45:51 UTC (rev 3242)
@@ -4,6 +4,7 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
  *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
  * Copyright (C) 2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
@@ -13,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: operation/buffer/OffsetCurveSetBuilder.java rev. 1.11 (JTS-1.10)
+ * Last port: operation/buffer/OffsetCurveSetBuilder.java r262 (JTS-1.11)
  *
  **********************************************************************/
 
@@ -109,7 +110,7 @@
 	void addPolygon(const geom::Polygon *p);
 
 	/**
-	 * Add an offset curve for a ring.
+	 * Add an offset curve for a polygon ring.
 	 * The side and left and right topological location arguments
 	 * assume that the ring is oriented CW.
 	 * If the ring is in the opposite orientation,

Modified: trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp
===================================================================
--- trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp	2011-02-23 15:45:40 UTC (rev 3241)
+++ trunk/src/operation/buffer/OffsetCurveSetBuilder.cpp	2011-02-23 15:45:51 UTC (rev 3242)
@@ -4,8 +4,9 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
  *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2005 Refractions Research Inc.
  * Copyright (C) 2001-2002 Vivid Solutions Inc.
- * Copyright (C) 2005 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU Lesser General Public Licence as published
@@ -14,7 +15,7 @@
  *
  **********************************************************************
  *
- * Last port: operation/buffer/OffsetCurveSetBuilder.java rev. 1.11 (JTS-1.10)
+ * Last port: operation/buffer/OffsetCurveSetBuilder.java r262 (JTS-1.11)
  *
  **********************************************************************/
 
@@ -277,6 +278,12 @@
 OffsetCurveSetBuilder::addPolygonRing(const CoordinateSequence *coord,
 	double offsetDistance, int side, int cwLeftLoc, int cwRightLoc)
 {
+
+	// don't bother adding ring if it is "flat" and
+	// will disappear in the output
+	if (offsetDistance == 0.0 && coord->size() < LinearRing::MINIMUM_VALID_SIZE)
+		return;
+
 	int leftLoc=cwLeftLoc;
 	int rightLoc=cwRightLoc;
 #if GEOS_DEBUG



More information about the geos-commits mailing list