Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="ProfilesImporter{T}"/>.
        /// </summary>
        /// <param name="referenceLine">The reference line used to check if the imported profiles are intersecting it.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="importTarget">The import target.</param>
        /// <param name="messageProvider">The message provider to provide messages during the import.</param>
        /// <param name="typeDescriptor">The description of the profiles that are imported.</param>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        protected ProfilesImporter(ReferenceLine referenceLine,
                                   string filePath,
                                   T importTarget,
                                   IImporterMessageProvider messageProvider,
                                   string typeDescriptor) : base(filePath, importTarget)
        {
            if (referenceLine == null)
            {
                throw new ArgumentNullException(nameof(referenceLine));
            }

            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }

            if (typeDescriptor == null)
            {
                throw new ArgumentNullException(nameof(typeDescriptor));
            }

            this.referenceLine  = referenceLine;
            this.typeDescriptor = typeDescriptor;
            MessageProvider     = messageProvider;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of <see cref="StructuresImporter{TCollection}"/>.
        /// </summary>
        /// <param name="importTarget">The import target.</param>
        /// <param name="referenceLine">The reference line used to check if the imported structures are intersecting it.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="messageProvider">The message provider to provide messages during importer actions.</param>
        /// <param name="structureUpdateStrategy">The strategy to update the imported data.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
        protected StructuresImporter(StructureCollection <TStructure> importTarget,
                                     ReferenceLine referenceLine,
                                     string filePath,
                                     IImporterMessageProvider messageProvider,
                                     IStructureUpdateStrategy <TStructure> structureUpdateStrategy)
            : base(filePath, importTarget)
        {
            if (referenceLine == null)
            {
                throw new ArgumentNullException(nameof(referenceLine));
            }

            if (structureUpdateStrategy == null)
            {
                throw new ArgumentNullException(nameof(structureUpdateStrategy));
            }

            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }

            this.referenceLine           = referenceLine;
            this.messageProvider         = messageProvider;
            this.structureUpdateStrategy = structureUpdateStrategy;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FailureMechanismSectionsImporter"/> class.
        /// </summary>
        /// <param name="importTarget">The failure mechanism to update.</param>
        /// <param name="referenceLine">The reference line used to check correspondence with.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="failureMechanismSectionUpdateStrategy">The strategy to update the failure mechanism sections
        /// with the imported data.</param>
        /// <param name="messageProvider">The message provider to provide the messages during the importer action.</param>
        /// <exception cref="ArgumentNullException">Thrown when any input argument is <c>null</c>.
        /// </exception>
        public FailureMechanismSectionsImporter(IFailureMechanism importTarget,
                                                ReferenceLine referenceLine,
                                                string filePath,
                                                IFailureMechanismSectionUpdateStrategy failureMechanismSectionUpdateStrategy,
                                                IImporterMessageProvider messageProvider)
            : base(filePath, importTarget)
        {
            if (referenceLine == null)
            {
                throw new ArgumentNullException(nameof(referenceLine));
            }

            if (failureMechanismSectionUpdateStrategy == null)
            {
                throw new ArgumentNullException(nameof(failureMechanismSectionUpdateStrategy));
            }

            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }

            this.referenceLine = referenceLine;
            this.failureMechanismSectionUpdateStrategy = failureMechanismSectionUpdateStrategy;
            this.messageProvider = messageProvider;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new instance of <see cref="ClosingStructuresImporter"/>.
 /// </summary>
 /// <param name="importTarget">The closing structures to import on.</param>
 /// <param name="referenceLine">The reference line used to check if the <see cref="ClosingStructure"/>
 /// objects found in the file are intersecting it.</param>
 /// <param name="filePath">The path to the file to import from.</param>
 /// <param name="messageProvider">The message provider to provide messages during importer actions.</param>
 /// <param name="updateStrategy">The strategy to update the structures with imported data.</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
 public ClosingStructuresImporter(StructureCollection <ClosingStructure> importTarget,
                                  ReferenceLine referenceLine,
                                  string filePath,
                                  IImporterMessageProvider messageProvider,
                                  IStructureUpdateStrategy <ClosingStructure> updateStrategy)
     : base(importTarget, referenceLine, filePath, messageProvider, updateStrategy)
 {
 }
