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

- File List

# CGAlgorithms.h

    00001 /**********************************************************************
    00002  *
    00003  * GEOS - Geometry Engine Open Source
    00004  * http://geos.refractions.net
    00005  *
    00006  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: algorithm/CGAlgorithms.java r378 (JTS-1.12)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_ALGORITHM_CGALGORITHM_H
    00022 #define GEOS_ALGORITHM_CGALGORITHM_H
    00023
    00024 #include <geos/export.h>
    00025 #include <vector>
    00026
    00027 // Forward declarations
    00028 namespace geos {
    00029         namespace geom {
    00030                 class Coordinate;
    00031                 class CoordinateSequence;
    00032         }
    00033 }
    00034
    00035
    00036 namespace geos {
    00037 namespace algorithm { // geos::algorithm
    00038
    00047 class GEOS_DLL CGAlgorithms {
    00048
    00049 public:
    00050
    00051         enum {
    00052                 CLOCKWISE=-1,
    00053                 COLLINEAR,
    00054                 COUNTERCLOCKWISE
    00055         };
    00056
    00057         enum {
    00058                 RIGHT=-1,
    00059                 LEFT,
    00060                 STRAIGHT
    00061         };
    00062
    00063         CGAlgorithms(){};
    00064
    00081         static bool isPointInRing(const geom::Coordinate& p,
    00082                         const geom::CoordinateSequence* ring);
    00083
    00085         static bool isPointInRing(const geom::Coordinate& p,
    00086                         const std::vector<const geom::Coordinate*>& ring);
    00087
    00102         static int locatePointInRing(const geom::Coordinate& p,
    00103                         const geom::CoordinateSequence& ring);
    00104
    00106         static int locatePointInRing(const geom::Coordinate& p,
    00107                         const std::vector<const geom::Coordinate*>& ring);
    00108
    00116         static bool isOnLine(const geom::Coordinate& p,
    00117                 const geom::CoordinateSequence* pt);
    00118
    00134         static bool isCCW(const geom::CoordinateSequence* ring);
    00135
    00148         static int computeOrientation(const geom::Coordinate& p1,
    00149                         const geom::Coordinate& p2,
    00150                         const geom::Coordinate& q);
    00151
    00162         static double distancePointLine(const geom::Coordinate& p,
    00163                         const geom::Coordinate& A,
    00164                         const geom::Coordinate& B);
    00165
    00175         static double distancePointLinePerpendicular(const geom::Coordinate& p,
    00176                         const geom::Coordinate& A,
    00177                         const geom::Coordinate& B);
    00178
    00189         static double distanceLineLine(const geom::Coordinate& A,
    00190                         const geom::Coordinate& B,
    00191                         const geom::Coordinate& C,
    00192                         const geom::Coordinate& D);
    00193
    00198         static double signedArea(const geom::CoordinateSequence* ring);
    00199
    00207         static double length(const geom::CoordinateSequence* pts);
    00208
    00221         static int orientationIndex(const geom::Coordinate& p1,
    00222                         const geom::Coordinate& p2,
    00223                         const geom::Coordinate& q);
    00224
    00225 };
    00226
    00227 } // namespace geos::algorithm
    00228 } // namespace geos
    00229
    00230 #endif // GEOS_ALGORITHM_CGALGORITHM_H