public static MapRoute ToSingleMapRoute(this GeoRoute route)
        {
            MapRoute maproute = new MapRoute(0);

            foreach (PointLatLng pos in route)
            {
                maproute.Add(SingleMapTransformSystem.ModelXYToPixelXY(pos));
            }
            return(maproute);
        }
Exemple #2
0
        public MovingObjectLayer()
        {
            GeoRoute rA = new GeoRoute(r1);

            rA.Reverse();
            GeoRoute rB = new GeoRoute(r2);

            rB.Reverse();
            //GeoRoute rC = new GeoRoute(r3);
            //rC.Reverse();
            //GeoRoute rD = new GeoRoute(r4);
            //rD.Reverse();
            for (int i = 0; i < 10; i++)
            {
                routes.Add(new GeoRoute(r1));
                routes.Add(new GeoRoute(rA));
                routes.Add(new GeoRoute(r2));
                routes.Add(new GeoRoute(rB));
                //routes.Add(new GeoRoute(r3));
                //routes.Add(new GeoRoute(rC));
                //routes.Add(new GeoRoute(r4));
                //routes.Add(new GeoRoute(rD));
            }
            for (int i = 0; i < busNum; i++)
            {
                totalCounts[i]   = (int)(1000 * (i + 1) / deltaTime.TotalMilliseconds);
                currPt[i]        = 0;
                starts[i]        = routes[i][0];
                ends[i]          = routes[i][1];
                tempLocations[i] = starts[i];
                deltaLats[i]     = (ends[i].Lat - starts[i].Lat) / totalCounts[i];
                deltaLngs[i]     = (ends[i].Lng - starts[i].Lng) / totalCounts[i];
            }
            bus = new BitmapImage(new Uri(Environment.CurrentDirectory + "/Bus.png"));
            if (bus.CanFreeze)
            {
                bus.Freeze();
            }
        }
Exemple #3
0
        private void SmobilerForm1_ToolbarItemClick(object sender, ToolbarClickEventArgs e)
        {
            switch (e.Name)
            {
            case "ShowPicked":
                List <GeoTag> tags1 = new List <GeoTag>();
                int           Rn    = 0;
                foreach (GridViewRow rowItem in gridView1.Rows)
                {
                    bool isR = (bool)rowItem.Cell.Items["checkBox1"].DefaultValue;
                    if (isR)
                    {
                        Rn += 1;
                    }
                }
                if (Rn > 0)
                {
                    foreach (GridViewRow rowItem in gridView1.Rows)
                    {
                        bool isR = (bool)rowItem.Cell.Items["checkBox1"].DefaultValue;
                        if (isR)
                        {
                            decimal latitude  = Convert.ToDecimal(rowItem.Cell.Items["imageLocation"].Value);
                            decimal longitude = Convert.ToDecimal(rowItem.Cell.Items["labelAddress"].Value);
                            string  address   = rowItem.Cell.Items["labelAddress"].DefaultValue.ToString();
                            tags1.Add(GeoTag.Create(longitude, latitude, address));
                        }
                    }
                    this.ShowMapTags(tags1.ToArray());
                    break;
                }
                else
                {
                    MessageBox.Show("请至少选择一个地点");
                    break;
                }

            case "MyLocation":
                this.gps2.GetGps((object sender1, GPSData GPSData) =>
                {
                    if (GPSData.ErrorInfo.Length <= 0 && !GPSData.Longitude.Equals(0) && !GPSData.Latitude.Equals(0))
                    {
                        this.ShowMap(GPSData.Latitude, GPSData.Longitude, GPSData.Location);
                    }
                });
                break;

            case "ShowRoute":
                if (listAddress.Count > 0)
                {
                    string          firstAddress = listAddress[0];
                    GeoPoint        start        = new GeoPoint(Convert.ToDecimal(firstAddress.Split('/')[0]), Convert.ToDecimal(firstAddress.Split('/')[1]));
                    GeoPoint        lastPoint    = start;
                    List <GeoRoute> routes       = new List <GeoRoute>();
                    foreach (string addressinfo in listAddress)
                    {
                        GeoRoute route = new GeoRoute();
                        route.Add(lastPoint);
                        decimal longitude = Convert.ToDecimal(addressinfo.Split('/')[0]);
                        decimal latitude  = Convert.ToDecimal(addressinfo.Split('/')[1]);
                        route.Add(longitude, latitude);
                        lastPoint = new GeoPoint(longitude, latitude);
                        routes.Add(route);
                    }
                    this.ShowMapRoute(start, lastPoint, routes.ToArray());
                }
                break;
            }
        }