GEOS  3.6.1
OrientedCoordinateArray.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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 
47 {
48 public:
49 
57  :
58  pts(&pts),
59  orientationVar(orientation(pts))
60  {
61  }
62 
74  int compareTo(const OrientedCoordinateArray& o1) const;
75 
76 
77 private:
78 
79  static int compareOriented(const geom::CoordinateSequence& pts1,
80  bool orientation1,
81  const geom::CoordinateSequence& pts2,
82  bool orientation2);
83 
84 
92  static bool orientation(const geom::CoordinateSequence& pts);
93 
95  const geom::CoordinateSequence* pts;
96 
97  bool orientationVar;
98 
99 };
100 
102 //
104 inline bool operator< ( const OrientedCoordinateArray& oca1,
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 
OrientedCoordinateArray(const geom::CoordinateSequence &pts)
Definition: OrientedCoordinateArray.h:56
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:59
int compareTo(const OrientedCoordinateArray &o1) const
Compares two OrientedCoordinateArrays for their relative order.