Skip to content

Ability to remove Marker from NonHierarchicalDistanceBasedAlgorithm #133

@bedzinsa

Description

@bedzinsa

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions