예제 #1
0
 static OsmSharp.OsmGeo EventsFilter_AddWayId(OsmSharp.OsmGeo osmGeo, object param)
 {
     if (osmGeo.Type == OsmSharp.OsmGeoType.Way)
     {
         osmGeo.Tags.Add("way_id", osmGeo.Id.ToString());
     }
     return(osmGeo);
 }
예제 #2
0
 /// <summary>
 /// Resetting this data source
 /// </summary>
 public override void Reset()
 {
     _current = null;
     if (_cachedPrimitives != null)
     {
         _cachedPrimitives.Clear();
     }
     _stream.Seek(_initialPosition, SeekOrigin.Begin);
 }
예제 #3
0
        /// <summary>
        /// Resetting this data source
        /// </summary>
        public override void Reset()
        {
            if (_initialPosition == null)
            {
                throw new NotSupportedException(
                          $"Cannot reset this stream, source stream is not seekable, check {nameof(this.CanReset)} before calling {nameof(this.Reset)}");
            }

            _current = null;
            _cachedPrimitives?.Clear();
            _stream.Seek(_initialPosition.Value, SeekOrigin.Begin);
        }
예제 #4
0
 public static string GetName(this OsmSharp.OsmGeo element)
 {
     if (element.Tags.ContainsKey("name"))
     {
         return(element.Tags["name"]);
     }
     else if (element.Tags.ContainsKey("name:he"))
     {
         return(element.Tags["name:he"]);
     }
     else if (element.Tags.ContainsKey("name:en"))
     {
         return(element.Tags["name:en"]);
     }
     else if (element.Tags.ContainsKey("int_name"))
     {
         return(element.Tags["int_name"]);
     }
     else
     {
         throw new ArgumentException(string.Format("The element at ({0}) has no valid name.", element.GetCoordinate()));
     }
 }
예제 #5
0
 public static GeoCoordinate GetCoordinate(this OsmSharp.OsmGeo element)
 {
     return(new GeoCoordinate((double)((OsmSharp.Node)element).Latitude, (double)((OsmSharp.Node)element).Longitude));
 }