GEOS  3.11.0rc0
SegmentString.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: noding/SegmentString.java r430 (JTS-1.12+)
18  *
19  **********************************************************************/
20 
21 #pragma once
22 
23 #include <geos/export.h>
24 #include <geos/noding/SegmentNodeList.h>
25 
26 #include <vector>
27 
28 // Forward declarations
29 namespace geos {
30 namespace algorithm {
31 class LineIntersector;
32 }
33 }
34 
35 namespace geos {
36 namespace noding { // geos.noding
37 
45 class GEOS_DLL SegmentString {
46 public:
47  typedef std::vector<const SegmentString*> ConstVect;
48  typedef std::vector<SegmentString*> NonConstVect;
49 
50  friend std::ostream& operator<< (std::ostream& os,
51  const SegmentString& ss);
52 
57  SegmentString(const void* newContext)
58  :
59  context(newContext)
60  {}
61 
62  virtual
63  ~SegmentString() {}
64 
70  const void*
71  getData() const
72  {
73  return context;
74  }
75 
81  void
82  setData(const void* data)
83  {
84  context = data;
85  }
86 
87 
88  virtual std::size_t size() const = 0;
89 
90  virtual const geom::Coordinate& getCoordinate(std::size_t i) const = 0;
91 
99 
100  virtual bool isClosed() const = 0;
101 
102  virtual std::ostream& print(std::ostream& os) const;
103 
104 private:
105 
106  const void* context;
107 
108  // Declare type as noncopyable
109  SegmentString(const SegmentString& other) = delete;
110  SegmentString& operator=(const SegmentString& rhs) = delete;
111 };
112 
113 std::ostream& operator<< (std::ostream& os, const SegmentString& ss);
114 
115 } // namespace geos.noding
116 } // namespace geos
117 
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:45
SegmentString(const void *newContext)
Construct a SegmentString.
Definition: SegmentString.h:57
virtual geom::CoordinateSequence * getCoordinates() const =0
Return a pointer to the CoordinateSequence associated with this SegmentString.
const void * getData() const
Gets the user-defined data for this segment string.
Definition: SegmentString.h:71
void setData(const void *data)
Sets the user-defined data for this segment string.
Definition: SegmentString.h:82
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25