GEOS 3.14.0dev
LinearGeometryBuilder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: linearref/LinearGeometryBuilder.java rev. 1.1
17 *
18 **********************************************************************/
19
20#pragma once
21
22#include <geos/geom/Coordinate.h>
23#include <geos/geom/CoordinateList.h>
24#include <geos/geom/Geometry.h>
25#include <geos/geom/GeometryFactory.h>
26#include <geos/linearref/LinearLocation.h>
27
28#include <vector>
29
30namespace geos {
31namespace linearref { // geos::linearref
32
40private:
41 const geom::GeometryFactory* geomFact;
42
43 typedef std::vector<std::unique_ptr<geom::Geometry>> GeomPtrVect;
44
45 // Geometry elements owned by this class
46 GeomPtrVect lines;
47
48 bool ignoreInvalidLines;
49 bool fixInvalidLines;
50 std::unique_ptr<geom::CoordinateSequence> coordList;
51
52 geom::Coordinate lastPt;
53
54public:
56
58
67 void setIgnoreInvalidLines(bool ignoreInvalidLines);
68
77 void setFixInvalidLines(bool fixInvalidLines);
78
84 void add(const geom::Coordinate& pt);
85
93 void add(const geom::Coordinate& pt, bool allowRepeatedPoints);
94
95 // NOTE strk: why return by value ?
96 geom::Coordinate getLastCoordinate() const;
97
99 void endLine();
100
101 std::unique_ptr<geom::Geometry> getGeometry();
102};
103
104} // namespace geos.linearref
105} // namespace geos
106
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Builds a linear geometry (LineString or MultiLineString) incrementally (point-by-point).
Definition LinearGeometryBuilder.h:39
void setIgnoreInvalidLines(bool ignoreInvalidLines)
Allows invalid lines to be ignored rather than causing Exceptions.
void add(const geom::Coordinate &pt, bool allowRepeatedPoints)
Adds a point to the current line.
void add(const geom::Coordinate &pt)
Adds a point to the current line.
void endLine()
Terminate the current LineString.
void setFixInvalidLines(bool fixInvalidLines)
Allows invalid lines to be ignored rather than causing Exceptions.
Basic namespace for all GEOS functionalities.
Definition geos.h:39