[geos-commits] r3450 - in trunk: . include/geos/geomgraph
include/geos/operation/buffer include/geos/operation/overlay
include/geos/operation/relate src/geomgraph
src/operation/buffer src/operation/overlay
src/operation/relate src/operation/valid
svn_geos at osgeo.org
svn_geos at osgeo.org
Tue Jul 26 11:09:35 EDT 2011
Author: strk
Date: 2011-07-26 08:09:35 -0700 (Tue, 26 Jul 2011)
New Revision: 3450
Modified:
trunk/NEWS
trunk/include/geos/geomgraph/DirectedEdge.h
trunk/include/geos/geomgraph/DirectedEdge.inl
trunk/include/geos/geomgraph/DirectedEdgeStar.h
trunk/include/geos/geomgraph/Edge.h
trunk/include/geos/geomgraph/EdgeEnd.h
trunk/include/geos/geomgraph/EdgeEndStar.h
trunk/include/geos/geomgraph/EdgeIntersectionList.h
trunk/include/geos/geomgraph/EdgeRing.h
trunk/include/geos/geomgraph/GeometryGraph.h
trunk/include/geos/geomgraph/GeometryGraph.inl
trunk/include/geos/geomgraph/GraphComponent.h
trunk/include/geos/geomgraph/Label.h
trunk/include/geos/geomgraph/Node.h
trunk/include/geos/geomgraph/PlanarGraph.h
trunk/include/geos/operation/buffer/BufferBuilder.h
trunk/include/geos/operation/overlay/OverlayOp.h
trunk/include/geos/operation/relate/EdgeEndBundle.h
trunk/include/geos/operation/relate/EdgeEndBundleStar.h
trunk/include/geos/operation/relate/RelateComputer.h
trunk/include/geos/operation/relate/RelateNode.h
trunk/src/geomgraph/DirectedEdge.cpp
trunk/src/geomgraph/DirectedEdgeStar.cpp
trunk/src/geomgraph/Edge.cpp
trunk/src/geomgraph/EdgeEnd.cpp
trunk/src/geomgraph/EdgeEndStar.cpp
trunk/src/geomgraph/EdgeIntersectionList.cpp
trunk/src/geomgraph/EdgeRing.cpp
trunk/src/geomgraph/GeometryGraph.cpp
trunk/src/geomgraph/GraphComponent.cpp
trunk/src/geomgraph/Label.cpp
trunk/src/geomgraph/Node.cpp
trunk/src/geomgraph/NodeMap.cpp
trunk/src/geomgraph/PlanarGraph.cpp
trunk/src/operation/buffer/BufferBuilder.cpp
trunk/src/operation/overlay/LineBuilder.cpp
trunk/src/operation/overlay/OverlayOp.cpp
trunk/src/operation/overlay/PointBuilder.cpp
trunk/src/operation/overlay/PolygonBuilder.cpp
trunk/src/operation/relate/EdgeEndBuilder.cpp
trunk/src/operation/relate/EdgeEndBundle.cpp
trunk/src/operation/relate/EdgeEndBundleStar.cpp
trunk/src/operation/relate/RelateComputer.cpp
trunk/src/operation/relate/RelateNode.cpp
trunk/src/operation/relate/RelateNodeGraph.cpp
trunk/src/operation/valid/ConnectedInteriorTester.cpp
Log:
Use geomgraph::Label by value (less extra-heap), cleanups and port sync.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/NEWS 2011-07-26 15:09:35 UTC (rev 3450)
@@ -3,6 +3,11 @@
- C++ API changes:
- Added BufferOp::setSingleSided
+ - Signature of most functions taking a Label changed to take it
+ by reference rather than pointer.
+ - Signature of most functions taking an IntersectionMatrix changed
+ to take it by reference rather than pointer.
+ - GraphComponent::label is now a Label value (from a pointer)
Changes in 3.3.0
2011-05-30
Modified: trunk/include/geos/geomgraph/DirectedEdge.h
===================================================================
--- trunk/include/geos/geomgraph/DirectedEdge.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/DirectedEdge.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/DirectedEdge.java rev. 1.5 (JTS-1.10)
+ * Last port: geomgraph/DirectedEdge.java r428 (JTS-1.12)
*
**********************************************************************/
Modified: trunk/include/geos/geomgraph/DirectedEdge.inl
===================================================================
--- trunk/include/geos/geomgraph/DirectedEdge.inl 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/DirectedEdge.inl 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,10 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
+ * Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
@@ -13,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/DirectedEdge.java rev. 1.5 (JTS-1.10)
+ * Last port: geomgraph/DirectedEdge.java r428 (JTS-1.12)
*
**********************************************************************/
Modified: trunk/include/geos/geomgraph/DirectedEdgeStar.h
===================================================================
--- trunk/include/geos/geomgraph/DirectedEdgeStar.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/DirectedEdgeStar.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/DirectedEdgeStar.java rev. 1.4 (JTS-1.10)
+ * Last port: geomgraph/DirectedEdgeStar.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -91,7 +91,7 @@
void mergeSymLabels();
/// Update incomplete dirEdge labels from the labelling for the node
- void updateLabelling(Label *nodeLabel);
+ void updateLabelling(const Label& nodeLabel);
/**
@@ -168,19 +168,3 @@
#endif // ifndef GEOS_GEOMGRAPH_DIRECTEDEDGEENDSTAR_H
-/**********************************************************************
- * $Log$
- * Revision 1.4 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.3 2006/03/23 15:10:29 strk
- * Dropped by-pointer TopologyException constructor, various small cleanups
- *
- * Revision 1.2 2006/03/15 17:17:41 strk
- * Added missing forward declarations
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/Edge.h
===================================================================
--- trunk/include/geos/geomgraph/Edge.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/Edge.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/Edge.java rev. 1.4 (JTS-1.10)
+ * Last port: geomgraph/Edge.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -62,6 +62,7 @@
namespace geos {
namespace geomgraph { // geos.geomgraph
+/** The edge component of a geometry graph */
class GEOS_DLL Edge: public GraphComponent{
using GraphComponent::updateIM;
@@ -91,7 +92,7 @@
friend std::ostream& operator<< (std::ostream& os, const Edge& el);
- static void updateIM(Label *lbl,geom::IntersectionMatrix *im);
+ static void updateIM(const Label& lbl, geom::IntersectionMatrix& im);
/// Externally-set, owned by Edge. FIXME: refuse ownership
geom::CoordinateSequence* pts;
@@ -100,8 +101,10 @@
//Edge();
- Edge(geom::CoordinateSequence* newPts, Label *newLabel);
+ /// Takes ownership of CoordinateSequence
+ Edge(geom::CoordinateSequence* newPts, const Label& newLabel);
+ /// Takes ownership of CoordinateSequence
Edge(geom::CoordinateSequence* newPts);
virtual ~Edge();
@@ -206,9 +209,10 @@
/// Update the IM with the contribution for this component.
//
- /// A component only contributes if it has a labelling for both parent geometries
+ /// A component only contributes if it has a labelling for both
+ /// parent geometries
///
- virtual void computeIM(geom::IntersectionMatrix *im) {
+ virtual void computeIM(geom::IntersectionMatrix& im) {
updateIM(label, im);
testInvariant();
}
@@ -259,20 +263,3 @@
#endif // ifndef GEOS_GEOMGRAPH_EDGE_H
-/**********************************************************************
- * $Log$
- * Revision 1.4 2006/04/05 18:28:42 strk
- * Moved testInvariant() methods from private to public, added
- * some comments about them.
- *
- * Revision 1.3 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.2 2006/03/14 11:03:14 strk
- * Added operator<< for Edge and EdgeList
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/EdgeEnd.h
===================================================================
--- trunk/include/geos/geomgraph/EdgeEnd.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/EdgeEnd.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeEnd.java rev. 1.6 (JTS-1.10)
+ * Last port: geomgraph/EdgeEnd.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -24,6 +24,7 @@
#include <geos/export.h>
#include <geos/geom/Coordinate.h> // for p0,p1
+#include <geos/geomgraph/Label.h> // for composition
#include <geos/inline.h>
#include <string>
@@ -34,7 +35,6 @@
class BoundaryNodeRule;
}
namespace geomgraph {
- class Label;
class Edge;
class Node;
}
@@ -61,24 +61,35 @@
EdgeEnd();
- virtual ~EdgeEnd();
+ virtual ~EdgeEnd() {}
/**
* NOTES:
- * - takes ownership of given Label (if any)
+ * - Copies the given Label
* - keeps a pointer to given Edge, make sure it's
* not deleted before the EdgeEnd.
* - copies given Coordinates (maybe we should avoid that)
*/
EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
const geom::Coordinate& newP1,
- Label* newLabel=NULL);
+ const Label& newLabel);
+ /**
+ * NOTES:
+ * - keeps a pointer to given Edge, make sure it's
+ * not deleted before the EdgeEnd.
+ * - copies given Coordinates (maybe we should avoid that)
+ */
+ EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
+ const geom::Coordinate& newP1);
+
Edge* getEdge() { return edge; }
//virtual Edge* getEdge() { return edge; }
- virtual Label* getLabel();
+ Label& getLabel() { return label; }
+ const Label& getLabel() const { return label; }
+
virtual geom::Coordinate& getCoordinate();
virtual geom::Coordinate& getDirectedCoordinate();
@@ -121,7 +132,7 @@
Edge* edge;// the parent edge of this edge end
- Label* label;
+ Label label;
EdgeEnd(Edge* newEdge);
@@ -158,26 +169,3 @@
//#endif
#endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H
-
-/**********************************************************************
- * $Log$
- * Revision 1.6 2006/06/14 14:32:20 strk
- * EdgeEnd::getEdge() made non-virtual and inlined.
- *
- * Revision 1.5 2006/04/06 09:39:56 strk
- * Added operator<<
- *
- * Revision 1.4 2006/04/03 17:05:22 strk
- * Assertion checking, port info, cleanups
- *
- * Revision 1.3 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.2 2006/03/15 15:27:24 strk
- * cleanups
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/EdgeEndStar.h
===================================================================
--- trunk/include/geos/geomgraph/EdgeEndStar.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/EdgeEndStar.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeEndStar.java rev. 1.8 (JTS-1.10)
+ * Last port: geomgraph/EdgeEndStar.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -201,19 +201,3 @@
#endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
-/**********************************************************************
- * $Log$
- * Revision 1.4 2006/06/12 10:49:43 strk
- * unsigned int => size_t
- *
- * Revision 1.3 2006/04/04 13:35:55 strk
- * Port info, assertion checking, indentation
- *
- * Revision 1.2 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/EdgeIntersectionList.h
===================================================================
--- trunk/include/geos/geomgraph/EdgeIntersectionList.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/EdgeIntersectionList.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeIntersectionList.java rev. 1.5 (JTS-1.10)
+ * Last port: geomgraph/EdgeIntersectionList.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -116,19 +116,5 @@
#pragma warning(pop)
#endif
-//#ifdef GEOS_INLINE
-//# include "geos/geomgraph/EdgeIntersectionList.inl"
-//#endif
-
#endif // ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
-/**********************************************************************
- * $Log$
- * Revision 1.2 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/EdgeRing.h
===================================================================
--- trunk/include/geos/geomgraph/EdgeRing.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/EdgeRing.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeRing.java rev. 1.10 (JTS-1.10)
+ * Last port: geomgraph/EdgeRing.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -55,6 +55,7 @@
namespace geos {
namespace geomgraph { // geos.geomgraph
+/** EdgeRing */
class GEOS_DLL EdgeRing {
public:
@@ -152,7 +153,7 @@
/// throw(const TopologyException &)
void computePoints(DirectedEdge *newStart);
- void mergeLabel(Label& deLabel);
+ void mergeLabel(const Label& deLabel);
/** \brief
* Merge the RHS label from a DirectedEdge into the label for
@@ -166,7 +167,7 @@
* information to the overall labelling, and is
* simply skipped.
*/
- void mergeLabel(Label& deLabel, int geomIndex);
+ void mergeLabel(const Label& deLabel, int geomIndex);
void addPoints(Edge *edge, bool isForward, bool isFirstEdge);
@@ -206,51 +207,5 @@
#pragma warning(pop)
#endif
-//#ifdef GEOS_INLINE
-//# include "geos/geomgraph/EdgeRing.inl"
-//#endif
-
#endif // ifndef GEOS_GEOMGRAPH_EDGERING_H
-/**********************************************************************
- * $Log$
- * Revision 1.9 2006/07/08 00:33:55 strk
- * * configure.in: incremented CAPI minor version, to avoid falling behind any future version from the 2.2. branch.
- * * source/geom/Geometry.cpp, source/geom/GeometryFactory.cpp,
- * source/geomgraph/EdgeRing.cpp,
- * source/headers/geos/geom/Geometry.h,
- * source/headers/geos/geom/GeometryFactory.h,
- * source/headers/geos/geom/GeometryFactory.inl,
- * source/headers/geos/geomgraph/EdgeRing.h:
- * updated doxygen comments (sync with JTS head).
- * * source/headers/geos/platform.h.in: include <inttypes.h>
- * rather then <stdint.h>
- *
- * Revision 1.8 2006/04/06 09:41:55 strk
- * Added operator<<, added pts!=NULL assertion in testInvariant() function
- *
- * Revision 1.7 2006/04/05 18:28:42 strk
- * Moved testInvariant() methods from private to public, added
- * some comments about them.
- *
- * Revision 1.6 2006/03/29 13:53:59 strk
- * EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages.
- *
- * Revision 1.5 2006/03/27 16:02:34 strk
- * Added INL file for MinimalEdgeRing, added many debugging blocks,
- * fixed memory leak in ConnectedInteriorTester (bug #59)
- *
- * Revision 1.4 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.3 2006/03/20 12:32:57 strk
- * Added note about responsibility of return from ::toPolygon
- *
- * Revision 1.2 2006/03/15 17:17:41 strk
- * Added missing forward declarations
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/GeometryGraph.h
===================================================================
--- trunk/include/geos/geomgraph/GeometryGraph.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/GeometryGraph.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/GeometryGraph.java r411 (JTS-1.12+)
+ * Last port: geomgraph/GeometryGraph.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -66,6 +66,9 @@
namespace geos {
namespace geomgraph { // geos.geomgraph
+/**
+ * A GeometryGraph is a graph that models a given Geometry
+ */
class GEOS_DLL GeometryGraph: public PlanarGraph
{
using PlanarGraph::add;
Modified: trunk/include/geos/geomgraph/GeometryGraph.inl
===================================================================
--- trunk/include/geos/geomgraph/GeometryGraph.inl 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/GeometryGraph.inl 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,10 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
+ * Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
@@ -13,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/GeometryGraph.java r411 (JTS-1.12+)
+ * Last port: geomgraph/GeometryGraph.java r428 (JTS-1.12+)
*
**********************************************************************/
Modified: trunk/include/geos/geomgraph/GraphComponent.h
===================================================================
--- trunk/include/geos/geomgraph/GraphComponent.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/GraphComponent.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/GraphComponent.java rev. 1.3 (JTS-1.10)
+ * Last port: geomgraph/GraphComponent.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -25,32 +25,39 @@
#include <geos/export.h>
#include <geos/inline.h>
+#include <geos/geomgraph/Label.h>
+
// Forward declarations
namespace geos {
namespace geom {
class IntersectionMatrix;
}
- namespace geomgraph {
- class Label;
- }
}
namespace geos {
namespace geomgraph { // geos.geomgraph
+/** \brief
+ * A GraphComponent is the parent class for the objects'
+ * that form a graph.
+ *
+ * Each GraphComponent can carry a Label.
+ */
class GEOS_DLL GraphComponent {
public:
GraphComponent();
/*
- * GraphComponent takes ownership of the given Label.
- * newLabel is deleted by destructor.
+ * GraphComponent copies the given Label.
*/
- GraphComponent(Label* newLabel);
+ GraphComponent(const Label& newLabel);
virtual ~GraphComponent();
- Label* getLabel();
- virtual void setLabel(Label* newLabel);
+
+ Label& getLabel() { return label; }
+ const Label& getLabel() const { return label; }
+ void setLabel(const Label& newLabel) { label = newLabel; }
+
virtual void setInResult(bool isInResult) { isInResultVar=isInResult; }
virtual bool isInResult() const { return isInResultVar; }
virtual void setCovered(bool isCovered);
@@ -59,10 +66,10 @@
virtual bool isVisited() const { return isVisitedVar; }
virtual void setVisited(bool isVisited) { isVisitedVar = isVisited; }
virtual bool isIsolated() const=0;
- virtual void updateIM(geom::IntersectionMatrix *im);
+ virtual void updateIM(geom::IntersectionMatrix& im);
protected:
- Label* label;
- virtual void computeIM(geom::IntersectionMatrix *im)=0;
+ Label label;
+ virtual void computeIM(geom::IntersectionMatrix& im)=0;
private:
bool isInResultVar;
bool isCoveredVar;
@@ -73,19 +80,4 @@
} // namespace geos.geomgraph
} // namespace geos
-//#ifdef GEOS_INLINE
-//# include "geos/geomgraph/GraphComponent.inl"
-//#endif
-
#endif // ifndef GEOS_GEOMGRAPH_GRAPHCOMPONENT_H
-
-/**********************************************************************
- * $Log$
- * Revision 1.2 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/geomgraph/Label.h
===================================================================
--- trunk/include/geos/geomgraph/Label.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/Label.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -64,10 +64,8 @@
* Converts a Label to a Line label
* (that is, one with no side Locations)
*
- * Returns a newly allocated object,
- * responsibility of it to the caller.
*/
- static Label* toLineLabel(const Label& label);
+ static Label toLineLabel(const Label& label);
/** \brief
* Construct a Label with a single location for both Geometries.
@@ -96,7 +94,9 @@
Label& operator= (const Label& l);
/** \brief
- * Initialize the locations to Location::UNDEF
+ * Initialize both locations to Location::UNDEF
+ *
+ * isNull() should return true after this kind of construction
*/
Label();
@@ -134,6 +134,8 @@
int getGeometryCount() const;
+ bool isNull() const;
+
bool isNull(int geomIndex) const;
bool isAnyNull(int geomIndex) const;
Modified: trunk/include/geos/geomgraph/Node.h
===================================================================
--- trunk/include/geos/geomgraph/Node.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/Node.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -58,6 +58,7 @@
namespace geos {
namespace geomgraph { // geos.geomgraph
+/** The node component of a geometry graph */
class GEOS_DLL Node: public GraphComponent {
using GraphComponent::setLabel;
@@ -107,7 +108,7 @@
* in the boundary.
* The merged location is the maximum of the two input values.
*/
- virtual int computeMergedLocation(const Label* label2, int eltIndex);
+ virtual int computeMergedLocation(const Label& label2, int eltIndex);
virtual std::string print();
@@ -139,7 +140,7 @@
/** \brief
* Basic nodes do not compute IMs
*/
- virtual void computeIM(geom::IntersectionMatrix* /*im*/) {};
+ virtual void computeIM(geom::IntersectionMatrix& /*im*/) {};
private:
Modified: trunk/include/geos/geomgraph/PlanarGraph.h
===================================================================
--- trunk/include/geos/geomgraph/PlanarGraph.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/geomgraph/PlanarGraph.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -14,7 +13,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/PlanarGraph.java rev. 1.6 (JTS-1.10)
+ * Last port: geomgraph/PlanarGraph.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -208,22 +207,3 @@
#endif // ifndef GEOS_GEOMGRAPH_PLANARGRAPH_H
-/**********************************************************************
- * $Log$
- * Revision 1.5 2006/06/01 11:49:36 strk
- * Reduced installed headers form geomgraph namespace
- *
- * Revision 1.4 2006/04/07 16:52:20 strk
- * Port info, doxygen comments, assertion checking
- *
- * Revision 1.3 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.2 2006/03/14 15:46:54 strk
- * Added PlanarGraph::getNodes(vector&) func, to reduce useless heap allocations
- *
- * Revision 1.1 2006/03/09 16:46:49 strk
- * geos::geom namespace definition, first pass at headers split
- *
- **********************************************************************/
-
Modified: trunk/include/geos/operation/buffer/BufferBuilder.h
===================================================================
--- trunk/include/geos/operation/buffer/BufferBuilder.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/operation/buffer/BufferBuilder.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -145,10 +145,11 @@
// throw (GEOSException);
private:
+
/**
* Compute the change in depth as an edge is crossed from R to L
*/
- static int depthDelta(geomgraph::Label *label);
+ static int depthDelta(const geomgraph::Label& label);
const BufferParameters& bufParams;
Modified: trunk/include/geos/operation/overlay/OverlayOp.h
===================================================================
--- trunk/include/geos/operation/overlay/OverlayOp.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/operation/overlay/OverlayOp.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -86,7 +86,7 @@
OpCode opCode);
//throw(TopologyException *);
- static bool isResultOfOp(geomgraph::Label *label, OpCode opCode);
+ static bool isResultOfOp(const geomgraph::Label& label, OpCode opCode);
/// This method will handle arguments of Location.NULL correctly
//
Modified: trunk/include/geos/operation/relate/EdgeEndBundle.h
===================================================================
--- trunk/include/geos/operation/relate/EdgeEndBundle.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/operation/relate/EdgeEndBundle.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -50,13 +50,18 @@
public:
EdgeEndBundle(geomgraph::EdgeEnd *e);
virtual ~EdgeEndBundle();
- geomgraph::Label *getLabel();
std::vector<geomgraph::EdgeEnd*>* getEdgeEnds();
void insert(geomgraph::EdgeEnd *e);
void computeLabel(const algorithm::BoundaryNodeRule& bnr);
- void updateIM(geom::IntersectionMatrix *im);
+ /**
+ * \brief
+ * Update the IM with the contribution for the computed label for
+ * the EdgeStubs.
+ */
+ void updateIM(geom::IntersectionMatrix& im);
+
std::string print();
protected:
std::vector<geomgraph::EdgeEnd*> *edgeEnds;
Modified: trunk/include/geos/operation/relate/EdgeEndBundleStar.h
===================================================================
--- trunk/include/geos/operation/relate/EdgeEndBundleStar.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/operation/relate/EdgeEndBundleStar.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -54,7 +54,11 @@
virtual ~EdgeEndBundleStar();
void insert(geomgraph::EdgeEnd *e);
- void updateIM(geom::IntersectionMatrix *im);
+
+ /**
+ * Update the IM with the contribution for the EdgeStubs around the node.
+ */
+ void updateIM(geom::IntersectionMatrix& im);
};
Modified: trunk/include/geos/operation/relate/RelateComputer.h
===================================================================
--- trunk/include/geos/operation/relate/RelateComputer.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/operation/relate/RelateComputer.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -116,7 +116,7 @@
/**
* update the IM with the sum of the IMs for each component
*/
- void updateIM(geom::IntersectionMatrix *imX);
+ void updateIM(geom::IntersectionMatrix& imX);
/**
* Processes isolated edges by computing their labelling and adding them
Modified: trunk/include/geos/operation/relate/RelateNode.h
===================================================================
--- trunk/include/geos/operation/relate/RelateNode.h 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/include/geos/operation/relate/RelateNode.h 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -52,11 +51,14 @@
virtual ~RelateNode();
- void updateIMFromEdges(geom::IntersectionMatrix *im);
+ /**
+ * Update the IM with the contribution for the EdgeEnds incident on this node.
+ */
+ void updateIMFromEdges(geom::IntersectionMatrix& im);
protected:
- void computeIM(geom::IntersectionMatrix *im);
+ void computeIM(geom::IntersectionMatrix& im);
};
@@ -65,11 +67,3 @@
} // namespace geos
#endif // GEOS_OP_RELATE_RELATENODE_H
-
-/**********************************************************************
- * $Log$
- * Revision 1.1 2006/03/21 13:11:29 strk
- * opRelate.h header split
- *
- **********************************************************************/
-
Modified: trunk/src/geomgraph/DirectedEdge.cpp
===================================================================
--- trunk/src/geomgraph/DirectedEdge.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/DirectedEdge.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/DirectedEdge.java rev. 1.5 (JTS-1.10)
+ * Last port: geomgraph/DirectedEdge.java r428 (JTS-1.12)
*
**********************************************************************/
@@ -134,10 +134,9 @@
bool
DirectedEdge::isLineEdge()
{
- assert(label);
- bool isLine=label->isLine(0) || label->isLine(1);
- bool isExteriorIfArea0=!label->isArea(0) || label->allPositionsEqual(0,Location::EXTERIOR);
- bool isExteriorIfArea1=!label->isArea(1) || label->allPositionsEqual(1,Location::EXTERIOR);
+ bool isLine = label.isLine(0) || label.isLine(1);
+ bool isExteriorIfArea0=!label.isArea(0) || label.allPositionsEqual(0,Location::EXTERIOR);
+ bool isExteriorIfArea1=!label.isArea(1) || label.allPositionsEqual(1,Location::EXTERIOR);
return isLine && isExteriorIfArea0 && isExteriorIfArea1;
}
@@ -146,11 +145,10 @@
DirectedEdge::isInteriorAreaEdge()
{
bool isInteriorAreaEdge=true;
- assert(label);
for (int i=0; i<2; i++) {
- if (!(label->isArea(i)
- && label->getLocation(i,Position::LEFT )==Location::INTERIOR
- && label->getLocation(i,Position::RIGHT)==Location::INTERIOR)) {
+ if (!(label.isArea(i)
+ && label.getLocation(i,Position::LEFT )==Location::INTERIOR
+ && label.getLocation(i,Position::RIGHT)==Location::INTERIOR)) {
isInteriorAreaEdge=false;
}
}
@@ -161,12 +159,9 @@
void
DirectedEdge::computeDirectedLabel()
{
- delete label;
- assert(edge);
- assert(edge->getLabel());
- label=new Label(*(edge->getLabel()));
+ label = edge->getLabel();
if (!isForwardVar)
- label->flip();
+ label.flip();
}
/*public*/
@@ -230,51 +225,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.21 2006/04/06 12:58:09 strk
- * Added printing of EdgeRing if available
- *
- * Revision 1.20 2006/04/06 07:52:42 strk
- * Fixed bug in ::print() function
- *
- * Revision 1.19 2006/04/03 17:05:22 strk
- * Assertion checking, port info, cleanups
- *
- * Revision 1.18 2006/03/29 15:23:49 strk
- * Moved GeometryGraph inlines from .h to .inl file
- *
- * Revision 1.17 2006/03/24 09:52:41 strk
- * USE_INLINE => GEOS_INLINE
- *
- * Revision 1.16 2006/03/23 15:10:29 strk
- * Dropped by-pointer TopologyException constructor, various small cleanups
- *
- * Revision 1.15 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- * Revision 1.14 2006/03/15 15:26:58 strk
- * Cleanups
- *
- * Revision 1.13 2006/03/14 15:31:39 strk
- * Cleaned up toString funx (more WKT friendly)
- *
- * Revision 1.12 2006/03/09 16:46:47 strk
- * geos::geom namespace definition, first pass at headers split
- *
- * Revision 1.11 2006/03/06 19:40:46 strk
- * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
- *
- * Revision 1.10 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.9 2006/02/28 14:34:04 strk
- * Added many assertions and debugging output hunting for a bug in BufferOp
- *
- * Revision 1.8 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.7 2006/02/09 15:52:47 strk
- * GEOSException derived from std::exception; always thrown and cought by const ref.
- **********************************************************************/
-
Modified: trunk/src/geomgraph/DirectedEdgeStar.cpp
===================================================================
--- trunk/src/geomgraph/DirectedEdgeStar.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/DirectedEdgeStar.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/DirectedEdgeStar.java rev. 1.4 (JTS-1.10)
+ * Last port: geomgraph/DirectedEdgeStar.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -143,10 +143,9 @@
assert(ee);
Edge *e=ee->getEdge();
assert(e);
- Label *eLabel=e->getLabel();
- assert(eLabel);
+ const Label& eLabel=e->getLabel();
for (int i=0; i<2; ++i) {
- int eLoc=eLabel->getLocation(i);
+ int eLoc=eLabel.getLocation(i);
if (eLoc==Location::INTERIOR || eLoc==Location::BOUNDARY)
label.setLocation(i, Location::INTERIOR);
}
@@ -163,32 +162,29 @@
assert(*it);
assert(dynamic_cast<DirectedEdge*>(*it));
DirectedEdge *de=static_cast<DirectedEdge*>(*it);
- Label* deLabel=de->getLabel();
- assert(deLabel);
+ Label& deLabel = de->getLabel();
DirectedEdge* deSym=de->getSym();
assert(deSym);
- Label* labelToMerge=deSym->getLabel();
- assert(labelToMerge);
+ const Label& labelToMerge = deSym->getLabel();
- deLabel->merge(*labelToMerge);
+ deLabel.merge(labelToMerge);
}
}
/*public*/
void
-DirectedEdgeStar::updateLabelling(Label *nodeLabel)
+DirectedEdgeStar::updateLabelling(const Label& nodeLabel)
{
EdgeEndStar::iterator endIt=end();
for (EdgeEndStar::iterator it=begin(); it!=endIt; ++it)
{
DirectedEdge *de=dynamic_cast<DirectedEdge*>(*it);
assert(de);
- Label *deLabel=de->getLabel();
- assert(deLabel);
- deLabel->setAllLocationsIfNull(0, nodeLabel->getLocation(0));
- deLabel->setAllLocationsIfNull(1, nodeLabel->getLocation(1));
+ Label& deLabel = de->getLabel();
+ deLabel.setAllLocationsIfNull(0, nodeLabel.getLocation(0));
+ deLabel.setAllLocationsIfNull(1, nodeLabel.getLocation(1));
}
}
@@ -233,8 +229,7 @@
assert(nextOut);
// skip de's that we're not interested in
- assert(nextOut->getLabel());
- if (!nextOut->getLabel()->isArea()) continue;
+ if (!nextOut->getLabel().isArea()) continue;
DirectedEdge *nextIn=nextOut->getSym();
assert(nextIn);
@@ -478,16 +473,3 @@
} // namespace geos.geomgraph
} // namespace geos
-
-/**********************************************************************
- * $Log$
- * Revision 1.19 2006/04/04 16:07:40 strk
- * More assertion checking, less overhead when built with NDEBUG defined
- *
- * Revision 1.18 2006/03/23 15:10:29 strk
- * Dropped by-pointer TopologyException constructor, various small cleanups
- *
- * Revision 1.17 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- **********************************************************************/
-
Modified: trunk/src/geomgraph/Edge.cpp
===================================================================
--- trunk/src/geomgraph/Edge.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/Edge.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,11 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2005-2006 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 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/Edge.java rev. 1.4 (JTS-1.10)
+ * Last port: geomgraph/Edge.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -59,12 +59,20 @@
* Handles edges from both L and A geometrys.
*/
void
-Edge::updateIM(Label *lbl, IntersectionMatrix *im)
+Edge::updateIM(const Label& lbl, IntersectionMatrix& im)
{
- im->setAtLeastIfValid(lbl->getLocation(0,Position::ON),lbl->getLocation(1,Position::ON),1);
- if (lbl->isArea()) {
- im->setAtLeastIfValid(lbl->getLocation(0,Position::LEFT),lbl->getLocation(1,Position::LEFT),2);
- im->setAtLeastIfValid(lbl->getLocation(0,Position::RIGHT),lbl->getLocation(1,Position::RIGHT),2);
+ im.setAtLeastIfValid(lbl.getLocation(0,Position::ON),
+ lbl.getLocation(1,Position::ON),
+ 1);
+ if (lbl.isArea()) {
+
+ im.setAtLeastIfValid(lbl.getLocation(0,Position::LEFT),
+ lbl.getLocation(1,Position::LEFT),
+ 2);
+
+ im.setAtLeastIfValid(lbl.getLocation(0,Position::RIGHT),
+ lbl.getLocation(1,Position::RIGHT),
+ 2);
}
}
@@ -78,7 +86,7 @@
}
/*public*/
-Edge::Edge(CoordinateSequence* newPts, Label *newLabel)
+Edge::Edge(CoordinateSequence* newPts, const Label& newLabel)
:
GraphComponent(newLabel),
mce(NULL),
@@ -122,7 +130,7 @@
Edge::isCollapsed() const
{
testInvariant();
- if (!label->isArea()) return false;
+ if (!label.isArea()) return false;
if (getNumPoints()!= 3) return false;
if (pts->getAt(0)==pts->getAt(2) ) return true;
return false;
@@ -135,7 +143,7 @@
CoordinateSequence *newPts = new CoordinateArraySequence(2);
newPts->setAt(pts->getAt(0),0);
newPts->setAt(pts->getAt(1),1);
- return new Edge(newPts, Label::toLineLabel(*label));
+ return new Edge(newPts, Label::toLineLabel(label));
}
/*public*/
@@ -261,7 +269,7 @@
os << "EDGE (rev)";
if ( name != "" ) os << " name:" << name;
- os << " label:" << label->toString()
+ os << " label:" << label
<< " depthDelta:" << depthDelta
<< ":" << std::endl
<< " LINESTRING(";
@@ -302,7 +310,7 @@
os
<< " LINESTRING"
<< *(e.pts)
- << " " << e.label->toString()
+ << " " << e.label
<< " " << e.depthDelta
;
@@ -312,161 +320,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.35 2006/03/23 13:31:56 strk
- * Fixed to allow build with GEOS_DEBUG
- *
- * Revision 1.34 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- * Revision 1.33 2006/03/14 16:53:31 strk
- * removed endline from printing funx
- *
- * Revision 1.32 2006/03/14 15:31:39 strk
- * Cleaned up toString funx (more WKT friendly)
- *
- * Revision 1.31 2006/03/14 11:03:14 strk
- * Added operator<< for Edge and EdgeList
- *
- * Revision 1.30 2006/03/09 16:46:47 strk
- * geos::geom namespace definition, first pass at headers split
- *
- * Revision 1.29 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.28 2006/03/02 12:12:00 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- * Revision 1.27 2006/02/28 14:34:04 strk
- * Added many assertions and debugging output hunting for a bug in BufferOp
- *
- * Revision 1.26 2006/02/28 14:05:38 strk
- * Fixed a bug in a debugging line
- *
- * Revision 1.25 2006/02/23 11:54:20 strk
- * - MCIndexPointSnapper
- * - MCIndexSnapRounder
- * - SnapRounding BufferOp
- * - ScaledNoder
- * - GEOSException hierarchy cleanups
- * - SpatialIndex memory-friendly query interface
- * - GeometryGraph::getBoundaryNodes memory-friendly
- * - NodeMap::getBoundaryNodes memory-friendly
- * - Cleanups in geomgraph::Edge
- * - Added an XML test for snaprounding buffer (shows leaks, working on it)
- *
- * Revision 1.24 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.23 2006/01/31 19:07:34 strk
- * - Renamed DefaultCoordinateSequence to CoordinateArraySequence.
- * - Moved GetNumGeometries() and GetGeometryN() interfaces
- * from GeometryCollection to Geometry class.
- * - Added getAt(int pos, Coordinate &to) funtion to CoordinateSequence class.
- * - Reworked automake scripts to produce a static lib for each subdir and
- * then link all subsystem's libs togheter
- * - Moved C-API in it's own top-level dir capi/
- * - Moved source/bigtest and source/test to tests/bigtest and test/xmltester
- * - Fixed PointLocator handling of LinearRings
- * - Changed CoordinateArrayFilter to reduce memory copies
- * - Changed UniqueCoordinateArrayFilter to reduce memory copies
- * - Added CGAlgorithms::isPointInRing() version working with
- * Coordinate::ConstVect type (faster!)
- * - Ported JTS-1.7 version of ConvexHull with big attention to
- * memory usage optimizations.
- * - Improved XMLTester output and user interface
- * - geos::geom::util namespace used for geom/util stuff
- * - Improved memory use in geos::geom::util::PolygonExtractor
- * - New ShortCircuitedGeometryVisitor class
- * - New operation/predicate package
- *
- * Revision 1.22 2005/12/07 20:49:23 strk
- * Oops, removed Coordinate copies introduced by recent code cleanups
- *
- * Revision 1.21 2005/11/29 14:39:46 strk
- * Removed number of points cache in Edge, replaced with local caches.
- *
- * Revision 1.20 2005/11/25 11:30:38 strk
- * Fix in ::equals() - this finally passes testLeaksBig.xml tests
- *
- * Revision 1.19 2005/11/24 23:43:13 strk
- * Yes another fix, sorry. Missing const-correctness.
- *
- * Revision 1.18 2005/11/24 23:24:38 strk
- * Fixed equals() function [ optimized in previous commit, but unchecked ]
- *
- * Revision 1.17 2005/11/24 23:09:15 strk
- * CoordinateSequence indexes switched from int to the more
- * the correct unsigned int. Optimizations here and there
- * to avoid calling getSize() in loops.
- * Update of all callers is not complete yet.
- *
- * Revision 1.16 2005/11/16 15:49:54 strk
- * Reduced gratuitous heap allocations.
- *
- * Revision 1.15 2005/11/14 18:14:04 strk
- * Reduced heap allocations made by TopologyLocation and Label objects.
- * Enforced const-correctness on GraphComponent.
- * Cleanups.
- *
- * Revision 1.14 2005/11/07 12:31:24 strk
- * Changed EdgeIntersectionList to use a set<> rathern then a vector<>, and
- * to avoid dynamic allocation of initial header.
- * Inlined short SweepLineEvent methods.
- *
- * Revision 1.13 2005/07/11 10:27:47 strk
- * Cleaned up signed/unsigned mismatches
- *
- * Revision 1.12 2005/02/22 16:24:17 strk
- * cached number of points in Edge
- *
- * Revision 1.11 2005/02/22 10:55:41 strk
- * Optimized Edge::equals(Edge *e)
- *
- * Revision 1.10 2004/12/08 13:54:43 strk
- * gcc warnings checked and fixed, general cleanups.
- *
- * Revision 1.9 2004/11/23 19:53:06 strk
- * Had LineIntersector compute Z by interpolation.
- *
- * Revision 1.8 2004/11/22 12:59:25 strk
- * Added debugging lines
- *
- * Revision 1.7 2004/11/01 16:43:04 strk
- * Added Profiler code.
- * Temporarly patched a bug in DoubleBits (must check drawbacks).
- * Various cleanups and speedups.
- *
- * Revision 1.6 2004/10/20 17:32:14 strk
- * Initial approach to 2.5d intersection()
- *
- * Revision 1.5 2004/07/21 09:55:24 strk
- * CoordinateSequence::atLeastNCoordinatesOrNothing definition fix.
- * Documentation fixes.
- *
- * Revision 1.4 2004/07/08 19:34:49 strk
- * Mirrored JTS interface of CoordinateSequence, factory and
- * default implementations.
- * Added CoordinateArraySequenceFactory::instance() function.
- *
- * Revision 1.3 2004/07/02 13:28:26 strk
- * Fixed all #include lines to reflect headers layout change.
- * Added client application build tips in README.
- *
- * Revision 1.2 2004/06/16 13:13:25 strk
- * Changed interface of SegmentString, now copying CoordinateSequence argument.
- * Fixed memory leaks associated with this and MultiGeometry constructors.
- * Other associated fixes.
- *
- * Revision 1.1 2004/03/19 09:48:45 ybychkov
- * "geomgraph" and "geomgraph/indexl" upgraded to JTS 1.4
- *
- * Revision 1.14 2003/11/07 01:23:42 pramsey
- * Add standard CVS headers licence notices and copyrights to all cpp and h
- * files.
- *
- * Revision 1.13 2003/10/15 16:39:03 strk
- * Made Edge::getCoordinates() return a 'const' value. Adapted code set.
- *
- **********************************************************************/
Modified: trunk/src/geomgraph/EdgeEnd.cpp
===================================================================
--- trunk/src/geomgraph/EdgeEnd.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/EdgeEnd.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeEnd.java rev. 1.6 (JTS-1.10)
+ * Last port: geomgraph/EdgeEnd.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -40,16 +40,10 @@
using namespace geos::algorithm;
/*public*/
-EdgeEnd::~EdgeEnd()
-{
- delete label;
-}
-
-/*public*/
EdgeEnd::EdgeEnd()
:
edge(NULL),
- label(NULL),
+ label(),
node(NULL),
dx(0.0),
dy(0.0),
@@ -61,7 +55,7 @@
EdgeEnd::EdgeEnd(Edge* newEdge)
:
edge(newEdge),
- label(NULL),
+ label(),
node(NULL),
dx(0.0),
dy(0.0),
@@ -71,7 +65,7 @@
/*public*/
EdgeEnd::EdgeEnd(Edge* newEdge, const Coordinate& newP0,
- const Coordinate& newP1, Label* newLabel)
+ const Coordinate& newP1, const Label& newLabel)
:
edge(newEdge),
label(newLabel),
@@ -84,6 +78,20 @@
}
/*public*/
+EdgeEnd::EdgeEnd(Edge* newEdge, const Coordinate& newP0,
+ const Coordinate& newP1)
+ :
+ edge(newEdge),
+ label(),
+ node(NULL),
+ dx(0.0),
+ dy(0.0),
+ quadrant(0)
+{
+ init(newP0, newP1);
+}
+
+/*public*/
void
EdgeEnd::init(const Coordinate& newP0, const Coordinate& newP1)
{
@@ -98,13 +106,6 @@
}
/*public*/
-Label*
-EdgeEnd::getLabel()
-{
- return label;
-}
-
-/*public*/
Coordinate&
EdgeEnd::getCoordinate()
{
@@ -208,7 +209,7 @@
os << " ";
os << ee.quadrant << ":" << std::atan2(ee.dy, ee.dx);
os << " ";
- os << *(ee.label);
+ os << ee.label;
return os;
}
@@ -217,38 +218,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.19 2006/06/14 14:32:20 strk
- * EdgeEnd::getEdge() made non-virtual and inlined.
- *
- * Revision 1.18 2006/04/08 13:05:49 strk
- * Added assertion
- *
- * Revision 1.17 2006/04/06 12:47:31 strk
- * Fixed output function
- *
- * Revision 1.16 2006/04/06 09:39:55 strk
- * Added operator<<
- *
- * Revision 1.15 2006/04/03 17:05:22 strk
- * Assertion checking, port info, cleanups
- *
- * Revision 1.14 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- * Revision 1.13 2006/03/09 16:46:47 strk
- * geos::geom namespace definition, first pass at headers split
- *
- * Revision 1.12 2006/03/06 19:40:46 strk
- * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
- *
- * Revision 1.11 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.10 2006/02/28 14:34:04 strk
- * Added many assertions and debugging output hunting for a bug in BufferOp
- *
- * Revision 1.9 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- **********************************************************************/
Modified: trunk/src/geomgraph/EdgeEndStar.cpp
===================================================================
--- trunk/src/geomgraph/EdgeEndStar.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/EdgeEndStar.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,11 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2005-2006 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 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeEndStar.java rev. 1.8 (JTS-1.10)
+ * Last port: geomgraph/EdgeEndStar.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -133,11 +133,10 @@
{
EdgeEnd *e=*it;
assert(e);
- Label *label=e->getLabel();
- assert(label);
+ const Label& label = e->getLabel();
for(int geomi=0; geomi<2; geomi++)
{
- if (label->isLine(geomi) && label->getLocation(geomi)==Location::BOUNDARY)
+ if (label.isLine(geomi) && label.getLocation(geomi) == Location::BOUNDARY)
hasDimensionalCollapseEdge[geomi]=true;
}
}
@@ -146,11 +145,10 @@
{
EdgeEnd *e=*it;
assert(e);
- Label *label=e->getLabel();
- assert(label);
+ Label& label = e->getLabel();
for(int geomi=0; geomi<2; ++geomi)
{
- if (label->isAnyNull(geomi)) {
+ if (label.isAnyNull(geomi)) {
int loc=Location::UNDEF;
if (hasDimensionalCollapseEdge[geomi]){
loc=Location::EXTERIOR;
@@ -158,7 +156,7 @@
Coordinate& p=e->getCoordinate();
loc = getLocation(geomi, p, geomGraph);
}
- label->setAllLocationsIfNull(geomi,loc);
+ label.setAllLocationsIfNull(geomi, loc);
}
}
}
@@ -215,8 +213,8 @@
EdgeEndStar::reverse_iterator it=rbegin();
assert(*it);
- Label *startLabel=(*it)->getLabel();
- int startLoc=startLabel->getLocation(geomIndex, Position::LEFT);
+ const Label& startLabel = (*it)->getLabel();
+ int startLoc = startLabel.getLocation(geomIndex, Position::LEFT);
// Found unlabelled area edge
assert(startLoc!=Location::UNDEF);
@@ -227,16 +225,15 @@
{
EdgeEnd *e=*it;
assert(e);
- Label *eLabel=e->getLabel();
- assert(eLabel);
+ const Label& eLabel = e->getLabel();
// we assume that we are only checking a area
// Found non-area edge
- assert(eLabel->isArea(geomIndex));
+ assert(eLabel.isArea(geomIndex));
- int leftLoc=eLabel->getLocation(geomIndex, Position::LEFT);
- int rightLoc=eLabel->getLocation(geomIndex, Position::RIGHT);
+ int leftLoc=eLabel.getLocation(geomIndex, Position::LEFT);
+ int rightLoc=eLabel.getLocation(geomIndex, Position::RIGHT);
// check that edge is really a boundary between inside and outside!
if (leftLoc==rightLoc) {
return false;
@@ -270,11 +267,12 @@
{
EdgeEnd *e=*it;
assert(e);
- Label *label=e->getLabel();
- assert(label);
- if (label->isArea(geomIndex) &&
- label->getLocation(geomIndex,Position::LEFT)!=Location::UNDEF)
- startLoc=label->getLocation(geomIndex,Position::LEFT);
+ const Label& label = e->getLabel();
+ if (label.isArea(geomIndex) &&
+ label.getLocation(geomIndex,Position::LEFT) != Location::UNDEF)
+ {
+ startLoc = label.getLocation(geomIndex, Position::LEFT);
+ }
}
// no labelled sides found, so no labels to propagate
@@ -285,19 +283,21 @@
{
EdgeEnd *e=*it;
assert(e);
- Label *label=e->getLabel();
- assert(label);
+ Label& label = e->getLabel();
// set null ON values to be in current location
- if (label->getLocation(geomIndex,Position::ON)==Location::UNDEF)
- label->setLocation(geomIndex,Position::ON,currLoc);
+ if (label.getLocation(geomIndex,Position::ON) == Location::UNDEF)
+ {
+ label.setLocation(geomIndex,Position::ON,currLoc);
+ }
+
// set side labels (if any)
// if (label.isArea()) //ORIGINAL
- if (label->isArea(geomIndex))
+ if (label.isArea(geomIndex))
{
- int leftLoc=label->getLocation(geomIndex,
+ int leftLoc=label.getLocation(geomIndex,
Position::LEFT);
- int rightLoc=label->getLocation(geomIndex,
+ int rightLoc=label.getLocation(geomIndex,
Position::RIGHT);
// if there is a right location, that is the next
@@ -324,12 +324,12 @@
* location.
*/
// found single null side
- assert(label->getLocation(geomIndex,
+ assert(label.getLocation(geomIndex,
Position::LEFT)==Location::UNDEF);
- label->setLocation(geomIndex,Position::RIGHT,
+ label.setLocation(geomIndex,Position::RIGHT,
currLoc);
- label->setLocation(geomIndex,Position::LEFT,
+ label.setLocation(geomIndex,Position::LEFT,
currLoc);
}
}
@@ -353,119 +353,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.21 2006/04/04 13:35:55 strk
- * Port info, assertion checking, indentation
- *
- * Revision 1.20 2006/03/23 15:10:29 strk
- * Dropped by-pointer TopologyException constructor, various small cleanups
- *
- * Revision 1.19 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- * Revision 1.18 2006/03/09 16:46:47 strk
- * geos::geom namespace definition, first pass at headers split
- *
- * Revision 1.17 2006/03/06 19:40:46 strk
- * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
- *
- * Revision 1.16 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.15 2006/03/02 12:12:00 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- * Revision 1.14 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.13 2006/02/09 15:52:47 strk
- * GEOSException derived from std::exception; always thrown and cought by const ref.
- *
- * Revision 1.12 2005/12/07 20:51:47 strk
- * removed dead code
- *
- * Revision 1.11 2005/11/29 00:48:35 strk
- * Removed edgeList cache from EdgeEndRing. edgeMap is enough.
- * Restructured iterated access by use of standard ::iterator abstraction
- * with scoped typedefs.
- *
- * Revision 1.10 2005/11/21 16:03:20 strk
- *
- * Coordinate interface change:
- * Removed setCoordinate call, use assignment operator
- * instead. Provided a compile-time switch to
- * make copy ctor and assignment operators non-inline
- * to allow for more accurate profiling.
- *
- * Coordinate copies removal:
- * NodeFactory::createNode() takes now a Coordinate reference
- * rather then real value. This brings coordinate copies
- * in the testLeaksBig.xml test from 654818 to 645991
- * (tested in 2.1 branch). In the head branch Coordinate
- * copies are 222198.
- * Removed useless coordinate copies in ConvexHull
- * operations
- *
- * STL containers heap allocations reduction:
- * Converted many containers element from
- * pointers to real objects.
- * Made some use of .reserve() or size
- * initialization when final container size is known
- * in advance.
- *
- * Stateless classes allocations reduction:
- * Provided ::instance() function for
- * NodeFactories, to avoid allocating
- * more then one (they are all
- * stateless).
- *
- * HCoordinate improvements:
- * Changed HCoordinate constructor by HCoordinates
- * take reference rather then real objects.
- * Changed HCoordinate::intersection to avoid
- * a new allocation but rather return into a provided
- * storage. LineIntersector changed to reflect
- * the above change.
- *
- * Revision 1.9 2004/12/08 13:54:43 strk
- * gcc warnings checked and fixed, general cleanups.
- *
- * Revision 1.8 2004/11/23 19:53:06 strk
- * Had LineIntersector compute Z by interpolation.
- *
- * Revision 1.7 2004/11/22 11:34:49 strk
- * More debugging lines and comments/indentation cleanups
- *
- * Revision 1.6 2004/11/17 08:13:16 strk
- * Indentation changes.
- * Some Z_COMPUTATION activated by default.
- *
- * Revision 1.5 2004/11/01 16:43:04 strk
- * Added Profiler code.
- * Temporarly patched a bug in DoubleBits (must check drawbacks).
- * Various cleanups and speedups.
- *
- * Revision 1.4 2004/10/21 22:29:54 strk
- * Indentation changes and some more COMPUTE_Z rules
- *
- * Revision 1.3 2004/07/02 13:28:26 strk
- * Fixed all #include lines to reflect headers layout change.
- * Added client application build tips in README.
- *
- * Revision 1.2 2004/05/03 10:43:42 strk
- * Exception specification considered harmful - left as comment.
- *
- * Revision 1.1 2004/03/19 09:48:45 ybychkov
- * "geomgraph" and "geomgraph/indexl" upgraded to JTS 1.4
- *
- * Revision 1.18 2003/11/12 15:43:38 strk
- * Added some more throw specifications
- *
- * Revision 1.17 2003/11/07 01:23:42 pramsey
- * Add standard CVS headers licence notices and copyrights to all cpp and h
- * files.
- *
- *
- **********************************************************************/
-
Modified: trunk/src/geomgraph/EdgeIntersectionList.cpp
===================================================================
--- trunk/src/geomgraph/EdgeIntersectionList.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/EdgeIntersectionList.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,11 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2005-2006 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 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeIntersectionList.java rev. 1.5 (JTS-1.10)
+ * Last port: geomgraph/EdgeIntersectionList.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -174,7 +174,7 @@
CoordinateSequence* pts=new CoordinateArraySequence(vc);
- return new Edge(pts, new Label(*(edge->getLabel())));
+ return new Edge(pts, edge->getLabel());
}
string
Modified: trunk/src/geomgraph/EdgeRing.cpp
===================================================================
--- trunk/src/geomgraph/EdgeRing.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/EdgeRing.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/EdgeRing.java rev. 1.10 (JTS-1.10)
+ * Last port: geomgraph/EdgeRing.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -240,10 +240,9 @@
de->getCoordinate());
edges.push_back(de);
- Label *deLabel=de->getLabel();
- assert(deLabel);
- assert(deLabel->isArea());
- mergeLabel(*deLabel);
+ const Label& deLabel = de->getLabel();
+ assert(deLabel.isArea());
+ mergeLabel(deLabel);
addPoints(de->getEdge(),de->isForward(),isFirstEdge);
isFirstEdge=false;
setEdgeRing(de,this);
@@ -302,7 +301,7 @@
/*protected*/
void
-EdgeRing::mergeLabel(Label& deLabel)
+EdgeRing::mergeLabel(const Label& deLabel)
{
mergeLabel(deLabel, 0);
mergeLabel(deLabel, 1);
@@ -313,7 +312,7 @@
/*protected*/
void
-EdgeRing::mergeLabel(Label& deLabel, int geomIndex)
+EdgeRing::mergeLabel(const Label& deLabel, int geomIndex)
{
testInvariant();
@@ -407,35 +406,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.25 2006/07/08 00:33:54 strk
- * * configure.in: incremented CAPI minor version, to avoid falling behind any future version from the 2.2. branch.
- * * source/geom/Geometry.cpp, source/geom/GeometryFactory.cpp,
- * source/geomgraph/EdgeRing.cpp,
- * source/headers/geos/geom/Geometry.h,
- * source/headers/geos/geom/GeometryFactory.h,
- * source/headers/geos/geom/GeometryFactory.inl,
- * source/headers/geos/geomgraph/EdgeRing.h:
- * updated doxygen comments (sync with JTS head).
- * * source/headers/geos/platform.h.in: include <inttypes.h>
- * rather then <stdint.h>
- *
- * Revision 1.24 2006/06/12 11:29:23 strk
- * unsigned int => size_t
- *
- * Revision 1.23 2006/04/06 09:41:55 strk
- * Added operator<<, added pts!=NULL assertion in testInvariant() function
- *
- * Revision 1.22 2006/03/29 13:53:56 strk
- * EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages.
- *
- * Revision 1.21 2006/03/27 16:02:33 strk
- * Added INL file for MinimalEdgeRing, added many debugging blocks,
- * fixed memory leak in ConnectedInteriorTester (bug #59)
- *
- * Revision 1.20 2006/03/23 15:10:29 strk
- * Dropped by-pointer TopologyException constructor, various small cleanups
- *
- **********************************************************************/
-
Modified: trunk/src/geomgraph/GeometryGraph.cpp
===================================================================
--- trunk/src/geomgraph/GeometryGraph.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/GeometryGraph.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,11 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2005-2006 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 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/GeometryGraph.java r411 (JTS-1.12+)
+ * Last port: geomgraph/GeometryGraph.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -264,7 +264,7 @@
throw;
}
- Edge *e=new Edge(coord,new Label(argIndex,Location::BOUNDARY,left,right));
+ Edge *e=new Edge(coord, Label(argIndex, Location::BOUNDARY, left, right));
lineEdgeMap[lr]=e;
insertEdge(e);
insertPoint(argIndex,coord->getAt(0), Location::BOUNDARY);
@@ -303,7 +303,7 @@
return;
}
- Edge *e=new Edge(coord,new Label(argIndex,Location::INTERIOR));
+ Edge *e=new Edge(coord, Label(argIndex, Location::INTERIOR));
lineEdgeMap[line]=e;
insertEdge(e);
@@ -397,14 +397,14 @@
cerr<<"GeometryGraph::insertPoint("<<coord.toString()<<" called"<<endl;
#endif
Node *n=nodes->addNode(coord);
- Label *lbl=n->getLabel();
- if (lbl==NULL)
+ Label& lbl = n->getLabel();
+ if ( lbl.isNull() )
{
n->setLabel(argIndex, onLocation);
}
else
{
- lbl->setLocation(argIndex, onLocation);
+ lbl.setLocation(argIndex, onLocation);
}
}
@@ -419,20 +419,19 @@
{
Node *n=nodes->addNode(coord);
// nodes always have labels
- Label *lbl=n->getLabel();
- assert(lbl);
+ Label& lbl = n->getLabel();
// the new point to insert is on a boundary
int boundaryCount=1;
// determine the current location for the point (if any)
- int loc = lbl->getLocation(argIndex,Position::ON);
+ int loc = lbl.getLocation(argIndex,Position::ON);
if (loc==Location::BOUNDARY) boundaryCount++;
// determine the boundary status of the point according to the
// Boundary Determination Rule
int newLoc = determineBoundary(boundaryNodeRule, boundaryCount);
- lbl->setLocation(argIndex,newLoc);
+ lbl.setLocation(argIndex,newLoc);
}
/*private*/
@@ -443,8 +442,8 @@
i!=endIt; ++i)
{
Edge *e=*i;
- int eLoc=e->getLabel()->getLocation(argIndex);
- EdgeIntersectionList &eiL=e->eiList;
+ int eLoc = e->getLabel().getLocation(argIndex);
+ EdgeIntersectionList &eiL = e->eiList;
for (EdgeIntersectionList::iterator
eiIt=eiL.begin(), eiEnd=eiL.end();
eiIt!=eiEnd; ++eiIt)
@@ -542,27 +541,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.30 2006/06/13 21:40:06 strk
- * Cleanups and some more debugging lines
- *
- * Revision 1.29 2006/06/12 11:29:23 strk
- * unsigned int => size_t
- *
- * Revision 1.28 2006/06/09 07:42:13 strk
- * * source/geomgraph/GeometryGraph.cpp, source/operation/buffer/OffsetCurveSetBuilder.cpp, source/operation/overlay/OverlayOp.cpp, source/operation/valid/RepeatedPointTester.cpp: Fixed warning after Polygon ring accessor methods changed to work with size_t. Small optimizations in loops.
- *
- * Revision 1.27 2006/04/07 09:54:30 strk
- * Geometry::getNumGeometries() changed to return 'unsigned int'
- * rather then 'int'
- *
- * Revision 1.26 2006/03/29 15:23:49 strk
- * Moved GeometryGraph inlines from .h to .inl file
- *
- * Revision 1.25 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- **********************************************************************/
-
-
Modified: trunk/src/geomgraph/GraphComponent.cpp
===================================================================
--- trunk/src/geomgraph/GraphComponent.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/GraphComponent.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,11 +1,11 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2005-2006 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 +14,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/GraphComponent.java rev. 1.3 (JTS-1.10)
+ * Last port: geomgraph/GraphComponent.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -28,8 +28,9 @@
namespace geos {
namespace geomgraph { // geos.geomgraph
-GraphComponent::GraphComponent():
- label(NULL),
+GraphComponent::GraphComponent()
+ :
+ label(),
isInResultVar(false),
isCoveredVar(false),
isCoveredSetVar(false),
@@ -37,7 +38,7 @@
{
}
-GraphComponent::GraphComponent(Label* newLabel):
+GraphComponent::GraphComponent(const Label& newLabel):
label(newLabel),
isInResultVar(false),
isCoveredVar(false),
@@ -48,23 +49,9 @@
GraphComponent::~GraphComponent()
{
- delete label;
}
-Label *
-GraphComponent::getLabel()
-{
- return label;
-}
-
void
-GraphComponent::setLabel(Label* newLabel)
-{
- delete label;
- label=newLabel;
-}
-
-void
GraphComponent::setCovered(bool isCovered)
{
isCoveredVar = isCovered;
@@ -72,45 +59,12 @@
}
void
-GraphComponent::updateIM(IntersectionMatrix *im)
+GraphComponent::updateIM(IntersectionMatrix& im)
{
- assert(label->getGeometryCount() >= 2); // found partial label
+ assert(label.getGeometryCount() >= 2); // found partial label
computeIM(im);
}
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.7 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- * Revision 1.6 2006/03/06 19:40:46 strk
- * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
- *
- * Revision 1.5 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.4 2005/11/16 15:49:54 strk
- * Reduced gratuitous heap allocations.
- *
- * Revision 1.3 2005/11/14 18:14:04 strk
- * Reduced heap allocations made by TopologyLocation and Label objects.
- * Enforced const-correctness on GraphComponent.
- * Cleanups.
- *
- * Revision 1.2 2004/07/02 13:28:26 strk
- * Fixed all #include lines to reflect headers layout change.
- * Added client application build tips in README.
- *
- * Revision 1.1 2004/03/19 09:48:45 ybychkov
- * "geomgraph" and "geomgraph/indexl" upgraded to JTS 1.4
- *
- * Revision 1.9 2003/11/07 01:23:42 pramsey
- * Add standard CVS headers licence notices and copyrights to all cpp and h
- * files.
- *
- *
- **********************************************************************/
-
Modified: trunk/src/geomgraph/Label.cpp
===================================================================
--- trunk/src/geomgraph/Label.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/Label.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -35,12 +35,12 @@
namespace geomgraph { // geos.geomgraph
/*public static*/
-Label*
+Label
Label::toLineLabel(const Label &label)
{
- Label *lineLabel=new Label(Location::UNDEF);
+ Label lineLabel(Location::UNDEF);
for (int i=0; i<2; i++) {
- lineLabel->setLocation(i, label.getLocation(i));
+ lineLabel.setLocation(i, label.getLocation(i));
}
return lineLabel;
}
@@ -192,6 +192,13 @@
/*public*/
bool
+Label::isNull() const
+{
+ return elt[0].isNull() && elt[1].isNull();
+}
+
+/*public*/
+bool
Label::isAnyNull(int geomIndex) const
{
assert(geomIndex>=0 && geomIndex<2);
Modified: trunk/src/geomgraph/Node.cpp
===================================================================
--- trunk/src/geomgraph/Node.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/Node.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,9 +1,9 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
@@ -49,7 +49,7 @@
/*public*/
Node::Node(const Coordinate& newCoord, EdgeEndStar* newEdges)
:
- GraphComponent(new Label(0,Location::UNDEF)),
+ GraphComponent(Label(0,Location::UNDEF)),
coord(newCoord),
edges(newEdges)
@@ -108,7 +108,7 @@
{
testInvariant();
- return (label->getGeometryCount()==1);
+ return (label.getGeometryCount()==1);
}
/*public*/
@@ -159,8 +159,8 @@
void
Node::mergeLabel(const Node& n)
{
- assert(n.label);
- mergeLabel(*(n.label));
+ assert(!n.label.isNull());
+ mergeLabel(n.label);
testInvariant();
}
@@ -169,9 +169,9 @@
Node::mergeLabel(const Label& label2)
{
for (int i=0; i<2; i++) {
- int loc=computeMergedLocation(&label2, i);
- int thisLoc=label->getLocation(i);
- if (thisLoc==Location::UNDEF) label->setLocation(i,loc);
+ int loc=computeMergedLocation(label2, i);
+ int thisLoc=label.getLocation(i);
+ if (thisLoc==Location::UNDEF) label.setLocation(i,loc);
}
testInvariant();
}
@@ -180,10 +180,10 @@
void
Node::setLabel(int argIndex, int onLocation)
{
- if (label==NULL) {
- label=new Label(argIndex, onLocation);
+ if ( label.isNull() ) {
+ label = Label(argIndex, onLocation);
} else
- label->setLocation(argIndex, onLocation);
+ label.setLocation(argIndex, onLocation);
testInvariant();
}
@@ -192,10 +192,7 @@
void
Node::setLabelBoundary(int argIndex)
{
- // See https://sourceforge.net/tracker/?func=detail&aid=3353871&group_id=128875&atid=713120
- if (label == NULL) return;
-
- int loc = label->getLocation(argIndex);
+ int loc = label.getLocation(argIndex);
// flip the loc
int newLoc;
switch (loc){
@@ -203,19 +200,19 @@
case Location::INTERIOR: newLoc=Location::BOUNDARY; break;
default: newLoc=Location::BOUNDARY; break;
}
- label->setLocation(argIndex, newLoc);
+ label.setLocation(argIndex, newLoc);
testInvariant();
}
/*public*/
int
-Node::computeMergedLocation(const Label* label2, int eltIndex)
+Node::computeMergedLocation(const Label& label2, int eltIndex)
{
int loc=Location::UNDEF;
- loc=label->getLocation(eltIndex);
- if (!label2->isNull(eltIndex)) {
- int nLoc=label2->getLocation(eltIndex);
+ loc=label.getLocation(eltIndex);
+ if (!label2.isNull(eltIndex)) {
+ int nLoc=label2.getLocation(eltIndex);
if (loc!=Location::BOUNDARY) loc=nLoc;
}
@@ -275,44 +272,10 @@
{
os << "Node["<<&node<<"]" << std::endl
<< " POINT(" << node.coord << ")" << std::endl
- << " lbl: "+node.label->toString();
+ << " lbl: " << node.label;
return os;
}
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.24 2006/04/27 15:03:48 strk
- * standard algorithm used in addZ() for vector seek
- *
- * Revision 1.23 2006/04/07 16:01:51 strk
- * Port info, doxygen comments, testInvariant(), many assertionss, handling of
- * the NULL EdgeEndStar member
- *
- * Revision 1.22 2006/03/15 16:27:54 strk
- * operator<< for Node class
- *
- * Revision 1.21 2006/03/14 15:31:39 strk
- * Cleaned up toString funx (more WKT friendly)
- *
- * Revision 1.20 2006/03/14 12:55:55 strk
- * Headers split: geomgraphindex.h, nodingSnapround.h
- *
- * Revision 1.19 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.18 2006/03/02 12:12:00 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- * Revision 1.17 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.16 2005/11/29 00:48:35 strk
- * Removed edgeList cache from EdgeEndRing. edgeMap is enough.
- * Restructured iterated access by use of standard ::iterator abstraction
- * with scoped typedefs.
- *
- **********************************************************************/
-
Modified: trunk/src/geomgraph/NodeMap.cpp
===================================================================
--- trunk/src/geomgraph/NodeMap.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/NodeMap.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -148,7 +148,7 @@
NodeMap::const_iterator it=nodeMap.begin();
for (;it!=nodeMap.end();it++) {
Node *node=it->second;
- if (node->getLabel()->getLocation(geomIndex)==Location::BOUNDARY)
+ if (node->getLabel().getLocation(geomIndex)==Location::BOUNDARY)
bdyNodes.push_back(node);
}
}
Modified: trunk/src/geomgraph/PlanarGraph.cpp
===================================================================
--- trunk/src/geomgraph/PlanarGraph.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/geomgraph/PlanarGraph.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -14,7 +13,7 @@
*
**********************************************************************
*
- * Last port: geomgraph/PlanarGraph.java rev. 1.6 (JTS-1.10)
+ * Last port: geomgraph/PlanarGraph.java r428 (JTS-1.12+)
*
**********************************************************************/
@@ -110,8 +109,8 @@
Node *node=nodes->find(coord);
if (node==NULL) return false;
- Label *label=node->getLabel();
- if (label!=NULL && label->getLocation(geomIndex)==Location::BOUNDARY)
+ const Label& label = node->getLabel();
+ if (! label.isNull() && label.getLocation(geomIndex)==Location::BOUNDARY)
return true;
return false;
@@ -377,40 +376,3 @@
} // namespace geos.geomgraph
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.33 2006/06/12 11:29:23 strk
- * unsigned int => size_t
- *
- * Revision 1.32 2006/05/04 12:17:27 strk
- * Added comment about management of newly created DirectedEdges
- *
- * Revision 1.31 2006/04/27 15:07:15 strk
- * use output operators in debugging lines
- *
- * Revision 1.30 2006/04/07 16:52:20 strk
- * Port info, doxygen comments, assertion checking
- *
- * Revision 1.29 2006/03/15 17:16:29 strk
- * streamlined headers inclusion
- *
- * Revision 1.28 2006/03/14 15:46:53 strk
- * Added PlanarGraph::getNodes(vector&) func, to reduce useless heap allocations
- *
- * Revision 1.27 2006/03/09 16:46:47 strk
- * geos::geom namespace definition, first pass at headers split
- *
- * Revision 1.26 2006/03/06 19:40:46 strk
- * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
- *
- * Revision 1.25 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.24 2006/03/02 16:21:26 strk
- * geos::precision namespace added
- *
- * Revision 1.23 2006/03/02 12:12:00 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- **********************************************************************/
-
Modified: trunk/src/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/src/operation/buffer/BufferBuilder.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/buffer/BufferBuilder.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -104,14 +104,11 @@
static Profiler *profiler = Profiler::instance();
#endif
-/**
-* Compute the change in depth as an edge is crossed from R to L
-*/
int
-BufferBuilder::depthDelta(Label *label)
+BufferBuilder::depthDelta(const Label& label)
{
- int lLoc=label->getLocation(0, Position::LEFT);
- int rLoc=label->getLocation(0, Position::RIGHT);
+ int lLoc=label.getLocation(0, Position::LEFT);
+ int rLoc=label.getLocation(0, Position::RIGHT);
if (lLoc== Location::INTERIOR && rLoc== Location::EXTERIOR)
return 1;
else if (lLoc== Location::EXTERIOR && rLoc== Location::INTERIOR)
@@ -126,9 +123,6 @@
{
delete li; // could be NULL
delete intersectionAdder;
- //delete edgeList;
- for (size_t i=0; i<newLabels.size(); i++)
- delete newLabels[i];
}
/*public*/
@@ -542,7 +536,7 @@
// as Edge will take ownership of them
// TODO: find a way to transfer ownership instead
// Who will own the edge ? FIXME: find out and handle that!
- Edge* edge = new Edge(cs, new Label(*oldLabel));
+ Edge* edge = new Edge(cs, *oldLabel);
// will take care of the Edge ownership
insertUniqueEdge(edge);
@@ -562,25 +556,26 @@
{
//<FIX> MD 8 Oct 03 speed up identical edge lookup
// fast lookup
- Edge *existingEdge=edgeList.findEqualEdge(e);
+ Edge *existingEdge = edgeList.findEqualEdge(e);
// If an identical edge already exists, simply update its label
if (existingEdge != NULL) {
- Label *existingLabel=existingEdge->getLabel();
- Label *labelToMerge=e->getLabel();
+ Label& existingLabel = existingEdge->getLabel();
+ Label labelToMerge = e->getLabel();
// check if new edge is in reverse direction to existing edge
// if so, must flip the label before merging it
if (! existingEdge->isPointwiseEqual(e))
{
- labelToMerge=new Label(*(e->getLabel()));
- labelToMerge->flip();
- newLabels.push_back(labelToMerge);
+ labelToMerge = e->getLabel();
+ labelToMerge.flip();
}
- existingLabel->merge(*labelToMerge);
+
+ existingLabel.merge(labelToMerge);
+
// compute new depth delta of sum of edges
- int mergeDelta=depthDelta(labelToMerge);
- int existingDelta=existingEdge->getDepthDelta();
- int newDelta=existingDelta + mergeDelta;
+ int mergeDelta = depthDelta(labelToMerge);
+ int existingDelta = existingEdge->getDepthDelta();
+ int newDelta = existingDelta + mergeDelta;
existingEdge->setDepthDelta(newDelta);
// we have memory release responsibility
@@ -684,199 +679,3 @@
} // namespace geos.operation
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.56 2006/06/12 11:29:23 strk
- * unsigned int => size_t
- *
- * Revision 1.55 2006/05/04 09:16:58 strk
- * Added JTS debugging, for comparison with JTS
- *
- * Revision 1.54 2006/03/24 09:25:02 strk
- * Bugs #77 and #76: missing <algorithm>
- *
- * Revision 1.53 2006/03/22 18:12:32 strk
- * indexChain.h header split.
- *
- * Revision 1.52 2006/03/17 13:24:59 strk
- * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
- *
- * Revision 1.51 2006/03/15 18:57:10 strk
- * cleanups in DEBUG lines
- *
- * Revision 1.50 2006/03/15 13:03:01 strk
- * removed leftover debugging line
- *
- * Revision 1.49 2006/03/15 11:42:54 strk
- * more debugging lines, with two levels of debugging handled
- *
- * Revision 1.48 2006/03/14 16:08:21 strk
- * changed buildSubgraphs signature to use refs rather then pointers, made it const-correct. Reduced heap allocations in createSubgraphs()
- *
- * Revision 1.47 2006/03/14 14:16:52 strk
- * operator<< for BufferSubgraph, more debugging calls
- *
- * Revision 1.46 2006/03/14 12:55:56 strk
- * Headers split: geomgraphindex.h, nodingSnapround.h
- *
- * Revision 1.45 2006/03/14 00:19:40 strk
- * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
- *
- * Revision 1.44 2006/03/10 10:44:53 strk
- * Unreferenced exception objects cleanup (#52)
- *
- * Revision 1.43 2006/03/06 19:40:47 strk
- * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
- *
- * Revision 1.42 2006/03/03 10:46:21 strk
- * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
- *
- * Revision 1.41 2006/03/02 12:12:01 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- * Revision 1.40 2006/02/28 17:44:27 strk
- * Added a check in SegmentNode::addSplitEdge to prevent attempts
- * to build SegmentString with less then 2 points.
- * This is a temporary fix for the buffer.xml assertion failure, temporary
- * as Martin Davis review would really be needed there.
- *
- * Revision 1.39 2006/02/28 14:34:05 strk
- * Added many assertions and debugging output hunting for a bug in BufferOp
- *
- * Revision 1.38 2006/02/23 20:05:21 strk
- * Fixed bug in MCIndexNoder constructor making memory checker go crazy, more
- * doxygen-friendly comments, miscellaneous cleanups
- *
- * Revision 1.37 2006/02/23 11:54:20 strk
- * - MCIndexPointSnapper
- * - MCIndexSnapRounder
- * - SnapRounding BufferOp
- * - ScaledNoder
- * - GEOSException hierarchy cleanups
- * - SpatialIndex memory-friendly query interface
- * - GeometryGraph::getBoundaryNodes memory-friendly
- * - NodeMap::getBoundaryNodes memory-friendly
- * - Cleanups in geomgraph::Edge
- * - Added an XML test for snaprounding buffer (shows leaks, working on it)
- *
- * Revision 1.36 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.35 2006/02/18 21:08:09 strk
- * - new CoordinateSequence::applyCoordinateFilter method (slow but useful)
- * - SegmentString::getCoordinates() doesn't return a clone anymore.
- * - SegmentString::getCoordinatesRO() obsoleted.
- * - SegmentString constructor does not promises constness of passed
- * CoordinateSequence anymore.
- * - NEW ScaledNoder class
- * - Stubs for MCIndexPointSnapper and MCIndexSnapRounder
- * - Simplified internal interaces of OffsetCurveBuilder and OffsetCurveSetBuilder
- *
- * Revision 1.34 2006/02/14 13:28:26 strk
- * New SnapRounding code ported from JTS-1.7 (not complete yet).
- * Buffer op optimized by using new snaprounding code.
- * Leaks fixed in XMLTester.
- *
- * Revision 1.33 2006/02/09 15:52:47 strk
- * GEOSException derived from std::exception; always thrown and cought by const ref.
- *
- * Revision 1.32 2006/02/08 17:18:28 strk
- * - New WKTWriter::toLineString and ::toPoint convenience methods
- * - New IsValidOp::setSelfTouchingRingFormingHoleValid method
- * - New Envelope::centre()
- * - New Envelope::intersection(Envelope)
- * - New Envelope::expandBy(distance, [ydistance])
- * - New LineString::reverse()
- * - New MultiLineString::reverse()
- * - New Geometry::buffer(distance, quadSeg, endCapStyle)
- * - Obsoleted toInternalGeometry/fromInternalGeometry
- * - More const-correctness in Buffer "package"
- *
- * Revision 1.31 2006/01/31 19:07:34 strk
- * - Renamed DefaultCoordinateSequence to CoordinateArraySequence.
- * - Moved GetNumGeometries() and GetGeometryN() interfaces
- * from GeometryCollection to Geometry class.
- * - Added getAt(int pos, Coordinate &to) funtion to CoordinateSequence class.
- * - Reworked automake scripts to produce a static lib for each subdir and
- * then link all subsystem's libs togheter
- * - Moved C-API in it's own top-level dir capi/
- * - Moved source/bigtest and source/test to tests/bigtest and test/xmltester
- * - Fixed PointLocator handling of LinearRings
- * - Changed CoordinateArrayFilter to reduce memory copies
- * - Changed UniqueCoordinateArrayFilter to reduce memory copies
- * - Added CGAlgorithms::isPointInRing() version working with
- * Coordinate::ConstVect type (faster!)
- * - Ported JTS-1.7 version of ConvexHull with big attention to
- * memory usage optimizations.
- * - Improved XMLTester output and user interface
- * - geos::geom::util namespace used for geom/util stuff
- * - Improved memory use in geos::geom::util::PolygonExtractor
- * - New ShortCircuitedGeometryVisitor class
- * - New operation/predicate package
- *
- * Revision 1.30 2005/11/21 16:03:20 strk
- *
- * Coordinate interface change:
- * Removed setCoordinate call, use assignment operator
- * instead. Provided a compile-time switch to
- * make copy ctor and assignment operators non-inline
- * to allow for more accurate profiling.
- *
- * Coordinate copies removal:
- * NodeFactory::createNode() takes now a Coordinate reference
- * rather then real value. This brings coordinate copies
- * in the testLeaksBig.xml test from 654818 to 645991
- * (tested in 2.1 branch). In the head branch Coordinate
- * copies are 222198.
- * Removed useless coordinate copies in ConvexHull
- * operations
- *
- * STL containers heap allocations reduction:
- * Converted many containers element from
- * pointers to real objects.
- * Made some use of .reserve() or size
- * initialization when final container size is known
- * in advance.
- *
- * Stateless classes allocations reduction:
- * Provided ::instance() function for
- * NodeFactories, to avoid allocating
- * more then one (they are all
- * stateless).
- *
- * HCoordinate improvements:
- * Changed HCoordinate constructor by HCoordinates
- * take reference rather then real objects.
- * Changed HCoordinate::intersection to avoid
- * a new allocation but rather return into a provided
- * storage. LineIntersector changed to reflect
- * the above change.
- *
- * Revision 1.29 2005/11/14 18:14:04 strk
- * Reduced heap allocations made by TopologyLocation and Label objects.
- * Enforced const-correctness on GraphComponent.
- * Cleanups.
- *
- * Revision 1.28 2005/08/22 13:31:17 strk
- * Fixed comparator functions used with STL sort() algorithm to
- * implement StrictWeakOrdering semantic.
- *
- * Revision 1.27 2005/05/19 10:29:28 strk
- * Removed some CGAlgorithms instances substituting them with direct calls
- * to the static functions. Interfaces accepting CGAlgorithms pointers kept
- * for backward compatibility but modified to make the argument optional.
- * Fixed a small memory leak in OffsetCurveBuilder::getRingCurve.
- * Inlined some smaller functions encountered during bug hunting.
- * Updated Copyright notices in the touched files.
- *
- * Revision 1.26 2005/02/01 13:44:59 strk
- * More profiling labels.
- *
- * Revision 1.25 2004/12/08 13:54:43 strk
- * gcc warnings checked and fixed, general cleanups.
- *
- * Revision 1.24 2004/11/04 19:08:07 strk
- * Cleanups, initializers list, profiling.
- *
- **********************************************************************/
-
Modified: trunk/src/operation/overlay/LineBuilder.cpp
===================================================================
--- trunk/src/operation/overlay/LineBuilder.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/overlay/LineBuilder.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -134,20 +133,26 @@
LineBuilder::collectLineEdge(DirectedEdge *de, OverlayOp::OpCode opCode,
vector<Edge*> *edges)
{
- Label *label=de->getLabel();
- Edge *e=de->getEdge();
- // include L edges which are in the result
- if (de->isLineEdge()) {
- if (!de->isVisited()
- && OverlayOp::isResultOfOp(label,opCode)
- && !e->isCovered())
+
+ // include L edges which are in the result
+ if (de->isLineEdge()) {
+
+ const Label& label = de->getLabel();
+
+ Edge *e = de->getEdge();
+
+ if (!de->isVisited()
+ && OverlayOp::isResultOfOp(label, opCode)
+ && !e->isCovered() )
{
//Debug.println("de: "+de.getLabel());
//Debug.println("edge: "+e.getLabel());
edges->push_back(e);
de->setVisitedEdge(true);
}
+
}
+
}
/*private*/
@@ -171,7 +176,7 @@
// include the linework if it's in the result of the operation
- Label *label = de->getLabel();
+ const Label& label = de->getLabel();
if ( OverlayOp::isResultOfOp(label, opCode)
&& opCode == OverlayOp::opINTERSECTION )
{
@@ -186,7 +191,6 @@
for(size_t i=0, s=lineEdgesList.size(); i<s; ++i)
{
Edge *e=lineEdgesList[i];
- //Label *label=e->getLabel();
CoordinateSequence *cs = e->getCoordinates()->clone();
#if COMPUTE_Z
propagateZ(cs);
@@ -290,13 +294,13 @@
for(size_t i=0, s=edgesList->size(); i<s; ++i)
{
Edge *e=(*edgesList)[i];
- Label *label=e->getLabel();
+ const Label& label = e->getLabel();
//n.print(System.out);
if (e->isIsolated()) {
- if (label->isNull(0))
- labelIsolatedLine(e,0);
+ if (label.isNull(0))
+ labelIsolatedLine(e, 0);
else
- labelIsolatedLine(e,1);
+ labelIsolatedLine(e, 1);
}
}
}
@@ -307,94 +311,12 @@
void
LineBuilder::labelIsolatedLine(Edge *e, int targetIndex)
{
- int loc=ptLocator->locate(e->getCoordinate(),op->getArgGeometry(targetIndex));
- e->getLabel()->setLocation(targetIndex,loc);
+ int loc = ptLocator->locate( e->getCoordinate(),
+ op->getArgGeometry(targetIndex) );
+ e->getLabel().setLocation(targetIndex,loc);
}
} // namespace geos.operation.overlay
} // namespace geos.operation
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.28 2006/06/13 22:19:39 strk
- * fixed unused parameter warning
- *
- * Revision 1.27 2006/06/12 11:29:24 strk
- * unsigned int => size_t
- *
- * Revision 1.26 2006/06/05 15:36:34 strk
- * Given OverlayOp funx code enum a name and renamed values to have a lowercase prefix. Drop all of noding headers from installed header set.
- *
- * Revision 1.25 2006/03/20 16:57:44 strk
- * spatialindex.h and opValid.h headers split
- *
- * Revision 1.24 2006/03/17 13:24:59 strk
- * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
- *
- * Revision 1.23 2006/03/02 12:12:01 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- * Revision 1.22 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.21 2005/12/08 00:03:51 strk
- * LineBuilder::lineEdgesList made a real vector, rather then pointer (private member).
- * Small optimizations in LineBuilder loops, cleanups in LineBuilder class dox.
- *
- * Revision 1.20 2005/11/15 12:14:05 strk
- * Reduced heap allocations, made use of references when appropriate,
- * small optimizations here and there.
- *
- * Revision 1.19 2005/02/05 05:44:47 strk
- * Changed geomgraph nodeMap to use Coordinate pointers as keys, reduces
- * lots of other Coordinate copies.
- *
- * Revision 1.18 2004/12/08 13:54:44 strk
- * gcc warnings checked and fixed, general cleanups.
- *
- * Revision 1.17 2004/11/29 16:05:33 strk
- * Fixed a bug in LineIntersector::interpolateZ causing NaN values
- * to come out.
- * Handled dimensional collapses in ElevationMatrix.
- * Added ISNAN macro and changed ISNAN/FINITE macros to avoid
- * dispendious isnan() and finite() calls.
- *
- * Revision 1.16 2004/11/24 11:32:39 strk
- * Re-enabled Z propagation in output lines.
- *
- * Revision 1.15 2004/11/23 19:53:07 strk
- * Had LineIntersector compute Z by interpolation.
- *
- * Revision 1.14 2004/11/20 18:17:26 strk
- * Added Z propagation for overlay lines output.
- *
- * Revision 1.13 2004/10/20 17:32:14 strk
- * Initial approach to 2.5d intersection()
- *
- * Revision 1.12 2004/07/02 13:28:28 strk
- * Fixed all #include lines to reflect headers layout change.
- * Added client application build tips in README.
- *
- * Revision 1.11 2004/07/01 14:12:44 strk
- *
- * Geometry constructors come now in two flavors:
- * - deep-copy args (pass-by-reference)
- * - take-ownership of args (pass-by-pointer)
- * Same functionality is available through GeometryFactory,
- * including buildGeometry().
- *
- * Revision 1.10 2004/06/30 20:59:13 strk
- * Removed GeoemtryFactory copy from geometry constructors.
- * Enforced const-correctness on GeometryFactory arguments.
- *
- * Revision 1.9 2003/11/07 01:23:42 pramsey
- * Add standard CVS headers licence notices and copyrights to all cpp and h
- * files.
- *
- * Revision 1.8 2003/10/16 08:50:00 strk
- * Memory leak fixes. Improved performance by mean of more calls
- * to new getCoordinatesRO() when applicable.
- *
- **********************************************************************/
-
Modified: trunk/src/operation/overlay/OverlayOp.cpp
===================================================================
--- trunk/src/operation/overlay/OverlayOp.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/overlay/OverlayOp.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -97,10 +96,10 @@
/* static public */
bool
-OverlayOp::isResultOfOp(Label *label, OverlayOp::OpCode opCode)
+OverlayOp::isResultOfOp(const Label& label, OverlayOp::OpCode opCode)
{
- int loc0=label->getLocation(0);
- int loc1=label->getLocation(1);
+ int loc0 = label.getLocation(0);
+ int loc1 = label.getLocation(1);
return isResultOfOp(loc0, loc1, opCode);
}
@@ -246,7 +245,7 @@
Node* newNode=graph.addNode(graphNode->getCoordinate());
assert(newNode);
- newNode->setLabel(argIndex,graphNode->getLabel()->getLocation(argIndex));
+ newNode->setLabel(argIndex, graphNode->getLabel().getLocation(argIndex));
}
}
@@ -336,7 +335,7 @@
assert( dynamic_cast<DirectedEdgeStar*>(ees) );
DirectedEdgeStar* des = static_cast<DirectedEdgeStar*>(ees);
Label &lbl = des->getLabel();
- node->getLabel()->merge(lbl);
+ node->getLabel().merge(lbl);
#if GEOS_DEBUG
cerr<<" "<<node->print()<<endl;
#endif
@@ -357,10 +356,10 @@
it != itEnd; ++it )
{
Node *n=it->second;
- Label *label=n->getLabel();
+ const Label& label = n->getLabel();
if (n->isIsolated())
{
- if (label->isNull(0))
+ if (label.isNull(0))
{
labelIncompleteNode(n,0);
}
@@ -389,7 +388,7 @@
#endif
const Geometry *targetGeom = arg[targetIndex]->getGeometry();
int loc=ptLocator.locate(n->getCoordinate(), targetGeom);
- n->getLabel()->setLocation(targetIndex,loc);
+ n->getLabel().setLocation(targetIndex, loc);
#if GEOS_DEBUG
cerr<<" after location set: "<<n->print()<<endl;
@@ -524,11 +523,11 @@
{
DirectedEdge *de=(DirectedEdge*) (*ee)[i];
// mark all dirEdges with the appropriate label
- Label *label=de->getLabel();
- if (label->isArea()
+ const Label& label = de->getLabel();
+ if ( label.isArea()
&& !de->isInteriorAreaEdge()
- && isResultOfOp(label->getLocation(0,Position::RIGHT),
- label->getLocation(1,Position::RIGHT),
+ && isResultOfOp(label.getLocation(0,Position::RIGHT),
+ label.getLocation(1,Position::RIGHT),
opCode)
)
{
@@ -805,29 +804,30 @@
#if GEOS_DEBUG
cerr<<" found identical edge, should merge Z"<<endl;
#endif
- Label *existingLabel=existingEdge->getLabel();
- Label *labelToMerge=e->getLabel();
+ Label& existingLabel = existingEdge->getLabel();
+ Label labelToMerge = e->getLabel();
+
// check if new edge is in reverse direction to existing edge
// if so, must flip the label before merging it
if (!existingEdge->isPointwiseEqual(e))
{
-// labelToMerge=new Label(e->getLabel());
- labelToMerge->flip();
+ labelToMerge.flip();
}
- Depth &depth=existingEdge->getDepth();
+ Depth &depth = existingEdge->getDepth();
// if this is the first duplicate found for this edge,
// initialize the depths
if (depth.isNull())
{
- depth.add(*existingLabel);
+ depth.add(existingLabel);
}
- depth.add(*labelToMerge);
+ depth.add(labelToMerge);
- existingLabel->merge(*labelToMerge);
+ existingLabel.merge(labelToMerge);
+
//Debug.print("inserted edge: "); Debug.println(e);
//Debug.print("existing edge: "); Debug.println(existingEdge);
dupEdges.push_back(e);
@@ -851,8 +851,8 @@
for(size_t j=0, s=edgeList.getEdges().size(); j<s; ++j)
{
Edge *e=edgeList.get(j);
- Label *lbl=e->getLabel();
- Depth &depth=e->getDepth();
+ Label& lbl = e->getLabel();
+ Depth &depth = e->getDepth();
/*
* Only check edges for which there were duplicates,
@@ -864,7 +864,7 @@
depth.normalize();
for (int i=0;i<2;i++)
{
- if (!lbl->isNull(i) && lbl->isArea() && !depth.isNull(i))
+ if (!lbl.isNull(i) && lbl.isArea() && !depth.isNull(i))
{
/*
* if the depths are equal, this edge is the result of
@@ -873,7 +873,7 @@
* so it has collapsed to a line.
*/
if (depth.getDelta(i)==0) {
- lbl->toLine(i);
+ lbl.toLine(i);
} else {
/*
* This edge may be the result of a dimensional collapse,
@@ -882,9 +882,9 @@
* side locations indicated by the depth values.
*/
assert(!depth.isNull(i,Position::LEFT)); // depth of LEFT side has not been initialized
- lbl->setLocation(i,Position::LEFT,depth.getLocation(i,Position::LEFT));
+ lbl.setLocation(i,Position::LEFT,depth.getLocation(i,Position::LEFT));
assert(!depth.isNull(i,Position::RIGHT)); // depth of RIGHT side has not been initialized
- lbl->setLocation(i,Position::RIGHT,depth.getLocation(i,Position::RIGHT));
+ lbl.setLocation(i,Position::RIGHT,depth.getLocation(i,Position::RIGHT));
}
}
}
@@ -1023,29 +1023,3 @@
} // namespace geos.operation
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.77 2006/07/05 20:19:29 strk
- * added checks for obviously wrong result of difference and intersection ops
- *
- * Revision 1.76 2006/06/14 15:38:16 strk
- * Fixed just-introduced bug
- *
- * Revision 1.75 2006/06/14 15:03:32 strk
- * * source/operation/overlay/OverlayOp.cpp: use NodeMap::container and related typedefs, removed (int) casts, optimized loops.
- *
- * Revision 1.74 2006/06/13 21:42:55 strk
- * trimmed cvs log, cleanups
- *
- * Revision 1.73 2006/06/12 11:29:24 strk
- * unsigned int => size_t
- *
- * Revision 1.72 2006/06/09 07:42:13 strk
- * * source/geomgraph/GeometryGraph.cpp, source/operation/buffer/OffsetCurveSetBuilder.cpp, source/operation/overlay/OverlayOp.cpp, source/operation/valid/RepeatedPointTester.cpp: Fixed warning after Polygon ring accessor methods changed to work with size_t. Small optimizations in loops.
- *
- * Revision 1.71 2006/06/05 15:36:34 strk
- * Given OverlayOp funx code enum a name and renamed values to have a lowercase prefix. Drop all of noding headers from installed header set.
- *
- *
- **********************************************************************/
-
Modified: trunk/src/operation/overlay/PointBuilder.cpp
===================================================================
--- trunk/src/operation/overlay/PointBuilder.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/overlay/PointBuilder.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -85,8 +84,8 @@
* in edge nodes being included even
* if none of their incident edges are included
*/
- Label *label=n->getLabel();
- if (OverlayOp::isResultOfOp(label,opCode))
+ const Label& label=n->getLabel();
+ if (OverlayOp::isResultOfOp(label, opCode))
filterCoveredNodeToPoint(n);
}
}
@@ -106,33 +105,3 @@
} // namespace geos.operation
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.21 2006/06/05 15:36:34 strk
- * Given OverlayOp funx code enum a name and renamed values to have a lowercase prefix. Drop all of noding headers from installed header set.
- *
- * Revision 1.20 2006/03/17 13:24:59 strk
- * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
- *
- * Revision 1.19 2006/03/02 12:12:01 strk
- * Renamed DEBUG macros to GEOS_DEBUG, all wrapped in #ifndef block to allow global override (bug#43)
- *
- * Revision 1.18 2006/02/19 19:46:49 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.17 2005/11/15 12:14:05 strk
- * Reduced heap allocations, made use of references when appropriate,
- * small optimizations here and there.
- *
- * Revision 1.16 2005/06/28 01:07:02 strk
- * improved extraction of result points in overlay op
- *
- * Revision 1.15 2005/06/25 10:20:39 strk
- * OverlayOp speedup (JTS port)
- *
- * Revision 1.14 2005/02/05 05:44:47 strk
- * Changed geomgraph nodeMap to use Coordinate pointers as keys, reduces
- * lots of other Coordinate copies.
- *
- **********************************************************************/
-
Modified: trunk/src/operation/overlay/PolygonBuilder.cpp
===================================================================
--- trunk/src/operation/overlay/PolygonBuilder.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/overlay/PolygonBuilder.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -151,7 +150,7 @@
<< " inResult:" << de->isInResult() << endl
<< " isArea:" << de->getLabel()->isArea() << endl;
#endif
- if (de->isInResult() && de->getLabel()->isArea())
+ if (de->isInResult() && de->getLabel().isArea())
{
// if this edge has not yet been processed
if (de->getEdgeRing() == NULL)
@@ -400,36 +399,3 @@
} // namespace geos.operation
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.43 2006/06/14 19:17:29 strk
- * Fixed bug in findShell() needlessly erasing vector elements
- *
- * Revision 1.42 2006/06/14 13:59:24 strk
- * Fixed bug in PolygonBuilder::placePolygonHoles, performance improved as a side effect.
- *
- * Revision 1.41 2006/06/13 23:26:46 strk
- * cleanups
- *
- * Revision 1.40 2006/06/12 11:29:24 strk
- * unsigned int => size_t
- *
- * Revision 1.39 2006/03/20 16:57:44 strk
- * spatialindex.h and opValid.h headers split
- *
- * Revision 1.38 2006/03/20 13:20:29 strk
- * Changed assertion to TopologyException for the "orphaned" hole case
- * in order to allow for reduced precision ops to catch the case.
- *
- * Revision 1.37 2006/03/20 12:33:45 strk
- * Simplified some privat methods to use refs instead of pointers, added
- * debugging section for failiures of holes/shells associations
- *
- * Revision 1.36 2006/03/17 13:24:59 strk
- * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
- *
- * Revision 1.35 2006/03/15 11:44:04 strk
- * debug blocks, dumping SQL when GEOS_DEBUG > 1
- *
- **********************************************************************/
-
Modified: trunk/src/operation/relate/EdgeEndBuilder.cpp
===================================================================
--- trunk/src/operation/relate/EdgeEndBuilder.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/relate/EdgeEndBuilder.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -104,9 +103,9 @@
// if prev intersection is past the previous vertex, use it instead
if (eiPrev!=NULL && eiPrev->segmentIndex>=iPrev)
pPrev=eiPrev->coord;
- Label *label=new Label(*(edge->getLabel()));
+ Label label( edge->getLabel() );
// since edgeStub is oriented opposite to it's parent edge, have to flip sides for edge label
- label->flip();
+ label.flip();
EdgeEnd *e=new EdgeEnd(edge,eiCurr->coord,pPrev,label);
//e.print(System.out); System.out.println();
l->push_back(e);
@@ -131,7 +130,7 @@
// if the next intersection is in the same segment as the current, use it as the endpoint
if (eiNext!=NULL && eiNext->segmentIndex==eiCurr->segmentIndex)
pNext=eiNext->coord;
- EdgeEnd *e=new EdgeEnd(edge,eiCurr->coord,pNext,new Label(*(edge->getLabel())));
+ EdgeEnd *e = new EdgeEnd(edge, eiCurr->coord, pNext, edge->getLabel());
//Debug.println(e);
l->push_back(e);
}
@@ -140,16 +139,3 @@
} // namespace geos.operation
} // namespace geos
-/**********************************************************************
- * $Log$
- * Revision 1.17 2006/03/21 13:11:29 strk
- * opRelate.h header split
- *
- * Revision 1.16 2006/03/20 16:57:44 strk
- * spatialindex.h and opValid.h headers split
- *
- * Revision 1.15 2006/02/19 19:46:50 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- **********************************************************************/
-
Modified: trunk/src/operation/relate/EdgeEndBundle.cpp
===================================================================
--- trunk/src/operation/relate/EdgeEndBundle.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/relate/EdgeEndBundle.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -39,7 +38,7 @@
EdgeEndBundle::EdgeEndBundle(EdgeEnd *e):
EdgeEnd(e->getEdge(),e->getCoordinate(),
e->getDirectedCoordinate(),
- new Label(*(e->getLabel())))
+ e->getLabel())
{
edgeEnds=new vector<EdgeEnd*>();
insert(e);
@@ -52,10 +51,6 @@
delete edgeEnds;
}
-Label* EdgeEndBundle::getLabel(){
- return label;
-}
-
//Not needed
//public Iterator iterator() { return edgeEnds.iterator(); }
@@ -86,14 +81,12 @@
it != itEnd; it++)
{
EdgeEnd *e=*it;
- if (e->getLabel()->isArea()) isArea=true;
+ if (e->getLabel().isArea()) isArea=true;
}
if (isArea) {
- delete label;
- label=new Label(Location::UNDEF,Location::UNDEF,Location::UNDEF);
+ label = Label(Location::UNDEF,Location::UNDEF,Location::UNDEF);
} else {
- delete label;
- label=new Label(Location::UNDEF);
+ label = Label(Location::UNDEF);
}
// compute the On label, and the side labels if present
for(int i=0;i<2;i++) {
@@ -113,7 +106,7 @@
for(vector<EdgeEnd*>::iterator it=edgeEnds->begin();it<edgeEnds->end();it++) {
EdgeEnd *e=*it;
- int loc=e->getLabel()->getLocation(geomIndex);
+ int loc=e->getLabel().getLocation(geomIndex);
if (loc==Location::BOUNDARY) boundaryCount++;
if (loc==Location::INTERIOR) foundInterior=true;
}
@@ -123,7 +116,7 @@
loc = GeometryGraph::determineBoundary(boundaryNodeRule,
boundaryCount);
}
- label->setLocation(geomIndex,loc);
+ label.setLocation(geomIndex,loc);
}
@@ -152,27 +145,24 @@
void EdgeEndBundle::computeLabelSide(int geomIndex, int side) {
for(vector<EdgeEnd*>::iterator it=edgeEnds->begin();it<edgeEnds->end();it++) {
EdgeEnd *e=*it;
- if (e->getLabel()->isArea()) {
- int loc=e->getLabel()->getLocation(geomIndex,side);
+ if (e->getLabel().isArea()) {
+ int loc=e->getLabel().getLocation(geomIndex,side);
if (loc==Location::INTERIOR) {
- label->setLocation(geomIndex,side,Location::INTERIOR);
+ label.setLocation(geomIndex,side,Location::INTERIOR);
return;
} else if (loc==Location::EXTERIOR) {
- label->setLocation(geomIndex,side,Location::EXTERIOR);
+ label.setLocation(geomIndex,side,Location::EXTERIOR);
}
}
}
}
-/**
-* Update the IM with the contribution for the computed label for the EdgeStubs.
-*/
-void EdgeEndBundle::updateIM(IntersectionMatrix *im) {
- Edge::updateIM(label,im);
+void EdgeEndBundle::updateIM(IntersectionMatrix& im) {
+ Edge::updateIM(label, im);
}
string EdgeEndBundle::print() {
- string out="EdgeEndBundle--> Label: "+label->toString()+"\n";
+ string out="EdgeEndBundle--> Label: "+label.toString()+"\n";
for(vector<EdgeEnd*>::iterator it=edgeEnds->begin();it<edgeEnds->end();it++) {
EdgeEnd *e=*it;
out+=e->print();
@@ -184,22 +174,3 @@
} // namespace geos.operation.relate
} // namespace geos.operation
} // namespace geos
-
-/**********************************************************************
- * $Log$
- * Revision 1.15 2006/06/12 11:29:24 strk
- * unsigned int => size_t
- *
- * Revision 1.14 2006/03/21 13:11:29 strk
- * opRelate.h header split
- *
- * Revision 1.13 2006/03/17 16:48:55 strk
- * LineIntersector and PointLocator made complete components of RelateComputer
- * (were statics const pointers before). Reduced inclusions from opRelate.h
- * and opValid.h, updated .cpp files to allow build.
- *
- * Revision 1.12 2006/02/19 19:46:50 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- **********************************************************************/
-
Modified: trunk/src/operation/relate/EdgeEndBundleStar.cpp
===================================================================
--- trunk/src/operation/relate/EdgeEndBundleStar.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/relate/EdgeEndBundleStar.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -64,11 +64,8 @@
}
}
-/**
- * Update the IM with the contribution for the EdgeStubs around the node.
- */
void
-EdgeEndBundleStar::updateIM(IntersectionMatrix *im)
+EdgeEndBundleStar::updateIM(IntersectionMatrix& im)
{
//vector<EdgeEnd*> *edges=getEdges();
EdgeEndStar::iterator it=begin();
Modified: trunk/src/operation/relate/RelateComputer.cpp
===================================================================
--- trunk/src/operation/relate/RelateComputer.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/relate/RelateComputer.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -142,7 +142,7 @@
//debugPrintln("Graph B isolated edges - ");
labelIsolatedEdges(1,0);
// update the IM from all components
- updateIM(im.get());
+ updateIM( *im );
return im.release();
}
@@ -155,6 +155,7 @@
}
}
+/* private */
void
RelateComputer::computeProperIntersectionIM(SegmentIntersector *intersector,IntersectionMatrix *imX)
{
@@ -219,7 +220,7 @@
Node *graphNode=nodeIt->second;
Node *newNode=nodes.addNode(graphNode->getCoordinate());
newNode->setLabel(argIndex,
- graphNode->getLabel()->getLocation(argIndex));
+ graphNode->getLabel().getLocation(argIndex));
//node.print(System.out);
}
}
@@ -240,7 +241,7 @@
for(std::vector<Edge*>::iterator i=edges->begin();i<edges->end();i++)
{
Edge *e=*i;
- int eLoc=e->getLabel()->getLocation(argIndex);
+ int eLoc=e->getLabel().getLocation(argIndex);
EdgeIntersectionList &eiL=e->getEdgeIntersectionList();
EdgeIntersectionList::iterator it=eiL.begin();
EdgeIntersectionList::iterator end=eiL.end();
@@ -255,7 +256,7 @@
}
else
{
- if (n->getLabel()->isNull(argIndex))
+ if (n->getLabel().isNull(argIndex))
n->setLabel(argIndex,Location::INTERIOR);
}
}
@@ -275,7 +276,7 @@
std::vector<Edge*> *edges=(*arg)[argIndex]->getEdges();
for(std::vector<Edge*>::iterator i=edges->begin();i<edges->end();i++) {
Edge *e=*i;
- int eLoc=e->getLabel()->getLocation(argIndex);
+ int eLoc=e->getLabel().getLocation(argIndex);
EdgeIntersectionList &eiL=e->getEdgeIntersectionList();
EdgeIntersectionList::iterator eiIt=eiL.begin();
EdgeIntersectionList::iterator eiEnd=eiL.end();
@@ -284,7 +285,7 @@
{
EdgeIntersection *ei=*eiIt;
RelateNode *n=(RelateNode*) nodes.find(ei->coord);
- if (n->getLabel()->isNull(argIndex)) {
+ if (n->getLabel().isNull(argIndex)) {
if (eLoc==Location::BOUNDARY)
n->setLabelBoundary(argIndex);
else
@@ -328,7 +329,7 @@
/*private*/
void
-RelateComputer::updateIM(IntersectionMatrix *imX)
+RelateComputer::updateIM(IntersectionMatrix& imX)
{
//Debug.println(im);
std::vector<Edge *>::iterator ei=isolatedEdges.begin();
@@ -374,9 +375,9 @@
// Possibly should use ptInArea locator instead? We probably know here
// that the edge does not touch the bdy of the target Geometry
int loc=ptLocator.locate(e->getCoordinate(), target);
- e->getLabel()->setAllLocations(targetIndex,loc);
+ e->getLabel().setAllLocations(targetIndex,loc);
} else {
- e->getLabel()->setAllLocations(targetIndex,Location::EXTERIOR);
+ e->getLabel().setAllLocations(targetIndex,Location::EXTERIOR);
}
//System.out.println(e.getLabel());
}
@@ -389,11 +390,11 @@
for( ; nodeIt!=nodeEnd; nodeIt++)
{
Node *n=nodeIt->second;
- Label *label=n->getLabel();
+ const Label& label = n->getLabel();
// isolated nodes should always have at least one geometry in their label
- assert(label->getGeometryCount()>0); // node with empty label found
+ assert(label.getGeometryCount()>0); // node with empty label found
if (n->isIsolated()) {
- if (label->isNull(0))
+ if (label.isNull(0))
labelIsolatedNode(n,0);
else
labelIsolatedNode(n,1);
@@ -407,7 +408,7 @@
{
int loc=ptLocator.locate(n->getCoordinate(),
(*arg)[targetIndex]->getGeometry());
- n->getLabel()->setAllLocations(targetIndex,loc);
+ n->getLabel().setAllLocations(targetIndex,loc);
//debugPrintln(n.getLabel());
}
Modified: trunk/src/operation/relate/RelateNode.cpp
===================================================================
--- trunk/src/operation/relate/RelateNode.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/relate/RelateNode.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -1,5 +1,4 @@
/**********************************************************************
- * $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
@@ -46,16 +45,13 @@
* A component only contributes if it has a labelling for both parent geometries
*/
void
-RelateNode::computeIM(IntersectionMatrix *im)
+RelateNode::computeIM(IntersectionMatrix& im)
{
- im->setAtLeastIfValid(label->getLocation(0),label->getLocation(1),0);
+ im.setAtLeastIfValid(label.getLocation(0), label.getLocation(1),0);
}
-/**
- * Update the IM with the contribution for the EdgeEnds incident on this node.
- */
void
-RelateNode::updateIMFromEdges(IntersectionMatrix *im)
+RelateNode::updateIMFromEdges(IntersectionMatrix& im)
{
assert(dynamic_cast<EdgeEndBundleStar*>(edges));
EdgeEndBundleStar* eebs=static_cast<EdgeEndBundleStar*>(edges);
@@ -66,17 +62,3 @@
} // namespace geos.operation.relate
} // namespace geos.operation
} // namespace geos
-
-/**********************************************************************
- * $Log$
- * Revision 1.12 2006/03/21 13:11:29 strk
- * opRelate.h header split
- *
- * Revision 1.11 2006/03/20 16:57:44 strk
- * spatialindex.h and opValid.h headers split
- *
- * Revision 1.10 2006/02/19 19:46:50 strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- **********************************************************************/
-
Modified: trunk/src/operation/relate/RelateNodeGraph.cpp
===================================================================
--- trunk/src/operation/relate/RelateNodeGraph.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/relate/RelateNodeGraph.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -98,7 +98,7 @@
for( ; edgeIt<edges->end(); ++edgeIt)
{
Edge *e=*edgeIt;
- int eLoc=e->getLabel()->getLocation(argIndex);
+ int eLoc=e->getLabel().getLocation(argIndex);
EdgeIntersectionList &eiL=e->getEdgeIntersectionList();
EdgeIntersectionList::iterator eiIt=eiL.begin();
EdgeIntersectionList::iterator eiEnd=eiL.end();
@@ -108,7 +108,7 @@
if (eLoc==Location::BOUNDARY)
n->setLabelBoundary(argIndex);
else {
- if (n->getLabel()->isNull(argIndex))
+ if (n->getLabel().isNull(argIndex))
n->setLabel(argIndex,Location::INTERIOR);
}
}
@@ -132,7 +132,7 @@
for(nodeIt=nMap.begin();nodeIt!=nMap.end();nodeIt++) {
Node *graphNode=nodeIt->second;
Node *newNode=nodes->addNode(graphNode->getCoordinate());
- newNode->setLabel(argIndex,graphNode->getLabel()->getLocation(argIndex));
+ newNode->setLabel(argIndex,graphNode->getLabel().getLocation(argIndex));
//node.print(System.out);
}
}
Modified: trunk/src/operation/valid/ConnectedInteriorTester.cpp
===================================================================
--- trunk/src/operation/valid/ConnectedInteriorTester.cpp 2011-07-21 09:54:11 UTC (rev 3449)
+++ trunk/src/operation/valid/ConnectedInteriorTester.cpp 2011-07-26 15:09:35 UTC (rev 3450)
@@ -186,7 +186,7 @@
// Unexpected non DirectedEdge in graphEdgeEnds
assert(dynamic_cast<DirectedEdge*>((*ee)[i]));
DirectedEdge *de=static_cast<DirectedEdge*>((*ee)[i]);
- if ( de->getLabel()->getLocation(0, Position::RIGHT) == Location::INTERIOR)
+ if ( de->getLabel().getLocation(0, Position::RIGHT) == Location::INTERIOR)
{
de->setInResult(true);
}
@@ -274,9 +274,9 @@
Edge *e=graph.findEdgeInSameDirection(pt0, pt1);
DirectedEdge *de=static_cast<DirectedEdge*>(graph.findEdgeEnd(e));
DirectedEdge *intDe=NULL;
- if (de->getLabel()->getLocation(0,Position::RIGHT)==Location::INTERIOR) {
+ if (de->getLabel().getLocation(0,Position::RIGHT)==Location::INTERIOR) {
intDe=de;
- } else if (de->getSym()->getLabel()->getLocation(0,Position::RIGHT)==Location::INTERIOR) {
+ } else if (de->getSym()->getLabel().getLocation(0,Position::RIGHT)==Location::INTERIOR) {
intDe=de->getSym();
}
assert(intDe!=NULL); // unable to find dirEdge with Interior on RHS
@@ -326,8 +326,7 @@
// don't check CW rings which are holes
// (MD - this check may now be irrelevant - 2006-03-09)
- assert(de->getLabel());
- if (de->getLabel()->getLocation(0, Position::RIGHT) != Location::INTERIOR) continue;
+ if (de->getLabel().getLocation(0, Position::RIGHT) != Location::INTERIOR) continue;
/*
* the edgeRing is CW ring which surrounds the INT
More information about the geos-commits
mailing list