# LineMerger.h

    00001 /**********************************************************************
    00002  * $Id: LineMerger.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************/
    00015
    00016 #ifndef GEOS_OP_LINEMERGE_LINEMERGER_H
    00017 #define GEOS_OP_LINEMERGE_LINEMERGER_H
    00018
    00019 #include <geos/operation/linemerge/LineMergeGraph.h> // for composition
    00020
    00021 #include <vector>
    00022
    00023 // Forward declarations
    00024 namespace geos {
    00025         namespace geom {
    00026                 class LineString;
    00027                 class GeometryFactory;
    00028                 class Geometry;
    00029         }
    00030         namespace planargraph {
    00031                 class Node;
    00032         }
    00033         namespace operation {
    00034                 namespace linemerge {
    00035                         class EdgeString;
    00036                         class LineMergeDirectedEdge;
    00037                 }
    00038         }
    00039 }
    00040
    00041
    00042 namespace geos {
    00043 namespace operation { // geos::operation
    00044 namespace linemerge { // geos::operation::linemerge
    00045
    00066 class LineMerger {
    00067
    00068 private:
    00069
    00070         LineMergeGraph graph;
    00071
    00072         std::vector<geom::LineString*> *mergedLineStrings;
    00073
    00074         std::vector<EdgeString*> edgeStrings;
    00075
    00076         const geom::GeometryFactory *factory;
    00077
    00078         void merge();
    00079
    00080         void buildEdgeStringsForObviousStartNodes();
    00081
    00082         void buildEdgeStringsForIsolatedLoops();
    00083
    00084         void buildEdgeStringsForUnprocessedNodes();
    00085
    00086         void buildEdgeStringsForNonDegree2Nodes();
    00087
    00088         void buildEdgeStringsStartingAt(planargraph::Node *node);
    00089
    00090         EdgeString* buildEdgeStringStartingWith(LineMergeDirectedEdge *start);
    00091
    00092 public:
    00093         LineMerger();
    00094         ~LineMerger();
    00095
    00104         void add(std::vector<geom::Geometry*> *geometries);
    00105
    00114         void add(const geom::Geometry *geometry);
    00115
    00120         std::vector<geom::LineString*>* getMergedLineStrings();
    00121
    00122         void add(const geom::LineString *lineString);
    00123
    00124 };
    00125
    00126 } // namespace geos::operation::linemerge
    00127 } // namespace geos::operation
    00128 } // namespace geos
    00129
    00130 #endif // GEOS_OP_LINEMERGE_LINEMERGER_H
    00131
    00132 /**********************************************************************
    00133  * $Log$
    00134  * Revision 1.1  2006/03/22 10:13:53  strk
    00135  * opLinemerge.h split
    00136  *
    00137  **********************************************************************/