OverlayPoints.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/export.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/Point.h>
#include <map>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class CoordinateSequence;
class GeometryFactory;
class Geometry;
class PrecisionModel;
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng
class GEOS_DLL OverlayPoints {
using Coordinate = geos::geom::Coordinate;
using CoordinateXY = geos::geom::CoordinateXY;
using CoordinateSequence = geos::geom::CoordinateSequence;
using GeometryFactory = geos::geom::GeometryFactory;
using Geometry = geos::geom::Geometry;
using Point = geos::geom::Point;
using PrecisionModel = geos::geom::PrecisionModel;
private:
// Members
int opCode;
const Geometry* geom0;
const Geometry* geom1;
const PrecisionModel* pm;
const GeometryFactory* geometryFactory;
std::vector<std::unique_ptr<Point>> resultList;
using PointMap = std::map<CoordinateXY, std::unique_ptr<Point>>;
// Methods
void
computeIntersection(PointMap& map0,
PointMap& map1,
std::vector<std::unique_ptr<Point>>& resultList);
void
computeDifference(PointMap& map0,
PointMap& map1,
std::vector<std::unique_ptr<Point>>& resultList);
void
computeUnion(PointMap& map0,
PointMap& map1,
std::vector<std::unique_ptr<Point>>& resultList);
PointMap buildPointMap(const Geometry* geom);
public:
OverlayPoints(int p_opCode, const Geometry* p_geom0, const Geometry* p_geom1, const PrecisionModel* p_pm)
: opCode(p_opCode)
, geom0(p_geom0)
, geom1(p_geom1)
, pm(p_pm)
, geometryFactory(p_geom0->getFactory()) {}
OverlayPoints(const OverlayPoints&) = delete;
OverlayPoints& operator=(const OverlayPoints&) = delete;
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::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::Point
Definition Point.h:61
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
geos::operation::overlayng::OverlayPoints
Definition OverlayPoints.h:53
geos::operation::overlayng::OverlayPoints::getResult
std::unique_ptr< Geometry > getResult()
geos::operation::overlayng::OverlayPoints::overlay
static std::unique_ptr< Geometry > overlay(int opCode, const Geometry *geom0, const Geometry *geom1, const PrecisionModel *pm)
geos::operation::overlayng::OverlayPoints::OverlayPoints
OverlayPoints(int p_opCode, const Geometry *p_geom0, const Geometry *p_geom1, const PrecisionModel *p_pm)
Definition OverlayPoints.h:97
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