GEOS: ConvexHull.h Source File

GEOS 3.5.0

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

- File List

ConvexHull.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: algorithm/ConvexHull.java r407 (JTS-1.12+)
18 *
19 **********************************************************************/
20
21 #ifndef GEOS_ALGORITHM_CONVEXHULL_H
22 #define GEOS_ALGORITHM_CONVEXHULL_H
23
24 #include <geos/export.h>
25 #include <vector>
26
27 // FIXME: avoid using Cordinate:: typedefs to avoid full include
28 #include <geos/geom/Coordinate.h>
29
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33 #endif
34
35 // Forward declarations
36 namespace geos {
37 namespace geom {
38 class Geometry;
39 class GeometryFactory;
40 class CoordinateSequence;
41 }
42 }
43
44 namespace geos {
45 namespace algorithm { // geos::algorithm
46
58 class GEOS_DLL ConvexHull {
59 private:
60 const geom::GeometryFactory *geomFactory;
61 geom::Coordinate::ConstVect inputPts;
62
63 void extractCoordinates(const geom::Geometry *geom);
64
69 geom::CoordinateSequence *toCoordinateSequence(geom::Coordinate::ConstVect &cv);
70
71 void computeOctPts(const geom::Coordinate::ConstVect &src,
72 geom::Coordinate::ConstVect &tgt);
73
74 bool computeOctRing(const geom::Coordinate::ConstVect &src,
75 geom::Coordinate::ConstVect &tgt);
76
101 void reduce(geom::Coordinate::ConstVect &pts);
102
104 void padArray3(geom::Coordinate::ConstVect &pts);
105
107 void preSort(geom::Coordinate::ConstVect &pts);
108
126 int polarCompare(const geom::Coordinate &o,
127 const geom::Coordinate &p, const geom::Coordinate &q);
128
129 void grahamScan(const geom::Coordinate::ConstVect &c,
130 geom::Coordinate::ConstVect &ps);
131
141 geom::Geometry* lineOrPolygon(const geom::Coordinate::ConstVect &vertices);
142
147 void cleanRing(const geom::Coordinate::ConstVect &input,
148 geom::Coordinate::ConstVect &cleaned);
149
154 bool isBetween(const geom::Coordinate& c1, const geom::Coordinate& c2, const geom::Coordinate& c3);
155
156 public:
157
161 ConvexHull(const geom::Geometry *newGeometry);
162
163
164 ~ConvexHull();
165
178 geom::Geometry* getConvexHull();
179 };
180
181 } // namespace geos::algorithm
182 } // namespace geos
183
184 #ifdef _MSC_VER
185 #pragma warning(pop)
186 #endif
187
188 #ifdef GEOS_INLINE
189 # include "geos/algorithm/ConvexHull.inl"
190 #endif
191
192 #endif // GEOS_ALGORITHM_CONVEXHULL_H
geos::geom::Coordinate::ConstVect
std::vector< const Coordinate * > ConstVect
A vector of const Coordinate pointers.
Definition: Coordinate.h:71
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
geos::algorithm::ConvexHull
Definition: ConvexHull.h:58
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59