Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs
===================================================================
diff -u -r583456a0f5395189a54a8cedf4e4a7b40945d990 -r0c3836acca0399823bbd7f8c9e242a5de7692aa2
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 583456a0f5395189a54a8cedf4e4a7b40945d990)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 0c3836acca0399823bbd7f8c9e242a5de7692aa2)
@@ -353,14 +353,14 @@
}
///
- /// Updates the with the properties of
- /// .
+ /// Copies the property values of the to
+ /// the .
///
/// The
/// to get the property values from.
/// Thrown when
/// is null.
- public void Update(RingtoetsPipingSurfaceLine fromSurfaceLine)
+ public void CopyProperties(RingtoetsPipingSurfaceLine fromSurfaceLine)
{
if (fromSurfaceLine == null)
{
@@ -369,6 +369,8 @@
Name = fromSurfaceLine.Name;
SetGeometry(fromSurfaceLine.Points);
+ ClearCharacteristicPoints();
+ SetCharacteristicPoints(fromSurfaceLine);
}
public override bool Equals(object obj)
@@ -397,16 +399,78 @@
{
hashCode = (hashCode * 397) ^ point.GetHashCode();
}
+
+ hashCode = (hashCode * 397) ^ (DikeToeAtPolder?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (DikeToeAtRiver?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (DitchDikeSide?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (DitchPolderSide?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (BottomDitchDikeSide?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (BottomDitchPolderSide?.GetHashCode() ?? 0);
+
return hashCode;
}
}
+ public override string ToString()
+ {
+ return Name;
+ }
+
+ private void SetCharacteristicPoints(RingtoetsPipingSurfaceLine fromSurfaceLine)
+ {
+ if (fromSurfaceLine.BottomDitchDikeSide != null)
+ {
+ SetBottomDitchDikeSideAt(fromSurfaceLine.BottomDitchDikeSide);
+ }
+ if (fromSurfaceLine.BottomDitchPolderSide != null)
+ {
+ SetBottomDitchPolderSideAt(fromSurfaceLine.BottomDitchPolderSide);
+ }
+ if (fromSurfaceLine.DikeToeAtPolder != null)
+ {
+ SetDikeToeAtPolderAt(fromSurfaceLine.DikeToeAtPolder);
+ }
+ if (fromSurfaceLine.DikeToeAtRiver != null)
+ {
+ SetDikeToeAtRiverAt(fromSurfaceLine.DikeToeAtRiver);
+ }
+ if (fromSurfaceLine.DitchDikeSide != null)
+ {
+ SetDitchDikeSideAt(fromSurfaceLine.DitchDikeSide);
+ }
+ if (fromSurfaceLine.DitchPolderSide != null)
+ {
+ SetDitchPolderSideAt(fromSurfaceLine.DitchPolderSide);
+ }
+ }
+
+ private void ClearCharacteristicPoints()
+ {
+ BottomDitchDikeSide = null;
+ BottomDitchPolderSide = null;
+ DikeToeAtPolder = null;
+ DikeToeAtRiver = null;
+ DitchDikeSide = null;
+ DitchPolderSide = null;
+ }
+
private bool Equals(RingtoetsPipingSurfaceLine other)
{
return string.Equals(Name, other.Name)
- && EqualPoints(other.Points);
+ && EqualPoints(other.Points)
+ && EqualCharacteristicPoints(other);
}
+ private bool EqualCharacteristicPoints(RingtoetsPipingSurfaceLine other)
+ {
+ return Equals(DikeToeAtPolder, other.DikeToeAtPolder)
+ && Equals(DikeToeAtRiver, other.DikeToeAtRiver)
+ && Equals(DitchDikeSide, other.DitchDikeSide)
+ && Equals(DitchPolderSide, other.DitchPolderSide)
+ && Equals(BottomDitchDikeSide, other.BottomDitchDikeSide)
+ && Equals(BottomDitchPolderSide, other.BottomDitchPolderSide);
+ }
+
private bool EqualPoints(Point3D[] otherPoints)
{
int nrOfOtherPoints = otherPoints.Length;
@@ -425,11 +489,6 @@
return true;
}
- public override string ToString()
- {
- return Name;
- }
-
///
/// Finds a point from which is at the same position as .
///