public double setBuldgeFromRadius(double radius, CurveLeftRightCategory leftRight) { double returnVal = 0; double t1 = 2 * radius / length(); double t2SR = Math.Sqrt(Math.Pow(radius, 2) - Math.Pow(length() / 2, 2)); double b1 = Math.Abs(t1 + 2 * t2SR / length()); double b2 = Math.Abs(t1 - 2 * t2SR / length()); if (leftRight.Value == "Right") { if (b1 <= 1) { returnVal = -b1; } else { returnVal = -b2; } } else if (leftRight.Value == "Left") { if (b1 <= 1) { returnVal = b1; } else { returnVal = b2; } } else { returnVal = 0; } this.gStart.setBuldge(returnVal); return(returnVal); }
public CurveLeftRightCategory findRightLeftKeyword(string aCallString) { CurveLeftRightCategory returnCat = CurveLeftRightCategory.NotFound; MWSelection selectionObject = findRight(0, aCallString); if (selectionObject.getStartIndex() > -1) { returnCat = CurveLeftRightCategory.Right; } if (returnCat != CurveLeftRightCategory.Right) { selectionObject = findLeft(0, aCallString); if (selectionObject.getStartIndex() > -1) { returnCat = CurveLeftRightCategory.Left; } } return(returnCat); }
public DeconstructedCallString(string aCallString, int _gStartindex, int _gEndIndex) { LegalDescriptionStringUtility util = new LegalDescriptionStringUtility(aCallString); theString = aCallString; globalStart = _gStartindex; globalEnd = _gEndIndex; //is is a curve and is it left or right if (util.findCurveKeyword(0, theString) == false) { curveLeftRight = CurveLeftRightCategory.NA; } else { curveLeftRight = util.findRightLeftKeyword(theString); } Console.WriteLine("Stop for Test"); if (curveLeftRight.Value == CurveLeftRightCategory.Left.Value || curveLeftRight.Value == CurveLeftRightCategory.Right.Value) { //find the radius radius = util.extractRadius(theString); } //set north or south MWSelection NSlocation = util.findStartDirection(0, theString); int begIndex = NSlocation.getStartIndex(); if (theString[begIndex] == 'N' || theString[begIndex] == 'n') { startDirection = StartDirectionCategory.North; } else { startDirection = StartDirectionCategory.South; } //set east or west MWSelection EWlocation = util.findEndDirection(0, theString); begIndex = EWlocation.getStartIndex(); if (theString[begIndex] == 'E' || theString[begIndex] == 'e') { endDirection = EndDirectionCategory.East; } else { endDirection = EndDirectionCategory.West; } //Find the degrees and its location in the string MWNumberSelection degreesSelection = util.extractDegrees(NSlocation.getEndIndex(), theString); degrees = Convert.ToInt32(degreesSelection.getNumberValue()); //find the minutes MWNumberSelection minutesSelection = util.extractMinutes(degreesSelection.getEndIndex(), theString); this.minutes = Convert.ToInt32(minutesSelection.getNumberValue()); //find the seconds MWNumberSelection secondsSelection = util.extractSeconds(minutesSelection.getEndIndex(), theString); //three might not be any seconds if (secondsSelection.getEndIndex() < EWlocation.getStartIndex()) { this.seconds = Convert.ToInt32(secondsSelection.getNumberValue()); } else { this.seconds = 0; } //find the length //find the seconds MWNumberSelection lengthSelection = util.extractLength(EWlocation.getEndIndex(), theString); this.length = Convert.ToDouble(lengthSelection.getNumberValue()); }