GEOS  3.4.2
PointBuilder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  ***********************************************************************
14  *
15  * Last port: operation/overlay/PointBuilder.java rev. 1.16 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_OVERLAY_POINTBUILDER_H
20 #define GEOS_OP_OVERLAY_POINTBUILDER_H
21 
22 #include <geos/export.h>
23 
24 #include <geos/geom/GeometryFactory.h> // for inlines
25 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum
26 #include <geos/util.h>
27 
28 #include <vector>
29 
30 // Forward declarations
31 namespace geos {
32  namespace geom {
33  class GeometryFactory;
34  class Point;
35  }
36  namespace geomgraph {
37  class Node;
38  }
39  namespace algorithm {
40  class PointLocator;
41  }
42  namespace operation {
43  namespace overlay {
44  class OverlayOp;
45  }
46  }
47 }
48 
49 namespace geos {
50 namespace operation { // geos::operation
51 namespace overlay { // geos::operation::overlay
52 
56 class GEOS_DLL PointBuilder {
57 private:
58 
59  OverlayOp *op;
60  const geom::GeometryFactory *geometryFactory;
61  void extractNonCoveredResultNodes(OverlayOp::OpCode opCode);
62 
63  /*
64  * Converts non-covered nodes to Point objects and adds them to
65  * the result.
66  *
67  * A node is covered if it is contained in another element Geometry
68  * with higher dimension (e.g. a node point might be contained in
69  * a polygon, in which case the point can be eliminated from
70  * the result).
71  *
72  * @param n the node to test
73  */
74  void filterCoveredNodeToPoint(const geomgraph::Node *);
75 
79  std::vector<geom::Point*> *resultPointList;
80 
81 public:
82 
83  PointBuilder(OverlayOp *newOp,
84  const geom::GeometryFactory *newGeometryFactory,
85  algorithm::PointLocator *newPtLocator=NULL)
86  :
87  op(newOp),
88  geometryFactory(newGeometryFactory),
89  resultPointList(new std::vector<geom::Point *>())
90  {
91  ::geos::ignore_unused_variable_warning(newPtLocator);
92  }
93 
98  std::vector<geom::Point*>* build(OverlayOp::OpCode opCode);
99 };
100 
101 
102 } // namespace geos::operation::overlay
103 } // namespace geos::operation
104 } // namespace geos
105 
106 #endif // ndef GEOS_OP_OVERLAY_POINTBUILDER_H
OpCode
The spatial functions supported by this class.
Definition: OverlayOp.h:76
Computes the geometric overlay of two Geometry.
Definition: OverlayOp.h:67
Computes the topological relationship (Location) of a single point to a Geometry. ...
Definition: PointLocator.h:57
Constructs geom::Point s from the nodes of an overlay graph.
Definition: PointBuilder.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Definition: geomgraph/Node.h:62