GEOS  3.3.3
CentroidLine.h
1 /**********************************************************************
2  * $Id: CentroidLine.h 2556 2009-06-06 22:22:28Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
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 #ifndef GEOS_ALGORITHM_CENTROIDLINE_H
18 #define GEOS_ALGORITHM_CENTROIDLINE_H
19 
20 
21 #include <geos/export.h>
22 #include <geos/geom/Coordinate.h>
23 
24 // Forward declarations
25 namespace geos {
26  namespace geom {
27  class Geometry;
28  class CoordinateSequence;
29  }
30 }
31 
32 namespace geos {
33 namespace algorithm { // geos::algorithm
34 
35 class GEOS_DLL CentroidLine {
36 private:
37 
38  geom::Coordinate centSum;
39 
40  double totalLength;
41 
42 public:
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
78 
79 /**********************************************************************
80  * $Log$
81  * Revision 1.1 2006/03/09 16:46:48 strk
82  * geos::geom namespace definition, first pass at headers split
83  *
84  **********************************************************************/
85