Hey,

It's *still* not clear what you are trying to do, what is happening and
what you expect to have happen. We are not inside your head so you have
to tell us way more information. 

JTS doesn't do arcs. JTS uses linear interpolation between vertices only
and all its algorithms rely on that assumption.


On Wed, 2008-05-14 at 02:19 -0700, apreciado wrote:
> Hello everyone.
> 
> I am render geometry (lineString, polygon, point (of the library jts )) as
> follows:
> 
> GeometryFactory geomFac = new GeometryFactory();
> 
> Coordinate[] polygonCoordinates = new Coordinate[3];
> polygonCoordinates[0] = new Coordinate(10, 20);
> polygonCoordinates[1] = new Coordinate(30,40);
> polygonCoordinates[2] = new Coordinate(10,20);
> LinearRing ring = geomFac.createLinearRing(polygonCoordinates);

I think you have to close the linear ring so
polygonCoordinates[3] = polygonCoordinates[0];
but maybe I'm wrong if it's working for you.

> Polygon polygon = geomFac.createPolygon(ring, null);
> StyleFactory sFac = CommonFactoryFinder.getStyleFactory(
> GeoTools.getDefaultHints() );
>               
> StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
> 
> org.geotools.styling.Style style = styleFactory.createStyle();
> org.opengis.filter.FilterFactory factory =
> CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
> PolygonSymbolizer polysym = sFac.createPolygonSymbolizer();
> FilterFactory filterFactory = FilterFactoryFinder.createFilterFactory();
> Stroke myStroke = sFac.getDefaultStroke();
> myStroke.setColor(filterFactory.createLiteralExpression("#000000"));
> myStroke.setWidth(filterFactory.createLiteralExpression(new Integer(1)));
> polysym.setStroke(myStroke);
> Rule ruleLine = sFac.createRule();
> ruleLine.setSymbolizers(new Symbolizer[] { polysym });
> FeatureTypeStyle fts = sFac.createFeatureTypeStyle();
> fts.setRules(new Rule[] { ruleLine });
> fts.setFeatureTypeName("circlefeature");
> style.addFeatureTypeStyle(fts);
> 
> 
> AttributeType[] typesNew = new AttributeType[1];
> typesNew[0] = AttributeTypeFactory.newAttributeType("coolection",
> curve2.getClass()
> , false, 0, null, DefaultGeographicCRS.WGS84);
> 
> FeatureType polyType = FeatureTypes.newFeatureType(typesNew,
> "circlefeature");
> Feature polyFeature = polyType.create(new Object[] { curve2});
> FeatureCollection featureCollectionLine =
> FeatureCollections.newCollection();
> featureCollectionLine.add(polyFeature);
> 
> CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84;
> MapContext context = new DefaultMapContext(crs);
> MapLayer layer = new DefaultMapLayer(featureCollectionLine,style);
> context.addLayer(context.getLayerCount(),layer);
> context.setAreaOfInterest(layer.getBounds());
> GTRenderer renderer;
>         if( true ){ 
>               renderer = new StreamingRenderer();
>               HashMap hints = new HashMap();
>               hints.put("memoryPreloadingEnabled", Boolean.TRUE);
>             renderer.setRendererHints( hints );
>         }
>         else {
>               renderer = new StreamingRenderer();
>               HashMap hints = new HashMap();
>               hints.put("memoryPreloadingEnabled", Boolean.FALSE);
>             renderer.setRendererHints( hints );
>         }
>         renderer.setContext(context);
>         mp.setRenderer(renderer);
>         mp.setContext(context);
>         mp.setMapArea(layer.getBounds());
>         frame.repaint();
>         frame.doLayout();
> 
> 
> Cuestion:
> 
> this is my example to render linestring, polygon, circle... 
> but i have to render arc (calcula arc 3 coordinate: center, point1 ,
> point2).

You are going to have to do the math for this yourself. JTS doesn't yet
do it nor does the ISO geometry from what I understand.

--adrian

> 
> help,
> 
> Could anyone please give me some pointers? 
> Thank you,


-------------------------------------------------------------------------
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
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to