GEOS  3.3.3
CentroidPoint.h
1 /**********************************************************************
2  * $Id: CentroidPoint.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_CENTROIDPOINT_H
18 #define GEOS_ALGORITHM_CENTROIDPOINT_H
19 
20 #include <geos/export.h>
21 #include <geos/geom/Coordinate.h>
22 
23 // Forward declarations
24 namespace geos {
25  namespace geom {
26  class Geometry;
27  }
28 }
29 
30 
31 namespace geos {
32 namespace algorithm { // geos::algorithm
33 
34 class GEOS_DLL CentroidPoint {
35 
36 private:
37 
38  int ptCount;
39 
40  geom::Coordinate centSum;
41 
42 public:
43 
44  CentroidPoint()
45  :
46  ptCount(0),
47  centSum(0.0, 0.0)
48  {}
49 
50  ~CentroidPoint()
51  {}
52 
59  void add(const geom::Geometry *geom);
60 
61  void add(const geom::Coordinate *pt);
62 
63  geom::Coordinate* getCentroid() const;
64 
66  bool getCentroid(geom::Coordinate& ret) const;
67 };
68 
69 } // namespace geos::algorithm
70 } // namespace geos
71 
72 #endif // GEOS_ALGORITHM_CENTROIDPOINT_H
73 
74 /**********************************************************************
75  * $Log$
76  * Revision 1.1 2006/03/09 16:46:48 strk
77  * geos::geom namespace definition, first pass at headers split
78  *
79  **********************************************************************/
80