Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

RayCrossingCounter.h

00001 /**********************************************************************
00002  * $Id: RayCrossingCounter.h 2556 2009-06-06 22:22:28Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: algorithm/RayCrossingCounter.java rev. 1.2 (JTS-1.9)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
00022 #define GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
00023 
00024 #include <geos/export.h>
00025 
00026 #include <vector>
00027 
00028 // forward declarations
00029 namespace geos {
00030         namespace geom {
00031                 class Coordinate;
00032                 class CoordinateSequence;
00033         }
00034 }
00035 
00036 
00037 namespace geos {
00038 namespace algorithm {
00039 
00067 class GEOS_DLL RayCrossingCounter 
00068 {
00069 private:
00070         const geom::Coordinate& point;
00071         
00072         int crossingCount;
00073         
00074         // true if the test point lies on an input segment
00075         bool isPointOnSegment;
00076 
00077 protected:
00078 public:
00087         static int locatePointInRing(const geom::Coordinate& p,
00088                                      const geom::CoordinateSequence& ring);
00089 
00091         static int locatePointInRing(const geom::Coordinate& p,
00092                  const std::vector<const geom::Coordinate*>& ring);
00093 
00094         RayCrossingCounter(const geom::Coordinate& point)
00095         :       point( point),
00096                 crossingCount( 0),
00097                 isPointOnSegment( false)
00098         { }
00099         
00106         void countSegment(const geom::Coordinate& p1,
00107                           const geom::Coordinate& p2);
00108         
00118         bool isOnSegment() 
00119         { 
00120                 return isPointOnSegment; 
00121         }
00122         
00133         int getLocation();
00134     
00145         bool isPointInPolygon();
00146 
00147 };
00148 
00149 } // geos::algorithm
00150 } // geos
00151 
00152 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
00153 /**********************************************************************
00154  * $Log$
00155  **********************************************************************/
00156 

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4