Ejemplo n.º 1
0
 public void TestRemoveSTRtree()
 {
     var tree = new STRtree<string>();
     tree.Insert(new Envelope(0, 10, 0, 10), "1");
     tree.Insert(new Envelope(5, 15, 5, 15), "2");
     tree.Insert(new Envelope(10, 20, 10, 20), "3");
     tree.Insert(new Envelope(15, 25, 15, 25), "4");
     Assert.DoesNotThrow(() => tree.Remove(new Envelope(10, 20, 10, 20), "4"));
     Assert.AreEqual(3, tree.Count);
 }
Ejemplo n.º 2
0
        public void TestRemoveSTRtree()
        {
            var tree = new STRtree <string>();

            tree.Insert(new Envelope(0, 10, 0, 10), "1");
            tree.Insert(new Envelope(5, 15, 5, 15), "2");
            tree.Insert(new Envelope(10, 20, 10, 20), "3");
            tree.Insert(new Envelope(15, 25, 15, 25), "4");
            Assert.DoesNotThrow(() => tree.Remove(new Envelope(10, 20, 10, 20), "4"));
            Assert.AreEqual(3, tree.Count);
        }
        private void DisplayShapeByRTree(Coordinate p1, Coordinate p2)
        {
            if (areaSTRtree.IsEmpty)
            {
                return;
            }
            var areaQuery = new Envelope(p1, p2);
            var areaItems = areaSTRtree.Query(areaQuery);

            foreach (IGeometry item in areaItems)
            {
                DrawShape(item);
                areaSTRtree.Remove(item.EnvelopeInternal, item);
            }
        }
        //Dictionary<Coordinate, bool> isExsitedOnView = new Dictionary<Coordinate, bool>();
        private void DisplayGPSByRTree(Coordinate p1, Coordinate p2)
        {
            if (gpsSTRtree.IsEmpty)
            {
                return;
            }
            var gpsQuery = new Envelope(p1, p2);
            var gpsItems = gpsSTRtree.Query(gpsQuery);

            //MainMap.Markers.Clear();
            //button10_Click(null, null);
            foreach (Coordinate gps in gpsItems)
            {
                //if (!isExsitedOnView.ContainsKey(gps))
                //{
                AddMakerToGmap(gps);
                //isExsitedOnMap.Add(gps, true);
                //}
                //else
                //{
                //   isExsitedOnView[gps] = true;
                //}
                gpsSTRtree.Remove(new Envelope(gps), gps);
            }

            //foreach (var item in isExsitedOnView)
            //{
            //   if (item.Value == false)
            //   {
            //      GMapMarker gps = new GMapMarker(new PointLatLng(item.Key.Y, item.Key.X));
            //      MainMap.Markers.Remove(gps);
            //   }
            //}
            //isExsitedOnView.Clear();
            //isExsitedOnView = gpsItems.GroupBy(x => x).Select(x => x.First()).ToDictionary(key => key, value => true);
        }