- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# CentroidPoint.h

    00001 /**********************************************************************
    00002  * $Id: CentroidPoint.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************/
    00016
    00017 #ifndef GEOS_ALGORITHM_CENTROIDPOINT_H
    00018 #define GEOS_ALGORITHM_CENTROIDPOINT_H
    00019
    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
    00033 class CentroidPoint {
    00034
    00035 private:
    00036
    00037         int ptCount;
    00038
    00039         geom::Coordinate centSum;
    00040
    00041 public:
    00042
    00043         CentroidPoint()
    00044                 :
    00045                 ptCount(0),
    00046                 centSum(0.0, 0.0)
    00047         {}
    00048
    00049         ~CentroidPoint()
    00050         {}
    00051
    00058         void add(const geom::Geometry *geom);
    00059
    00060         void add(const geom::Coordinate *pt);
    00061
    00062         geom::Coordinate* getCentroid() const;
    00063
    00065         bool getCentroid(geom::Coordinate& ret) const;
    00066 };
    00067
    00068 } // namespace geos::algorithm
    00069 } // namespace geos
    00070
    00071 #endif // GEOS_ALGORITHM_CENTROIDPOINT_H
    00072
    00073 /**********************************************************************
    00074  * $Log$
    00075  * Revision 1.1  2006/03/09 16:46:48  strk
    00076  * geos::geom namespace definition, first pass at headers split
    00077  *
    00078  **********************************************************************/
    00079