GEOS  3.8.0dev
OrientedCoordinateArray.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/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 <vector>
25 //#include <iostream>
26 
27 //#include <geos/inline.h>
28 
29 // Forward declarations
30 namespace geos {
31 namespace geom {
32 class CoordinateSequence;
33 }
34 namespace noding {
35 //class SegmentString;
36 }
37 }
38 
39 namespace geos {
40 namespace noding { // geos.noding
41 
46 class GEOS_DLL OrientedCoordinateArray {
47 public:
48 
56  :
57  pts(&p_pts),
58  orientationVar(orientation(p_pts))
59  {
60  }
61 
73  int compareTo(const OrientedCoordinateArray& o1) const;
74 
75 
76 private:
77 
78  static int compareOriented(const geom::CoordinateSequence& pts1,
79  bool orientation1,
80  const geom::CoordinateSequence& pts2,
81  bool orientation2);
82 
83 
91  static bool orientation(const geom::CoordinateSequence& pts);
92 
94  const geom::CoordinateSequence* pts;
95 
96  bool orientationVar;
97 
98 };
99 
101 //
103 inline bool
105  const OrientedCoordinateArray& oca2)
106 {
107  return oca1.compareTo(oca2) < 0;
108 }
109 
110 } // namespace geos.noding
111 } // namespace geos
112 
113 
114 #endif // GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
115 
Allows comparing geom::CoordinateSequences in an orientation-independent way.
Definition: OrientedCoordinateArray.h:46
bool operator<(const OrientedCoordinateArray &oca1, const OrientedCoordinateArray &oca2)
Strict weak ordering operator for OrientedCoordinateArray.
Definition: OrientedCoordinateArray.h:104
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
OrientedCoordinateArray(const geom::CoordinateSequence &p_pts)
Definition: OrientedCoordinateArray.h:55
int compareTo(const OrientedCoordinateArray &o1) const
Compares two OrientedCoordinateArrays for their relative order.