コード例 #1
0
        /// <summary>
        /// Clones this object.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            RoutePoint clone = new RoutePoint();

            clone.Distance  = this.Distance;
            clone.Latitude  = this.Latitude;
            clone.Longitude = this.Longitude;
            if (this.Metrics != null)
            {
                clone.Metrics = new RouteMetric[this.Metrics.Length];
                for (int idx = 0; idx < this.Metrics.Length; idx++)
                {
                    clone.Metrics[idx] = this.Metrics[idx].Clone() as RouteMetric;
                }
            }
            clone.Name = this.Name;
            if (this.Tags != null)
            {
                clone.Tags = new RouteTags[this.Tags.Length];
                for (int idx = 0; idx < this.Tags.Length; idx++)
                {
                    clone.Tags[idx] = this.Tags[idx].Clone() as RouteTags;
                }
            }
            clone.Time = this.Time;
            return(clone);
        }
コード例 #2
0
        /// <summary>
        /// Returns true if the given point has the same name tags and positiong.
        /// </summary>
        /// <param name="routePoint"></param>
        /// <returns></returns>
        internal bool RepresentsSame(RoutePoint routePoint)
        {
            if (routePoint == null)
            {
                return(false);
            }

            if (this.Longitude == routePoint.Longitude &&
                this.Latitude == routePoint.Latitude &&
                this.Name == routePoint.Name)
            {
                if (routePoint.Tags != null || routePoint.Tags.Length == 0)
                {         // there are tags in the other point.
                    if (this.Tags != null || this.Tags.Length == 0)
                    {     // there are also tags in this point.
                        if (this.Tags.Length == routePoint.Tags.Length)
                        { // and they have the same number of tags!
                            for (int idx = 0; idx < this.Tags.Length; idx++)
                            {
                                if (this.Tags[idx].Key != routePoint.Tags[idx].Key ||
                                    this.Tags[idx].Value != routePoint.Tags[idx].Value)
                                { // tags don't equal.
                                    return(false);
                                }
                            }
                            return(true);
                        }
                        return(false);
                    }
                }
                return(this.Tags != null || this.Tags.Length == 0);
            }
            return(false);
        }
コード例 #3
0
ファイル: OsmSharpRoute.cs プロジェクト: jorik041/osmsharp
 /// <summary>
 /// Clones this object.
 /// </summary>
 /// <returns></returns>
 public object Clone()
 {
     RoutePoint clone = new RoutePoint();
     clone.Distance = this.Distance;
     clone.Latitude = this.Latitude;
     clone.Longitude = this.Longitude;
     if (this.Metrics != null)
     {
         clone.Metrics = new RouteMetric[this.Metrics.Length];
         for (int idx = 0; idx < this.Metrics.Length; idx++)
         {
             clone.Metrics[idx] = this.Metrics[idx].Clone() as RouteMetric;
         }
     }
     clone.Name = this.Name;
     if (this.Tags != null)
     {
         clone.Tags = new RouteTags[this.Tags.Length];
         for (int idx = 0; idx < this.Tags.Length; idx++)
         {
             clone.Tags[idx] = this.Tags[idx].Clone() as RouteTags;
         }
     }
     clone.Time = this.Time;
     return clone;
 }