GEOS  3.14.0dev
BasicSegmentString.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: noding/BasicSegmentString.java rev. 1.1 (JTS-1.9)
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <geos/export.h>
22 #include <geos/noding/BasicSegmentString.h>
23 #include <geos/noding/Octant.h>
24 #include <geos/noding/SegmentString.h> // for inheritance
25 #include <geos/geom/CoordinateSequence.h> // for inlines (size())
26 
27 
28 #include <vector>
29 
30 // Forward declarations
31 
32 namespace geos {
33 namespace noding { // geos.noding
34 
44 class GEOS_DLL BasicSegmentString : public SegmentString {
45 
46 public:
47 
54  const void* newContext)
55  :
56  SegmentString(newContext, newPts)
57  {}
58 
59  ~BasicSegmentString() override
60  {}
61 
62  // see dox in SegmentString.h
63  std::ostream& print(std::ostream& os) const override;
64 
72  int getSegmentOctant(std::size_t index) const
73  {
74  if(index >= size() - 1) {
75  return -1;
76  }
77  return Octant::octant(getCoordinate(index), getCoordinate(index + 1));
78  };
79 
80 private:
81 
82  // Declare type as noncopyable
83  BasicSegmentString(const BasicSegmentString& other) = delete;
84  BasicSegmentString& operator=(const BasicSegmentString& rhs) = delete;
85 
86 };
87 
88 } // namespace geos.noding
89 } // namespace geos
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Represents a list of contiguous line segments, and supports noding the segments.
Definition: BasicSegmentString.h:44
int getSegmentOctant(std::size_t index) const
Gets the octant of the segment starting at vertex index.
Definition: BasicSegmentString.h:72
BasicSegmentString(geom::CoordinateSequence *newPts, const void *newContext)
Construct a BasicSegmentString.
Definition: BasicSegmentString.h:53
static int octant(double dx, double dy)
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:47
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25