GEOS  3.9.1dev
OrientedCoordinateArray.h
Go to the documentation of this file.
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/OrientedCoordinateArray.java rev. 1.1 (JTS-1.9)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
20 #define GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
21 
22 #include <geos/export.h>
23 
24 #include <cstddef>
25 
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class CoordinateSequence;
30 }
31 namespace noding {
32 //class SegmentString;
33 }
34 }
35 
36 namespace geos {
37 namespace noding { // geos.noding
38 
44 public:
45 
53  :
54  pts(&p_pts),
55  orientationVar(orientation(p_pts))
56  {
57  }
58 
70  int compareTo(const OrientedCoordinateArray& o1) const;
71 
72  bool operator==(const OrientedCoordinateArray& other) const;
73 
74  struct GEOS_DLL HashCode {
75  size_t operator()(const OrientedCoordinateArray & oca) const;
76  };
77 
78 private:
79 
80  static int compareOriented(const geom::CoordinateSequence& pts1,
81  bool orientation1,
82  const geom::CoordinateSequence& pts2,
83  bool orientation2);
84 
85 
93  static bool orientation(const geom::CoordinateSequence& pts);
94 
97 
99 
100 };
101 
105 inline bool
107  const OrientedCoordinateArray& oca2)
108 {
109  return oca1.compareTo(oca2) < 0;
110 }
111 
112 } // namespace geos.noding
113 } // namespace geos
114 
115 
116 #endif // GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
117 
#define GEOS_DLL
Definition: export.h:28
bool operator<(const Coordinate &a, const Coordinate &b)
Strict weak ordering operator for Coordinate.
Definition: Coordinate.h:134
const geom::CoordinateSequence * pts
Externally owned.
Allows comparing geom::CoordinateSequences in an orientation-independent way.
Basic namespace for all GEOS functionalities.
The internal representation of a list of coordinates inside a Geometry.
OrientedCoordinateArray(const geom::CoordinateSequence &p_pts)
int compareTo(const OrientedCoordinateArray &o1) const
Compares two OrientedCoordinateArrays for their relative order.
bool operator==(const Coordinate &a, const Coordinate &b)
Equality operator for Coordinate. 2D only.