1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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.
13 **********************************************************************
15 * Last port: noding/OrientedCoordinateArray.java rev. 1.1 (JTS-1.9)
17 **********************************************************************/
19 #ifndef GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
20 #define GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
22 #include <geos/export.h>
27 //#include <geos/inline.h>
29 // Forward declarations
32 class CoordinateSequence
;
35 //class SegmentString;
40 namespace noding
{ // geos.noding
43 * Allows comparing {@link geom::CoordinateSequence}s
44 * in an orientation-independent way.
46 class GEOS_DLL OrientedCoordinateArray
51 * Creates a new {@link OrientedCoordinateArray}
52 * for the given {@link geom::CoordinateSequence}.
54 * @param pts the coordinates to orient
56 OrientedCoordinateArray(const geom::CoordinateSequence
& pts
)
59 orientationVar(orientation(pts
))
64 * Compares two {@link OrientedCoordinateArray}s for their
67 * @return -1 this one is smaller
68 * @return 0 the two objects are equal
69 * @return 1 this one is greater
71 * In JTS, this is used automatically by ordered lists.
72 * In C++, operator< would be used instead....
74 int compareTo(const OrientedCoordinateArray
& o1
) const;
79 static int compareOriented(const geom::CoordinateSequence
& pts1
,
81 const geom::CoordinateSequence
& pts2
,
86 * Computes the canonical orientation for a coordinate array.
88 * @param pts the array to test
89 * @return <code>true</code> if the points are oriented forwards
90 * @return <code>false</code if the points are oriented in reverse
92 static bool orientation(const geom::CoordinateSequence
& pts
);
95 const geom::CoordinateSequence
& pts
;
99 // Declare type as noncopyable
100 OrientedCoordinateArray(const OrientedCoordinateArray
& other
);
101 OrientedCoordinateArray
& operator=(const OrientedCoordinateArray
& rhs
);
104 } // namespace geos.noding
108 #endif // GEOS_NODING_ORIENTEDCOORDINATEARRAY_H