Hi Tommaso, the easiest way to do a rotation for example is: Coordinate ancorPoint = ...; AffineTransform affineTransform = AffineTransform.getRotateInstance(angleRad, ancorPoint.x, ancorPoint.y); MathTransform mathTransform = new AffineTransform2D(affineTransform);
Point point = ...point to rotate; Geometry rotatedPoint = JTS.transform(point, mathTransform); Where point can be any geometry. Does that help? Ciao Andrea On Wed, Aug 18, 2010 at 11:26 PM, tommaso <[email protected]> wrote: > Hallo List, > > I would like to perform some geometry transformations on polygons, i.e > rotate about a point, scale and translate. > > So I create the polygon: > > import com.vividsolutions.jts.geom.Coordinate > import org.geotools.geometry.jts.JTSFactoryFinder > import com.vividsolutions.jts.geom.GeometryFactory > import com.vividsolutions.jts.geom.LinearRing > import com.vividsolutions.jts.geom.Polygon > > GeometryFactory geometryFactory = > JTSFactoryFinder.getGeometryFactory( null ); > > Coordinate[] coords = [new Coordinate(0, 0), new Coordinate(2, 0), > new Coordinate(2, 2), new Coordinate(0, 2), new Coordinate(0, 0)] > LinearRing ring = new LinearRing(coords, geometryFactory) > Polygon polygon = geometryFactory.createPolygon(ring) > > I guess I have to use AffineTransform > (com.vividsolutions.jts.geom.util.AffineTransformation ?) but I don't know > exactly how. > A code example or a link to a tutorial were very appreciated. > > Cheers, > Tom > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