Exemplo n.º 5
0
 public TestStructuresImporter(StructureCollection <TestStructure> importTarget,
                               ReferenceLine referenceLine,
                               string filePath,
                               IStructureUpdateStrategy <TestStructure> structureUpdateStrategy,
                               IImporterMessageProvider messageProvider)
     : base(importTarget, referenceLine, filePath, messageProvider, structureUpdateStrategy)
 {
 }
Exemplo n.º 6
0
 private static IFileImporter CreateClosingStructuresImporter(ClosingStructuresContext context,
                                                              string filePath,
                                                              IImporterMessageProvider importerMessageProvider,
                                                              IStructureUpdateStrategy <ClosingStructure> structureUpdateStrategy)
 {
     return(new ClosingStructuresImporter(context.WrappedData,
                                          context.AssessmentSection.ReferenceLine,
                                          filePath,
                                          importerMessageProvider,
                                          structureUpdateStrategy));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Creates a new instance of <see cref="DikeProfilesImporter"/>.
        /// </summary>
        /// <param name="importTarget">The dike profiles to import on.</param>
        /// <param name="referenceLine">The reference line used to check if the <see cref="DikeProfile"/>
        /// objects found in the file are intersecting it.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="dikeProfileUpdateStrategy">The strategy to update the dike profiles
        /// with the imported data.</param>
        /// <param name="messageProvider">The message provider to provide the messages during the importer action.</param>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        public DikeProfilesImporter(DikeProfileCollection importTarget, ReferenceLine referenceLine,
                                    string filePath,
                                    IDikeProfileUpdateDataStrategy dikeProfileUpdateStrategy,
                                    IImporterMessageProvider messageProvider)
            : base(referenceLine, filePath, importTarget, messageProvider, RiskeerCommonDataResources.DikeProfileCollection_TypeDescriptor)
        {
            if (dikeProfileUpdateStrategy == null)
            {
                throw new ArgumentNullException(nameof(dikeProfileUpdateStrategy));
            }

            dikeProfileUpdateDataStrategy = dikeProfileUpdateStrategy;
            updatedInstances = Enumerable.Empty <IObservable>();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates a new instance of <see cref="ForeshoreProfilesImporter"/>.
        /// </summary>
        /// <param name="importTarget">The foreshore profiles to import on.</param>
        /// <param name="referenceLine">The reference line used to check if the <see cref="ForeshoreProfile"/>
        /// objects found in the file are intersecting it.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="foreshoreProfileUpdateStrategy">The strategy to update the
        /// foreshore profiles with the imported data.</param>
        /// <param name="messageProvider">The message provider to provide messages during the import.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public ForeshoreProfilesImporter(ForeshoreProfileCollection importTarget,
                                         ReferenceLine referenceLine,
                                         string filePath,
                                         IForeshoreProfileUpdateDataStrategy foreshoreProfileUpdateStrategy,
                                         IImporterMessageProvider messageProvider)
            : base(referenceLine, filePath, importTarget, messageProvider, RiskeerCommonDataResources.ForeshoreProfileCollection_TypeDescriptor)
        {
            if (foreshoreProfileUpdateStrategy == null)
            {
                throw new ArgumentNullException(nameof(foreshoreProfileUpdateStrategy));
            }

            this.foreshoreProfileUpdateStrategy = foreshoreProfileUpdateStrategy;
            affectedObjects = Enumerable.Empty <IObservable>();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SurfaceLinesCsvImporter{T}"/> class.
        /// </summary>
        /// <param name="importTarget">The import target.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="messageProvider">The message provider to provide messages during importer actions.</param>
        /// <param name="configuration">The mechanism specific configuration containing all necessary surface lines components.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
        public SurfaceLinesCsvImporter(
            ObservableUniqueItemCollectionWithSourcePath <T> importTarget,
            string filePath,
            IImporterMessageProvider messageProvider,
            SurfaceLinesCsvImporterConfiguration <T> configuration)
            : base(filePath, importTarget)
        {
            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.messageProvider      = messageProvider;
            surfaceLineUpdateStrategy = configuration.UpdateStrategy;
            updatedInstances          = Enumerable.Empty <IObservable>();
            surfaceLineTransformer    = configuration.Transformer;
        }
Exemplo n.º 10
0
 public TestProfilesImporter(ObservableList <object> importTarget, ReferenceLine referenceLine, string filePath,
                             IImporterMessageProvider messageProvider, string typeDescriptor)
     : base(referenceLine, filePath, importTarget, messageProvider, typeDescriptor)
 {
 }