private void FindCheckpoints(Placemark p, List<CheckpointLocation> locations)
        {
            Point point = p.Flatten().OfType<Point>().FirstOrDefault();
              if (point == null)
            return;

              CheckpointLocation location = new CheckpointLocation
              {
            Name = p.Name,
            Location = point.Coordinate
              };
              locations.Add(location);
        }
Esempio n. 2
0
        private bool parsePoint(Placemark placemark, DBStation_Bus dbStationBus, DBStation dbStation, BUS bus, ROUTE route, bool hasStation)
        {
            foreach (var lineString in placemark.Flatten().OfType<SharpKml.Dom.Point>())
            {
                IList<STATION> stationsNear = dbStation.SelectStationsNear(50,
                    Methods.ConvertLatLonToDbGeography(lineString.Coordinate.Longitude, lineString.Coordinate.Latitude));

                foreach (var station in stationsNear)
                {
                    STATION_BUSES stationBus = new STATION_BUSES();

                    stationBus.STATION = station;
                    stationBus.BUS = bus;

                    dbStationBus.AddStation_Buses_Route(route, stationBus);
                    hasStation = true;
                }
            }
            return hasStation;
        }
Esempio n. 3
0
        private void parseLineString(Placemark placemark, StringBuilder sb)
        {
            if (chbBus.Checked)
            {

                StringBuilder textString = new StringBuilder();

                bool flag = false;

                textString.Append("Route_Coordinates: ");

                foreach (var lineString in placemark.Flatten().OfType<SharpKml.Dom.LineString>())
                {
                    flag = true;

                    sb.Append(string.Join(" ", lineString.Coordinates.Select(x => x.Latitude.ToString() + " " + x.Longitude.ToString() + ",")));

                    textString.Append(string.Join(" ", lineString.Coordinates.Select(x => x.Latitude.ToString() + "," + x.Longitude.ToString() + "; ")));
                }

                if (flag)
                {
                    using (StreamWriter writetext = new StreamWriter("write.txt"))
                    {
                        writetext.Write(textString.ToString());
                    }
                }
            }
        }