Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs =================================================================== diff -u -r5199 -r5478 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs (.../Point2D.cs) (revision 5199) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs (.../Point2D.cs) (revision 5478) @@ -58,14 +58,9 @@ public double Z { get; set; } /// - /// Determines whether the location of the given point and this one are the same. + /// The name for a point (must be here for the IGeometryObject interface) /// - /// The other. - /// - public bool LocationEquals(Point2D other) - { - return LocationEquals(other, GeometryConstants.Accuracy); - } + public string Name { get; set; } /// /// Determines whether the difference between the location of the given point and @@ -74,7 +69,7 @@ /// The other. /// The precision. /// - public bool LocationEquals(Point2D other, double precision) + public bool LocationEquals(Point2D other, double precision = GeometryConstants.Accuracy) { if (ReferenceEquals(other, null)) { @@ -91,24 +86,6 @@ } /// - /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. - /// - /// An object to compare with this instance. - /// - /// A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes in the sort order. Zero This instance occurs in the same position in the sort order as . Greater than zero This instance follows in the sort order. - /// - public int CompareTo(object obj) - { - var point = obj as Point2D; - if (point != null) - { - return X.CompareTo(point.X); - } - - return String.Compare(ToString(), obj.ToString(), StringComparison.Ordinal); - } - - /// /// Initializes the point coordinates wi th the coordinates of the given point /// /// @@ -129,22 +106,17 @@ double res = Math.Round(value / accuracy); return res * accuracy; } - - /// - /// The name for a point (must be here for the IGeometryObject interface) - /// - public string Name { get; set; } - + public static Point2D operator -(Point2D aPoint2, Point2D aPoint1) { return new Point2D(aPoint2.X - aPoint1.X, aPoint2.Z - aPoint1.Z); } - + public static Point2D operator *(double aValue1, Point2D aPoint1) { return new Point2D(aValue1 * aPoint1.X, aValue1 * aPoint1.Z); } - + public static Point2D operator +(Point2D aPoint2, Point2D aPoint1) { return new Point2D(aPoint2.X + aPoint1.X, aPoint2.Z + aPoint1.Z); @@ -156,6 +128,29 @@ /// Returns a clone public Point2D Clone() { - return new Point2D { X = this.X, Z = this.Z, Name = this.Name}; + return new Point2D + { + X = X, + Z = Z, + Name = Name + }; } + + /// + /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. + /// + /// An object to compare with this instance. + /// + /// A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes in the sort order. Zero This instance occurs in the same position in the sort order as . Greater than zero This instance follows in the sort order. + /// + public int CompareTo(object obj) + { + var point = obj as Point2D; + if (point != null) + { + return X.CompareTo(point.X); + } + + return String.Compare(ToString(), obj.ToString(), StringComparison.Ordinal); + } } \ No newline at end of file