public void RemoveAll()
 {
     for (int i = 0; i < count; i++)
     {
         ClusterItem item = childs[i];
         if (item is Cluster)
         {
             (item as Cluster).RemoveAll();
         }
         item.Dispose();
     }
     childs     = null;
     count      = 0;
     capacity   = 0;
     totalCount = 0;
 }
        private bool TryRemoveMarker(OnlineMapsMarker marker)
        {
            for (int i = 0; i < count; i++)
            {
                ClusterItem item = childs[i];
                if (item is Cluster)
                {
                    if ((item as Cluster).TryRemoveMarker(marker))
                    {
                        return(true);
                    }
                }
                else if (item.markerRef == marker)
                {
                    item.Dispose();
                    for (int j = i; j < count - 1; j++)
                    {
                        childs[j] = childs[j + 1];
                    }
                    count--;
                    totalCount--;

                    Cluster p = parent;
                    while (p != null)
                    {
                        p.totalCount--;
                        p.Update();
                        p = p.parent;
                    }

                    childs[count] = null;

                    if (count == 1 && parent != null)
                    {
                        if (childs[0] is MarkerWrapper)
                        {
                            parent.Replace(this, childs[0] as MarkerWrapper);
                            Dispose();
                        }
                    }

                    return(true);
                }
            }
            return(false);
        }