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_CENTROIDLINE_H |
17
|
|
|
|
|
|
|
#define GEOS_ALGORITHM_CENTROIDLINE_H |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#include |
21
|
|
|
|
|
|
|
#include |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
// Forward declarations |
24
|
|
|
|
|
|
|
namespace geos { |
25
|
|
|
|
|
|
|
namespace geom { |
26
|
|
|
|
|
|
|
class Geometry; |
27
|
|
|
|
|
|
|
class CoordinateSequence; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
namespace geos { |
32
|
|
|
|
|
|
|
namespace algorithm { // geos::algorithm |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
/// @deprecated use Centroid instead |
35
|
|
|
|
|
|
|
class GEOS_DLL CentroidLine { |
36
|
|
|
|
|
|
|
private: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
geom::Coordinate centSum; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
double totalLength; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
public: |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
|
CentroidLine() |
45
|
|
|
|
|
|
|
: |
46
|
|
|
|
|
|
|
centSum(0.0, 0.0), |
47
|
2
|
|
|
|
|
|
totalLength(0.0) |
48
|
2
|
|
|
|
|
|
{} |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
|
~CentroidLine() {} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
/** \brief |
53
|
|
|
|
|
|
|
* Adds the linestring(s) defined by a Geometry to the centroid total. |
54
|
|
|
|
|
|
|
* |
55
|
|
|
|
|
|
|
* If the geometry is not linear it does not contribute to the centroid |
56
|
|
|
|
|
|
|
* @param geom the geometry to add |
57
|
|
|
|
|
|
|
*/ |
58
|
|
|
|
|
|
|
void add(const geom::Geometry *geom); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
/** \brief |
61
|
|
|
|
|
|
|
* Adds the length defined by an array of coordinates. |
62
|
|
|
|
|
|
|
* |
63
|
|
|
|
|
|
|
* @param pts an array of {@link geom::Coordinate}s |
64
|
|
|
|
|
|
|
*/ |
65
|
|
|
|
|
|
|
void add(const geom::CoordinateSequence *pts); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
geom::Coordinate* getCentroid() const; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
/// return false if centroid could not be computed |
70
|
|
|
|
|
|
|
bool getCentroid(geom::Coordinate& ret) const; |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} // namespace geos::algorithm |
74
|
|
|
|
|
|
|
} // namespace geos |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#endif // GEOS_ALGORITHM_CENTROIDLINE_H |