[udig-devel] Re: adding and modifying a new feature

andrea antonello andrea.antonello at gmail.com
Tue May 6 04:29:26 PDT 2008


PS: there is a small typo in
EditCommandFactory.getInstance().createSetGeomteryCommand


On Tue, May 6, 2008 at 11:11 AM, andrea antonello
<andrea.antonello at gmail.com> wrote:
> I'm trying to add programmatically a new feature to a layer and to
>  modify it as new coordinates come to make the geometry of that feature
>  evolve.
>  What I am doing is:
>
>  - the first time create a feature and add it to the layer with
>                 UndoableMapCommand createAddFeatureCommand = EditCommandFactory
>                         .getInstance().createAddFeatureCommand(feature, layer);
>                 layer.getMap().sendCommandASync(createAddFeatureCommand);
>
>  - having kept the reference to that feature, every time new
>  coordinates come, I add the coordinate to the geometry of the feature
>  I created at the first round and modify on the layer with the
>  following:
>
>                 UndoableMapCommand[] cmds = new UndoableMapCommand[3];
>                 cmds[0] = EditCommandFactory.getInstance()
>                         .createSetEditFeatureCommand(feature, layer);
>                 cmds[1] = EditCommandFactory.getInstance()
>                         .createSetGeomteryCommand(feature, layer, geometry);
>
>                 layer.getMap().sendCommandASync(cmds[0]);
>                 layer.getMap().sendCommandASync(cmds[1]);
>
>  Should this work?
>
>  Ciao,
>  Andrea
>


More information about the udig-devel mailing list