| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
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_CENTROIDPOINT_H |
|
17
|
|
|
|
|
|
|
#define GEOS_ALGORITHM_CENTROIDPOINT_H |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#include |
|
20
|
|
|
|
|
|
|
#include |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
// Forward declarations |
|
23
|
|
|
|
|
|
|
namespace geos { |
|
24
|
|
|
|
|
|
|
namespace geom { |
|
25
|
|
|
|
|
|
|
class Geometry; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
namespace geos { |
|
31
|
|
|
|
|
|
|
namespace algorithm { // geos::algorithm |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
/// @deprecated use Centroid instead |
|
34
|
|
|
|
|
|
|
class GEOS_DLL CentroidPoint { |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
private: |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
int ptCount; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
geom::Coordinate centSum; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
public: |
|
43
|
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
|
CentroidPoint() |
|
45
|
|
|
|
|
|
|
: |
|
46
|
|
|
|
|
|
|
ptCount(0), |
|
47
|
3
|
|
|
|
|
|
centSum(0.0, 0.0) |
|
48
|
3
|
|
|
|
|
|
{} |
|
49
|
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
|
~CentroidPoint() |
|
51
|
3
|
|
|
|
|
|
{} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
/** |
|
54
|
|
|
|
|
|
|
* Adds the point(s) defined by a Geometry to the centroid total. |
|
55
|
|
|
|
|
|
|
* If the geometry is not of dimension 0 it does not contribute to the |
|
56
|
|
|
|
|
|
|
* centroid. |
|
57
|
|
|
|
|
|
|
* @param geom the geometry to add |
|
58
|
|
|
|
|
|
|
*/ |
|
59
|
|
|
|
|
|
|
void add(const geom::Geometry *geom); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
void add(const geom::Coordinate *pt); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
geom::Coordinate* getCentroid() const; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
/// Return false if centroid could not be computed |
|
66
|
|
|
|
|
|
|
bool getCentroid(geom::Coordinate& ret) const; |
|
67
|
|
|
|
|
|
|
}; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} // namespace geos::algorithm |
|
70
|
|
|
|
|
|
|
} // namespace geos |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#endif // GEOS_ALGORITHM_CENTROIDPOINT_H |