CentroidLine.h

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_CENTROIDLINE_H
00017 #define GEOS_ALGORITHM_CENTROIDLINE_H
00018 
00019 
00020 #include <geos/export.h>
00021 #include <geos/geom/Coordinate.h>
00022 
00023 // Forward declarations
00024 namespace geos {
00025         namespace geom {
00026                 class Geometry;
00027                 class CoordinateSequence;
00028         }
00029 }
00030 
00031 namespace geos {
00032 namespace algorithm { // geos::algorithm
00033 
00035 class GEOS_DLL CentroidLine {
00036 private:
00037 
00038         geom::Coordinate centSum;
00039 
00040         double totalLength;
00041 
00042 public:
00043 
00044         CentroidLine()
00045                 :
00046                 centSum(0.0, 0.0),
00047                 totalLength(0.0)
00048         {}
00049 
00050         ~CentroidLine() {}
00051 
00058         void add(const geom::Geometry *geom);
00059 
00065         void add(const geom::CoordinateSequence *pts);
00066 
00067         geom::Coordinate* getCentroid() const;
00068 
00070         bool getCentroid(geom::Coordinate& ret) const;
00071 };
00072 
00073 } // namespace geos::algorithm
00074 } // namespace geos
00075 
00076 
00077 #endif // GEOS_ALGORITHM_CENTROIDLINE_H

Generated on 15 May 2014 for GEOS by  doxygen 1.4.7