BufferBuilder.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2008-2010 Safe Software Inc.
* Copyright (C) 2006-2007 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/buffer/BufferBuilder.java 149b38907 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <vector>
#include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums)
#include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums)
#include <geos/geomgraph/EdgeList.h> // for composition
#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 PrecisionModel;
class Geometry;
class GeometryFactory;
}
namespace algorithm {
class LineIntersector;
}
namespace noding {
class Noder;
class SegmentString;
class IntersectionAdder;
}
namespace geomgraph {
class Edge;
class Label;
class PlanarGraph;
}
namespace operation {
namespace buffer {
class BufferSubgraph;
class PolygonBuilder;
}
}
}
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
class GEOS_DLL BufferBuilder {
public:
BufferBuilder(const BufferParameters& nBufParams)
:
bufParams(nBufParams),
workingPrecisionModel(nullptr),
li(nullptr),
intersectionAdder(nullptr),
workingNoder(nullptr),
geomFact(nullptr),
edgeList(),
isInvertOrientation(false)
{}
~BufferBuilder();
void
setWorkingPrecisionModel(const geom::PrecisionModel* pm)
{
workingPrecisionModel = pm;
}
void
setNoder(noding::Noder* newNoder)
{
workingNoder = newNoder;
}
void
setInvertOrientation(bool p_isInvertOrientation)
{
isInvertOrientation = p_isInvertOrientation;
}
std::unique_ptr<geom::Geometry> buffer(const geom::Geometry* g, double distance);
std::unique_ptr<geom::Geometry> bufferLineSingleSided(
const geom::Geometry* g,
double distance, bool leftSide);
private:
static int depthDelta(const geomgraph::Label& label);
const BufferParameters& bufParams;
const geom::PrecisionModel* workingPrecisionModel;
algorithm::LineIntersector* li;
noding::IntersectionAdder* intersectionAdder;
noding::Noder* workingNoder;
const geom::GeometryFactory* geomFact;
geomgraph::EdgeList edgeList;
std::vector<geomgraph::Label*> newLabels;
bool isInvertOrientation;
void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
const geom::PrecisionModel* precisionModel);
// throw(GEOSException);
void insertUniqueEdge(geomgraph::Edge* e);
void createSubgraphs(geomgraph::PlanarGraph* graph,
std::vector<BufferSubgraph*>& list);
void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
PolygonBuilder& polyBuilder);
noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
std::unique_ptr<geom::Geometry> createEmptyResultGeometry() const;
// Declare type as noncopyable
BufferBuilder(const BufferBuilder& other) = delete;
BufferBuilder& operator=(const BufferBuilder& rhs) = delete;
};
} // namespace geos::operation::buffer
} // namespace geos::operation
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:53
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::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
geos::geomgraph::EdgeList
A EdgeList is a list of Edges.
Definition EdgeList.h:55
geos::geomgraph::Edge
Definition geomgraph/Edge.h:63
geos::geomgraph::Label
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition Label.h:57
geos::geomgraph::PlanarGraph
Represents a directed graph which is embeddable in a planar surface.
Definition geomgraph/PlanarGraph.h:72
geos::noding::IntersectionAdder
Computes the intersections between two line segments in SegmentString and adds them to each string.
Definition IntersectionAdder.h:54
geos::noding::Noder
Computes all intersections between segments in a set of SegmentString.
Definition Noder.h:46
geos::noding::SegmentString
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:47
geos::operation::buffer::BufferBuilder
Builds the buffer geometry for a given input geometry and precision model.
Definition BufferBuilder.h:86
geos::operation::buffer::BufferBuilder::BufferBuilder
BufferBuilder(const BufferParameters &nBufParams)
Definition BufferBuilder.h:98
geos::operation::buffer::BufferBuilder::setInvertOrientation
void setInvertOrientation(bool p_isInvertOrientation)
Definition BufferBuilder.h:151
geos::operation::buffer::BufferBuilder::setNoder
void setNoder(noding::Noder *newNoder)
Definition BufferBuilder.h:137
geos::operation::buffer::BufferBuilder::setWorkingPrecisionModel
void setWorkingPrecisionModel(const geom::PrecisionModel *pm)
Definition BufferBuilder.h:124
geos::operation::buffer::BufferBuilder::bufferLineSingleSided
std::unique_ptr< geom::Geometry > bufferLineSingleSided(const geom::Geometry *g, double distance, bool leftSide)
geos::operation::buffer::BufferParameters
Contains the parameters which describe how a buffer should be constructed.
Definition BufferParameters.h:56
geos::operation::buffer::BufferSubgraph
A connected subset of the graph of DirectedEdge and geomgraph::Node.
Definition BufferSubgraph.h:60
geos::operation::buffer::PolygonBuilder
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition buffer/PolygonBuilder.h:61
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos::geomgraph
Contains classes that implement topology graphs.
Definition Depth.h:31
geos::noding
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition CoverageCleaner.h:42
geos::operation::buffer
Provides classes for computing buffers of geometries.
Definition namespaces.h:182
geos::operation::distance
Provides classes for computing the distance between geometries.
Definition namespaces.h:185
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38