// Copyright (C) Stichting Deltares 2019. All rights reserved.
//
// This file is part of the application DAM - Clients Library.
//
// DAM - UI is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using Deltares.Standard.Extensions;
using DataAttribute = Deltares.Dam.Data.DataPlugins.Configuration.DataAttribute;
namespace Deltares.Dam.Data.Importers
{
public class LocationShapeFileAttributeMap
{
#region Attribute ID Constants
///
/// location_id
///
public const string LocationAttributeId = CsvColumnNames.LocationColumnName;
///
/// DikeringId
///
public const string DikeRingAttributeId = CsvColumnNames.DikeRingColumnName;
///
/// crosssection
/// CustomShape
/// crosssection.shp
/// LocationId
/// string, string
///
public const string CrossSectionAttributId = "crossection";
///
/// segment_id
/// segment_id.shp
/// segmentid
/// string
///
public const string SegmentAttributeId = CsvColumnNames.SegmentColumnName;
///
/// PolderLevel
/// PolderLevel.shp
/// PLHigh
/// double
///
public const string PolderLevelAttributeId = CsvColumnNames.PolderLevelColumnName;
///
/// head_pl2 HeadPL2.shp HeadPL2 double
///
public const string HeadPl2AttributeId = CsvColumnNames.HeadPl2ColumnName;
///
/// head_pl3 CustomShape HeadPL3.shp HeadPL3 double
///
public const string HeadPl3AttributeId = CsvColumnNames.HeadPl3ColumnName;
///
/// head_pl4 CustomShape HeadPL4.shp HeadPL4 double
///
public const string HeadPl4AttributeId = CsvColumnNames.HeadPl4ColumnName;
///
/// grass_quality
/// CustomShape
/// GrassQuality.shp
/// GrassQlty
/// double
///
public const string GrassQualityAttributeId = CsvColumnNames.GrassQualityColumnName;
///
/// direction
/// CustomShape
/// Direction.shp
/// Direction
/// double
///
public const string DirectionAttributeId = CsvColumnNames.DirectionColumnName;
///
/// x_soilgeometry2D_origin
/// CustomShape
/// XSoilGeometry2DOrigin.shp
/// XG2DOrg
/// double
///
public const string XSoilGeometry2DOriginAttributeId = CsvColumnNames.XSoilGeometry2DOriginColumnName;
///
/// ophoogmateriaaldijk
/// CustomShape
/// ShoulderMaterial.shp
/// DikeMtrl
/// string
///
public const string DikeEmbankmentMaterialAttributeId = CsvColumnNames.DikeEmbankmentMaterialColumnName;
///
/// ophoogmateriaalberm
/// CustomShape
/// ShoulderMaterial.shp
/// ShlderMtrl
/// string
///
public const string ShoulderEmbankmentMaterialAttributeId = CsvColumnNames.ShoulderEmbankmentMaterialColumnName;
///
/// dempingsfactor_pl3
/// CustomShape
/// DampingFactorPL3.shp
/// DampingPL3 double
///
public const string DampingFactorPl3AttributeId = CsvColumnNames.DampingFactorPl3ColumnName;
///
/// dempingsfactor_pl4
/// CustomShape
/// DampingFactorPL4.shp
/// DampingPL4
/// double
///
public const string DampingFactorPl4AttributeId = CsvColumnNames.DampingFactorPl4ColumnName;
///
/// use_original_plline_assignments CustomShape use_original_plline_assignments.shp IsOrgPLs bool
///
public const string UseOriginalPlLineAssignmentsAttributeId = CsvColumnNames.UseOriginalPlLineAssignmentsColumnName;
///
/// PenetrationLength
/// CustomShape
/// PenetrationLength.shp
/// PenLength
/// double
///
public const string PenetrationLengthAttributeId = CsvColumnNames.PenetrationLengthColumnName;
///
/// TrafficLoad
/// CustomShape
/// TrafficLoad.shp
/// TrafLoad
/// double
///
public const string TrafficLoadAttributeId = CsvColumnNames.TrafficLoadColumnName;
///
/// TL_DegreeOfConsolidation
/// CustomShape
/// TL_DegreeOfConsolidation.shp
/// TL_DegOfCo
/// double
///
public const string TL_DegreeOfConsolidationAttributeId = CsvColumnNames.TL_DegreeOfConsolidationColumnName;
///
/// PLLineCreationMethod
/// CustomShape
/// PLLineCreationMethod.shp
/// PLCrtMthd
/// string
///
public const string PlLineCreationMethodAttributeId = CsvColumnNames.PlLineCreationMethodColumnName;
///
/// PLLineOffsetBelowDikeTopAtRiver
/// CustomShape
/// PLLineOffsetBelowDikeTopAtRiver.shp
/// PLBlwTDRvr
/// double
///
public const string PlLineOffsetBelowDikeTopAtRiverAttributeId = CsvColumnNames.PlLineOffsetBelowDikeTopAtRiverColumnName;
///
/// PLLineOffsetBelowDikeTopAtPolder
/// CustomShape
/// PLLineOffsetBelowDikeTopAtPolder.shp
/// PLBlwTDPld
/// double
///
public const string PlLineOffsetBelowDikeTopAtPolderAttributeId = CsvColumnNames.PlLineOffsetBelowDikeTopAtPolderColumnName;
///
/// PlLineOffsetBelowShoulderBaseInside
/// CustomShape
/// PlLineOffsetBelowShoulderBaseInside.shp
/// PLBlwTDSh
/// double
///
public const string PlLineOffsetBelowShoulderBaseInsideAttributeId = CsvColumnNames.PlLineOffsetBelowShoulderBaseInsideColumnName;
///
/// PlLineOffsetBelowDikeToeAtPolder
/// CustomShape
/// PLLineOffsetBelowDikeToeAtPolder.shp
/// PLBlwDTPld
/// double
///
public const string PlLineOffsetBelowDikeToeAtPolderAttributeId = CsvColumnNames.PlLineOffsetBelowDikeToeAtPolderColumnName;
///
/// PlLineOffsetBelowDikeCrestMiddle
/// CustomShape
/// PlLineOffsetBelowDikeCrestMiddle.shp
/// PLBlDCM
/// double
///
public const string PlLineOffsetBelowDikeCrestMiddleAttributeId = CsvColumnNames.PlLineOffsetBelowDikeCrestMiddleColumnName;
///
/// PlLineOffsetFactorBelowShoulderCrest
/// CustomShape
/// PlLineOffsetFactorBelowShoulderCrest.shp
/// PLFBlSC
/// double
///
public const string PlLineOffsetFactorBelowShoulderCrestAttributeId = CsvColumnNames.PlLineOffsetFactorBelowShoulderCrestColumnName;
///
/// UsePlLineOffsetBelowDikeCrestMiddle
/// CustomShape
/// UsePlLineOffsetBelowDikeCrestMiddle.shp
/// UPLBlDCM
/// double
///
public const string UsePlLineOffsetBelowDikeCrestMiddleAttributeId = CsvColumnNames.UsePlLineOffsetBelowDikeCrestMiddleColumnName;
///
/// UsePlLineOffsetFactorBelowShoulderCrest
/// CustomShape
/// UsePlLineOffsetFactorBelowShoulderCrest.shp
/// UPLFBlSC
/// double
///
public const string UsePlLineOffsetFactorBelowShoulderCrestAttributeId = CsvColumnNames.UsePlLineOffsetFactorBelowShoulderCrestColumnName;
///
/// The intrusion vertical water pressure attribute identifier
/// CustomShape
/// IntrusionVerticalWaterPressure.shp
/// IVWP
/// string
///
public const string IntrusionVerticalWaterPressureAttributeId = CsvColumnNames.IntrusionVerticalWaterPressureColumnName;
///
/// StabilityShoulderGrowSlope
/// CustomShape
/// StabilityShoulderGrowSlope.shp
/// StShSlpGr
/// double
///
public const string StabilityShoulderGrowSlopeAttributeId = CsvColumnNames.StabilityShoulderGrowSlopeColumnName;
///
/// StabilityShoulderGrowDeltaX
/// CustomShape
/// StabilityShoulderGrowDeltaX.shp
/// StShDXGr
/// double
///
public const string StabilityShoulderGrowDeltaXAttributeId = CsvColumnNames.StabilityShoulderGrowDeltaXColumnName;
///
/// StabilitySlopeAdaptionDeltaX
/// CustomShape
/// StabilitySlopeAdaptionDeltaX.shp
/// StSlAdaptDX
/// double
///
public const string StabilitySlopeAdaptionDeltaXAttributeId = CsvColumnNames.StabilitySlopeAdaptionDeltaXColumnName;
///
/// minimal_circle_depth
/// CustomShape
/// minimal_circle_depth.shp
/// mincrcldepth
/// double
///
public const string MinimalCircleDepthAtrributeId = CsvColumnNames.MinimalCircleDepthColumnName;
///
/// level_reduction_inside
/// CustomShape
/// level_reduction_inside.shp
/// lvlrinside
/// double
///
public const string LevelReductionInsideAttributeId = CsvColumnNames.LevelReductionInsideColumnName;
///
/// level_reduction_outside
/// CustomShape
/// level_reduction_outside.shp
/// lvlroutside
/// double
///
public const string LevelReductionOutsideAttributeId = CsvColumnNames.LevelReductionOutsideColumnName;
///
/// layer_height_distribution
/// CustomShape
/// layer_height_distribution.shp
/// layerhdist
/// double
///
public const string LayerHeightDistributionAttributeId = CsvColumnNames.LayerHeightDistributionColumnName;
///
/// layer_height_deviation
/// CustomShape
/// layer_height_deviation.shp
/// layerhdev
/// double
///
public const string LayerHeightDeviationAttributeId = CsvColumnNames.LayerHeightDeviationColumnName;
///
/// safety_factor_piping
/// CustomShape
/// safety_factor_piping.shp
/// fpiping
/// double
///
public const string SafetyFactorPipingAttributeId = CsvColumnNames.RequiredSafetyFactorPipingColumnName;
///
/// safety_factor_stability_inner_slope
/// CustomShape
/// safety_factor_stability_inner_slope.shp
/// fstabinner
/// double
///
public const string SafetyFactorStabilityInnerSlopeAttributeId = CsvColumnNames.RequiredSafetyFactorStabilityInnerSlopeColumnName;
///
/// safety_factor_stability_outer_slope
/// CustomShape
/// safety_factor_stability_outer_slope.shp
/// fstabouter
/// double
///
public const string SafetyFactorStabilityOuterSlopeAttributeId = CsvColumnNames.RequiredSafetyFactorStabilityOuterSlopeColumnName;
///
/// uplift_criterion_piping
/// CustomShape
/// uplift_criterion_piping.shp
/// uplpiping
/// double
///
public const string UpliftCriterionPipingAttributeId = CsvColumnNames.UpliftCriterionPipingColumnName;
///
/// uplift_criterion_stability
/// CustomShape
/// uplift_criterion_stability.shp
/// uplstab
/// double
///
public const string UpliftCriterionStabilityAttributeId = CsvColumnNames.UpliftCriterionStabilityColumnName;
///
/// distance_to_entry_point
/// CustomShape
/// distance_to_entry_point.shp
/// distentry
/// double
///
public const string DistanceToEntryPointAttributeId = CsvColumnNames.DistanceToEntryPointColumnName;
///
/// SlopeDampingPiezometricHeightPolderSideAttributeId
/// CustomShape
/// DTH.shp
/// DTH
/// double
///
public const string SlopeDampingPiezometricHeightPolderSideAttributeId = CsvColumnNames.SlopeDampingPiezometricHeightPolderSideColumnName;
///
/// ZoneType
/// CustomShape
/// StabilityZones.shp
/// zonetype
/// string
///
public const string ZoneTypeAttributeId = CsvColumnNames.ZoneTypeColumnName;
///
/// ForbiddenZoneFactor
/// CustomShape
/// StabilityZones.shp
/// ForbiddenZoneFactor
/// double
///
public const string ForbiddenZoneFactorAttributeId = CsvColumnNames.ForbiddenZoneFactorColumnName;
///
/// ZoneAreaRestSlopeCrestWidth
/// CustomShape
/// StabilityZones.shp
/// ZoneAreaRestSlopeCrestWidth
/// double
///
public const string ZoneAreaRestSlopeCrestWidthAttributeId = CsvColumnNames.ZoneAreaRestSlopeCrestWidthColumnName;
///
/// StabilityDesignMethodColumnName
/// CustomShape
/// DesignParameters.shp
/// StabilityDesignMethodColumnName
/// string
///
public const string StabilityDesignMethodAttributeId = CsvColumnNames.StabilityDesignMethodColumnName;
///
/// SlopeAdaptionStartCotangentColumnName
/// CustomShape
/// DesignParameters.shp
/// SlopeAdaptionStartCotangentColumnName
/// double
///
public const string SlopeAdaptionStartCotangentAttributeId = CsvColumnNames.SlopeAdaptionStartCotangentColumnName;
///
/// SlopeAdaptionEndCotangentColumnName
/// CustomShape
/// DesignParameters.shp
/// SlopeAdaptionEndCotangentColumnName
/// double
///
public const string SlopeAdaptionEndCotangentAttributeId = CsvColumnNames.SlopeAdaptionEndCotangentColumnName;
///
/// SlopeAdaptionStepCotangentColumnName
/// CustomShape
/// DesignParameters.shp
/// SlopeAdaptionStepCotangentColumnName
/// double
///
public const string SlopeAdaptionStepCotangentAttributeId = CsvColumnNames.SlopeAdaptionStepCotangentColumnName;
///
/// UseNewDikeTopWidth
/// CustomShape
/// DesignParameters.shp
/// UseNewDikeTopWidth
/// double
///
public const string UseNewDikeTopWidthAttributeId = CsvColumnNames.UseNewDikeTopWidthColumnName;
///
/// NewDikeTopWidth
/// CustomShape
/// DesignParameters.shp
/// NewDikeTopWidth
/// double
///
public const string NewDikeTopWidthAttributeId = CsvColumnNames.NewDikeTopWidthColumnName;
///
/// UseNewDikeSlopeInside
/// CustomShape
/// DesignParameters.shp
/// UseNewDikeSlopeInside
/// double
///
public const string UseNewDikeSlopeInsideAttributeId = CsvColumnNames.UseNewDikeSlopeInsideColumnName;
///
/// NewDikeSlopeInside
/// CustomShape
/// DesignParameters.shp
/// NewDikeSlopeInside
/// double
///
public const string NewDikeSlopeInsideAttributeId = CsvColumnNames.NewDikeSlopeInsideColumnName;
///
/// UseNewDikeSlopeOutside
/// CustomShape
/// DesignParameters.shp
/// UseNewDikeSlopeOutside
/// double
///
public const string UseNewDikeSlopeOutsideAttributeId = CsvColumnNames.UseNewDikeSlopeOutsideColumnName;
///
/// NewDikeSlopeOutside
/// CustomShape
/// DesignParameters.shp
/// NewDikeSlopeOutside
/// double
///
public const string NewDikeSlopeOutsideAttributeId = CsvColumnNames.NewDikeSlopeOutsideColumnName;
///
/// UseNewShoulderTopSlope
/// CustomShape
/// DesignParameters.shp
/// UseNewShoulderTopSlope
/// double
///
public const string UseNewShoulderTopSlopeAttributeId = CsvColumnNames.UseNewShoulderTopSlopeColumnName;
///
/// NewShoulderTopSlope
/// CustomShape
/// DesignParameters.shp
/// NewShoulderTopSlope
/// double
///
public const string NewShoulderTopSlopeAttributeId = CsvColumnNames.NewShoulderTopSlopeColumnName;
///
/// UseNewShoulderBaseSlope
/// CustomShape
/// DesignParameters.shp
/// UseNewShoulderBaseSlope
/// double
///
public const string UseNewShoulderBaseSlopeAttributeId = CsvColumnNames.UseNewShoulderBaseSlopeColumnName;
///
/// NewShoulderBaseSlope
/// CustomShape
/// DesignParameters.shp
/// NewShoulderBaseSlope
/// double
///
public const string NewShoulderBaseSlopeAttributeId = CsvColumnNames.NewShoulderBaseSlopeColumnName;
///
/// UseNewMaxHeightShoulderAsFraction
/// CustomShape
/// DesignParameters.shp
/// UseNewMaxHeightShoulderAsFraction
/// double
///
public const string UseNewMaxHeightShoulderAsFractionAttributeId = CsvColumnNames.UseNewMaxHeightShoulderAsFractionColumnName;
///
/// NewMaxHeightShoulderAsFraction
/// CustomShape
/// DesignParameters.shp
/// NewMaxHeightShoulderAsFraction
/// double
///
public const string NewMaxHeightShoulderAsFractionAttributeId = CsvColumnNames.NewMaxHeightShoulderAsFractionColumnName;
///
/// UseNewMinDistanceDikeToeStartDitch
/// CustomShape
/// DesignParameters.shp
/// UseNewMinDistanceDikeToeStartDitch
/// double
///
public const string UseNewMinDistanceDikeToeStartDitchAttributeId = CsvColumnNames.UseNewMinDistanceDikeToeStartDitchColumnName;
///
/// NewMinDistanceDikeToeStartDitch
/// CustomShape
/// DesignParameters.shp
/// NewMinDistanceDikeToeStartDitch
/// double
///
public const string NewMinDistanceDikeToeStartDitchAttributeId = CsvColumnNames.NewMinDistanceDikeToeStartDitchColumnName;
///
/// UseNewDitchDefinition
/// CustomShape
/// DesignParameters.shp
/// UseNewDitchDefinition
/// double
///
public const string UseNewDitchDefinitionAttributeId = CsvColumnNames.UseNewDitchDefinitionColumnName;
///
/// NewWidthDitchBottom
/// CustomShape
/// DesignParameters.shp
/// NewWidthDitchBottom
/// double
///
public const string NewWidthDitchBottomAttributeId = CsvColumnNames.NewWidthDitchBottomColumnName;
///
/// NewDepthDitch
/// CustomShape
/// DesignParameters.shp
/// NewDepthDitch
/// double
///
public const string NewDepthDitchAttributeId = CsvColumnNames.NewDepthDitchColumnName;
///
/// NewSlopeAngleDitch
/// CustomShape
/// DesignParameters.shp
/// NewSlopeAngleDitch
/// double
///
public const string NewSlopeAngleDitchAttributeId = CsvColumnNames.NewSlopeAngleDitchColumnName;
///
/// DikeTableHeight
/// CustomShape
/// DikeTableHeight.shp
/// DikeTableHeight
/// double
///
public const string DikeTableHeightAttributeId = CsvColumnNames.DikeTableHeightColumnName;
///
/// water_height
/// CustomShape
/// WaterHeight.shp
/// WaterHeight
/// double
///
public const string WaterHeightAttributeId = CsvColumnNames.WaterHeightColumnName;
///
/// water_height_low
/// CustomShape
/// WaterHeightLow.shp
/// WaterHeightLow
/// double
///
public const string WaterHeightLowAttributeId = CsvColumnNames.WaterHeightLowColumnName;
#endregion
internal static readonly IDictionary AttributePropertyMap;
internal static readonly IDictionary ConstructionalMap;
internal const string LocationShapeFileName = "Location.shp";
internal const string ShoulderMaterialShapeFileName = "ShoulderMaterial.shp";
internal const string PolderLevelShapeFileName = "PolderLevel.shp";
internal const string PlLineShapeFileName = "PLLines.shp";
static LocationShapeFileAttributeMap()
{
// Note: the reason that I create a keyValPair lists here is that I can see which keys are alredy added
// when using a dictionary initializer you cant see which attribute is already added which gives you a headache when you have duplicate keys :)
#region Attribute Map
Func,KeyValuePair> createItem =
(id, f, c, a) => new KeyValuePair(id, new LocationAttributeMapping(){Id = id.ToLower(), File = f, Name = c, Action = a});
var mappings = new List>
{
// direct property mappings
createItem(SegmentAttributeId, "segment_id.shp", "segmentid", (t, value) => t.SegmentId = value.ToString()),
createItem(DampingFactorPl3AttributeId, "DampingFactoPL3.shp", "DampingPL3", (t, value) => t.DampingFactorPL3 = value.ToType() ),
createItem(DampingFactorPl4AttributeId, "DampingFactoPL4.shp", "DampingPL4", (t, value) => t.DampingFactorPL4 = value.ToType() ),
createItem(DikeEmbankmentMaterialAttributeId, "Dikematerial.shp", "DikeMtrl", (t, value) => t.DikeEmbankmentMaterial = value.ToType() ),
createItem(DirectionAttributeId, "Direction.shp", "Direction", (t, value) => t.Direction = value.ToType()),
createItem(DistanceToEntryPointAttributeId, "distance_to_entry_point.shp", "dist_entry", (t, value) => t.DistanceToEntryPoint = value.ToType()),
createItem(GrassQualityAttributeId, "GrassQuality.shp", "GrassQlty", (t, value) => t.GrassQuality = value.ToType()),
createItem(HeadPl2AttributeId, "HeadPL2.shp", "HeadPL2", (t, value) => t.HeadPL2 = value.ToType() ),
createItem(HeadPl3AttributeId, "HeadPL3.shp", "HeadPL3", (t, value) => t.HeadPl3 = value.ToType() ),
createItem(HeadPl4AttributeId, "HeadPL4.shp", "HeadPL4", (t, value) => t.HeadPl4 = value.ToType() ),
createItem(LayerHeightDistributionAttributeId, "layer_height_distribution.shp", "layerhdist", (t, value) => t.LayerHeightDistribution = LocationImportHelper.ToDistribution(value)),
createItem(LayerHeightDeviationAttributeId, "layer_height_deviation.shp", "layerhdev", (t, value) => t.LayerHeightDeviation = value.ToType()),
createItem(LevelReductionInsideAttributeId, "level_reduction_inside.shp", "lvlrinside", (t, value) => t.LevelReductionInside = value.ToType()),
createItem(LevelReductionOutsideAttributeId, "level_reduction_outside.shp", "lvlroutside", (t, value) => t.LevelReductionOutside = value.ToType()),
createItem(MinimalCircleDepthAtrributeId, "minimal_circle_depth.shp", "mincrcldepth", (t, value) => t.MinimalCircleDepth = value.ToType()),
createItem(PenetrationLengthAttributeId, "PenetrationLength.shp", "PenLength", (t, value) => t.PenetrationLength = value.ToType()),
createItem(PolderLevelAttributeId, PolderLevelShapeFileName, "PLHigh", (t, value) => t.PolderLevel = value.ToType()),
createItem(PlLineCreationMethodAttributeId, "PLLineCreationMethod.shp", "PLCrtMthd", (t, value) => t.PLLineCreationMethod = LocationImportHelper.ToPLLineCreationMethod(value)),
createItem(ZoneTypeAttributeId, "StabilityZones.shp", "ZoneType", (t, value) => t.StabilityZoneType = LocationImportHelper.ToMStabZonesTypeMethod(value)),
createItem(ForbiddenZoneFactorAttributeId, "StabilityZones.shp", "ForbiddenZoneFactor", (t, value) => t.ForbiddenZoneFactor = value.ToType()),
createItem(ZoneAreaRestSlopeCrestWidthAttributeId, "StabilityZones.shp", "ZoneAreaRestSlopeCrestWidth", (t, value) => t.ZoneAreaRestSlopeCrestWidth = value.ToType()),
createItem(PlLineOffsetBelowDikeTopAtRiverAttributeId, PlLineShapeFileName, "PLBlwTDRvr", (t, value) => t.PlLineOffsetBelowDikeTopAtRiver = value.ToType()),
createItem(PlLineOffsetBelowDikeTopAtPolderAttributeId, PlLineShapeFileName, "PLBlwTDPld", (t, value) => t.PlLineOffsetBelowDikeTopAtPolder = value.ToType()),
createItem(PlLineOffsetBelowShoulderBaseInsideAttributeId, PlLineShapeFileName, "PLBlwTDSh", (t, value) => t.PlLineOffsetBelowShoulderBaseInside = value.ToType()),
createItem(PlLineOffsetBelowDikeToeAtPolderAttributeId, PlLineShapeFileName, "PLBlwDTPld", (t, value) => t.PlLineOffsetBelowDikeToeAtPolder = value.ToType()),
createItem(PlLineOffsetBelowDikeCrestMiddleAttributeId, PlLineShapeFileName, "PLBlDCM", (t, value) => t.PlLineOffsetBelowDikeCrestMiddle = value.ToType()),
createItem(PlLineOffsetFactorBelowShoulderCrestAttributeId, PlLineShapeFileName, "PLFBlSC", (t, value) => t.PlLineOffsetFactorBelowShoulderCrest = value.ToType()),
createItem(UsePlLineOffsetBelowDikeCrestMiddleAttributeId, PlLineShapeFileName, "UPLBlDCM", (t, value) => t.UsePlLineOffsetBelowDikeCrestMiddle = value.ToType()),
createItem(UsePlLineOffsetFactorBelowShoulderCrestAttributeId, PlLineShapeFileName, "UPLFBlSC", (t, value) => t.UsePlLineOffsetFactorBelowShoulderCrest = value.ToType()),
createItem(IntrusionVerticalWaterPressureAttributeId, "IntrusionVerticalWaterPressure.shp", "IVWP", (t, value) => t.IntrusionVerticalWaterPressure = LocationImportHelper.ToIntrusionVerticalWaterPressure(value)),
createItem(TrafficLoadAttributeId, "trafficload.shp", "TrafLoad", (t, value) => t.TrafficLoad = value.ToType() ),
createItem(TL_DegreeOfConsolidationAttributeId, "TL_DegreeOfConsolidation.shp", "TL_DegOfCo", (t, value) => t.TL_DegreeOfConsolidation = value.ToType() ),
createItem(SafetyFactorPipingAttributeId, "safety_factor_piping.shp", "fpiping", (t, value) => t.ModelFactors.RequiredSafetyFactorPiping = value.ToType()),
createItem(SafetyFactorStabilityInnerSlopeAttributeId, "safety_factor_stability_inner_slope.shp", "fstabinner", (t, value) => t.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = value.ToType()),
createItem(SafetyFactorStabilityOuterSlopeAttributeId, "safety_factor_stability_outer_slope.shp", "fstabouter", (t, value) => t.ModelFactors.RequiredSafetyFactorStabilityOuterSlope = value.ToType()),
createItem(ShoulderEmbankmentMaterialAttributeId, ShoulderMaterialShapeFileName, "ShlderMtrl", (t, value) => t.ShoulderEmbankmentMaterial = value.ToType() ),
createItem(StabilityShoulderGrowSlopeAttributeId, "StabilityShoulderGrowSlope.shp", "StShSlpGr", (t, value) => t.StabilityShoulderGrowSlope = value.ToType()),
createItem(StabilityShoulderGrowDeltaXAttributeId, "StabilityShoulderGrowDeltaX.shp", "StShDXGr", (t, value) => t.StabilityShoulderGrowDeltaX = value.ToType()),
createItem(StabilitySlopeAdaptionDeltaXAttributeId, "StabilitySlopeAdaptionDeltaX.shp", "StSlAdaptDX", (t, value) => t.StabilitySlopeAdaptionDeltaX = value.ToType()),
createItem(UpliftCriterionPipingAttributeId, "uplift_criterion_piping.shp", "uplpiping", (t, value) => t.ModelFactors.UpliftCriterionPiping = value.ToType()),
createItem(UpliftCriterionStabilityAttributeId, "uplift_criterion_stability.shp", "uplstab", (t, value) => t.ModelFactors.UpliftCriterionStability = value.ToType()),
createItem(UseOriginalPlLineAssignmentsAttributeId, "use_original_plline_assignments.shp", "IsOrgPLs", (t, value) => t.IsUseOriginalPLLineAssignments = value.ToType()),
createItem(XSoilGeometry2DOriginAttributeId, "XSoilGeometry2DOrigin.shp", "XG2DOrg", (t, value) => t.XSoilGeometry2DOrigin = value.ToType()),
createItem(SlopeDampingPiezometricHeightPolderSideAttributeId, "SlopeDampingPiezometricHeightPolderSide.shp", "SlopeDampingPiezometricHeightPolderSide", (t, value) => t.SlopeDampingPiezometricHeightPolderSide = value.ToType() ),
createItem(DikeTableHeightAttributeId, "DikeTableHeight.shp", "DikeTableHeight", (t, value) => t.DikeTableHeight = value.ToType() ),
createItem(WaterHeightAttributeId, "WaterHeight.shp", "WaterHeight", (t, value) => t.WaterHeight = value.ToType() ),
createItem(WaterHeightLowAttributeId, "WaterHeightLow.shp", "WaterHeightLow", (t, value) => t.WaterHeightLow = value.ToType() ),
createItem(StabilityDesignMethodAttributeId, "DesignParameters.shp", "StabilityDesignMethod", (t, value) => t.StabilityDesignMethod = LocationImportHelper.ToStabilityDesignMethod(value) ),
createItem(SlopeAdaptionStartCotangentAttributeId, "DesignParameters.shp", "SlopeAdaptionStartCotangent", (t, value) => t.SlopeAdaptionStartCotangent = value.ToType() ),
createItem(SlopeAdaptionEndCotangentAttributeId, "DesignParameters.shp", "SlopeAdaptionEndCotangent", (t, value) => t.SlopeAdaptionEndCotangent = value.ToType() ),
createItem(SlopeAdaptionStepCotangentAttributeId, "DesignParameters.shp", "SlopeAdaptionStepCotangent", (t, value) => t.SlopeAdaptionStepCotangent = value.ToType() ),
createItem(UseNewDikeTopWidthAttributeId, "DesignParameters.shp", "UseNewDikeTopWidth", (t, value) => t.UseNewDikeTopWidth = value.ToType() ),
createItem(NewDikeTopWidthAttributeId, "DesignParameters.shp", "NewDikeTopWidth", (t, value) => t.NewDikeTopWidth = value.ToType() ),
createItem(UseNewDikeSlopeInsideAttributeId, "DesignParameters.shp", "UseNewDikeSlopeInside", (t, value) => t.UseNewDikeSlopeInside = value.ToType() ),
createItem(NewDikeSlopeInsideAttributeId, "DesignParameters.shp", "NewDikeSlopeInside", (t, value) => t.NewDikeSlopeInside = value.ToType() ),
createItem(UseNewDikeSlopeOutsideAttributeId, "DesignParameters.shp", "UseNewDikeSlopeOutside", (t, value) => t.UseNewDikeSlopeOutside = value.ToType() ),
createItem(NewDikeSlopeOutsideAttributeId, "DesignParameters.shp", "NewDikeSlopeOutside", (t, value) => t.NewDikeSlopeOutside = value.ToType() ),
createItem(UseNewShoulderTopSlopeAttributeId, "DesignParameters.shp", "UseNewShoulderTopSlope", (t, value) => t.UseNewShoulderTopSlope = value.ToType() ),
createItem(NewShoulderTopSlopeAttributeId, "DesignParameters.shp", "NewShoulderTopSlope", (t, value) => t.NewShoulderTopSlope = value.ToType() ),
createItem(UseNewShoulderBaseSlopeAttributeId, "DesignParameters.shp", "UseNewShoulderBaseSlope", (t, value) => t.UseNewShoulderBaseSlope = value.ToType() ),
createItem(NewShoulderBaseSlopeAttributeId, "DesignParameters.shp", "NewShoulderBaseSlope", (t, value) => t.NewShoulderBaseSlope = value.ToType() ),
createItem(UseNewMaxHeightShoulderAsFractionAttributeId, "DesignParameters.shp", "UseNewMaxHeightShoulderAsFraction", (t, value) => t.UseNewMaxHeightShoulderAsFraction = value.ToType() ),
createItem(NewMaxHeightShoulderAsFractionAttributeId, "DesignParameters.shp", "NewMaxHeightShoulderAsFraction", (t, value) => t.NewMaxHeightShoulderAsFraction = value.ToType() ),
createItem(UseNewMinDistanceDikeToeStartDitchAttributeId, "DesignParameters.shp", "UseNewMinDistanceDikeToeStartDitch", (t, value) => t.UseNewMinDistanceDikeToeStartDitch = value.ToType() ),
createItem(NewMinDistanceDikeToeStartDitchAttributeId, "DesignParameters.shp", "NewMinDistanceDikeToeStartDitch", (t, value) => t.NewMinDistanceDikeToeStartDitch = value.ToType() ),
createItem(UseNewDitchDefinitionAttributeId, "DesignParameters.shp", "UseNewDitchDefinition", (t, value) => t.UseNewDitchDefinition = value.ToType() ),
createItem(NewWidthDitchBottomAttributeId, "DesignParameters.shp", "NewWidthDitchBottom", (t, value) => t.NewWidthDitchBottom = value.ToType() ),
createItem(NewDepthDitchAttributeId, "DesignParameters.shp", "NewDepthDitch", (t, value) => t.NewDepthDitch = value.ToType() ),
createItem(NewSlopeAngleDitchAttributeId, "DesignParameters.shp", "NewSlopeAngleDitch", (t, value) => t.NewSlopeAngleDitch = value.ToType() )
};
AttributePropertyMap = new Dictionary();
foreach (var keyValuePair in mappings)
{
var key = keyValuePair.Key.ToLower();
if (AttributePropertyMap.ContainsKey(key))
{
throw new TypeInitializationException(typeof (LocationShapeFileAttributeMap).FullName,
new ArgumentException(string.Format("The item with the key '{0}' has already been added", key)));
}
AttributePropertyMap.Add(key, keyValuePair.Value);
}
ConstructionalMap = new Dictionary()
{
{LocationAttributeId.ToLower(), new LocationAttributeMapping() { File = LocationShapeFileName, Id = LocationAttributeId, Name = "LocationId"}},
{DikeRingAttributeId.ToLower(), new LocationAttributeMapping() { File = LocationShapeFileName, Id = DikeRingAttributeId, Name = "DikeringId"}},
{CrossSectionAttributId.ToLower(), new LocationAttributeMapping() { File = "crosssection.shp", Id = CrossSectionAttributId, Name = "LocationId"}}
};
#endregion
}
private static IEnumerable NonPropertyAttributes
{
get
{
yield return LocationAttributeId.ToLower();
yield return DikeRingAttributeId.ToLower();
//yield return SegmentAttributeId.ToLower();
yield return CrossSectionAttributId.ToLower();
}
}
public static bool IsPropertyAttribute(string attributeId)
{
if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "")
throw new ArgumentNullException("attributeId");
var id = attributeId.ToLowerInvariant();
return !NonPropertyAttributes.Contains(id);
}
public static LocationAttributeMapping GetAttributeMapping(string attributeId)
{
if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "")
throw new ArgumentNullException("attributeId");
return GetAttributeMapping(null, attributeId);
}
public static LocationAttributeMapping GetAttributeMapping(DataAttribute dataAttribute)
{
if (dataAttribute == null)
throw new ArgumentNullException("dataAttribute");
return GetAttributeMapping(dataAttribute, dataAttribute.AttributeId);
}
public static LocationAttributeMapping GetAttributeMapping(DataAttribute dataAttribute, string attributeId)
{
if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "")
throw new ArgumentNullException("attributeId");
var map = ConstructionalMap;
string file = string.Empty, attrName = string.Empty;
Action action = (t, value) => { };
var id = attributeId.ToLower();
if (ConstructionalMap.ContainsKey(id))
{
file = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.DataSource) || dataAttribute.DataSource.Trim() == string.Empty ?
map[id].File : dataAttribute.DataSource;
attrName = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.AttributeName) || dataAttribute.AttributeName.Trim() == ""
? map[id].Name // return the default shape file colum name
: dataAttribute.AttributeName.ToLower();
action = map[id].Action;
}
else if (AttributePropertyMap.ContainsKey(id))
{
map = AttributePropertyMap;
file = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.DataSource) || dataAttribute.DataSource.Trim() == string.Empty ?
map[id].File : dataAttribute.DataSource;
attrName = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.AttributeName) || dataAttribute.AttributeName.Trim() == ""
? map[id].Name // return the default shape file colum name
: dataAttribute.AttributeName;
action = map[id].Action;
}
return new LocationAttributeMapping
{
Id = attributeId,
File = file,
Name = attrName,
Action = action
};
}
///
/// Checks if the given attribute id is supported by this importer.
/// The id check is case sensitive!
///
///
/// True if the attribute id is in the key map
public static bool IsAttributeIdSupported(string attributeId)
{
if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "")
throw new ArgumentNullException("attributeId");
var id = attributeId.ToLower();
return AttributePropertyMap.ContainsKey(id);
}
}
}