OffsetCurveBuilder.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
* 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/OffsetCurveBuilder.java r378 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/operation/buffer/BufferParameters.h> // for composition
#include <geos/operation/buffer/OffsetSegmentGenerator.h>
#include <vector>
#include <memory> // for unique_ptr
#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 CoordinateSequence;
class PrecisionModel;
}
}
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
class GEOS_DLL OffsetCurveBuilder {
using CoordinateSequence = geos::geom::CoordinateSequence;
using PrecisionModel = geos::geom::PrecisionModel;
public:
/*
* @param nBufParams buffer parameters, this object will
* keep a reference to the passed parameters
* so caller must make sure the object is
* kept alive for the whole lifetime of
* the buffer builder.
*/
OffsetCurveBuilder(
const PrecisionModel* newPrecisionModel,
const BufferParameters& nBufParams)
: distance(0.0)
, precisionModel(newPrecisionModel)
, bufParams(nBufParams)
{}
const BufferParameters&
getBufferParameters() const
{
return bufParams;
}
bool isLineOffsetEmpty(double distance);
void getLineCurve(const CoordinateSequence* inputPts,
double distance,
std::vector<CoordinateSequence*>& lineList);
std::unique_ptr<CoordinateSequence> getLineCurve(
const CoordinateSequence* inputPts, double pDistance);
void getSingleSidedLineCurve(const CoordinateSequence* inputPts,
double distance, std::vector<CoordinateSequence*>& lineList,
bool leftSide, bool rightSide) ;
void getRingCurve(const CoordinateSequence* inputPts, int side,
double distance,
std::vector<CoordinateSequence*>& lineList);
std::unique_ptr<CoordinateSequence> getRingCurve(
const CoordinateSequence* inputPts,
int side, double pDistance);
void getOffsetCurve(const CoordinateSequence* inputPts,
double p_distance,
std::vector<CoordinateSequence*>& lineList);
std::unique_ptr<CoordinateSequence> getOffsetCurve(
const CoordinateSequence* inputPts,
double pDistance);
private:
double distance;
const PrecisionModel* precisionModel;
const BufferParameters& bufParams;
static const double SIMPLIFY_FACTOR; // 100.0;
double simplifyTolerance(double bufDistance);
void computeLineBufferCurve(const CoordinateSequence& inputPts,
OffsetSegmentGenerator& segGen);
void computeSingleSidedBufferCurve(const CoordinateSequence& inputPts,
bool isRightSide,
OffsetSegmentGenerator& segGen);
void computeRingBufferCurve(const CoordinateSequence& inputPts,
int side, OffsetSegmentGenerator& segGen);
void computePointCurve(const geom::Coordinate& pt,
OffsetSegmentGenerator& segGen);
void computeOffsetCurve(
const CoordinateSequence* inputPts,
bool isRightSide,
OffsetSegmentGenerator& segGen);
// Declare type as noncopyable
OffsetCurveBuilder(const OffsetCurveBuilder& other) = delete;
OffsetCurveBuilder& operator=(const OffsetCurveBuilder& rhs) = delete;
};
} // namespace geos::operation::buffer
} // namespace geos::operation
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
geos::operation::buffer::BufferParameters
Contains the parameters which describe how a buffer should be constructed.
Definition BufferParameters.h:56
geos::operation::buffer::OffsetCurveBuilder::getRingCurve
std::unique_ptr< CoordinateSequence > getRingCurve(const CoordinateSequence *inputPts, int side, double pDistance)
geos::operation::buffer::OffsetCurveBuilder::getBufferParameters
const BufferParameters & getBufferParameters() const
Gets the buffer parameters being used to generate the curve.
Definition OffsetCurveBuilder.h:92
geos::operation::buffer::OffsetCurveBuilder::getLineCurve
void getLineCurve(const CoordinateSequence *inputPts, double distance, std::vector< CoordinateSequence * > &lineList)
This method handles single points as well as lines.
geos::operation::buffer::OffsetCurveBuilder::isLineOffsetEmpty
bool isLineOffsetEmpty(double distance)
geos::operation::buffer::OffsetCurveBuilder::getSingleSidedLineCurve
void getSingleSidedLineCurve(const CoordinateSequence *inputPts, double distance, std::vector< CoordinateSequence * > &lineList, bool leftSide, bool rightSide)
This method handles single points as well as lines.
geos::operation::buffer::OffsetCurveBuilder::getLineCurve
std::unique_ptr< CoordinateSequence > getLineCurve(const CoordinateSequence *inputPts, double pDistance)
geos::operation::buffer::OffsetCurveBuilder::getRingCurve
void getRingCurve(const CoordinateSequence *inputPts, int side, double distance, std::vector< CoordinateSequence * > &lineList)
This method handles the degenerate cases of single points and lines, as well as rings.
geos::operation::buffer::OffsetSegmentGenerator
Definition OffsetSegmentGenerator.h:60
geos::geom
Definition Angle.h:26
geos::operation::buffer
Provides classes for computing buffers of geometries.
Definition namespaces.h:182
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38