org.geotools.geometry.iso.util.algorithm2D
Class CentroidArea2D

java.lang.Object
  extended by org.geotools.geometry.iso.util.algorithm2D.CentroidArea2D

public class CentroidArea2D
extends java.lang.Object

Computes the centroid of an area geometry.

Algorithm

Based on the usual algorithm for calculating the centroid as a weighted sum of the centroids of a decomposition of the area into (possibly overlapping) triangles. The algorithm has been extended to handle holes and multi-polygons. See http://www.faqs.org/faqs/graphics/algorithms-faq/ for further details of the basic approach.


Constructor Summary
CentroidArea2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
          Creates a new Centroid operation
 
Method Summary
 void add(GeometryImpl geom)
          Adds the area defined by a Geometry to the centroid total.
 DirectPositionImpl getCentroid()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CentroidArea2D

public CentroidArea2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates a new Centroid operation

Parameters:
crs -
Method Detail

add

public void add(GeometryImpl geom)
Adds the area defined by a Geometry to the centroid total. If the geometry has no area it does not contribute to the centroid.

Parameters:
geom - the geometry to add

getCentroid

public DirectPositionImpl getCentroid()


Copyright © 1996-2010 Geotools. All Rights Reserved.