LinearGeometryBuilder.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* 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: linearref/LinearGeometryBuilder.java rev. 1.1
*
**********************************************************************/
#pragma once
#include <geos/geom/Coordinate.h>
#include <geos/geom/CoordinateList.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/GeometryFactory.h>
#include <geos/linearref/LinearLocation.h>
#include <vector>
namespace geos {
namespace linearref { // geos::linearref
class LinearGeometryBuilder {
private:
const geom::GeometryFactory* geomFact;
typedef std::vector<std::unique_ptr<geom::Geometry>> GeomPtrVect;
// Geometry elements owned by this class
GeomPtrVect lines;
bool ignoreInvalidLines;
bool fixInvalidLines;
std::unique_ptr<geom::CoordinateSequence> coordList;
geom::Coordinate lastPt;
public:
LinearGeometryBuilder(const geom::GeometryFactory* geomFact);
~LinearGeometryBuilder();
void setIgnoreInvalidLines(bool ignoreInvalidLines);
void setFixInvalidLines(bool fixInvalidLines);
void add(const geom::Coordinate& pt);
void add(const geom::Coordinate& pt, bool allowRepeatedPoints);
// NOTE strk: why return by value ?
geom::Coordinate getLastCoordinate() const;
void endLine();
std::unique_ptr<geom::Geometry> getGeometry();
};
} // namespace geos.linearref
} // namespace geos
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::linearref::LinearGeometryBuilder::setIgnoreInvalidLines
void setIgnoreInvalidLines(bool ignoreInvalidLines)
Allows invalid lines to be ignored rather than causing Exceptions.
geos::linearref::LinearGeometryBuilder::add
void add(const geom::Coordinate &pt, bool allowRepeatedPoints)
Adds a point to the current line.
geos::linearref::LinearGeometryBuilder::add
void add(const geom::Coordinate &pt)
Adds a point to the current line.
geos::linearref::LinearGeometryBuilder::endLine
void endLine()
Terminate the current LineString.
geos::linearref::LinearGeometryBuilder::setFixInvalidLines
void setFixInvalidLines(bool fixInvalidLines)
Allows invalid lines to be ignored rather than causing Exceptions.
geos::linearref
Contains classes and interfaces implementing linear referencing on linear geometries.
Definition ExtractLineByLocation.h:27
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38