GEOS  3.4.2
OrientedCoordinateArray.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2009    Sandro Santilli <strk@keybit.net>
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  **********************************************************************
00014  *
00015  * Last port: noding/OrientedCoordinateArray.java rev. 1.1 (JTS-1.9)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
00020 #define GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
00021 
00022 #include <geos/export.h>
00023 
00024 //#include <vector>
00025 //#include <iostream>
00026 
00027 //#include <geos/inline.h>
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace geom {
00032                 class CoordinateSequence;
00033         }
00034         namespace noding {
00035                 //class SegmentString;
00036         }
00037 }
00038 
00039 namespace geos {
00040 namespace noding { // geos.noding
00041 
00046 class GEOS_DLL OrientedCoordinateArray
00047 {
00048 public:
00049 
00056         OrientedCoordinateArray(const geom::CoordinateSequence& pts)
00057                 :
00058                 pts(&pts),
00059                 orientationVar(orientation(pts))
00060         {
00061         }
00062 
00074         int compareTo(const OrientedCoordinateArray& o1) const;
00075 
00076 
00077 private:
00078 
00079         static int compareOriented(const geom::CoordinateSequence& pts1,
00080                                      bool orientation1,
00081                                      const geom::CoordinateSequence& pts2,
00082                                      bool orientation2);
00083 
00084 
00092         static bool orientation(const geom::CoordinateSequence& pts);
00093 
00095         const geom::CoordinateSequence* pts;
00096 
00097         bool orientationVar;
00098 
00099 };
00100 
00102 //
00104 inline bool operator< ( const OrientedCoordinateArray& oca1,
00105                         const OrientedCoordinateArray& oca2 )
00106 {
00107   return oca1.compareTo(oca2)<0;
00108 }
00109 
00110 } // namespace geos.noding
00111 } // namespace geos
00112 
00113 
00114 #endif // GEOS_NODING_ORIENTEDCOORDINATEARRAY_H
00115