コード例 #1
0
ファイル: GeoURI.cs プロジェクト: usagi/usagi.cs
 /// <summary>
 /// 経度、緯度、高度が許容範囲内で近似的に等価かつ測地系と不確実性パラメーターが完全に一致するか判定
 /// </summary>
 /// <param name="other">比較対象</param>
 /// <param name="angle_tolelance">平面角の許容範囲</param>
 /// <param name="length_tolerance">長さの許容範囲</param>
 /// <returns>一致する場合は true</returns>
 public bool NearlyEquals(GeoURI other, PlaneAngle angle_tolelance = null, Length length_tolerance = null)
 {
     if (!Longitude.NormalizedNearlyEquals(other.Longitude, angle_tolelance))
     {
         return(false);
     }
     if (!Latitude.NormalizedNearlyEquals(other.Latitude, angle_tolelance))
     {
         return(false);
     }
     if (Altitude is Length && !Altitude.NearlyEquals(other.Altitude, length_tolerance))
     {
         return(false);
     }
     if (CoordinateReferenceSystem is string && !CoordinateReferenceSystem.Equals(other.CoordinateReferenceSystem))
     {
         return(false);
     }
     if (Uncertainty is string && !Uncertainty.Equals(other.Uncertainty))
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
ファイル: GeoURI.cs プロジェクト: usagi/usagi.cs
 /// <summary>
 /// 経度、緯度、標高、座標系、不確実性パラメーターが完全に一致するか比較する
 /// </summary>
 /// <param name="other">比較対象</param>
 /// <returns>一致する場合は true</returns>
 /// <remarks>
 /// 平面角の内部実装は浮動小数点数型なのでよほど意図しない限り完全一致はまずしない。
 /// <para/>必要に応じて <see cref="NearlyEquals(GeoURI, PlaneAngle, Length)"/> を使うとよい。
 /// </remarks>
 public bool Equals(GeoURI other)
 {
     if (!Longitude.Equals(other.Longitude))
     {
         return(false);
     }
     if (!Latitude.Equals(other.Latitude))
     {
         return(false);
     }
     if (Altitude is Length && !Altitude.Equals(other.Altitude))
     {
         return(false);
     }
     if (CoordinateReferenceSystem is string && !CoordinateReferenceSystem.Equals(other.CoordinateReferenceSystem))
     {
         return(false);
     }
     if (Uncertainty is string && !Uncertainty.Equals(other.Uncertainty))
     {
         return(false);
     }
     return(true);
 }