public RaySheet(CogoStation beginStation, CogoStation endStation, Slope initialSlope) { interpretWidths = new Profile(beginStation, endStation, (double) enmWidthInterpret.HorizontalOnly); Widths = null; interpretCrossSlopes = new Profile(beginStation, endStation, (double)enmCrossSlopeInterpret.xPercentage); CrossSlopes = new Profile(beginStation, endStation, initialSlope); LiederLineHeight = 5.0; }
public Profile getSectionProfile(ptsPoint BeginPoint, double startStation, ptsPoint EndPoint) { if (null == theProfile) { theProfile = new Profile(startStation, Math.Abs(startStation), 10.0); } return theProfile; }
public ProfileVPI_VM(Profile aProfile) : base(null) { theProfile_ = aProfile; rawVPI_VM = new ObservableCollection<RawVPI_VM>(); foreach (var aRawVPI in theProfile_.VpiList.theVPIs) { rawVPI_VM.Add(new RawVPI_VM(aRawVPI)); } }
public void arithmaticAdd_computesCorrectElevation_whenBothProfilesAreOnVerticalCurves_subtract() { CogoStation sta = new CogoStation(1950.0); double el1 = (double)profile1.getElevation(sta); double el2 = (double)profile2.getElevation(sta); double expectedValue = el1 - el2; resultingProfile = Profile.arithmaticAddProfile(profile1, profile2, -1.0); double computedElevation = (double)resultingProfile.getElevation(sta); Assert.AreEqual(expectedValue, computedElevation, doubleDelta); }
public ribbonBase(CogoStation beginStation, CogoStation endStation, double initialWidth, Slope initialSlope) { if (null == beginStation) throw new ArgumentNullException("beginStation"); if (null == endStation) throw new ArgumentNullException("endStation"); interpretWidths = new Profile(beginStation, endStation, (double) enmWidthInterpret.HorizontalOnly); NominalWidth = initialWidth; Widths = new Profile(beginStation, endStation, initialWidth); interpretCrossSlopes = new Profile(beginStation, endStation, (double)enmCrossSlopeInterpret.xPercentage); NominalCrossSlope = initialSlope; resetCrossSlopes(); LiederLineHeight = 5.0; }
private static List<CogoStation> mergeStationLists(Profile First, Profile Other) { List<Double> listOfDoubles = First.allVCs.Select(vc => vc.BeginStation.trueStation).ToList(); listOfDoubles = listOfDoubles.Union(First.allVCs.Select(vc => vc.EndStation.trueStation).ToList()).ToList(); listOfDoubles = listOfDoubles.Union(Other.allVCs.Select(vc => vc.BeginStation.trueStation).ToList()).ToList(); listOfDoubles = listOfDoubles.Union(Other.allVCs.Select(vc => vc.EndStation.trueStation).ToList()).ToList(); listOfDoubles = listOfDoubles.OrderBy(sta => sta).ToList(); List<CogoStation> listOfStations = new List<CogoStation>(); foreach (Double aStationDbl in listOfDoubles) { listOfStations.Add((CogoStation) aStationDbl); } return listOfStations; }
public static void generateProfileInstatingCodeToAidTesting(Profile aProf) { long index = 0; StringBuilder instantiationCode = new StringBuilder(); instantiationCode.AppendLine(" {"); instantiationCode.AppendLine(" Profile aPfl = new Profile();"); instantiationCode.AppendLine(" "); foreach (var aVC in aProf.allVCs) { instantiationCode.AppendLine(" "); instantiationCode.Append(" // Add a Segment: No "); instantiationCode.AppendLine(index.ToString()); instantiationCode.AppendLine(" aPfl.addSegment("); instantiationCode.Append(" (CogoStation) "); instantiationCode.Append(aVC.BeginStation.trueStation.ToString()); instantiationCode.AppendLine(", // BeginStation"); instantiationCode.Append(" "); instantiationCode.Append(aVC.BeginElevation.ToString()); instantiationCode.Append(", // BeginElevation -- EndElevation = "); instantiationCode.AppendLine(aVC.EndElevation.ToString()); instantiationCode.Append(" "); instantiationCode.Append(aVC.BeginSlope.ToString()); instantiationCode.AppendLine(", // BeginSlope"); instantiationCode.Append(" "); instantiationCode.Append(aVC.EndSlope.ToString()); instantiationCode.Append(", // EndSlope -- KValue = "); instantiationCode.AppendLine(aVC.Kvalue.ToString()); instantiationCode.Append(" "); instantiationCode.Append(aVC.Length.ToString()); instantiationCode.AppendLine(", // Length"); instantiationCode.Append(" "); instantiationCode.Append(lowerCaseToString(aVC.IsBeginPINC)); instantiationCode.AppendLine(", // IsBeginPINC"); instantiationCode.Append(" "); instantiationCode.Append(lowerCaseToString(aVC.IsEndPINC)); instantiationCode.AppendLine(", // IsEndPINC"); instantiationCode.Append(" "); instantiationCode.Append(lowerCaseToString(aVC.IsaProfileGap)); instantiationCode.AppendLine("); // IsaProfileGap"); index++; } instantiationCode.AppendLine(" }"); try { System.Windows.Forms.Clipboard.SetText(instantiationCode.ToString()); } catch (Exception e) { string ignoreExcepton = e.Message; } }
public void fixedBug2012011_1() { Profile pfl2 = new Profile(); pfl2.addSegment( (CogoStation) 1000, // BeginStation 12, // BeginElevation -- EndElevation = 12 0, // BeginSlope 0, // EndSlope -- KValue = Infinity 9000, // Length false, // IsBeginPINC false, // IsEndPINC false); // IsaProfileGap Profile pfl1 = new Profile(); // Add a Segment: No 0 pfl1.addSegment( (CogoStation)1000, // BeginStation 0, // BeginElevation -- EndElevation = 0 0, // BeginSlope 0, // EndSlope -- KValue = 0 1235, // Length false, // IsBeginPINC true, // IsEndPINC false); // IsaProfileGap // Add a Segment: No 1 pfl1.addSegment( (CogoStation)2235, // BeginStation 0, // BeginElevation -- EndElevation = 12 0.0375, // BeginSlope 0.0375, // EndSlope -- KValue = 0 320, // Length true, // IsBeginPINC false, // IsEndPINC false); // IsaProfileGap // Add a Segment: No 2 pfl1.addSegment( (CogoStation)2555, // BeginStation 12, // BeginElevation -- EndElevation = 27 0.0375, // BeginSlope 0.0375, // EndSlope -- KValue = 0 400, // Length false, // IsBeginPINC true, // IsEndPINC false); // IsaProfileGap // Add a Segment: No 3 pfl1.addSegment( (CogoStation)2955, // BeginStation 27, // BeginElevation -- EndElevation = 27 0, // BeginSlope 0, // EndSlope -- KValue = 0 5095, // Length true, // IsBeginPINC true, // IsEndPINC false); // IsaProfileGap // Add a Segment: No 4 pfl1.addSegment( (CogoStation)8050, // BeginStation 27, // BeginElevation -- EndElevation = 0 -26999.9999944994, // BeginSlope -26999.9999944994, // EndSlope -- KValue = 0 0.00100000000020373, // Length true, // IsBeginPINC true, // IsEndPINC false); // IsaProfileGap // Add a Segment: No 5 pfl1.addSegment( (CogoStation)8050.001, // BeginStation 0, // BeginElevation -- EndElevation = 0 0, // BeginSlope 0, // EndSlope -- KValue = 0 1949.999, // Length true, // IsBeginPINC false, // IsEndPINC false); // IsaProfileGap Profile pflResult = Profile.arithmaticAddProfile(pfl1, pfl2, -1.0); double actualElevation = (double)pflResult.getElevation((CogoStation)5000); double expectedElevation = 15.0; Assert.AreEqual(expectedElevation, actualElevation, 0.000001); }
public void DrawCrossSection(IRM21cad2dDrawingContext cadContext, CogoStation station) { if (allPGLgroupings != null) { if (null != existingGroundSurface) { ptsPoint leftEndPt = null; ptsPoint rightEndPt = null; double distancetoLeftPoint = -200.0; if (Alignment.GetType is ptsCogo.Horizontal.rm21HorizontalAlignment) { ((ptsCogo.Horizontal.rm21HorizontalAlignment)Alignment).getCrossSectionEndPoints(station, out leftEndPt, distancetoLeftPoint, out rightEndPt, Math.Abs(distancetoLeftPoint)); } existingGroundProfile = existingGroundSurface.getSectionProfile(leftEndPt, distancetoLeftPoint, rightEndPt); } DrawExistingGroundLine(cadContext, existingGroundProfile); DrawCenterLineAnnotationelementsForXS(cadContext, station); foreach (var pglGrouping in allPGLgroupings) { pglGrouping.DrawCrossSection(cadContext, existingGroundProfile, station, pglGrouping.myIndex); } } }
public void setSectionProfileForMocking(Profile aProfileForMocking) { theProfile = aProfileForMocking; }
public void resetCrossSlopes() { CrossSlopes = new Profile(this.BeginStation, this.EndStation, NominalCrossSlope); }
public void Profile_Constraints_createAsUnconstrainedSingleValue_CreateSuccessful() { pfl21 = null; pfl21 = new Profile((CogoStation)0.0, (CogoStation)0.0, 12.0, unconstrained: true); Assert.IsTrue(pfl21.BeginIsUnconstrained && pfl21.EndIsUnconstrained); }
public void Profile_Constraints_createAsUnconstrained_createSuccessful() { pfl21 = null; pfl21 = new Profile(unconstrained: true); Assert.IsNotNull(pfl21); }
public void Profile_Constraints_constrainedBothUnconstrainedEnd_getValueAfterEnd_is14_complex() { pfl21 = null; pfl21 = new Profile((CogoStation)1000.0, (CogoStation)2000.0, 12.0, true); pfl21.appendStationAndElevation((CogoStation)2100.0, 18.0); pfl21.appendStationAndElevation((CogoStation)2200.0, 20.0); pfl21.appendStationAndElevation((CogoStation)2300.0, 14.0); double? actual = pfl21.getElevation((CogoStation)2150.0); double expected = 19.0; Assert.AreEqual(expected, actual, 0.000001); actual = pfl21.getElevation((CogoStation)500.0); Assert.IsNotNull(actual); expected = 12.0; Assert.AreEqual(expected, actual, 0.000001); }
public void Profile_Constraints_constrainedSingleValue_getValuePastEnd() { pfl21 = null; pfl21 = new Profile((CogoStation)0.0, (CogoStation)0.0, 12.0, unconstrained: false); double? actual = pfl21.getElevation((CogoStation)1000.0); Assert.IsNull(actual); }
public void Profile_Constraints_constrainedBeginUnconstrainedEnd_getValueBeforeBegin_isNull() { pfl21 = null; pfl21 = new Profile((CogoStation)1000.0, (CogoStation)2000.0, 12.0); pfl21.EndIsUnconstrained = true; double? actual = pfl21.getElevation((CogoStation)500.0); Assert.IsNull(actual); }
public void Profile_Constraints_constrainedBeginUnconstrainedEnd_getValueAfterEnd_is12() { pfl21 = null; pfl21 = new Profile((CogoStation)1000.0, (CogoStation)2000.0, 12.0); pfl21.EndIsUnconstrained = true; double? actual = pfl21.getElevation((CogoStation)2500.0); Assert.IsNotNull(actual); double expected = 12.0; Assert.AreEqual(expected, actual, 0.000001); }
public void ProfilesTestSetup() { var aVpiList = new vpiList(); aVpiList.add(1062.50, 12.0); aVpiList.add(1120.00, 12.0); aVpiList.add(1220.00, 15.0); aVpiList.add(1315.00, 15.0); aVpiList.add(1345.00, 10.0); aVpiList.add(1365.00, 10.0); aVpiList.add(1400.00, 10.0); aVpiList.add(2000.00, 14.0, 200); aVpiList.add(2500.00, 9.0); aVpiList.add(3000.00, 4.0); profile1 = new Profile(aVpiList); aVpiList = new vpiList(); aVpiList.add(1062.50, 12.0); aVpiList.add(1120.00, 12.0); aVpiList.add(1220.00, 15.0); aVpiList.add(1250.00, 15.0); aVpiList.add(1340.00, 10.0); aVpiList.add(1365.00, 10.0); aVpiList.add(1400.00, 10.0); aVpiList.add(2000.00, 14.0, 200); aVpiList.add(2500.00, 9.0); aVpiList.add(3000.00, 4.0); profile2 = new Profile(aVpiList); pfl1Setup(); pfl2Setup(); pfl3Setup(); pfl4and5Setup(); pfl6_7and8Setup(); pfl9Setup(); ray1.StartPoint = new ptsPoint(1100.0, 0.0, 10.0); ray1.Slope = new Slope(1.00); ray1.HorizontalDirection = null; ray2.StartPoint = new ptsPoint(1312.0, 0.0, 15.2); ray2.Slope = new Slope(-1.0 / 7.0); ray2.HorizontalDirection = null; ray3.StartPoint = new ptsPoint(1312.0, 0.0, 15.2); ray3.Slope = new Slope(+1.0 / 7.0); ray3.HorizontalDirection = null; ray4.StartPoint = new ptsPoint(1880.0, 0.0, 13.54533333333); ray4.Slope = new Slope(-0.02 / 100.0); ray4.HorizontalDirection = null; ray5.StartPoint = new ptsPoint(1976.600, 0.0, 13.50); ray5.Slope = new Slope(-0.06 / 100.0); ray5.advanceDirection = -1; ray5.HorizontalDirection = null; }
private static Profile scaleAprofile(Profile ProfileToScale, double scaleSecondProfile) { if (null == ProfileToScale) throw new ArgumentNullException(); Profile retProfile = new Profile(); retProfile.BeginProfTrueStation = ProfileToScale.BeginProfTrueStation; retProfile.EndProfTrueStation = ProfileToScale.EndProfTrueStation; retProfile.allVCs = new List<verticalCurve>(); foreach (verticalCurve vc in ProfileToScale.allVCs) { verticalCurve newVC = new verticalCurve(vc); if (newVC.IsaProfileGap == false) { newVC.BeginElevation *= scaleSecondProfile; newVC.BeginSlope *= scaleSecondProfile; newVC.EndSlope *= scaleSecondProfile; newVC.Length = vc.Length; // force computation of slopeRateOfChange_ } retProfile.allVCs.Add(newVC); } return retProfile; }
public void Profile_Constraints_createAsUnconstrained_VerifyConstrainedStatus() { pfl21 = null; pfl21 = new Profile(unconstrained: true); Assert.IsTrue(pfl21.BeginIsUnconstrained && pfl21.EndIsUnconstrained); }
internal void DrawCrossSection(IRM21cad2dDrawingContext cadContext, Profile existingGroundProfile, CogoStation station, int whichSide_) { int whichSide = Math.Sign(whichSide_); StationOffsetElevation StaOffEL = new StationOffsetElevation(station.trueStation, 0.0, 0.0); if (pglProfile != null) StaOffEL.elevation = pglProfile.getElevation(station); if (thePGLoffsetRibbon != null) thePGLoffsetRibbon.DrawCrossSection(cadContext, ref StaOffEL, whichSide); if (insideRibbons != null) { double pglOffset = StaOffEL.offset; double pglElevation = StaOffEL.elevation; foreach (var aRibbon in insideRibbons) { aRibbon.DrawCrossSection(cadContext, ref StaOffEL, -1 * whichSide); } StaOffEL.offset = pglOffset; StaOffEL.elevation = pglElevation; } if (outsideRibbons != null) { foreach (var aRibbon in outsideRibbons) { aRibbon.DrawCrossSection(cadContext, ref StaOffEL, whichSide); } } }
public void Profile_Constraints_unconstrainedSingleValue_getValuePastEnd_simple() { pfl21 = null; pfl21 = new Profile((CogoStation)0.0, (CogoStation)0.0, 12.0, unconstrained: true); double expected = 12.0; double? actual = pfl21.getElevation((CogoStation)1000.0); Assert.IsNotNull(actual); Assert.AreEqual(expected, actual, 0.000001); }
public void resetWidths() { Widths = new Profile(this.BeginStation, this.EndStation, NominalWidth); }
private void pfl3Setup() { var aVpiList = new vpiList(); aVpiList.add(1000.00, 12.0); aVpiList.add(1100.00, 12.0); pfl3 = new Profile(aVpiList); }
private void pfl6_7and8Setup() { var aVpiList = new vpiList(); aVpiList.add(1062.50, 12.0); aVpiList.add(1120.00, 12.0); aVpiList.add(1220.00, 15.0); aVpiList.add(1315.00, 15.0); aVpiList.add(1345.00, 10.0); aVpiList.add(1365.00, 10.0); pfl6 = new Profile(aVpiList); aVpiList = new vpiList(); aVpiList.add(2062.50, 12.0); aVpiList.add(2120.00, 12.0); aVpiList.add(2220.00, 15.0); pfl7 = new Profile(aVpiList); pfl8 = Profile.arithmaticAddProfile(pfl6, pfl7, 1.0); }
public void arithmaticAdd_computesCorrectElevation_whenOnTangentAndTangent() { CogoStation sta = new CogoStation(1100.0); double el1 = (double)profile1.getElevation(sta); double el2 = (double)profile2.getElevation(sta); double expectedValue = el1 + el2; resultingProfile = Profile.arithmaticAddProfile(profile1, profile2, 1.0); double computedElevation = (double)resultingProfile.getElevation(sta); Assert.AreEqual(expectedValue, computedElevation, doubleDelta); }
private void pfl4and5Setup() { var aVpiList = new vpiList(); aVpiList.add(1062.50, 2178.23); aVpiList.add(1120.00, 2173.973, 115.0); aVpiList.add(1220.00, 2173.140, 85.0); aVpiList.add(1315.00, 2168.2265, 90.0); aVpiList.add(1365.00, 2167.8765); pfl4 = new Profile(aVpiList); pfl5 = Profile.arithmaticAddProfile(null, pfl4, -1.0); }
public static Profile arithmaticAddProfile(Profile This, Profile Other, double scaleSecondProfile) { if (Other == null) throw new ArgumentNullException(); if (null == Other.allVCs) throw new Exception("Second profile variable has no profile segments."); // to do: check to see if both profiles are on the same hor alignment or // are both unassociated with a horizontal alignment Profile scaledProfileOther = scaleAprofile(Other, scaleSecondProfile); if (null == This) return scaledProfileOther; Profile newProf = new Profile(); newProf.allVCs = new List<verticalCurve>(); This.vcIndex = 0; Other.vcIndex = 0; Profile prof1; Profile prof2; /* if profile stations do not overlap, append end to end */ if (This.EndProfTrueStation <= Other.BeginProfTrueStation || Other.EndProfTrueStation <= This.BeginProfTrueStation) { if (This.EndProfTrueStation <= Other.BeginProfTrueStation) { prof1 = This; prof2 = Other; } else { prof1 = Other; prof2 = This; } foreach (var vc in prof1.allVCs) { newProf.allVCs.Add(new verticalCurve(vc)); } double gapLength = prof2.BeginProfTrueStation - prof1.EndProfTrueStation; if (gapLength > 0.0) { var gapVC = new verticalCurve(); gapVC.IsaProfileGap = true; gapVC.BeginStation = (CogoStation) prof1.EndProfTrueStation; gapVC.Length = gapLength; newProf.allVCs.Add(gapVC); } foreach(var vc in prof2.allVCs) { var dupVC = new verticalCurve(vc); dupVC.Scale(scaleSecondProfile); newProf.allVCs.Add(dupVC); } newProf.BeginProfTrueStation = Math.Min(prof1.BeginProfTrueStation, prof2.BeginProfTrueStation); newProf.EndProfTrueStation = Math.Max(prof1.EndProfTrueStation, prof2.EndProfTrueStation); newProf.iHaveOneOrMoreVerticalCurves = prof1.iHaveOneOrMoreVerticalCurves && prof2.iHaveOneOrMoreVerticalCurves; return newProf; } /* end if profile stations do not overlap, append end to end */ prof1 = This; prof2 = scaledProfileOther; List<CogoStation> mergedStationList = mergeStationLists(prof1, prof2); CogoStation begSta = new CogoStation(); verticalCurve prevVC = new verticalCurve(); long count = -1; foreach (var endSta in mergedStationList) { count++; if (count == 0) { begSta = endSta; newProf.BeginProfTrueStation = begSta.trueStation; continue; } double? begEL1 = prof1.getElevationFromTheRight(begSta); double? begEL2 = prof2.getElevationFromTheRight(begSta); double? endEL1 = prof1.getElevationFromTheLeft(endSta); //start here. why is this returning null? double? endEL2 = prof2.getElevationFromTheLeft(endSta); double? begSlope1 = prof1.getSlopeFromTheRight(begSta); double? begSlope2 = prof2.getSlopeFromTheRight(begSta); double? endSlope1 = prof1.getSlopeFromTheLeft(endSta); double? endSlope2 = prof2.getSlopeFromTheLeft(endSta); double? Kvalue1 = prof1.getKValueFromTheRight(begSta); double? Kvalue2 = prof2.getKValueFromTheRight(begSta); double newBegEL = utilFunctions.addNullableDoubles(begEL1, begEL2); double newEndEL = utilFunctions.addNullableDoubles(endEL1, endEL2); double newBegSlope = utilFunctions.addNullableDoubles(begSlope1, begSlope2); double newEndSlope = utilFunctions.addNullableDoubles(endSlope1, endSlope2); double newKValue = utilFunctions.addRecipricals(Kvalue1, Kvalue2); double length = endSta - begSta; var newVC = new verticalCurve(begSta, newBegEL, newBegSlope, length, newKValue); // bug: add EndStation value newProf.allVCs.Add(newVC); if (count == 1) { newVC.IsBeginPINC = false; } else { prevVC.IsEndPINC = newVC.IsBeginPINC = false; if (prevVC.EndSlope != newVC.BeginSlope) prevVC.IsEndPINC = newVC.IsBeginPINC = true; else if (prevVC.EndElevation != newVC.BeginElevation) prevVC.IsEndPINC = newVC.IsBeginPINC = true; } prevVC = newVC; begSta = endSta; newProf.EndProfTrueStation = endSta.trueStation; } return newProf; }
private void DrawExistingGroundLine(IRM21cad2dDrawingContext cadContext, Profile existingGroundProfile) { if (null == existingGroundProfile) return; cadContext.setElementColor(Color.FromArgb(128, 255, 255, 255)); cadContext.setElementWeight(2.0); cadContext.addToDashArray(12); cadContext.addToDashArray(2); existingGroundProfile.draw(cadContext); }
private void pfl9Setup() { // Tests for adding two profiles that cover the same range: No VCs var aVpiList = new vpiList(); aVpiList.add(1062.50, 12.0); aVpiList.add(1120.00, 12.0); aVpiList.add(1220.00, 15.0); aVpiList.add(1315.00, 15.0); aVpiList.add(1345.00, 10.0); aVpiList.add(1365.00, 10.0); var aProfile = new Profile(aVpiList); aVpiList = new vpiList(); aVpiList.add(1062.50, 12.0); aVpiList.add(1120.00, 12.0); aVpiList.add(1219.00, 15.0); aVpiList.add(1315.00, 15.0); aVpiList.add(1345.00, 10.0); aVpiList.add(1365.00, 10.0); var otherPfl = new Profile(aVpiList); pfl9 = Profile.arithmaticAddProfile(aProfile, otherPfl, 1.0); }