Reputation: 874
I have a H.map.Group
with a bunch of markers.
If i need to remove a single marker i run:
this.markerGroup.removeObject(marker);
But sometimes in other part of my code i run:
this.markerGroup.removeAll();
So if after i run single marker remove method it throws me an error, because there is no such marker on markerGroup
layer because all markers were removed previously.
How can i know the marker is valid and exists on a map so i can remove it correctly?
In Yandex Maps i have isValid
method so i can validate marker before making some actions with one:
marker.isValid && markerGroup.remove(marker);
If isValid
is true
it means the marker has geometry and it is on a map, if false
means the marker just exists in memory and not attached to the map.
What is equal functionality in Here maps?
Upvotes: 0
Views: 85
Reputation: 932
H.map.Marker#getParentGroup() or H.map.Marker#getRootGroup() should work for that case.
Upvotes: 1