LineLimiter.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 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/geom/CoordinateSequence.h>
#include <geos/export.h>
#include <array>
#include <memory>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
class Envelope;
class Coordinate;
class CoordinateSequence;
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng
class GEOS_DLL LineLimiter {
using Envelope = geos::geom::Envelope;
using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
private:
// Members
const Envelope* limitEnv;
std::unique_ptr<geom::CoordinateSequence> ptList;
const Coordinate* lastOutside;
std::vector<std::unique_ptr<CoordinateSequence>> sections;
// Methods
void addPoint(const Coordinate* p);
void addOutside(const Coordinate* p);
bool isLastSegmentIntersecting(const Coordinate* p);
bool isSectionOpen();
void startSection();
void finishSection();
public:
LineLimiter(const Envelope* env)
: limitEnv(env)
, ptList(nullptr)
, lastOutside(nullptr)
{};
std::vector<std::unique_ptr<CoordinateSequence>>& limit(const CoordinateSequence *pts);
};
} // namespace geos.operation.overlayng
} // 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::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
geos::geom
Definition Angle.h:26
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38