using System.Collections.Generic;
using Deltares.DamEngine.Io.XmlInput;
using Deltares.Geotechnics.SurfaceLines;
namespace Deltares.Dam.Data.DamEngineIo
{
public static class ConversionHelper
{
///
/// Converts the type DamProjectType from input object type to Dam Engine type.
///
/// Type of the input object.
/// Dam Engine type
public static DamProjectType ConvertToDamProjectType(InputDamProjectType inputDamProjectType)
{
var translationTable = new Dictionary()
{
{InputDamProjectType.Assessment, DamProjectType.Assessment},
{InputDamProjectType.AssessmentRegional, DamProjectType.Assessment}, // must be handled in additional code after conversion
{InputDamProjectType.Design, DamProjectType.Design},
{InputDamProjectType.Operational, DamProjectType.Calamity}
// InputDamProjectType.NWO not implemented yet
};
return translationTable[inputDamProjectType];
}
///
/// Converts the type DamProjectType from Dam Engine type to input object type.
///
/// Type of the dam project.
/// Type of the input object.
public static InputDamProjectType ConvertToInputDamProjectType(DamProjectType damProjectType)
{
var translationTable = new Dictionary()
{
{DamProjectType.Assessment, InputDamProjectType.Assessment},
{DamProjectType.Design, InputDamProjectType.Design},
{DamProjectType.Calamity, InputDamProjectType.Operational},
};
return translationTable[damProjectType];
}
///
/// Converts the type PLLineCreationMethod from Dam Engine type to input object type.
///
/// Type of the dam project.
///
/// Type of the input object.
///
public static LocationWaternetOptionsPhreaticLineCreationMethod ConvertToInputPhreaticLineCreationMethod(PLLineCreationMethod plLineCreationMethod)
{
var translationTable = new Dictionary()
{
{PLLineCreationMethod.ExpertKnowledgeLinearInDike, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike},
{PLLineCreationMethod.ExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD},
{PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD},
{PLLineCreationMethod.Sensors, LocationWaternetOptionsPhreaticLineCreationMethod.Sensors},
{PLLineCreationMethod.None, LocationWaternetOptionsPhreaticLineCreationMethod.None}
};
return translationTable[plLineCreationMethod];
}
///
/// Converts the type PLLineCreationMethod from input object type to Dam Engine type.
///
/// Type of the input object.
///
/// Type of the dam object.
///
public static PLLineCreationMethod ConvertToPhreaticLineCreationMethod(LocationWaternetOptionsPhreaticLineCreationMethod inputPhreaticLineCreationMethod)
{
var translationTable = new Dictionary()
{
{LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike,PLLineCreationMethod.ExpertKnowledgeLinearInDike},
{LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD, PLLineCreationMethod.ExpertKnowledgeRRD},
{LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD},
{LocationWaternetOptionsPhreaticLineCreationMethod.Sensors, PLLineCreationMethod.Sensors},
{LocationWaternetOptionsPhreaticLineCreationMethod.None, PLLineCreationMethod.None}
};
return translationTable[inputPhreaticLineCreationMethod];
}
///
/// Converts the type IntrusionVerticalWaterPressureType from Dam Engine type to input object type.
///
/// Type of the dam project.
///
/// Type of the input object.
///
public static LocationWaternetOptionsIntrusionVerticalWaterPressure ConvertToInputIntrusionVerticalWaterPressure(IntrusionVerticalWaterPressureType intrusionVerticalWaterPressureType)
{
var translationTable = new Dictionary()
{
{IntrusionVerticalWaterPressureType.FullHydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic},
{IntrusionVerticalWaterPressureType.HydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic},
{IntrusionVerticalWaterPressureType.Linear, LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear},
{IntrusionVerticalWaterPressureType.SemiTimeDependent, LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent},
{IntrusionVerticalWaterPressureType.Standard, LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard}
};
return translationTable[intrusionVerticalWaterPressureType];
}
///
/// Converts the type IntrusionVerticalWaterPressureType from input object type to Dam Engine type.
///
/// Type of the input object.
///
/// Type of the dam object.
///
public static IntrusionVerticalWaterPressureType ConvertToIntrusionVerticalWaterPressure(LocationWaternetOptionsIntrusionVerticalWaterPressure inputIntrusionVerticalWaterPressure)
{
var translationTable = new Dictionary()
{
{LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic, IntrusionVerticalWaterPressureType.FullHydroStatic},
{LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic, IntrusionVerticalWaterPressureType.HydroStatic},
{LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear, IntrusionVerticalWaterPressureType.Linear},
{LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent, IntrusionVerticalWaterPressureType.SemiTimeDependent},
{LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard, IntrusionVerticalWaterPressureType.Standard}
};
return translationTable[inputIntrusionVerticalWaterPressure];
}
public const int CpNone = 0;//
public const int CpSurfaceLevelOutside = 1; // Maaiveld buitenwaarts
public const int CpDikeToeAtRiver = 5; // Teen dijk buitenwaarts
public const int CpShoulderTopOutside = 6; // Kruin buitenberm
public const int CpShoulderBaseOutside = 7; // Insteek buitenberm
public const int CpDikeTopAtRiver = 8; // Kruin buitentalud
public const int CpDikeLine = 9; // referentielijn
public const int CpTrafficLoadOutside = 10; // Verkeersbelasting kant buitenwaarts
public const int CpTrafficLoadInside = 11; // Verkeersbelasting kant binnenwaarts
public const int CpDikeTopAtPolder = 12; // Kruin binnentalud
public const int CpShoulderBaseInside = 13; // Insteek binnenberm
public const int CpShoulderTopInside = 14; // Kruin binnenberm
public const int CpDikeToeAtPolder = 15; // Teen dijk binnenwaarts
public const int CpDitchDikeSide = 16; // Insteek sloot dijkzijde
public const int CpBottomDitchDikeSide = 17; // Slootbodem dijkzijde
public const int CpBottomDitchPolderSide = 18; // Slootbodem polderzijde
public const int CpDitchPolderSide = 19; // Insteek sloot polderzijde
public const int CpSurfaceLevelInside = 25; // Maaiveld binnenwaarts
public static CharacteristicPointType ConvertToDamPointType(int inputPointType)
{
var translationTable = new Dictionary()
{
{CpNone, CharacteristicPointType.None},
{CpSurfaceLevelOutside, CharacteristicPointType.SurfaceLevelOutside},
{CpDikeToeAtRiver, CharacteristicPointType.DikeToeAtRiver},
{CpShoulderTopOutside, CharacteristicPointType.ShoulderTopOutside},
{CpShoulderBaseOutside, CharacteristicPointType.ShoulderBaseOutside},
{CpDikeTopAtRiver, CharacteristicPointType.DikeTopAtRiver},
{CpDikeLine, CharacteristicPointType.DikeLine},
{CpTrafficLoadOutside, CharacteristicPointType.TrafficLoadOutside},
{CpTrafficLoadInside, CharacteristicPointType.TrafficLoadInside},
{CpDikeTopAtPolder, CharacteristicPointType.DikeTopAtPolder},
{CpShoulderBaseInside, CharacteristicPointType.ShoulderBaseInside},
{CpShoulderTopInside, CharacteristicPointType.ShoulderTopInside},
{CpDikeToeAtPolder, CharacteristicPointType.DikeToeAtPolder},
{CpDitchDikeSide, CharacteristicPointType.DitchDikeSide},
{CpBottomDitchDikeSide, CharacteristicPointType.BottomDitchDikeSide},
{CpBottomDitchPolderSide, CharacteristicPointType.BottomDitchPolderSide},
{CpDitchPolderSide, CharacteristicPointType.DitchPolderSide},
{CpSurfaceLevelInside, CharacteristicPointType.SurfaceLevelInside}
};
return translationTable[inputPointType];
}
public static int ConvertToInputPointType(CharacteristicPointType characteristicPointType)
{
var translationTable = new Dictionary()
{
{CharacteristicPointType.None, CpNone},
{CharacteristicPointType.SurfaceLevelOutside, CpSurfaceLevelOutside},
{CharacteristicPointType.DikeToeAtRiver, CpDikeToeAtRiver},
{CharacteristicPointType.ShoulderTopOutside, CpShoulderTopOutside},
{CharacteristicPointType.ShoulderBaseOutside, CpShoulderBaseOutside},
{CharacteristicPointType.DikeTopAtRiver, CpDikeTopAtRiver},
{CharacteristicPointType.DikeLine, CpDikeLine},
{CharacteristicPointType.TrafficLoadOutside, CpTrafficLoadOutside},
{CharacteristicPointType.TrafficLoadInside, CpTrafficLoadInside},
{CharacteristicPointType.DikeTopAtPolder, CpDikeTopAtPolder},
{CharacteristicPointType.ShoulderBaseInside, CpShoulderBaseInside},
{CharacteristicPointType.ShoulderTopInside, CpShoulderTopInside},
{CharacteristicPointType.DikeToeAtPolder, CpDikeToeAtPolder},
{CharacteristicPointType.DitchDikeSide, CpDitchDikeSide},
{CharacteristicPointType.BottomDitchDikeSide, CpBottomDitchDikeSide},
{CharacteristicPointType.BottomDitchPolderSide, CpBottomDitchPolderSide},
{CharacteristicPointType.DitchPolderSide, CpDitchPolderSide},
{CharacteristicPointType.SurfaceLevelInside, CpSurfaceLevelInside}
};
return translationTable[characteristicPointType];
}
}
}