Esempio n. 1
0
 /// <summary>
 /// Imports the <see cref="MacroStabilityInwardsStochasticSoilModel"/> data for the <see cref="MacroStabilityInwardsFailureMechanism"/>
 /// of the given <see cref="IAssessmentSection"/>.
 /// </summary>
 /// <param name="assessmentSection">The <see cref="AssessmentSection"/> to import on.</param>
 /// <remarks>This will import 4 soil models with one profile each.</remarks>
 public static void ImportMacroStabilityInwardsStochasticSoilModels(AssessmentSection assessmentSection)
 {
     using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
                                                                            true,
                                                                            "DR6.soil"))
     {
         string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6.soil");
         var    activity = new FileImportActivity(new StochasticSoilModelImporter <MacroStabilityInwardsStochasticSoilModel>(
                                                      assessmentSection.MacroStabilityInwards.StochasticSoilModels,
                                                      filePath,
                                                      new ImportMessageProvider(),
                                                      MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.MacroStabilityInwards)),
                                                  "MacroStabilityInwardsStochasticSoilModelImporter");
         activity.Run();
         activity.Finish();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Imports the <see cref="MacroStabilityInwardsSurfaceLine"/> data for the <see cref="MacroStabilityInwardsFailureMechanism"/>
 /// of the given <see cref="IAssessmentSection"/>.
 /// </summary>
 /// <param name="assessmentSection">The <see cref="AssessmentSection"/> to import on.</param>
 /// <remarks>This will import 4 surface lines.</remarks>
 public static void ImportMacroStabilityInwardsSurfaceLines(AssessmentSection assessmentSection)
 {
     using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
                                                                            true,
                                                                            "DR6_surfacelines.csv",
                                                                            "DR6_surfacelines.krp.csv"))
     {
         string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6_surfacelines.csv");
         var    activity = new FileImportActivity(new SurfaceLinesCsvImporter <MacroStabilityInwardsSurfaceLine>(
                                                      assessmentSection.MacroStabilityInwards.SurfaceLines,
                                                      filePath,
                                                      new ImportMessageProvider(),
                                                      MacroStabilityInwardsSurfaceLinesCsvImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.MacroStabilityInwards, assessmentSection.ReferenceLine)),
                                                  "MacroStabilityInwardsSurfaceLinesCsvImporter");
         activity.Run();
         activity.Finish();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Imports the <see cref="PipingStochasticSoilModel"/> data for the <see cref="PipingFailureMechanism"/>
 /// of the given <see cref="IAssessmentSection"/> and updates existing data based upon the imported
 /// data.
 /// </summary>
 /// <param name="assessmentSection">The <see cref="AssessmentSection"/> to import on.</param>
 /// <remarks>When data from <see cref="DataImportHelper.ImportPipingStochasticSoilModels"/> is added first,
 /// then calling this method will remove soil model 'PK001_0004_Piping', stochastic soil profile 'W1-6_4_1D1'
 /// and update the probability of stochastic soil profile '6-3_22' (100% to 50%).</remarks>
 public static void UpdatePipingStochasticSoilModels(AssessmentSection assessmentSection)
 {
     using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataUpdateHelper).Assembly,
                                                                            true,
                                                                            "DR6_updated.soil"))
     {
         string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6_updated.soil");
         var    activity = new FileImportActivity(
             new StochasticSoilModelImporter <PipingStochasticSoilModel>(
                 assessmentSection.Piping.StochasticSoilModels,
                 filePath,
                 new UpdateMessageProvider(),
                 PipingStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(assessmentSection.Piping)),
             "StochasticSoilModelUpdater");
         activity.Run();
         activity.Finish();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Imports <see cref="FailureMechanismSection"/> data for a given <see cref="IFailureMechanism{T}"/>.
 /// </summary>
 /// <param name="assessmentSection">The <see cref="AssessmentSection"/> that contains the <see cref="IFailureMechanism{T}"/> instance.</param>
 /// <param name="failureMechanism">The <see cref="IFailureMechanism{T}"/> instance to import on.</param>
 /// <remarks>
 /// <para>This will import 283 failure mechanism sections.</para>
 /// <para>Imports using <see cref="FileImportActivity"/>.</para>
 /// </remarks>
 public static void ImportFailureMechanismSections(AssessmentSection assessmentSection, IFailureMechanism <FailureMechanismSectionResult> failureMechanism)
 {
     using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
                                                                            true,
                                                                            "traject_6-3_vakken.shp",
                                                                            "traject_6-3_vakken.dbf",
                                                                            "traject_6-3_vakken.prj",
                                                                            "traject_6-3_vakken.shx"))
     {
         string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "traject_6-3_vakken.shp");
         var    activity = new FileImportActivity(new FailureMechanismSectionsImporter(
                                                      failureMechanism, assessmentSection.ReferenceLine, filePath,
                                                      new FailureMechanismSectionReplaceStrategy(failureMechanism),
                                                      new ImportMessageProvider()),
                                                  "FailureMechanismSectionsImporter");
         activity.Run();
         activity.Finish();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Imports the <see cref="ReferenceLine"/> on the <see cref="AssessmentSection"/>.
 /// </summary>
 /// <param name="assessmentSection">The <see cref="AssessmentSection"/> to import the reference line on.</param>
 public static void ImportReferenceLine(AssessmentSection assessmentSection)
 {
     using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
                                                                            true,
                                                                            "traject_6-3.shp",
                                                                            "traject_6-3.dbf",
                                                                            "traject_6-3.prj",
                                                                            "traject_6-3.shx"))
     {
         string filePath     = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "traject_6-3.shp");
         var    mocks        = new MockRepository();
         var    viewCommands = mocks.Stub <IViewCommands>();
         mocks.ReplayAll();
         var activity = new FileImportActivity(new ReferenceLineImporter(assessmentSection.ReferenceLine,
                                                                         new ReferenceLineUpdateHandler(assessmentSection, viewCommands),
                                                                         filePath),
                                               "ReferenceLineImporter");
         activity.Run();
         activity.Finish();
         mocks.VerifyAll();
     }
 }