[OpenLayers-Users] Restore feature's geometry
Alexandre Dube
adube at mapgears.com
Wed Jul 29 14:33:24 EDT 2009
Hey,
Alexandre Dube wrote:
> Well, in the end I would really like to avoid the use of
> layer.refresh({'force':true}) if possible.
>
> If you activate the DrawFeature control while modifying a feature
> (instead of hitting cancel), the geometry of the current modified
> feature still needs to be restored (didn't hit the "save" button). So
> the following happens :
>
> 1. layer.refresh is called
> 2. DrawFeature control activates (at the same time, "featureadded"
> events are registered")
>
I registered the event on the Layer instead of the DrawFeature control.
That's why I had this behavior. Registering it to the control instead
solved that problem.
Still interested to hear more about other (and faster) options though.
Alexandre
> 3. response from the layer.refresh draws new features, but they get
> all engulfed in the DrawFeature "featureadded" events (resulting in
> selecting them all in my case)
>
> So, I would really need an other option... Any clue ?
>
> I'll show the "weird" behavior of cloning the geometry in a live
> example. Maybe I'm doing something wrong.
>
> Alexandre
>
> Alexandre Dube wrote:
>
>> Hi,
>>
>> I'd like to know if there's a better (faster) way to restore a
>> modified feature's geometry other than using layer.refresh({'force':true});
>>
>> I use a ModifyFeature control with a popup that as save and cancel
>> buttons. On save, it commits the changes (fine). On cancel, it should
>> 'restore' the feature to its original state (at least the geometry).
>>
>> I tried to clone the feature + fid before modifications, then on
>> cancel destroy the original feature and add the clone but it's obviously
>> wrong to do so since it becomes unbound to its source.
>>
>> I also tried to clone the geometry only but I had weird behaviors
>> (duplicated features).
>>
>> Any hint ?
>>
>>
>>
>
>
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list