Hi again:
On 25/04/2010, at 3:31 AM, Thorsten Reitz wrote:
> Hi again Jody & all,
>
> based on your hints I have made some progress (implementing a custom
> FeatureCollection implementation with Filtering and some other features
> based on the examples), but some FeatureImpl-related questions remain:
>
> My main issue concerns the correct creation of FeatureImpls. I created
> my SimpleFeatures in a simple ;) way:
>
> target = SimpleFeatureBuilder.build(targetType, new Object[]{},
> source.getIdentifier().getID());
I think you will need a different "FeatureBuilder" if you want to make normal
features.
The factories to make features are there; so you can do it ... it just may be
there is not
builder around yet to make things easier.
The idea is that factories are stupid; and just do construction; and stateless.
Builders can have some logic and default values and generally have state to
make things easier.
> Creating a FeatureImpl compared to that:
> new FeatureImpl(new HashSet(), targetType, source.getIdentifier());
>
> I assume this is not a good idea, leading me to my second issue...
Yeah should be using a factory at least; in order not to get stuck against one
implementation.
>
> ...the later modification of the FeatureImpls. Is it intended to work
> like this (example with setting the geometry)?
>
> GeometryAttribute gattr = target.getDefaultGeometryProperty();
> gattr.setValue(sourceGeom);
The default geometry should of been defined when the FeatureType was defined.
If it was not we have a trouble.
>
> This doesn't work (since getDefaultGeometryProperty always looks up in
> the set of attributes returned by value(), where it's obviously not yet
> stored).
That seems wrong; it should look up in the feature type.
>>> - Can the Geotools StreamingRenderer also work with FeatureImpl objects?
>>
>> Yes; it uses the same property accessor code and expressions as the
>> filter implementation.
I was talking with Andrea bout this today on the devel list; the render has
code to render normal collections of objects
but I found a few specific cases where it assumed a simple feature collection.
So something to look at on the devel
list - hopefully with Ben?
> OK, I just had to use a different method in setting up the MapContext,
> because the one using FeatureCollections was fixed to accepting
> SimpleFeatures.
I am a bit out of the loop since my own local checkout is playing host to a
patch to make things
easier for those using SimpleFeatures. After that settles down I would like to
work through any
issues you and Ben are having.
Jody
------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users