Ejemplo n.º 1
0
        private void InitCar()
        {
            double CarSize      = 50;
            string strImagePath = "/BaseMap;component/image/vehicle.png";
            //string strImagePath = "http://soulsolutions.com.au/Images/pin.png";
            var iconSpec3 = new CustomIconSpecification()
            {
                IconUri    = new Uri(strImagePath, UriKind.RelativeOrAbsolute),
                Width      = CarSize,
                Height     = CarSize,
                IconOffset = new System.Windows.Point(-CarSize / 2, -CarSize / 2),//getIconOffset(iRotateTr),
                //TextContent = ClientStatic.GetIconLblText(initData.CarNo),
                TextOffet = new System.Windows.Point(-15, -46),
                //FontSize = ClientStatic.LableFontSize,
                //TextColor = ClientStatic.CarIconLblColorSCB,
                RotateTr = 0
            };
            var pin = new CustomPushpin
            {
                IconSpecification = iconSpec3,
                Location          = new Location(31.6, 120.3),
                MapInstance       = ctlMap,
                Name = "car",
            };

            carml.AddChild(pin);

            var dp = new DraggablePushpin {
                Location = new Location(31.6, 120.3), Name = "drapcar"
            };

            carml.AddChild(dp, dp.Location);
        }
Ejemplo n.º 2
0
        private void ctlMap_MouseClick(object sender, MapMouseEventArgs e)
        {
            if (isbegin == true)
            {
                BaseGeometry bg = GetItemByID("routing", "begin");

                if (bg != null)
                {
                    LayerReset();
                }


                var data  = new ObservableCollection <VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                data.Add(new VectorLayerData
                {
                    Geo   = point.AsBinary(),
                    ID    = "begin",
                    Label = "起点",
                });

                layer.Add(data);

                isbegin = false;
            }

            if (islast == true)
            {
                var data  = new ObservableCollection <VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                data.Add(new VectorLayerData
                {
                    Geo   = point.AsBinary(),
                    ID    = "last",
                    Label = "终点",
                });

                layer.Add(data);


                DraggablePushpin dp = GetDCarByMSID("drapcar", carml);
                if (dp != null)
                {
                    GetBegionRoad(dp.Location.Latitude, dp.Location.Longitude, 100);
                }
                Dtimer.Begin();
                Ltimer.Begin();
                islast = false;
            }

            if (isbarrier == true)
            {
                //初始化一个图标

                var data  = new ObservableCollection <VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                GetBarrier(point.X, point.Y, 30);
                data.Add(new VectorLayerData
                {
                    Geo   = point.AsBinary(),
                    ID    = "barrier",
                    Label = "障碍" + bn.ToString(),
                });

                layer.Add(data);

                isbarrier = false;
                bn++;
            }
        }