Index: DamClients/DamUI/trunk/src/Dam/Forms/DamSpatialEditorDecorator.cs
===================================================================
diff -u -r3557 -r3558
--- DamClients/DamUI/trunk/src/Dam/Forms/DamSpatialEditorDecorator.cs (.../DamSpatialEditorDecorator.cs) (revision 3557)
+++ DamClients/DamUI/trunk/src/Dam/Forms/DamSpatialEditorDecorator.cs (.../DamSpatialEditorDecorator.cs) (revision 3558)
@@ -94,6 +94,10 @@
{
get
{
+ if (index >= GeometryProbabilitiesCount)
+ {
+ index = Math.Max(0, GeometryProbabilitiesCount - 1);
+ }
var profileName = GeometryProbabilitiesCount > 0 ? GeometryProbabilities[index].SoilGeometryName : "";
if (!String.IsNullOrEmpty(profileName))
{
@@ -370,16 +374,14 @@
{
UpdateRedesignedSurfaceLine();
// Add drawing object for slip circle
-
if (ResultSlice != null)
{
DrawSlipCircle();
DetermineSlipCircleZoomLimits(out startPoint, out endPoint);
}
}
-
- decoratedSpatialEditor.EmptySelection = new EmptyShape(locationJob);
+ decoratedSpatialEditor.EmptySelection = new EmptyShape(locationJob);
if (ResultSlice != null)
{
@@ -422,27 +424,37 @@
decoratedSpatialEditor.AddShape(slipCircleObject);
}
+ private double GetMaximumDepthOfCircle()
+ {
+ var maximumDepth = double.MaxValue;
+ foreach (var stabilityResultSlice in ResultSlice.StabilityResultSlice)
+ {
+ maximumDepth = Math.Min(maximumDepth, stabilityResultSlice.BottomLeftPoint.Y);
+ maximumDepth = Math.Min(maximumDepth, stabilityResultSlice.BottomRightPoint.Y);
+ }
+ return maximumDepth;
+ }
+
///
/// Set the zoom limits when the slip circle is shown.
///
/// The bottom left screen coordinates.
/// The top right screen coordinates.
private void DetermineSlipCircleZoomLimits(out Point startPointScreen, out Point endPointScreen)
{
- const int verticalMargin = 10;
+ const int verticalMargin = 5;
var startPointWorld = new Point2D()
{
X = ResultSlice.StabilityResultSlice[0].BottomLeftPoint.X,
- Y = CurrentSoilProfile.SoilProfile.BottomLevel - verticalMargin
+ Y = GetMaximumDepthOfCircle() - verticalMargin
};
var endPointWorld = new Point2D()
{
X = ResultSlice.StabilityResultSlice[ResultSlice.StabilityResultSlice.Count - 1].BottomRightPoint.X,
Y = ResultSlice.ActiveCenterPoint.Y + verticalMargin
};
-
startPointScreen = decoratedSpatialEditor.CoordinateSystem.ConvertToScreen(startPointWorld);
endPointScreen = decoratedSpatialEditor.CoordinateSystem.ConvertToScreen(endPointWorld);
}