Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/SoilProfile2DDataModel.cs =================================================================== diff -u -r6159 -r6181 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/SoilProfile2DDataModel.cs (.../SoilProfile2DDataModel.cs) (revision 6159) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.StixFileReader/SoilProfile2DDataModel.cs (.../SoilProfile2DDataModel.cs) (revision 6181) @@ -219,27 +219,7 @@ private static void CreateInnerLoops(SoilProfile2D soilProfile) { - // Find all inner loops - var layerConnections = new List(); - for (var index1 = 0; index1 < soilProfile.Surfaces.Count; index1++) - { - GeometryLoop loop1 = soilProfile.Surfaces[index1].GeometrySurface.OuterLoop; - for (var index2 = 0; index2 < soilProfile.Surfaces.Count; index2++) - { - if (index1 == index2) - { - continue; - } - GeometryLoop loop2 = soilProfile.Surfaces[index2].GeometrySurface.OuterLoop; - if (loop2.Points.All(loop1.IsPointInLoopArea)) - { - if (CentroidOfLoop2IsInLoop1(loop2, loop1)) - { - layerConnections.Add(new LayerConnection(index2, index1, loop1.Area())); - } - } - } - } + List layerConnections = FindAllInnerLoops(soilProfile); // When layer 1 is in layer 2 and layer 2 is in layer 3, layer 3 is not an inner loop of layer 1 if (layerConnections.Count > 0) { @@ -259,6 +239,28 @@ } } + private static List FindAllInnerLoops(SoilProfile2D soilProfile) + { + var layerConnections = new List(); + for (var index1 = 0; index1 < soilProfile.Surfaces.Count; index1++) + { + GeometryLoop loop1 = soilProfile.Surfaces[index1].GeometrySurface.OuterLoop; + for (var index2 = 0; index2 < soilProfile.Surfaces.Count; index2++) + { + if (index1 == index2) + { + continue; + } + GeometryLoop loop2 = soilProfile.Surfaces[index2].GeometrySurface.OuterLoop; + if (loop2.Points.All(loop1.IsPointInLoopArea) && CentroidOfLoop2IsInLoop1(loop2, loop1)) + { + layerConnections.Add(new LayerConnection(index2, index1, loop1.Area())); + } + } + } + return layerConnections; + } + private static bool CentroidOfLoop2IsInLoop1(GeometryLoop loop2, GeometryLoop loop1) { List loop2Points = loop2.GetLocalPoint2DList();