Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs (.../GeometryCurve.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs (.../GeometryCurve.cs) (revision 4052) @@ -19,214 +19,213 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -namespace Deltares.DamEngine.Data.Geometry +namespace Deltares.DamEngine.Data.Geometry; + +/// +/// Represents the possible directions of the curve +/// +public enum CurveDirection { /// - /// Represents the possible directions of the curve + /// Unknown as direction /// - public enum CurveDirection - { - /// - /// Unknown as direction - /// - Unknown = -1, + Unknown = -1, - /// - /// Forward as direction - /// - Forward = 0, + /// + /// Forward as direction + /// + Forward = 0, - /// - /// Reverse as direction - /// - Reverse = 1 - } + /// + /// Reverse as direction + /// + Reverse = 1 +} +/// +/// Contains the collection of all the curves data. +/// +public class GeometryCurve : GeometryObject +{ + private Point2D endPoint; + private Point2D headPoint; + /// - /// Contains the collection of all the curves data. + /// Initializes a new instance of the class. /// - public class GeometryCurve : GeometryObject + public GeometryCurve() {} + + /// + /// Initializes a new instance of the class. + /// + /// The head point. + /// The end point. + public GeometryCurve(Point2D headPoint, Point2D endPoint) { - private Point2D endPoint; - private Point2D headPoint; + this.headPoint = headPoint; + this.endPoint = endPoint; + } - /// - /// Initializes a new instance of the class. - /// - public GeometryCurve() {} - - /// - /// Initializes a new instance of the class. - /// - /// The head point. - /// The end point. - public GeometryCurve(Point2D headPoint, Point2D endPoint) + /// + /// The unique name of the object. + /// + public override string Name + { + get { - this.headPoint = headPoint; - this.endPoint = endPoint; - } - - /// - /// The unique name of the object. - /// - public override string Name - { - get + if (!string.IsNullOrEmpty(base.Name)) { - if (!string.IsNullOrEmpty(base.Name)) - { - return base.Name; - } - - var text = ""; - if (HeadPoint != null) - { - text += HeadPoint.ToString().Trim(); - } - - text += "-"; - if (EndPoint != null) - { - text += EndPoint.ToString().Trim(); - } - - return text; + return base.Name; } - set + + var text = ""; + if (HeadPoint != null) { - base.Name = value; + text += HeadPoint.ToString().Trim(); } - } - /// - /// Gets or sets the head point of the curve. - /// - public virtual Point2D HeadPoint - { - get + text += "-"; + if (EndPoint != null) { - return headPoint; + text += EndPoint.ToString().Trim(); } - set - { - headPoint = value; - } - } - /// - /// Gets or sets the end point of the curve. - /// - public virtual Point2D EndPoint + return text; + } + set { - get - { - return endPoint; - } - set - { - endPoint = value; - } + base.Name = value; } + } - /// - /// Gets or sets the surface at the Left. - /// - public virtual GeometrySurface SurfaceAtLeft { get; set; } - - /// - /// Gets or sets the surface at the Right. - /// - public virtual GeometrySurface SurfaceAtRight { get; set; } - - /// - /// Locations the equals. - /// - /// a curve. - /// - public bool LocationEquals(GeometryCurve aCurve) + /// + /// Gets or sets the head point of the curve. + /// + public virtual Point2D HeadPoint + { + get { - return (headPoint.LocationEquals(aCurve.HeadPoint) && endPoint.LocationEquals(aCurve.EndPoint)) || - (headPoint.LocationEquals(aCurve.EndPoint) && endPoint.LocationEquals(aCurve.HeadPoint)); + return headPoint; } - - /// - /// Swaps and . - /// - public void Reverse() + set { - Point2D point = HeadPoint; - HeadPoint = EndPoint; - EndPoint = point; + headPoint = value; } + } - /// - /// Returns the head point in given direction - /// - /// Direction is either Forward or Reverse or Unknown - /// Returns the head point in the given direction - public Point2D GetHeadPoint(CurveDirection aDirection) + /// + /// Gets or sets the end point of the curve. + /// + public virtual Point2D EndPoint + { + get { - if (aDirection == CurveDirection.Forward) - { - return headPoint; - } - return endPoint; } - - /// - /// Gets the end point in the given direction - /// - /// Direction is either Forward or Reverse or Unknown - /// Returns the end point in the given direction - public Point2D GetEndPoint(CurveDirection aDirection) + set { - if (aDirection == CurveDirection.Forward) - { - return endPoint; - } + endPoint = value; + } + } + /// + /// Gets or sets the surface at the Left. + /// + public virtual GeometrySurface SurfaceAtLeft { get; set; } + + /// + /// Gets or sets the surface at the Right. + /// + public virtual GeometrySurface SurfaceAtRight { get; set; } + + /// + /// Locations the equals. + /// + /// a curve. + /// + public bool LocationEquals(GeometryCurve aCurve) + { + return (headPoint.LocationEquals(aCurve.HeadPoint) && endPoint.LocationEquals(aCurve.EndPoint)) || + (headPoint.LocationEquals(aCurve.EndPoint) && endPoint.LocationEquals(aCurve.HeadPoint)); + } + + /// + /// Swaps and . + /// + public void Reverse() + { + Point2D point = HeadPoint; + HeadPoint = EndPoint; + EndPoint = point; + } + + /// + /// Returns the head point in given direction + /// + /// Direction is either Forward or Reverse or Unknown + /// Returns the head point in the given direction + public Point2D GetHeadPoint(CurveDirection aDirection) + { + if (aDirection == CurveDirection.Forward) + { return headPoint; } - /// - /// Determines whether the curve contains the specified point within the given tolerance. - /// - /// The point. - /// The tolerance. - /// - public bool ContainsPoint(Point2D point, double tolerance = GeometryConstants.Accuracy * 0.5) + return endPoint; + } + + /// + /// Gets the end point in the given direction + /// + /// Direction is either Forward or Reverse or Unknown + /// Returns the end point in the given direction + public Point2D GetEndPoint(CurveDirection aDirection) + { + if (aDirection == CurveDirection.Forward) { - return HeadPoint != null && EndPoint != null && - Routines2D.DoesPointExistInLine(HeadPoint, EndPoint, point, tolerance); + return endPoint; } - /// - /// Gets the geometry bounds. - /// - /// - public override GeometryBounds GetGeometryBounds() - { - if (HeadPoint != null && EndPoint != null) - { - var head = new GeometryBounds(HeadPoint.X, HeadPoint.X, HeadPoint.Z, HeadPoint.Z); - var end = new GeometryBounds(EndPoint.X, EndPoint.X, EndPoint.Z, EndPoint.Z); - return head + end; - } + return headPoint; + } - return null; - } + /// + /// Determines whether the curve contains the specified point within the given tolerance. + /// + /// The point. + /// The tolerance. + /// + public bool ContainsPoint(Point2D point, double tolerance = GeometryConstants.Accuracy * 0.5) + { + return HeadPoint != null && EndPoint != null && + Routines2D.DoesPointExistInLine(HeadPoint, EndPoint, point, tolerance); + } - /// - /// Returns a string that represents the current object. - /// - /// - /// A string that represents the current object. - /// - /// 2 - public override string ToString() + /// + /// Gets the geometry bounds. + /// + /// + public override GeometryBounds GetGeometryBounds() + { + if (HeadPoint != null && EndPoint != null) { - return string.Empty; + var head = new GeometryBounds(HeadPoint.X, HeadPoint.X, HeadPoint.Z, HeadPoint.Z); + var end = new GeometryBounds(EndPoint.X, EndPoint.X, EndPoint.Z, EndPoint.Z); + return head + end; } + + return null; } + + /// + /// Returns a string that represents the current object. + /// + /// + /// A string that represents the current object. + /// + /// 2 + public override string ToString() + { + return string.Empty; + } } \ No newline at end of file