using System; using System.Collections.Generic; // =========================================================================================== // Class name: // // Description: // // Copyright (c) 2008 Deltares // // Date ID Modification // 2008-04-17 Best Created // =========================================================================================== namespace Deltares.Stability.Calculation.Inner { public class TCentrePoints { // Private Declarations private List FArrayOfCentrePoints = new List(); // =========================================================================================== // Date ID Modification // 2008-04-17 Best Created // =========================================================================================== //Constructor Create() public TCentrePoints() : base() { // TODO: Add any constructor code here } public List ArrayOfCentrePoints { get { return FArrayOfCentrePoints; } } // =========================================================================================== // Date ID Modification // 2008-04-17 Best Created // =========================================================================================== public void AddCentrePoint(TCentrePoint ACentrePoint) { FArrayOfCentrePoints.Add(ACentrePoint); } // =========================================================================================== // Date ID Modification // 2008-04-17 Best Created // =========================================================================================== public void FilldataFromOldCentrePoints(TCentrePoints AHulpCentrePoint, bool HasTangentMoved) { int i; int j; double LXMid; double LZMid; double LHelpXMid; double LHelpZmid; bool LFound; for (i = 0; i < FArrayOfCentrePoints.Count; i ++) { LXMid = ArrayOfCentrePoints[i].XMid; LZMid = ArrayOfCentrePoints[i].ZMid; j = 0; LFound = false; // Find the x of the center point while (!LFound && (j < AHulpCentrePoint.ArrayOfCentrePoints.Count)) { LHelpXMid = AHulpCentrePoint.FArrayOfCentrePoints[j].XMid; // Find the Z of the center point if ((Math.Abs(LXMid - LHelpXMid) < Constants.CGeoAccu)) { LHelpZmid = AHulpCentrePoint.FArrayOfCentrePoints[j].ZMid; if ((Math.Abs(LZMid - LHelpZmid) < Constants.CGeoAccu)) { // Same Centre point if (HasTangentMoved) { // CopyRelevant circles ArrayOfCentrePoints[i].AddCalculatedcircles(AHulpCentrePoint.FArrayOfCentrePoints[j].circles.ToArray()); // There are new circels so center point is not complete ArrayOfCentrePoints[i].CentrePointMessage = ""; } else { // Radii are the same so Copy all the circles ArrayOfCentrePoints[i].circles.Clear(); ArrayOfCentrePoints[i].circles.AddRange(AHulpCentrePoint.FArrayOfCentrePoints[j].circles); ArrayOfCentrePoints[i].CentrePointMessage = AHulpCentrePoint.FArrayOfCentrePoints[j].CentrePointMessage; } } } j ++; } } } // =========================================================================================== // Date ID Modification // 2008-04-17 Best Created // =========================================================================================== public void FindMinimumCircle(double AXMidMin, double AZMidMin, double ARadMin, double AMinSafety, ref int AMinCenterpoint, ref int AMincircle) { int i; int j; double LXMid; double LZMid; double LRAd; bool LFound; i = 0; LFound = false; while (!LFound && (i < FArrayOfCentrePoints.Count)) { LXMid = ArrayOfCentrePoints[i].XMid; LZMid = ArrayOfCentrePoints[i].ZMid; if (((Math.Abs(LXMid - AXMidMin) < Constants.CGeoAccu) && (Math.Abs(LZMid - AZMidMin) < Constants.CGeoAccu))) { for (j = 0; j < ArrayOfCentrePoints[i].circles.Count; j ++) { LRAd = LZMid - ArrayOfCentrePoints[i].circles[j].ZTangent; if ((Math.Abs(LRAd - ARadMin) < Constants.CGeoAccu)) { if ((Math.Abs(ArrayOfCentrePoints[i].circles[j].FStability - AMinSafety) < Constants.CAlmostZero)) { LFound = true; AMincircle = j; AMinCenterpoint = i; } } } } i ++; } } } // end TCentrePoints }