org.geotools.geometry.iso.util.algorithmND
Class CentroidLine

java.lang.Object
  extended by org.geotools.geometry.iso.util.algorithmND.CentroidLine

public class CentroidLine
extends java.lang.Object

Computes the centroid of a linear geometry.

Algorithm

Compute the average of the midpoints of all line segments weighted by the segment length.


Constructor Summary
CentroidLine(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
          Creates a new Centroid operation
 
Method Summary
 void add(org.opengis.geometry.Geometry geom)
          Adds the linestring(s) defined by a Geometry to the centroid total.
 void addPointSequence(java.util.List<org.opengis.geometry.DirectPosition> pts)
          Adds the length defined by an array of coordinates.
 DirectPositionImpl getCentroid()
          Returns the centroid for the added curves
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CentroidLine

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

Parameters:
crs -
Method Detail

add

public void add(org.opengis.geometry.Geometry geom)
Adds the linestring(s) defined by a Geometry to the centroid total. If the geometry is not linear it does not contribute to the centroid

Parameters:
geom - the geometry to add

addPointSequence

public void addPointSequence(java.util.List<org.opengis.geometry.DirectPosition> pts)
Adds the length defined by an array of coordinates.

Parameters:
pts - an array of Coordinates

getCentroid

public DirectPositionImpl getCentroid()
Returns the centroid for the added curves

Returns:
Centroid position


Copyright © 1996-2010 Geotools. All Rights Reserved.