Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] two questions about using shapefiles for uncommon things

>Von: Jesse Eichar
>Gesendet von: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
>Datum: 22.02.2007 06:19PM
>So I'm guessing that you want you're temporary polygon layer to
>contain the rectangle? If this is the case then don't use the
>IDrawCommands. Those are just for very temporary decorations in the
>
>view. I would use the following code to add the rectangle to the
>temporary layer. Do this after you create the resource but before
>you create the layer so you don't have to worry about committing the
>
>added polygon.
>
>GeometryFactory fac=new GeometryFactory();
>LinearRIng ring = fac.createLinearRing( new Coordinate[]{
> new Coordinate( -180,-90 ),
> new Coordinate( 180,-90 ),
> new Coordinate( 180,90 ),
> new Coordinate( -180,90 ),
> new Coordinate( -180,-90 ),
> });
>Polygon poly = fac.createPolygon( ring, new LinearRing[0] );
>FeatureStore fs=resource.resolve( FeatureStore.class,
>progressMonitor)
>featureBuilder.getFeatureType().createFeature( new Object[] { ....,
>
>poly, ...} ); // insert other parameters
>fs.addFeatures( DataUtilities.toCollection( new Feature[]{ feature }
>);
>
>
>That's it :-P. 
Thanks a lot!! It solved my problem and I got an understanding how this stuff works.
 
 
>Hope this helps, 
yes!
 
tony roth
INVALID HTML

Back to the top