PointBuilder.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2006 Refractions Research Inc.
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  ***********************************************************************
00014  *
00015  * Last port: operation/overlay/PointBuilder.java rev. 1.16 (JTS-1.10)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_OP_OVERLAY_POINTBUILDER_H
00020 #define GEOS_OP_OVERLAY_POINTBUILDER_H
00021 
00022 #include <geos/export.h>
00023 
00024 #include <geos/geom/GeometryFactory.h> // for inlines
00025 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum
00026 #include <geos/util.h>
00027 
00028 #include <vector>
00029 
00030 // Forward declarations
00031 namespace geos {
00032         namespace geom {
00033                 class GeometryFactory;
00034                 class Point;
00035         }
00036         namespace geomgraph {
00037                 class Node;
00038         }
00039         namespace algorithm {
00040                 class PointLocator;
00041         }
00042         namespace operation {
00043                 namespace overlay {
00044                         class OverlayOp;
00045                 }
00046         }
00047 }
00048 
00049 namespace geos {
00050 namespace operation { // geos::operation
00051 namespace overlay { // geos::operation::overlay
00052 
00056 class GEOS_DLL PointBuilder {
00057 private:
00058 
00059         OverlayOp *op;
00060         const geom::GeometryFactory *geometryFactory;
00061         void extractNonCoveredResultNodes(OverlayOp::OpCode opCode);
00062 
00063         /*
00064          * Converts non-covered nodes to Point objects and adds them to
00065          * the result.
00066          *
00067          * A node is covered if it is contained in another element Geometry
00068          * with higher dimension (e.g. a node point might be contained in
00069          * a polygon, in which case the point can be eliminated from
00070          * the result).
00071          *
00072          * @param n the node to test
00073          */
00074         void filterCoveredNodeToPoint(const geomgraph::Node *);
00075 
00079         std::vector<geom::Point*> *resultPointList;
00080 
00081 public:
00082 
00083         PointBuilder(OverlayOp *newOp,
00084                         const geom::GeometryFactory *newGeometryFactory,
00085                         algorithm::PointLocator *newPtLocator=NULL)
00086                 :
00087                 op(newOp),
00088                 geometryFactory(newGeometryFactory),
00089                 resultPointList(new std::vector<geom::Point *>())
00090         {
00091         ::geos::ignore_unused_variable_warning(newPtLocator);
00092     }
00093 
00098         std::vector<geom::Point*>* build(OverlayOp::OpCode opCode);
00099 };
00100 
00101 
00102 } // namespace geos::operation::overlay
00103 } // namespace geos::operation
00104 } // namespace geos
00105 
00106 #endif // ndef GEOS_OP_OVERLAY_POINTBUILDER_H

Generated on 23 Sep 2013 for GEOS by  doxygen 1.4.7