GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2005-2006 Refractions Research Inc. 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 **********************************************************************/ 00015 00016 #ifndef GEOS_ALGORITHM_CENTROIDPOINT_H 00017 #define GEOS_ALGORITHM_CENTROIDPOINT_H 00018 00019 #include <geos/export.h> 00020 #include <geos/geom/Coordinate.h> 00021 00022 // Forward declarations 00023 namespace geos { 00024 namespace geom { 00025 class Geometry; 00026 } 00027 } 00028 00029 00030 namespace geos { 00031 namespace algorithm { // geos::algorithm 00032 00034 class GEOS_DLL CentroidPoint { 00035 00036 private: 00037 00038 int ptCount; 00039 00040 geom::Coordinate centSum; 00041 00042 public: 00043 00044 CentroidPoint() 00045 : 00046 ptCount(0), 00047 centSum(0.0, 0.0) 00048 {} 00049 00050 ~CentroidPoint() 00051 {} 00052 00059 void add(const geom::Geometry *geom); 00060 00061 void add(const geom::Coordinate *pt); 00062 00063 geom::Coordinate* getCentroid() const; 00064 00066 bool getCentroid(geom::Coordinate& ret) const; 00067 }; 00068 00069 } // namespace geos::algorithm 00070 } // namespace geos 00071 00072 #endif // GEOS_ALGORITHM_CENTROIDPOINT_H