apreciado wrote:
> Question:
>
> this is my example to render linestring, polygon, circle... but i have to
> render arc (calcula arc 3 coordinate: center, point1 , point2).
>
So you can do the math to create your "circle", ie use sine and cosine
functions to calculate the individual points ... there is no such thing
as an "arc" or circle using JTS Geometries.
Here is an example I used when testing, it creates a circle in a random
location ... but you get the idea:
> /**
> * Create a little 2x2 unit circle any grid location
> * in a 10 x 10 area. Used for testing.
> *
> * @return Polygon
> */
> private static Geometry createCircle() {
> int x = random.nextInt(5);
> int y = random.nextInt(5);
> int S = 32;
> Coordinate coords[] = new Coordinate[S];
> for( int i = 0; i < S; i++){
> double angle = ((double) i / (double) S) * 360.0;
> double dx = Math.cos( angle );
> double dy = Math.sin( angle );
> coords[i] = new Coordinate( (double) x + dx, (double) y + dy );
> }
> coords[coords.length-1] = coords[0];
>
> LinearRing ring = factory.createLinearRing( coords );
> Polygon polygon = factory.createPolygon( ring, null );
>
> return polygon;
> }
>
Cheers,
Jody
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users