private static MacroStabilityInwardsCharacteristicPointEntity CreateCharacteristicPointEntity(Point3D point, MacroStabilityInwardsCharacteristicPointType type) { var entity = new MacroStabilityInwardsCharacteristicPointEntity { Type = Convert.ToByte(type), X = point.X.ToNaNAsNull(), Y = point.Y.ToNaNAsNull(), Z = point.Z.ToNaNAsNull() }; return(entity); }
private static void CreateCharacteristicPointEntities(MacroStabilityInwardsSurfaceLine surfaceLine, SurfaceLineEntity entity) { Tuple <Point3D, MacroStabilityInwardsCharacteristicPointType>[] characteristicPointAssociations = { Tuple.Create(surfaceLine.SurfaceLevelOutside, MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside), Tuple.Create(surfaceLine.DikeTopAtPolder, MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder), Tuple.Create(surfaceLine.DikeTopAtRiver, MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver), Tuple.Create(surfaceLine.ShoulderBaseInside, MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside), Tuple.Create(surfaceLine.ShoulderTopInside, MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside), Tuple.Create(surfaceLine.BottomDitchDikeSide, MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide), Tuple.Create(surfaceLine.BottomDitchPolderSide, MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide), Tuple.Create(surfaceLine.DikeToeAtPolder, MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder), Tuple.Create(surfaceLine.DikeToeAtRiver, MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver), Tuple.Create(surfaceLine.DitchDikeSide, MacroStabilityInwardsCharacteristicPointType.DitchDikeSide), Tuple.Create(surfaceLine.DitchPolderSide, MacroStabilityInwardsCharacteristicPointType.DitchPolderSide), Tuple.Create(surfaceLine.SurfaceLevelInside, MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside) }; foreach (Tuple <Point3D, MacroStabilityInwardsCharacteristicPointType> characteristicPointToSave in characteristicPointAssociations.Where(t => t.Item1 != null)) { MacroStabilityInwardsCharacteristicPointEntity characteristicPointEntity = CreateCharacteristicPointEntity(characteristicPointToSave.Item1, characteristicPointToSave.Item2); entity.MacroStabilityInwardsCharacteristicPointEntities.Add(characteristicPointEntity); } }