コード例 #1
0
        /// <summary>
        /// Returns true if the other edge represents the same geographical information than this edge.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool EqualsGeometrically(IDynamicGraphEdgeData other)
        {
            if (other is CHEdgeData)
            { // ok, type is the same.
                var otherCH = (CHEdgeData)other;

                // only the coordinates can be different now.
                if (this.Coordinates != null)
                {     // both have to contain the same coordinates.
                    if (this.Coordinates.Length != otherCH.Coordinates.Length)
                    { // impossible, different number of coordinates.
                        return(false);
                    }

                    for (int idx = 0; idx < otherCH.Coordinates.Length; idx++)
                    {
                        if (this.Coordinates[idx].Longitude != otherCH.Coordinates[idx].Longitude ||
                            this.Coordinates[idx].Latitude != otherCH.Coordinates[idx].Latitude)
                        { // oeps, coordinates are different!
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                { // both are null.
                    return(otherCH.Coordinates == null);
                }
            }
            return(false);
        }
コード例 #2
0
            /// <summary>
            /// Returns true if the other edge represents the same geographical information than this edge.
            /// </summary>
            /// <param name="other"></param>
            /// <returns></returns>
            public bool EqualsGeometrically(IDynamicGraphEdgeData other)
            {
                var otherResolved = (other as RouterResolvedGraphEdge);
                if (otherResolved != null)
                { // the same type already!
                    // only the coordinates can be different now.
                    if (this.Coordinates != null)
                    { // both have to contain the same coordinates.
                        if (this.Coordinates.Length != otherResolved.Coordinates.Length)
                        { // impossible, different number of coordinates.
                            return false;
                        }

                        for (int idx = 0; idx < otherResolved.Coordinates.Length; idx++)
                        {
                            if (this.Coordinates[idx].Longitude != otherResolved.Coordinates[idx].Longitude ||
                                this.Coordinates[idx].Latitude != otherResolved.Coordinates[idx].Latitude)
                            { // oeps, coordinates are different!
                                return false;
                            }
                        }
                        return true;
                    }
                    else
                    { // both are null.
                        return otherResolved.Coordinates == null;
                    }
                }
                return false;
            }
コード例 #3
0
 /// <summary>
 /// Returns true if the other edge represents the same information than this edge.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(IDynamicGraphEdgeData other)
 {
     if (other is LiveEdge)
     { // ok, type is the same.
         var otherLive = (LiveEdge)other;
         if (otherLive._value != this._value)
         { // basic info different.
             return(false);
         }
     }
     return(false);
 }
コード例 #4
0
        /// <summary>
        /// Returns true if the other edge represents the same information than this edge.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(IDynamicGraphEdgeData other)
        {
            if (other is CHEdgeData)
            { // ok, type is the same.
                var otherCH = (CHEdgeData)other;
                if (otherCH.Direction != this.Direction &&
                    otherCH.ContractedVertexId != this.ContractedVertexId &&
                    otherCH.Weight != this.Weight &&
                    otherCH.Tags != this.Tags)
                { // basic info different.
                    return(false);
                }

                // only the coordinates can be different now.
                if (this.Coordinates != null)
                {     // both have to contain the same coordinates.
                    if (this.Coordinates.Length != otherCH.Coordinates.Length)
                    { // impossible, different number of coordinates.
                        return(false);
                    }

                    for (int idx = 0; idx < otherCH.Coordinates.Length; idx++)
                    {
                        if (this.Coordinates[idx].Longitude != otherCH.Coordinates[idx].Longitude ||
                            this.Coordinates[idx].Latitude != otherCH.Coordinates[idx].Latitude)
                        { // oeps, coordinates are different!
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                { // both are null.
                    return(otherCH.Coordinates == null);
                }
            }
            return(false);
        }