Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u -r4169 -r4198 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 4169) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 4198) @@ -200,9 +200,6 @@ DataSourceEsriProjection = dataSourceContainer.DataSourceEsriProjection }; - // Make sure Soil properties are same as in database, also build IsAquifer dictionary - UpdateSoilPropertiesToSoilDatabase(); - // handle logs if (logMessages.Any()) { @@ -346,7 +343,6 @@ // This will become obsolete as soon as Delphi DGeoStability version is no longer used. ResolveBackwardCompatibility(); UpdateSoilDatabaseReferences(damProjectFolder); - UpdateSoilPropertiesToSoilDatabase(); }); // Add stability as standard mechanism when not yet available. @@ -603,110 +599,6 @@ } /// - /// Updates the soil properties to the values in the soil database, to avoid discrepancies. - /// If the use of the soil database is not necessary anymore (and the soil parameters can be edited in the UI) - /// then this method is not needed anymore. - /// Also all references of soil in the layers are forced to point to a soil in the SoilList. - /// - /// After this method every soil has only 1 instance, and is present in the soillist - /// - private void UpdateSoilPropertiesToSoilDatabase() - { - foreach (Dike dike in DamProjectData.WaterBoard.Dikes) - { - UpdateSoilListFromDatabase(dike); - - Dictionary aquiferDictionary = dike.SoilList.AquiferDictionary; - foreach (Location location in dike.Locations) - { - location.SoilList = dike.SoilList; - if (location.Segment != null) - { - foreach (SoilGeometryProbability soilGeometryProbability in location.Segment.SoilProfileProbabilities) - { - if (soilGeometryProbability.SoilProfileType == SoilProfileType.SoilProfile1D) - { - foreach (SoilLayer1D layer in soilGeometryProbability.SoilProfile.Layers) - { - bool isAquifer; - // Assign correct soil to layer - Soil newSoil; - int index = dike.SoilList.GetSoilIndexByName(layer.Soil.Name); - if (index < 0) - { - Soil databaseSoil = dike.SoilBaseDB.GetSoil(layer.Soil.Name, out isAquifer); - newSoil = databaseSoil; - dike.SoilList.Soils.Add(newSoil); - } - else - { - newSoil = dike.SoilList.Soils[index]; - isAquifer = aquiferDictionary[newSoil]; - } - - // Set correct IsAquifer property in layer - layer.IsAquifer = isAquifer; - layer.Soil = newSoil; - } - } - } - } - } - } - } - - /// - /// Update all soil parameters to the data read from database - /// - /// - private static void UpdateSoilListFromDatabase(Dike dike) - { - SoilList soilList = dike.SoilList; - Dictionary soils = soilList.Soils.ToDictionary(s => s.Name); - CleanDikeAquiferDictionary(dike); - foreach (Soil soil in dike.SoilList.Soils) - { - Soil newSoil = soils[soil.Name]; - // if the current soil was found in the db list, update the params for the current soil - if (newSoil != null) - { - soil.Assign(newSoil); - // update aquifer dictionary too - if (soilList.AquiferDictionary.ContainsKey(newSoil)) - { - if (dike.SoilList.AquiferDictionary.ContainsKey(soil)) - { - dike.SoilList.AquiferDictionary[soil] = soilList.AquiferDictionary[newSoil]; - } - else - { - dike.SoilList.AquiferDictionary.Add(soil, soilList.AquiferDictionary[newSoil]); - } - } - else - { - dike.SoilList.AquiferDictionary.Add(soil, false); - } - } - } - } - - private static void CleanDikeAquiferDictionary(Dike dike) - { - var newDict = new Dictionary(); - foreach (Soil soil in dike.SoilList.Soils) - { - if (dike.SoilList.AquiferDictionary.ContainsKey(soil)) - { - newDict[soil] = dike.SoilList.AquiferDictionary[soil]; - } - } - - dike.SoilList.AquiferDictionary.Clear(); - dike.SoilList.AquiferDictionary = newDict; - } - - /// /// Update soil database references: /// Soildatabase should always be in the project path /// Make sure the file reference is adjusted to this