GEOS 3.6.2
CentroidLine.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#ifndef GEOS_ALGORITHM_CENTROIDLINE_H
17#define GEOS_ALGORITHM_CENTROIDLINE_H
18
19
20#include <geos/export.h>
21#include <geos/geom/Coordinate.h>
22
23// Forward declarations
24namespace geos {
25 namespace geom {
26 class Geometry;
28 }
29}
30
31namespace geos {
32namespace algorithm { // geos::algorithm
33
35class GEOS_DLL CentroidLine {
36private:
37
38 geom::Coordinate centSum;
39
40 double totalLength;
41
42public:
43
44 CentroidLine()
45 :
46 centSum(0.0, 0.0),
47 totalLength(0.0)
48 {}
49
50 ~CentroidLine() {}
51
58 void add(const geom::Geometry *geom);
59
65 void add(const geom::CoordinateSequence *pts);
66
67 geom::Coordinate* getCentroid() const;
68
70 bool getCentroid(geom::Coordinate& ret) const;
71};
72
73} // namespace geos::algorithm
74} // namespace geos
75
76
77#endif // GEOS_ALGORITHM_CENTROIDLINE_H
bool getCentroid(geom::Coordinate &ret) const
return false if centroid could not be computed
void add(const geom::Geometry *geom)
Adds the linestring(s) defined by a Geometry to the centroid total.
void add(const geom::CoordinateSequence *pts)
Adds the length defined by an array of coordinates.
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25