17#include <geos/geom/Coordinate.h>
18#include <geos/geom/CoordinateSequence.h>
19#include <geos/geom/CoordinateSequenceFilter.h>
20#include <geos/io/OrdinateSet.h>
25class CheckOrdinatesFilter :
public geom::CoordinateSequenceFilter {
27 CheckOrdinatesFilter(OrdinateSet checkOrdinateFlags) :
28 m_checkFlags(checkOrdinateFlags),
29 m_foundFlags(OrdinateSet::createXY())
32 void filter_ro(
const geom::CoordinateSequence& seq, std::size_t i)
override {
33 bool checkZ = m_checkFlags.hasZ() && !m_foundFlags.hasZ();
34 bool checkM = m_checkFlags.hasM() && !m_foundFlags.hasM();
36 if (checkZ || checkM) {
37 seq.getAt(i, m_coord);
39 if (checkZ && !std::isnan(m_coord.z)) {
40 m_foundFlags.setZ(
true);
43 if (checkM && !std::isnan(m_coord.m)) {
44 m_foundFlags.setM(
true);
49 bool isGeometryChanged()
const override {
53 bool isDone()
const override {
54 return m_checkFlags == m_foundFlags;
57 OrdinateSet getFoundOrdinates()
const {
62 OrdinateSet m_checkFlags;
63 OrdinateSet m_foundFlags;
64 geom::CoordinateXYZM m_coord;
Basic namespace for all GEOS functionalities.
Definition geos.h:39