/usr/include/geos/precision/GeometryPrecisionReducer.h is in libgeos++-dev 3.6.2-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2012 Sandro Santilli <strk@keybit.net>
*
* 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: precision/GeometryPrecisionReducer.cpp rev. 1.10 (JTS-1.7)
*
**********************************************************************/
#ifndef GEOS_PRECISION_GEOMETRYPRECISIONREDUCER_H
#define GEOS_PRECISION_GEOMETRYPRECISIONREDUCER_H
#include <geos/export.h>
#include <geos/geom/GeometryFactory.h> // for GeometryFactory::unique_ptr
#include <memory> // for auto_ptr
// Forward declarations
namespace geos {
namespace geom {
class PrecisionModel;
class GeometryFactory;
class Geometry;
}
}
namespace geos {
namespace precision { // geos.precision
/** \brief
* Reduces the precision of a {@link Geometry}
* according to the supplied {@link PrecisionModel},
* ensuring that the result is topologically valid.
*/
class GEOS_DLL GeometryPrecisionReducer {
private:
// Externally owned
const geom::GeometryFactory *newFactory;
const geom::PrecisionModel &targetPM;
bool removeCollapsed;
bool isPointwise;
std::auto_ptr<geom::Geometry> reducePointwise( const geom::Geometry& geom );
std::auto_ptr<geom::Geometry> fixPolygonalTopology(
const geom::Geometry& geom );
geom::GeometryFactory::unique_ptr createFactory(
const geom::GeometryFactory& oldGF,
const geom::PrecisionModel& newPM );
GeometryPrecisionReducer(GeometryPrecisionReducer const&); /*= delete*/
GeometryPrecisionReducer& operator=(GeometryPrecisionReducer const&); /*= delete*/
public:
/**
* Convenience method for doing precision reduction
* on a single geometry,
* with collapses removed
* and keeping the geometry precision model the same,
* and preserving polygonal topology.
*
* @param g the geometry to reduce
* @param precModel the precision model to use
* @return the reduced geometry
*/
static std::auto_ptr<geom::Geometry> reduce(
const geom::Geometry &g,
const geom::PrecisionModel &precModel )
{
GeometryPrecisionReducer reducer(precModel);
return reducer.reduce(g);
}
/**
* Convenience method for doing precision reduction
* on a single geometry,
* with collapses removed
* and keeping the geometry precision model the same,
* but NOT preserving valid polygonal topology.
*
* @param g the geometry to reduce
* @param precModel the precision model to use
* @return the reduced geometry
*/
static std::auto_ptr<geom::Geometry> reducePointwise(
const geom::Geometry &g,
const geom::PrecisionModel &precModel )
{
GeometryPrecisionReducer reducer(precModel);
reducer.setPointwise(true);
return reducer.reduce(g);
}
GeometryPrecisionReducer(const geom::PrecisionModel &pm)
:
newFactory(0),
targetPM(pm),
removeCollapsed(true),
isPointwise(false)
{}
/**
* \brief
* Create a reducer that will change the precision model of the
* new reduced Geometry
*
* @param gf the factory for the created Geometry.
* Its PrecisionModel will be used for the reduction.
* NOTE: ownership left to caller must be kept alive for
* the whole lifetime of the returned Geometry.
*/
GeometryPrecisionReducer(const geom::GeometryFactory &gf);
/**
* Sets whether the reduction will result in collapsed components
* being removed completely, or simply being collapsed to an (invalid)
* Geometry of the same type.
*
* @param remove if <code>true</code> collapsed components will be removed
*/
void setRemoveCollapsedComponents(bool remove) {
removeCollapsed = remove;
}
/** \brief
* Sets whether the precision reduction will be done
* in pointwise fashion only.
*
* Pointwise precision reduction reduces the precision
* of the individual coordinates only, but does
* not attempt to recreate valid topology.
* This is only relevant for geometries containing polygonal components.
*
* @param pointwise if reduction should be done pointwise only
*/
void setPointwise(bool pointwise)
{
isPointwise = pointwise;
}
std::auto_ptr<geom::Geometry> reduce(const geom::Geometry& geom);
};
} // namespace geos.precision
} // namespace geos
#endif // GEOS_PRECISION_GEOMETRYPRECISIONREDUCER_H
|