OpenLayers Add-on: Removing PointVector

Hello

I have an OpenStreetMapLayer and a VectorLayer with some PointVectors in it. I would like to remove the selected PointVector. It gets removed but afterwards the selection seems not to work. What happens is the following:

  1. My VectorLayer is in MODIFY drawing mode.
  2. I click on a PointVector on the map. As a result, the PointVector gets selected.
  3. I remove the selected PointVector from the VectorLayer (by the click of a Button):

public void delete(PointVector point) {
       myVectorLayer.removeComponent(point);
}
  1. The PointVector disappears from the map.
  2. Then when I click on another PointVector it is not selected (and I don’t receive a VectorSelectedEvent on the server side). No clicks result in a selection anymore.
  3. However, I can still drag PointVectors around. If I drag PointVector “A” and then click somewhere on the map, I get no VectorModifiedEvent. However, if I click another PointVector (“B”) then (a) I get a VectorModifiedEvent for “A”, (b) then a VectorSelectedEvent for “A”, (c) a VectorUnSelectedEvent for “A” and then a VectorSelectedEvent for “B” and “B” gets into the selected state.

Basically, I would like to get your help with the following questions:

Is Vectorlayer.removeComponent(…) the way to delete a PointVector?

If so then what else do I need to do not to have the above described issues?

If not, then what is the preferred way of removing a PointVector?

Thanks in advance,
Richie.

Hi,

Maybe there is some issue when selection, editing and removing a vector is used at the same time. At least selection and editing are rather tightly coupled in OpenLayers, so I wouldn’t be surprised if there is some special situation which is not handled well. Have you tried if selection and removing works properly when drawing mode is NONE?

If you want me or some other contributor to take a look at the issue, you should prepare a standalone example app and attach it to an issue in the Google code project. I think I have no time to work on OpenLayers at least this week, so I’ll most probably forget this issue if you don’t file one.


Google code project page for OpenLayers Add-On

cheers,
matti

With DrawingMode.NONE selection is not working. With DrawingMode.NONE and SelectionMode.SIMPLE, the issue is not present, i.e. after the removal further PointVectors can be selected. (But obviously they cannot be moved.)

I filed an issue and attached a standalone example application to it:

Issue #37

Thanks in advance,
Richie.