Index: src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs =================================================================== diff -u -r63 -r88 --- src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs (.../DSoilModelGeometryEditor.cs) (revision 63) +++ src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs (.../DSoilModelGeometryEditor.cs) (revision 88) @@ -968,10 +968,22 @@ // TODO: Implement ? private void CreateNew2DProfileFromSoilProfile2DAndSurfaceLine2(SoilProfile2D profile2D, SurfaceLine2 surfaceLine2) { - // Determine the requested shift of the surf? or geom? + // Determine the requested shift of the geometry + var dtrx = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; + var dtpx = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; + var cloneProfile = (SoilProfile2D)profile2D.Clone(); - // Create the new 2D based on the surfaceline, the old 2D and the shift. + var shift = ((dtrx + dtpx) * 0.5) - cloneProfile.CenterCrestLocation; + foreach (var point in cloneProfile.Geometry.Points) + { + point.X += shift; + } + cloneProfile.Geometry.Rebox(); + var utils = new GeotechnicsUtilities(); + var soilProfile2D = utils.CombineSurfaceLineWithSoilProfile2D(surfaceLine2.Geometry, cloneProfile, null); + soilProfile2D.Name = profile2D.Name + surfaceLine2.Name; + AddSoilProfile2DToProjectAndUpdateUI(soilProfile2D); } private void Create2DProfileFromSoilProfile1DAndSurfaceLine2(SoilProfile1D profile1D, SurfaceLine2 surfaceLine2) @@ -992,6 +1004,11 @@ surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X)*0.5; } soilSurfaceProfile.Dispose(); + AddSoilProfile2DToProjectAndUpdateUI(soilProfile2D); + } + + private void AddSoilProfile2DToProjectAndUpdateUI(SoilProfile2D soilProfile2D) + { DataEventPublisher.BeforeChange(project.SoilProfiles2D); UniqueNameProvider.ProvideUniqueName(project.SoilProfiles2D, soilProfile2D); project.SoilProfiles2D.Add(soilProfile2D);