Hi,

Thanks for your reply.


I have try with:

FilterFactory filterFactory =
CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
SimpleFeatureType schemaNet = networkFC.getSchema();
AttributeType areaType =
schemaNe.getType(PipesTrentoP.DRAIN_AREA.getAttributeName());
 store.modifyFeatures(areaType.getName(), new Double(value),
filterFactory.id(FeatureUtils .stringToId(
filterFactory,networkFeature.getID())));
network.refresh(null);

where network is my layer.

But I have the same problem in the table (the same value in the table)
and all value setted to 0.0 in the FeatureCollection.

Maybe my filter is wrong?

Thanks

2011/7/8 Jody Garnett <[email protected]>:
> I think I understand.
> The command system is used to work on aspects of the user interface;
> including the "edit feature" (a special staging area used
> to provide interactive feedback when an edit tool is doing its job).  At the
> end of the day the tools issues change that calls
> FeatureStore.modifyFeature( filter, attribute, value ).
> You can ask the layer for a featureStore; and call modifyFeature directly;
> the code is thread safe.
> After you are done you can call layer.refresh( null ) to redraw the screen.
> For more information and examples of using FeatureStore you can see here:
> - http://docs.geotools.org/latest/userguide/welcome/udig.html
> --
> Jody Garnett
>
> On Friday, 8 July 2011 at 6:53 PM, Daniele Andreis wrote:
>
> Hi all,
>
> I would to change some fields value in a FeatureCollection, and in the
> related shp file. I try to do it with loop on my collection:
>
> UndoableMapCommand undoableMapCommand =
> cmdFactor.createSetAttributeCommand( networkFeature, network,
>
> PipesTrentoP.DRAIN_AREA.getAttributeName(), ((MultiPolygon)
> featureAre.getDefaultGeometry())
>
> .getArea() / M_TO_HA);
> toolContext.sendSyncCommand(undoableMapCommand);
>
> Where networkFeature is my feature,
> PipesTrentoP.DRAIN_AREA.getAttributeName() the name of the field,
> network the FeatureCollection, and the last parameter is the new value
> to put.
>
> At the end the FeatureCollection contains the right value but in the
> table (and in the shp) they are random mixed.
>
> I have try to take a look at the code but I can't understand the
> problems, it seems to happen after I added a new feature in a next
> session.
>
>
> Thanks and regards.
>
>
> --
> Daniele Andreis
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>



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

Reply via email to