HotPixelIndex.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/Envelope.h> // for unique_ptr
#include <geos/geom/Coordinate.h> // for composition
#include <geos/algorithm/LineIntersector.h>
#include <geos/noding/snapround/HotPixel.h>
#include <geos/geom/PrecisionModel.h>
#include <geos/util/IllegalArgumentException.h>
#include <geos/io/WKTWriter.h>
#include <geos/index/kdtree/KdTree.h>
#include <geos/index/kdtree/KdNodeVisitor.h>
#include <geos/util.h>
#include <array>
#include <map>
#include <memory>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
// Forward declarations
namespace geos {
namespace algorithm {
class LineIntersector;
}
namespace index {
class ItemVisitor;
}
namespace noding {
namespace snapround {
class HotPixel;
}
}
}
namespace geos {
namespace noding { // geos::noding
namespace snapround { // geos::noding::snapround
class GEOS_DLL HotPixelIndex {
private:
/* members */
const geom::PrecisionModel* pm;
double scaleFactor;
std::unique_ptr<geos::index::kdtree::KdTree> index;
std::deque<HotPixel> hotPixelQue;
/* methods */
template<typename CoordType>
geom::CoordinateXYZM round(const CoordType& pt) {
geom::CoordinateXYZM p2(pt);
pm->makePrecise(p2);
return p2;
}
HotPixel* find(const geom::Coordinate& pixelPt);
public:
HotPixelIndex(const geom::PrecisionModel* p_pm);
HotPixel* addRounded(const geom::CoordinateXYZM& pt);
template<typename CoordType>
HotPixel* add(const CoordType& p) {
static_assert(std::is_base_of<geom::CoordinateXY, CoordType>(), "Only valid for Coordinate types");
auto pRound = round(p);
return addRounded(pRound);
}
void add(const geom::CoordinateSequence* pts);
void add(const std::vector<geom::Coordinate>& pts);
void addNodes(const geom::CoordinateSequence* pts);
void addNodes(const std::vector<geom::Coordinate>& pts);
void query(const geom::CoordinateXY& p0, const geom::CoordinateXY& p1,
index::kdtree::KdNodeVisitor& visitor);
};
} // namespace geos::noding::snapround
} // namespace geos::noding
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:53
geos::index::ItemVisitor
A visitor for items in an index.
Definition ItemVisitor.h:28
geos::noding::snapround::HotPixel
Implements a "hot pixel" as used in the Snap Rounding algorithm.
Definition HotPixel.h:60
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::index
Provides classes for various kinds of spatial indexes.
Definition CleanCoverage.h:39
geos::noding::snapround
Contains classes to implement the Snap Rounding algorithm for noding linestrings.
Definition namespaces.h:175
geos::noding
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition CoverageCleaner.h:42
geos::util::round
double round(double val)
Definition math.h:36
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38