BufferInputLineSimplifier.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
*
* 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/BufferInputLineSimplifier.java r320 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/geom/CoordinateSequence.h> // complete type required
#include <memory>
#include <vector> // for composition
// Forward declarations
namespace geos {
namespace geom {
class CoordinateSequence;
//class PrecisionModel;
}
}
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
class BufferInputLineSimplifier {
public:
static std::unique_ptr<geom::CoordinateSequence> simplify(
const geom::CoordinateSequence& inputLine, double distanceTol);
BufferInputLineSimplifier(const geom::CoordinateSequence& input);
std::unique_ptr<geom::CoordinateSequence> simplify(double distanceTol);
private:
bool deleteShallowConcavities();
std::size_t findNextNonDeletedIndex(std::size_t index) const;
std::unique_ptr<geom::CoordinateSequence> collapseLine() const;
bool isDeletable(std::size_t i0, std::size_t i1, std::size_t i2, double distanceTol) const;
bool isShallowConcavity(const geom::Coordinate& p0,
const geom::Coordinate& p1,
const geom::Coordinate& p2,
double distanceTol) const;
bool isShallowSampled(const geom::Coordinate& p0,
const geom::Coordinate& p2,
std::size_t i0, std::size_t i2, double distanceTol) const;
bool isShallow(const geom::Coordinate& p0,
const geom::Coordinate& p1,
const geom::Coordinate& p2,
double distanceTol) const;
bool isConcave(const geom::Coordinate& p0,
const geom::Coordinate& p1,
const geom::Coordinate& p2) const;
static const int NUM_PTS_TO_CHECK = 10;
static const int INIT = 0;
static const int DELETE = 1;
static const int KEEP = 1;
const geom::CoordinateSequence& inputLine;
double distanceTol;
std::vector<int> isDeleted;
int angleOrientation;
// Declare type as noncopyable
BufferInputLineSimplifier(const BufferInputLineSimplifier& other) = delete;
BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs) = delete;
};
} // 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::operation::buffer::BufferInputLineSimplifier::simplify
static std::unique_ptr< geom::CoordinateSequence > simplify(const geom::CoordinateSequence &inputLine, double distanceTol)
geos::operation::buffer::BufferInputLineSimplifier::simplify
std::unique_ptr< geom::CoordinateSequence > simplify(double distanceTol)
geos::geom
Definition Angle.h:26
geos::index
Provides classes for various kinds of spatial indexes.
Definition CleanCoverage.h:39
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