GEOS  3.3.3
PointBuilder.h
1 /**********************************************************************
2  * $Id: PointBuilder.h 2757 2009-12-01 15:39:41Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  ***********************************************************************
15  *
16  * Last port: operation/overlay/PointBuilder.java rev. 1.16 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_OVERLAY_POINTBUILDER_H
21 #define GEOS_OP_OVERLAY_POINTBUILDER_H
22 
23 #include <geos/export.h>
24 
25 #include <geos/geom/GeometryFactory.h> // for inlines
26 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum
27 #include <geos/util.h>
28 
29 #include <vector>
30 
31 // Forward declarations
32 namespace geos {
33  namespace geom {
34  class GeometryFactory;
35  class Point;
36  }
37  namespace geomgraph {
38  class Node;
39  }
40  namespace algorithm {
41  class PointLocator;
42  }
43  namespace operation {
44  namespace overlay {
45  class OverlayOp;
46  }
47  }
48 }
49 
50 namespace geos {
51 namespace operation { // geos::operation
52 namespace overlay { // geos::operation::overlay
53 
57 class GEOS_DLL PointBuilder {
58 private:
59 
60  OverlayOp *op;
61  const geom::GeometryFactory *geometryFactory;
62  void extractNonCoveredResultNodes(OverlayOp::OpCode opCode);
63 
64  /*
65  * Converts non-covered nodes to Point objects and adds them to
66  * the result.
67  *
68  * A node is covered if it is contained in another element Geometry
69  * with higher dimension (e.g. a node point might be contained in
70  * a polygon, in which case the point can be eliminated from
71  * the result).
72  *
73  * @param n the node to test
74  */
75  void filterCoveredNodeToPoint(const geomgraph::Node *);
76 
80  std::vector<geom::Point*> *resultPointList;
81 
82 public:
83 
84  PointBuilder(OverlayOp *newOp,
85  const geom::GeometryFactory *newGeometryFactory,
86  algorithm::PointLocator *newPtLocator=NULL)
87  :
88  op(newOp),
89  geometryFactory(newGeometryFactory),
90  resultPointList(new std::vector<geom::Point *>())
91  {
92  ::geos::ignore_unused_variable_warning(newPtLocator);
93  }
94 
99  std::vector<geom::Point*>* build(OverlayOp::OpCode opCode);
100 };
101 
102 
103 } // namespace geos::operation::overlay
104 } // namespace geos::operation
105 } // namespace geos
106 
107 #endif // ndef GEOS_OP_OVERLAY_POINTBUILDER_H
108 
109 /**********************************************************************
110  * $Log$
111  * Revision 1.2 2006/06/05 15:36:34 strk
112  * Given OverlayOp funx code enum a name and renamed values to have a lowercase prefix. Drop all of noding headers from installed header set.
113  *
114  * Revision 1.1 2006/03/17 13:24:59 strk
115  * 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).
116  *
117  **********************************************************************/
118