OffsetCurveSection.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (c) 2021 Martin Davis
* Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.ca>
*
* 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.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/CoordinateSequence.h> // to materialize CoordinateSequence
#include <memory>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class CoordinateSequence;
class Geometry;
class GeometryFactory;
class LineString;
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
class GEOS_DLL OffsetCurveSection {
using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
using Geometry = geos::geom::Geometry;
using GeometryFactory = geos::geom::GeometryFactory;
using LineString = geos::geom::LineString;
private:
std::unique_ptr<CoordinateSequence> sectionPts;
double location;
double locLast;
bool isEndInSameSegment(double nextLoc) const;
public:
OffsetCurveSection(std::unique_ptr<CoordinateSequence> && secPts, double pLoc, double pLocLast)
: sectionPts(std::move(secPts))
, location(pLoc)
, locLast(pLocLast)
{};
const CoordinateSequence* getCoordinates() const;
std::unique_ptr<CoordinateSequence> releaseCoordinates();
double getLocation() const { return location; };
static std::unique_ptr<Geometry> toLine(
std::vector<std::unique_ptr<OffsetCurveSection>>& sections,
const GeometryFactory* geomFactory);
static std::unique_ptr<Geometry> toGeometry(
std::vector<std::unique_ptr<OffsetCurveSection>>& sections,
const GeometryFactory* geomFactory);
static std::unique_ptr<OffsetCurveSection> create(
const CoordinateSequence* srcPts,
std::size_t start, std::size_t end,
double loc, double locLast);
static bool OffsetCurveSectionComparator(
const std::unique_ptr<OffsetCurveSection>& a,
const std::unique_ptr<OffsetCurveSection>& b);
};
} // namespace geos.operation.buffer
} // namespace geos.operation
} // namespace geos
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::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::buffer::OffsetCurveSection::toLine
static std::unique_ptr< Geometry > toLine(std::vector< std::unique_ptr< OffsetCurveSection > > &sections, const GeometryFactory *geomFactory)
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