private void TimerCompleted(object sender, EventArgs e) { CarGraphic c = GetCarByName("car", MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer); if (carloc.Count > 0) { CustomMapPoint lc = carloc.ElementAt(_cari); if (lc != null) { c.Node = lc.Node; c.Geometry = lc; } if (_cari % 10 == 0 && cbxLocCar.IsChecked == true) { MyMap.PanTo(lc); } } fcarloc.Clear(); var cmp = GetCarByName("car", MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer); foreach (var trigger in carloc.Where(trigger => trigger.Node == cmp.Node)) { fcarloc.Add(trigger); } if (fcarloc.Count > 25) { for (int k = 0; k < fcarloc.Count - 1; k++) { var cp = fcarloc.ElementAt(k); if (Isclost(cmp.Geometry as CustomMapPoint, cp, 0.00001)) { if (fcarloc.Count - k > 18) { _isgetlocing = true; } } } } //if (_isgetlocing == false) //{ timer.Begin(); //} if (_cari < carloc.Count - 1) { _cari++; } }
private void AddPictureMarker() { var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = new CustomMapPoint(120.428, 31.577), Name = "car", Symbol = GlobePictureSymbol }; if (graphicsLayer != null) { graphicsLayer.Graphics.Add(cg); } }
void RscGetBeginRoadCompleted(object sender, GetBeginRoadCompletedEventArgs e) { string[] strArray = e.Result[0].Split(new char[] { ';' }); _beginNum = int.Parse(strArray[2]); if (_lastNum == 0) { _fristArray = strArray[strArray.Length - 1].Split(new char[] { ',' }); fcarloc.Clear(); for (int i = 0; i < _fristArray.Length - 1; i++) { var tmoloc = new CustomMapPoint( double.Parse(_fristArray[i].Split(new char[] { ' ' })[1]), double.Parse(_fristArray[i].Split(new char[] { ' ' })[0])) { Node = _beginNum }; fcarloc.Add(tmoloc); } } if (_lastNum != 0) { GetRouting("routing", _beginNum, _lastNum); } else { CarGraphic c = GetCarByName("终点", MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer); if (c != null) { GetLastPoint((c.Geometry as MapPoint).Y, (c.Geometry as MapPoint).X, 100); } } //BaseGeometry bg = GetItemByID("routing", "last"); }
private void MyMap_MouseClick(object sender, Map.MouseEventArgs e) { if (_isbegin == true) { //BaseGeometry bg = GetItemByID("routing", "beginNum"); //if (bg != null) //{ // LayerReset(); //} var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = e.MapPoint, Name = "起点", Symbol = BeginPictureSymbol }; if (graphicsLayer != null) graphicsLayer.Graphics.Add(cg); _isbegin = false; } if (_islast == true) { var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = e.MapPoint, Name = "终点", Symbol = EndPictureSymbol }; if (graphicsLayer != null) graphicsLayer.Graphics.Add(cg); CarBeginRun(); //Ltimer.Begin(); _islast = false; } if (_isbarrier == true) { //初始化一个图标 var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = e.MapPoint, Name = "障碍"+_barriarNum.ToString(), Symbol = BarriarPictureSymbol }; if (graphicsLayer != null) graphicsLayer.Graphics.Add(cg); _isbarrier = false; _barriarNum++; } }
private void AddPictureMarker() { var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = new CustomMapPoint(120.428, 31.577), Name = "car", Symbol = GlobePictureSymbol }; if (graphicsLayer != null) graphicsLayer.Graphics.Add(cg); }
private void MyMap_MouseClick(object sender, Map.MouseEventArgs e) { if (_isbegin == true) { //BaseGeometry bg = GetItemByID("routing", "beginNum"); //if (bg != null) //{ // LayerReset(); //} var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = e.MapPoint, Name = "起点", Symbol = BeginPictureSymbol }; if (graphicsLayer != null) { graphicsLayer.Graphics.Add(cg); } _isbegin = false; } if (_islast == true) { var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = e.MapPoint, Name = "终点", Symbol = EndPictureSymbol }; if (graphicsLayer != null) { graphicsLayer.Graphics.Add(cg); } CarBeginRun(); //Ltimer.Begin(); _islast = false; } if (_isbarrier == true) { //初始化一个图标 var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; var cg = new CarGraphic() { Geometry = e.MapPoint, Name = "障碍" + _barriarNum.ToString(), Symbol = BarriarPictureSymbol }; if (graphicsLayer != null) { graphicsLayer.Graphics.Add(cg); } _isbarrier = false; _barriarNum++; } }