[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [udig-devel] The new catalog method createTemporaryResource(FeatureType)
|
You just need a feature reader. Here's a little example for you.
(just psuedo code)
IGeoResource resource=catalog.createTemporaryResource( featureType );
FeatureStore store=resource.resolve( FeatureStore.class, monitor);
Feature[] feature=createCustomFeatures(); // note: feature's Feature
Type must be == to featureType.
final Iterator<Feature> iter=Arrays.asList(feature).iterator();
store.addFeature( new FeatureReader(){
public boolean hasNext(){ iter.hasNext(); }
public Feature next() { iter.next(); }
public void remove() { throw new UnsupportedOperationException() }
}
That's all you need. Of course there are many variations on this as
well.
Jesse
On 15-Mar-06, at 11:57 PM, Adrian Custer wrote:
Hey all (and perhaps Jesse in particular),
I'm unsure how to add features to the "TemporaryResource" created by:
IGeoResource newIGR = CatalogPlugin.getDefault().
getLocalCatalog().
createTemporaryResource
( myBufferFT );
and the approach I have found so far leaves me confused.
Through a FeatureStore:
-----------------------
Assuming, as stated in the docs and based on experience, that the
newIGR .resolve(FeatureStore.class) method (may) yield a FeatureStore,
then I need to add my feature to that store.
This requires
(1) creating a FeatureReader
(2) creating an AttributeReader
but this second step requires knowing what kind of FeatureStore we are
working against which I don't know. This also seems a lot of work
compared to the convenience that got me started on this path.
Question 1: How do I discover/figure out this second step?
Question 2: is there another approach that I am missing?
Question 3: Would it make sense to provide another convenience method:
addFeatureToTemporaryResource(IGeoResource,Feature)
or am I lost?
cheers,
adrian
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel