public void AddsMultipleAndRemovesSingleEntry() { var index = new SpatialIndex <MockGameObject>(); var p1 = new Point(0, 0); var obj = new MockGameObject(p1); index.Insert(p1, obj); var p2 = new Point(-55, 654); index.Insert(p2, new MockGameObject(p2)); // Validate total buckets Assert.AreEqual(index.Keys.Count, 2); // Validate bucket count var bucket = index.Get(p1); Assert.AreEqual(bucket.Count, 1); index.Remove(p1, obj); // Validate total buckets Assert.AreEqual(index.Keys.Count, 1); }
PointFeature GetArcEndPoint(PointGeometry g, ILength tol, Operation creator) { // Ensure we've got a point at the required position PointFeature pt = EnsurePointExists(g, tol, creator); // If it's not exactly coincident, we've picked up a previously loaded point // that happens to be within tolerance. If it's not already connected to any // lines, shift it to where we want it. if (!pt.IsCoincident(g)) { if (!pt.HasDependents) { m_Index.Remove(pt); PointFeature[] pts = pt.Node.Points; pt.SetNode(new Node(pts, g)); m_Index.Add(pt); } } return(pt); }
public void AddsAndRemovesSingleEntry() { var index = new SpatialIndex <MockGameObject>(); var p = new Point(0, 0); var obj = new MockGameObject(p); index.Insert(p, obj); // Validate total buckets Assert.AreEqual(index.Keys.Count, 1); // Validate bucket count var bucket = index.Get(p); Assert.AreEqual(bucket.Count, 1); index.Remove(p, obj); // Validate total buckets Assert.AreEqual(index.Keys.Count, 0); }
/// <summary> /// Removes a circle from this index. /// </summary> /// <param name="c">The circle to remove from the index</param> internal void RemoveCircle(Circle c) { m_ExtraData.Remove(c); }
public virtual void RemoveBounds(IVisual visual) { SpatialIndex.Remove(visual); }