GEOS: RayCrossingCounter.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# RayCrossingCounter.h

    00001 /**********************************************************************
    00002  * $Id: RayCrossingCounter.h 2770 2009-12-03 19:27:18Z mloskot $
    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     // Declare type as noncopyable
    00078     RayCrossingCounter(const RayCrossingCounter& other);
    00079     RayCrossingCounter& operator=(const RayCrossingCounter& rhs);
    00080
    00081 public:
    00090         static int locatePointInRing(const geom::Coordinate& p,
    00091                                      const geom::CoordinateSequence& ring);
    00092
    00094         static int locatePointInRing(const geom::Coordinate& p,
    00095                  const std::vector<const geom::Coordinate*>& ring);
    00096
    00097         RayCrossingCounter(const geom::Coordinate& point)
    00098         :       point( point),
    00099                 crossingCount( 0),
    00100                 isPointOnSegment( false)
    00101         { }
    00102
    00109         void countSegment(const geom::Coordinate& p1,
    00110                           const geom::Coordinate& p2);
    00111
    00121         bool isOnSegment()
    00122         {
    00123                 return isPointOnSegment;
    00124         }
    00125
    00136         int getLocation();
    00137
    00148         bool isPointInPolygon();
    00149
    00150 };
    00151
    00152 } // geos::algorithm
    00153 } // geos
    00154
    00155 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
    00156 /**********************************************************************
    00157  * $Log$
    00158  **********************************************************************/
    00159