Hello,
I am using NonHierarchicalDistanceBasedAlgorithm and GridBasedAlgorithm is not suitable for me. However i really need the removeItem Method from GridBasedAlgorithm which in NonHierarchical throws an Exception. I tried to extend the hierarchical algorithm and override the removeItem method and remove item using the same principle as it is displayed in addItem method.
@Override
public void removeItem(MarkerItem item)
{
final QuadItem<MarkerItem> quadItem = new QuadItem<MarkerItem>(item);
synchronized (mQuadTree)
{
mItems.remove(quadItem);
mQuadTree.remove(quadItem);
}
}
However, im not sure whether it is remove or not that way, because when i call removeItem, and recluster items it is still displayed on the map. But if i try it twice, it throws me nullpointerexception on
final QuadItem quadItem = new QuadItem(item); which I think means that it no longer exists.
Any idea how should i do it properly?
Hello,
I am using NonHierarchicalDistanceBasedAlgorithm and GridBasedAlgorithm is not suitable for me. However i really need the removeItem Method from GridBasedAlgorithm which in NonHierarchical throws an Exception. I tried to extend the hierarchical algorithm and override the removeItem method and remove item using the same principle as it is displayed in addItem method.
However, im not sure whether it is remove or not that way, because when i call removeItem, and recluster items it is still displayed on the map. But if i try it twice, it throws me nullpointerexception on
final QuadItem quadItem = new QuadItem(item); which I think means that it no longer exists.
Any idea how should i do it properly?