GEOS  3.12.0
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 
30 namespace geos {
31 namespace linearref { // geos::linearref
32 
40 private:
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 
54 public:
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 
void endLine()
Terminate the current LineString.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
void add(const geom::Coordinate &pt)
Adds a point to the current line.
void setIgnoreInvalidLines(bool ignoreInvalidLines)
Allows invalid lines to be ignored rather than causing Exceptions.
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:65
Builds a linear geometry (LineString or MultiLineString) incrementally (point-by-point).
Definition: LinearGeometryBuilder.h:39
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25
void setFixInvalidLines(bool fixInvalidLines)
Allows invalid lines to be ignored rather than causing Exceptions.