Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs
===================================================================
diff -u -r5460 -r5483
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs (.../GeometryCurve.cs) (revision 5460)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryCurve.cs (.../GeometryCurve.cs) (revision 5483)
@@ -29,11 +29,6 @@
public enum CurveDirection
{
///
- /// Unknown as direction
- ///
- Unknown = -1,
-
- ///
/// Forward as direction
///
Forward = 0,
@@ -75,21 +70,24 @@
{
get
{
- if (string.IsNullOrEmpty(base.Name))
+ if (!string.IsNullOrEmpty(base.Name))
{
- var text = "";
- if (HeadPoint != null)
- {
- text += HeadPoint.ToString()?.Trim();
- }
+ return base.Name;
+ }
- text += "-";
- if (EndPoint != null)
- {
- text += EndPoint.ToString()?.Trim();
- }
- base.Name = text;
+ var text = "";
+ if (HeadPoint != null)
+ {
+ text += HeadPoint.ToString()?.Trim();
}
+
+ text += "-";
+ if (EndPoint != null)
+ {
+ text += EndPoint.ToString()?.Trim();
+ }
+
+ base.Name = text;
return base.Name;
}
set => base.Name = value;
@@ -100,29 +98,17 @@
///
public virtual Point2D HeadPoint
{
- get
- {
- return headPoint;
- }
- set
- {
- headPoint = value;
- }
+ get => headPoint;
+ set => headPoint = value;
}
///
/// Gets or sets the end point of the curve.
///
public virtual Point2D EndPoint
{
- get
- {
- return endPoint;
- }
- set
- {
- endPoint = value;
- }
+ get => endPoint;
+ set => endPoint = value;
}
///
@@ -151,9 +137,7 @@
///
public void Reverse()
{
- Point2D point = HeadPoint;
- HeadPoint = EndPoint;
- EndPoint = point;
+ (HeadPoint, EndPoint) = (EndPoint, HeadPoint);
}
///
@@ -163,12 +147,7 @@
/// Returns the head point in the given direction
public Point2D GetHeadPoint(CurveDirection aDirection)
{
- if (aDirection == CurveDirection.Forward)
- {
- return headPoint;
- }
-
- return endPoint;
+ return aDirection == CurveDirection.Forward ? headPoint : endPoint;
}
///
@@ -178,12 +157,7 @@
/// Returns the end point in the given direction
public Point2D GetEndPoint(CurveDirection aDirection)
{
- if (aDirection == CurveDirection.Forward)
- {
- return endPoint;
- }
-
- return headPoint;
+ return aDirection == CurveDirection.Forward ? endPoint : headPoint;
}
///
@@ -199,50 +173,22 @@
}
///
- /// 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 null;
- }
-
- ///
- /// Returns a string that represents the current object.
- ///
- ///
- /// A string that represents the current object.
- ///
- /// 2
- public override string ToString()
- {
- return string.Empty;
- }
-
- ///
/// Assigns the surfaces from the curve.
///
///
public void AssignSurfacesFromCurve(GeometryCurve aCurve)
{
if (aCurve.SurfaceAtLeft != SurfaceAtLeft)
{
- SurfaceAtLeft = aCurve.SurfaceAtLeft;
+ SurfaceAtLeft = aCurve.SurfaceAtLeft;
}
if (aCurve.SurfaceAtRight != SurfaceAtRight)
{
SurfaceAtRight = aCurve.SurfaceAtRight;
}
}
-
+
///
/// Clones the curve.
///
@@ -259,10 +205,40 @@
{
curve.SurfaceAtLeft = SurfaceAtLeft;
}
+
if (SurfaceAtRight != null)
{
curve.SurfaceAtRight = SurfaceAtRight;
}
+
return curve;
}
+
+ ///
+ /// 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 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