OverlayMixedPoints.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/Point.h>
#include <geos/geom/Polygon.h>
#include <geos/geom/LineString.h>
#include <geos/export.h>
#include <set>
#include <memory>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
class GeometryFactory;
class PrecisionModel;
class Geometry;
class Coordinate;
class CoordinateSequence;
}
namespace algorithm {
namespace locate {
class PointOnGeometryLocator;
}
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng
class GEOS_DLL OverlayMixedPoints {
using GeometryFactory = geos::geom::GeometryFactory;
using PrecisionModel = geos::geom::PrecisionModel;
using Geometry = geos::geom::Geometry;
using Coordinate = geos::geom::Coordinate;
using CoordinateXY = geos::geom::CoordinateXY;
using CoordinateSequence = geos::geom::CoordinateSequence;
using Point = geos::geom::Point;
using Polygon = geos::geom::Polygon;
using LineString = geos::geom::LineString;
using PointOnGeometryLocator = algorithm::locate::PointOnGeometryLocator;
private:
// Members
int opCode;
const PrecisionModel* pm;
const Geometry* geomPoint;
const Geometry* geomNonPointInput;
const GeometryFactory* geometryFactory;
bool isPointRHS;
std::unique_ptr<Geometry> geomNonPoint;
int geomNonPointDim;
std::unique_ptr<PointOnGeometryLocator> locator;
int resultDim;
// Methods
std::unique_ptr<PointOnGeometryLocator> createLocator(const Geometry* geomNonPoint);
std::unique_ptr<Geometry> prepareNonPoint(const Geometry* geomInput);
std::unique_ptr<Geometry> computeIntersection(const CoordinateSequence* coords) const;
std::unique_ptr<Geometry> computeUnion(const CoordinateSequence* coords);
std::unique_ptr<Geometry> computeDifference(const CoordinateSequence* coords);
std::unique_ptr<Geometry> createPointResult(std::vector<std::unique_ptr<Point>>& points) const;
std::vector<std::unique_ptr<Point>> findPoints(bool isCovered, const CoordinateSequence* coords) const;
std::vector<std::unique_ptr<Point>> createPoints(const CoordinateSequence& coords) const;
bool hasLocation(bool isCovered, const CoordinateXY& coord) const;
std::unique_ptr<Geometry> copyNonPoint() const;
std::unique_ptr<CoordinateSequence> extractCoordinates(const Geometry* points, const PrecisionModel* pm) const;
std::vector<std::unique_ptr<Polygon>> extractPolygons(const Geometry* geom) const;
std::vector<std::unique_ptr<LineString>> extractLines(const Geometry* geom) const;
public:
OverlayMixedPoints(int p_opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* p_pm);
static std::unique_ptr<Geometry> overlay(int opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* pm);
std::unique_ptr<Geometry> getResult();
};
} // namespace geos.operation.overlayng
} // namespace geos.operation
} // namespace geos
geos::algorithm::locate::PointOnGeometryLocator
An interface for classes which determine the Location of points in Polygon or MultiPolygon geometries...
Definition PointOnGeometryLocator.h:36
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::geom::Point
Definition Point.h:61
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
geos::algorithm::locate
Classes which determine the Location of points in geometries.
Definition IndexedPointInAreaLocator.h:40
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
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