GEOS
3.6.2
|
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/linemerge/LineMerger.java r378 (JTS-1.12) 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_OP_LINEMERGE_LINEMERGER_H 00020 #define GEOS_OP_LINEMERGE_LINEMERGER_H 00021 00022 #include <geos/export.h> 00023 #include <geos/operation/linemerge/LineMergeGraph.h> // for composition 00024 00025 #include <vector> 00026 00027 #ifdef _MSC_VER 00028 #pragma warning(push) 00029 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00030 #endif 00031 00032 // Forward declarations 00033 namespace geos { 00034 namespace geom { 00035 class LineString; 00036 class GeometryFactory; 00037 class Geometry; 00038 } 00039 namespace planargraph { 00040 class Node; 00041 } 00042 namespace operation { 00043 namespace linemerge { 00044 class EdgeString; 00045 class LineMergeDirectedEdge; 00046 } 00047 } 00048 } 00049 00050 00051 namespace geos { 00052 namespace operation { // geos::operation 00053 namespace linemerge { // geos::operation::linemerge 00054 00075 class GEOS_DLL LineMerger { 00076 00077 private: 00078 00079 LineMergeGraph graph; 00080 00081 std::vector<geom::LineString*> *mergedLineStrings; 00082 00083 std::vector<EdgeString*> edgeStrings; 00084 00085 const geom::GeometryFactory *factory; 00086 00087 void merge(); 00088 00089 void buildEdgeStringsForObviousStartNodes(); 00090 00091 void buildEdgeStringsForIsolatedLoops(); 00092 00093 void buildEdgeStringsForUnprocessedNodes(); 00094 00095 void buildEdgeStringsForNonDegree2Nodes(); 00096 00097 void buildEdgeStringsStartingAt(planargraph::Node *node); 00098 00099 EdgeString* buildEdgeStringStartingWith(LineMergeDirectedEdge *start); 00100 00101 public: 00102 LineMerger(); 00103 ~LineMerger(); 00104 00113 void add(std::vector<geom::Geometry*> *geometries); 00114 00123 void add(const geom::Geometry *geometry); 00124 00131 std::vector<geom::LineString*>* getMergedLineStrings(); 00132 00133 void add(const geom::LineString *lineString); 00134 00135 }; 00136 00137 } // namespace geos::operation::linemerge 00138 } // namespace geos::operation 00139 } // namespace geos 00140 00141 #ifdef _MSC_VER 00142 #pragma warning(pop) 00143 #endif 00144 00145 #endif // GEOS_OP_LINEMERGE_LINEMERGER_H