Pergunta

As is similar to many other mapping APIs, the nutiteq map api contains a MarkerLayer that can be added to the map. It has a simple method for removing markers (for example: markerLayer.remove(myMarker)).

I noticed that the Marker class inherits a method called detachFromLayer, which originates in the VectorElement from which Marker extends. According to the Javadoc:

This method is intended for vector layers. When element is removed from layer, it must be detached to drop the element-layer link.

Question: Since a Marker is a VectorElement, and a MarkerLayer is a VectorLayer, given the above Javadoc description, what is the proper way to remove a marker from the marker layer?

Would I be correct that the proper way is to both remove the marker from the layer (using MarkerLayer#remove), and to invoke detachFromLayer? Or is it sufficient to merely remove the marker from the layer?

Foi útil?

Solução 2

Use markerLayer.remove(myMarker) , detachFromLayer is an internal method and you should not use it normally.

Outras dicas

JaakL is correct, remove is the correct method to call. detachFromLayer/detachFromDataSource are internal methods and should not be called by application (they are reserved for custom layers/data sources). The issue you reported is actually a bug that is already fixed in the development snapshot and will be in 2.3.1 release (it is not in 2.3.1RC1 though). Thanks for pointing it out!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top