[OpenLayers-Users] Adding a new feature with different graphics

Pierre GIRAUD bluecarto at gmail.com
Sat Dec 13 08:20:48 EST 2008


If I'm correct, what you want is to be able to distinguish vector
features by their state eg. update, insert, delete, unknown. The
vector features drawn by user and not yet committed to server would be
of insert state.

Currently, there's already a "state" property for the Vector.Feature
class object.

What you need is :
 - to set that state to "OpenLayers.State.INSERT" when the user draws
a new feature, you can easily do this with events at the layer's level
[1]
 - to have different styles for the different states. [2]

Regards,
Pierre

[1] http://www.openlayers.org/dev/examples/protocol-gears.html
[2] http://www.openlayers.org/dev/examples/styles-unique.html

On Fri, Dec 12, 2008 at 10:44 PM, Yves Moisan <yves.moisan at boreal-is.com> wrote:
> Hi All,
>
> I'm playing with something similar to
> http://openlayers.org/dev/examples/vector-formats.html and I was
> wondering what the approach is if I want to allow users to add e.g.
> points on an existing layer.vector object but with a different symbol.
> The idea is that I would like objects updated to an OL vector layer but
> not yet committed back to the server to show up in a different symbol
> than the rest of the features of the layer.
>
> One option I thought was to use an independent feature.vector object and
> then call the features it contains when committing to the layer.vector I
> want to update.  After committing, I would erase the feature.vector.
> Does that make sense ?
>
> Cheers,
>
> Yves
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list