コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: NtxImport.cs プロジェクト: 15831944/backsight
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
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);
 }
コード例 #5
0
ファイル: Scene.cs プロジェクト: git-thinh/limada
 public virtual void RemoveBounds(IVisual visual)
 {
     SpatialIndex.Remove(visual);
 }