OverlayNGRobust.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.
*
**********************************************************************
*
* Last port: operation/overlayng/OverlayNGRobust.java 6ef89b09
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/PrecisionModel.h>
#include <geos/operation/union/UnionStrategy.h>
#include <geos/operation/overlayng/OverlayNG.h>
// Forward declarations
namespace geos {
namespace geom {
class Geometry;
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng
class GEOS_DLL OverlayNGRobust {
using Geometry = geos::geom::Geometry;
private:
// Constants
static constexpr int NUM_SNAP_TRIES = 5;
static constexpr double SNAP_TOL_FACTOR = 1e12;
static std::unique_ptr<Geometry> overlaySnapping(
const Geometry* geom0, const Geometry* geom1, int opCode, double snapTol);
static std::unique_ptr<Geometry> overlaySnapBoth(
const Geometry* geom0, const Geometry* geom1, int opCode, double snapTol);
static std::unique_ptr<Geometry> overlaySnapTol(
const Geometry* geom0, const Geometry* geom1, int opCode, double snapTol);
static double snapTolerance(const Geometry* geom);
static double ordinateMagnitude(const Geometry* geom);
static std::unique_ptr<Geometry>
overlaySR(const Geometry* geom0, const Geometry* geom1, int opCode);
static std::unique_ptr<Geometry>
snapSelf(const Geometry* geom, double snapTol);
public:
class SRUnionStrategy : public operation::geounion::UnionStrategy {
std::unique_ptr<geom::Geometry> Union(const geom::Geometry* g0, const geom::Geometry* g1) override
{
return OverlayNGRobust::Overlay(g0, g1, OverlayNG::UNION);
};
bool isFloatingPrecision() const override
{
return true;
};
};
static std::unique_ptr<Geometry> Intersection(
const Geometry* g0, const Geometry* g1);
static std::unique_ptr<Geometry> Union(
const Geometry* g0, const Geometry* g1);
static std::unique_ptr<Geometry> Difference(
const Geometry* g0, const Geometry* g1);
static std::unique_ptr<Geometry> SymDifference(
const Geometry* g0, const Geometry* g1);
static std::unique_ptr<Geometry> Union(
const Geometry* a);
static std::unique_ptr<Geometry> Overlay(
const Geometry* geom0, const Geometry* geom1, int opCode);
static std::unique_ptr<Geometry> overlaySnapTries(
const Geometry* geom0, const Geometry* geom1, int opCode);
static double snapTolerance(const Geometry* geom0, const Geometry* geom1);
};
} // namespace geos.operation.overlayng
} // namespace geos.operation
} // namespace geos
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::operation::geounion::UnionStrategy
Definition UnionStrategy.h:40
geos::operation::overlayng::OverlayNGRobust
Definition OverlayNGRobust.h:64
geos::operation::overlayng::OverlayNGRobust::snapTolerance
static double snapTolerance(const Geometry *geom0, const Geometry *geom1)
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