Exemplo n.º 1
0
        public static GeoRoute BingMapToGeoRoute(this MapRoute route)
        {
            GeoRoute georoute = new GeoRoute();

            foreach (PointInt pos in route)
            {
                georoute.Add(BingMapTileSystem.PixelXYToLatLong(pos, route.Level));
            }
            return(georoute);
        }
Exemplo n.º 2
0
        public static GeoRoute SingleMapToGeoRoute(this MapRoute route)
        {
            GeoRoute georoute = new GeoRoute();

            foreach (PointInt pos in route)
            {
                georoute.Add(SingleMapTransformSystem.PixelXYToModelXY(pos));
            }
            return(georoute);
        }
Exemplo n.º 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;
            }
        }