Hi Vurfem,
Here's one way of doing it:
SimpleFeature feature = ...
Polygon poly = (Polygon) feature.getDefaultGeometry();
// We only want the polygon's boundary, ignoring any holes
LineString boundary = poly.getExteriorRing();
// We need to get rid of any redundant vertices e.g. collinear points
// that would artificially split sides. Any point that is closer than
// minDistance to the line between the points before and after it will
// be removed (choose a minDistance value for your own data)
final double minDistance = 0.01d;
Coordinate[] coords = DouglasPeuckerLineSimplifier.simplify(
boundary.getCoordinates(), minDistance);
double[] sideLength = new double[coords.length - 1];
for (int i = 0; i < sideLength.length; i++) {
sideLength[i] = Point2D.distance(coords[i].x, coords[i].y,
coords[i+1].x, coords[i+1].y);
}
Michael
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users