LineMerger.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: operation/linemerge/LineMerger.java r378 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/LineString.h>
#include <geos/operation/linemerge/LineMergeGraph.h> // for composition
#include <memory>
#include <vector>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
// Forward declarations
namespace geos {
namespace geom {
class GeometryFactory;
class Geometry;
}
namespace planargraph {
class Node;
}
namespace operation {
namespace linemerge {
class EdgeString;
class LineMergeDirectedEdge;
}
}
}
namespace geos {
namespace operation { // geos::operation
namespace linemerge { // geos::operation::linemerge
class GEOS_DLL LineMerger {
private:
LineMergeGraph graph;
bool isDirected;
std::vector<std::unique_ptr<geom::LineString>> mergedLineStrings;
std::vector<EdgeString*> edgeStrings;
const geom::GeometryFactory* factory;
void merge();
void buildEdgeStringsForObviousStartNodes();
void buildEdgeStringsForIsolatedLoops();
void buildEdgeStringsForUnprocessedNodes();
void buildEdgeStringsForNonDegree2Nodes();
void buildEdgeStringsStartingAt(planargraph::Node* node);
EdgeString* buildEdgeStringStartingWith(LineMergeDirectedEdge* start);
public:
LineMerger(bool directed = false);
~LineMerger();
void add(std::vector<const geom::Geometry*>* geometries);
void add(const geom::Geometry* geometry);
std::vector<std::unique_ptr<geom::LineString>> getMergedLineStrings();
void add(const geom::LineString* lineString);
// Declare type as noncopyable
LineMerger(const LineMerger& other) = delete;
LineMerger& operator=(const LineMerger& rhs) = delete;
};
} // namespace geos::operation::linemerge
} // namespace geos::operation
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::LineString
Definition LineString.h:66
geos::operation::linemerge::EdgeString
A sequence of LineMergeDirectedEdge forming one of the lines that will be output by the line-merging ...
Definition EdgeString.h:55
geos::operation::linemerge::LineMergeDirectedEdge
A DirectedEdge of a LineMergeGraph.
Definition LineMergeDirectedEdge.h:46
geos::operation::linemerge::LineMergeGraph
A planar graph of edges that is analyzed to sew the edges together.
Definition LineMergeGraph.h:58
geos::operation::linemerge::LineMerger::add
void add(std::vector< const geom::Geometry * > *geometries)
Adds a collection of Geometries to be processed. May be called multiple times.
geos::operation::linemerge::LineMerger::getMergedLineStrings
std::vector< std::unique_ptr< geom::LineString > > getMergedLineStrings()
Returns the LineStrings built by the merging process.
geos::operation::linemerge::LineMerger::add
void add(const geom::Geometry *geometry)
Adds a Geometry to be processed. May be called multiple times.
geos::planargraph::Node
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition planargraph/Node.h:44
geos::geom
Definition Angle.h:26
geos::operation::linemerge
Line merging package.
Definition namespaces.h:192
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos::planargraph
Contains classes to implement a planar graph data structure.
Definition namespaces.h:293
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38