I'd suggest using 

IGeoResource resource = CatalogPlugin.getDefault().getLocalCatalog().createTemporaryResource( featureType ); 
resource.resolve( FeatureStore.class, progressMonitor ).addFeatures(collection);

ApplicationGIS.addLayersToMap( map, Collections.singletonList(resource), addPosition );



Jesse

On 10-Nov-06, at 6:33 AM, Jan Jezek wrote:

Hi all,

I'm working on 'transformation' plugin (for RC5) and I've run in some problems during creating the Layer from temporary resource. I'm having the FeatureCollection (result from transformation) and I would like to make a temporary layer from that. I was searching a lot about this in mail list, but still can't understand how I should do it in right way. 
When I do it this way it works:


map.getLayersInternal().add(newLayer);
 newLayer.getGeoResource().resolve(FeatureStore.class,null).addFeatures(collection);

but when the Feature collection is big (and ussualy it is)  and uDig starts rendering right after each feature is added, it is very very slow, so I tryed to add  new features first and then to add the layer into the map, but then I get java.lang.NullPointerException

newLayer.getGeoResource().resolve(FeatureStore.class,null).addFeatures(collection);
map.getLayersInternal().add(newLayer);

Thanks for any help.
Jan.

_______________________________________________
User-friendly Desktop Internet GIS (uDig)

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to