public override void DrawCrossSection(IRM21cad2dDrawingContext cadContext,
  ref StationOffsetElevation aSOE, int whichSide)
 {
     base.setupCrossSectionDrawing(cadContext);
      cadContext.setElementColor(Color.FromArgb(255, 40, 123, 54));
      cadContext.setElementWeight(1.1);
      base.DrawCrossSection(cadContext, ref aSOE, whichSide);
 }
Beispiel #2
0
        public override void DrawCrossSection(IRM21cad2dDrawingContext cadContext,
         ref StationOffsetElevation aSOE, int whichSide)
        {
            base.setupCrossSectionDrawing(cadContext);
             cadContext.setElementColor(Color.FromArgb(128, 128, 128, 128));
             cadContext.setElementWeight(0.75);
             cadContext.addToDashArray(5);

             SuppressSlopeText = true;
             base.DrawCrossSection(cadContext, ref aSOE, whichSide);
        }
 public void ComplexRibbon_WhenAtStation1550offset18_ElevationChangeIsPlus1p28()
 {
     String conditionString = "Elevation change is +1.28 when 18.0' rt of station 15+50";
      Double expectedDbl = 1.28;
      var soe1 = new StationOffsetElevation();
      soe1.station = 1550.00;
      soe1.offset = 18.0;
      soe1.elevation = 0.0;
      complexRibbon.accumulateRibbonTraversal(ref soe1);
      Double actualDbl = (Double)soe1.elevation;
      Assert.AreEqual(expected: expectedDbl, actual: actualDbl, message: conditionString);
 }
Beispiel #4
0
        public override void DrawCrossSection(IRM21cad2dDrawingContext cadContext,
         ref StationOffsetElevation aSOE, int whichSide)
        {
            double LLH = LiederLineHeight;
             double ribbonWidth;
             double X1 = aSOE.offset;
             double Y1 = aSOE.elevation;
             this.moveToOuterEdge(ref aSOE, whichSide);
             if (X1 == aSOE.offset && Y1 == aSOE.elevation) return;

             cadContext.Draw(X1, Y1, aSOE.offset, aSOE.elevation);
             return;
        }
Beispiel #5
0
        public override void moveToOuterEdge(ref StationOffsetElevation aSOE, int whichSide)
        {
            //double traversedWidth;
             double? theWidth;
             tupleNullableDoubles result;
             double? theCrossSlope = getCrossSlope((CogoStation)aSOE.station, out result);
             if (result.isSingleValue == false)
             {
            if (result.ahead != null)
            {
               theCrossSlope = result.ahead;
            }
            else if (result.back != null)
            {
               theCrossSlope = result.back;
            }
            else
            {
               throw new NotImplementedException("Width discontinuity is not allowed. This happens at station = " + aSOE.station);
            }
             }

             ptsRay thisAsRay = new ptsRay();
             thisAsRay.StartPoint = new ptsPoint(aSOE.offset, 0.0, aSOE.elevation);
             thisAsRay.Slope = (double)theCrossSlope;
             thisAsRay.advanceDirection = whichSide;
             Profile rayAsProfile = this.MyParentPGLgrouping.ParentCorridor.existingGroundProfile.getIntersections(thisAsRay).FirstOrDefault<Profile>();

             theWidth = Math.Abs(rayAsProfile.EndProfTrueStation - rayAsProfile.BeginProfTrueStation);
             if (theWidth == null) theWidth = 0.0;

             aSOE.offset += theWidth * whichSide;

             if (theCrossSlope == null) theCrossSlope = 0.0;
             aSOE.elevation += theCrossSlope * theWidth;
        }
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            Double piOver2 = Math.PI / 2.0;
             ptsVector alongVector = new ptsVector(this.BeginAzimuth, anSOE.station - this.BeginStation);
             ptsPoint returnPoint = this.BeginPoint + alongVector;
             returnPoint.z = anSOE.elevation.EL;

             Azimuth perpandicularAzimuth = this.BeginAzimuth + piOver2;
             ptsVector perpandicularVector = new ptsVector(perpandicularAzimuth, anSOE.offset.OFST);
             returnPoint = returnPoint + perpandicularVector;

             return returnPoint;
        }
 public override void drawHorizontalByOffset(IPersistantDrawer_Cogo drawer, StationOffsetElevation soe1, StationOffsetElevation soe2)
 {
     ptsPoint startPoint = this.getXYZcoordinates(soe1);
      ptsPoint endPoint = this.getXYZcoordinates(soe2);
      drawer.PlaceLine(this, startPoint, soe1, endPoint, soe2);
 }
        public virtual void moveToOuterEdge(ref StationOffsetElevation aSOE, int whichSide)
        {
            //double traversedWidth;
             tupleNullableDoubles result;
             double? theWidth = getActualWidth((CogoStation)aSOE.station, out result);
             if (result.isSingleValue == false)
             {
            if (result.ahead !=null)
            {
               theWidth = result.ahead;
            }
            else if (result.back != null)
            {
               theWidth = result.back;
            }
            else
            {
               throw new NotImplementedException("Width discontinuity is not allowed. This happens at station = " + aSOE.station);
            }
             }

             double? theCrossSlope = getCrossSlope((CogoStation)aSOE.station, out result);
             if (result.isSingleValue == false)
             {
            if (result.ahead != null)
            {
               theCrossSlope = result.ahead;
            }
            else if (result.back != null)
            {
               theCrossSlope = result.back;
            }
            else
            {
               throw new NotImplementedException("Width discontinuity is not allowed. This happens at station = " + aSOE.station);
            }
             }

             if (theWidth == null) theWidth = 0.0;

             aSOE.offset += theWidth * whichSide;

             if (theCrossSlope == null) theCrossSlope = 0.0;
             aSOE.elevation += theCrossSlope * theWidth;
        }
 public virtual void PersistantDraw(IPersistantDrawer drawer)
 {
     StationOffsetElevation soe1 = null;
      StationOffsetElevation soe2 = new StationOffsetElevation();
      var drawPoints = getOutsideEdgeDrawPoints();
      if (null == drawPoints) return;
      foreach (var sta2 in drawPoints)
      {
     soe2 = this.getOutsideEdgeStationOffsetElevation(sta2);
     if (soe1 != null)
     {
        Double aveStation = (sta2.trueStation + soe1.station) / 2.0;
        HorizontalAlignmentBase HAelement =
           this.GoverningAlignment.GetElementByStation(aveStation);
        HAelement.drawHorizontalByOffset(drawer, soe1, soe2);
     }
     soe1 = soe2;
      }
 }
 public virtual ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
 {
     return null;
 }
Beispiel #11
0
        public override List<StationOffsetElevation> getStationOffsetElevation(ptsPoint interestPoint)
        {
            ptsVector arcCenterToInterestPtVector = new ptsVector(this.ArcCenterPt, interestPoint);
             Deflection deflToInterestPt = new Deflection(this.BeginRadiusVector.Azimuth, arcCenterToInterestPtVector.Azimuth, true);
             int arcDeflDirection = Math.Sign(this.Deflection.getAsDegreesDouble());
             if (arcDeflDirection * deflToInterestPt.getAsDegreesDouble() < 0.0)
             {
            return null;
             }
             else if (Math.Abs(this.Deflection.getAsDegreesDouble()) - Math.Abs(deflToInterestPt.getAsDegreesDouble()) < 0.0)
             {
            return null;
             }

             Double interestLength = this.Length * deflToInterestPt.getAsRadians() / this.Deflection.getAsRadians();
             Offset offset =  new Offset(arcDeflDirection * (this.Radius - arcCenterToInterestPtVector.Length));

             var soe = new StationOffsetElevation(this.BeginStation + interestLength, offset, 0.0);
             var returnList = new List<StationOffsetElevation>();
             returnList.Add(soe);
             return returnList;
        }
        public int getCrossSlope(StationOffsetElevation soePoint, ref Slope theCrossSlope)
        {
            StationOffsetElevation workingSOE = new StationOffsetElevation(soePoint);
             workingSOE.offset *= myIndex;
             IRibbonLike bingoRibbon=null;

             // seek the correct ribbon
             if (thePGLoffsetRibbon != null)
             {
            double? pglOffset = thePGLoffsetRibbon.getActualWidth((CogoStation)workingSOE.station);
            if (pglOffset != null)
               workingSOE.offset -= pglOffset;
             }
             if (workingSOE.offset > 0.0)
             {
            if (outsideRibbons == null) return 1;

            foreach (var aRibbon in outsideRibbons)
            {
               aRibbon.accumulateRibbonTraversal(ref workingSOE);
               bingoRibbon = aRibbon;
               if (workingSOE.offset <= 0.0) break;
            }
            if (workingSOE.offset > 0.0)
               return 1;
             }
             else if (workingSOE.offset < 0.0)
             {
            if (insideRibbons == null) return -1;

            workingSOE.offset *= -1.0;
            foreach (var aRibbon in insideRibbons)
            {
               aRibbon.accumulateRibbonTraversal(ref workingSOE);
               bingoRibbon = aRibbon;
               if (workingSOE.offset <= 0.0) break;
            }
            if (workingSOE.offset > 0.0)
               return -1;
             }
             else
            workingSOE.elevation = 0.0;

             theCrossSlope = null;
             if (bingoRibbon != null)
             {
            theCrossSlope = bingoRibbon.getCrossSlope((CogoStation) (soePoint.station));
             }

             return 0;
        }
        public bool getElevation(ref StationOffsetElevation soePoint)
        {
            foreach (var pglGr in allPGLgroupings)
             {
            int isOnThisPGLgrp = pglGr.getElevationFromSOE(ref soePoint);
            if (isOnThisPGLgrp == 0)
               return true;
             }

             return false;
        }
 public void RibbonSingleSimple_WhenAtStation1150offset7RT_ElevationDropIsNeg0p14()
 {
     String conditionString = "Verify elevation drop is -0.14 when 7.0' rt of station 11+50";
      Double expectedDbl = -0.14;
      var soe1 = new StationOffsetElevation();
      soe1.station = 1150.00;
      soe1.offset = 7.0;
      soe1.elevation = 0.0;
      simpleRibbon.accumulateRibbonTraversal(ref soe1);
      Double actualDbl = soe1.elevation;
      Assert.AreEqual(expected: expectedDbl, actual: actualDbl, message: conditionString);
 }
        public override List<StationOffsetElevation> getStationOffsetElevation(ptsPoint interestPoint)
        {
            ptsVector BeginToInterestPtVector = new ptsVector(this.BeginPoint, interestPoint);
             Deflection BeginToInterestDeflection = new Deflection(this.BeginAzimuth, BeginToInterestPtVector.Azimuth, true);
             if (Math.Abs(BeginToInterestDeflection.getAsDegreesDouble()) > 90.0)
            return null;

             ptsVector EndToInterestPtVector = new ptsVector(this.EndPoint, interestPoint);
             Deflection EndToInterestDeflection = new Deflection(this.EndAzimuth, EndToInterestPtVector.Azimuth, true);
             if (Math.Abs(EndToInterestDeflection.getAsDegreesDouble()) < 90.0)
            return null;

             Double length = BeginToInterestPtVector.Length * Math.Cos(BeginToInterestDeflection.getAsRadians());
             Double theStation = this.BeginStation + length;

             Double offset = BeginToInterestPtVector.Length * Math.Sin(BeginToInterestDeflection.getAsRadians());

             var soe = new StationOffsetElevation(this.BeginStation + length, offset, 0.0);
             var returnList = new List<StationOffsetElevation>();
             returnList.Add(soe);
             return returnList;
        }
 public void RibbonSingleSimple_WhenAtStation1150offset14_OffsetRemainderIs2()
 {
     String conditionString = "At 14 ft right of 11+50, offset has remainder value of 2.0.";
      Double expectedDbl = 2.0;
      var soe1 = new StationOffsetElevation();
      soe1.station = 1150.00;
      soe1.offset = 14.0;
      soe1.elevation = 0.0;
      simpleRibbon.accumulateRibbonTraversal(ref soe1);
      Double actualDbl = soe1.offset;
      Assert.AreEqual(expected: expectedDbl, actual: actualDbl, message: conditionString);
 }
        public void HorizontalAlignment_givenStationOffsetValues_getXYvalues()
        {
            bool allValuesAgree = true;
             List<IRM21fundamentalGeometry> fundmtlGeoms = createTestHA_fundGeom1();

             rm21HorizontalAlignment HA = new rm21HorizontalAlignment(
            fundamentalGeometryList: fundmtlGeoms,
            Name: null, stationEquationing: null);

             StationOffsetElevation anSOE = new StationOffsetElevation();

             // test a point right of the second line segment (the third segment)
             anSOE.station = 3611.75; anSOE.offset.OFST = 238.949;
             ptsPoint anXYpoint = HA.getXYZcoordinates(anSOE);
             if (anXYpoint != null)
             {
            allValuesAgree &= anXYpoint.x.tolerantEquals(6180.0, 0.014);
            allValuesAgree &= anXYpoint.y.tolerantEquals(4460.0, 0.014);
            allValuesAgree &= anXYpoint.z.tolerantEquals(0.0, 0.000001);
             }
             else
             {
            allValuesAgree = false;
             }

             // test a point right of the second arc (the fourth segment)
             anSOE.station = 4469.2978; anSOE.offset.OFST = 138.1336;
             anXYpoint = HA.getXYZcoordinates(anSOE);
             if (anXYpoint != null)
             {
            allValuesAgree &= anXYpoint.x.tolerantEquals(7062.3839, 0.014);
            allValuesAgree &= anXYpoint.y.tolerantEquals(4636.0766, 0.014);
            allValuesAgree &= anXYpoint.z.tolerantEquals(0.0, 0.000001);
             }
             else
             {
            allValuesAgree = false;
             }

             Assert.IsTrue(allValuesAgree);
        }
        public void HorizontalAlignment_buildFreehand_PointIs8LeftOf2000()
        {
            var HA = buildFrehandHAforTesting();
             Assert.IsNotNull(HA);

             StationOffsetElevation soe = new StationOffsetElevation(2000.0, -8.0, 0.0);
             var pt = HA.getXYZcoordinates(soe);

             Double expectedX = 2084191.011134;
             Double actualX = pt.x;
             Assert.AreEqual(expected: expectedX, actual: actualX, delta: 0.0025);
             Double expectedY = 741266.52458;
             Double actualY = pt.y;
             Assert.AreEqual(expected: expectedY, actual: actualY, delta: 0.0025);
        }
        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 accumulateRibbonTraversal(ref StationOffsetElevation aSOE);
        /// <summary>
        /// Gets the elevation of a point on the PGLgrouping
        /// if the point is on the grouping.  If the point is off the grouping to 
        /// the left, return -1.  If it is off the grouping to the right, 
        /// retrun +1.
        /// </summary>
        /// <param name="soePoint">Reads station and offset.
        /// Sets elevation.</param>
        /// <returns>0 if the point is on the PGLgrouping
        /// -1 if the point is left of the grouping
        /// +1 if the point is right of the grouping</returns>
        public int getElevationFromSOE(ref StationOffsetElevation soePoint)
        {
            StationOffsetElevation workingSOE = new StationOffsetElevation(soePoint);
             workingSOE.offset *= myIndex;

             // seek the correct ribbon
             if (thePGLoffsetRibbon != null)
             {
            double? pglOffset = thePGLoffsetRibbon.getActualWidth((CogoStation)workingSOE.station);
            if (pglOffset != null)
               workingSOE.offset -= pglOffset;
             }
             if (workingSOE.offset > 0.0)
             {
            if (outsideRibbons == null) return 1;

            foreach (var aRibbon in outsideRibbons)
            {
               aRibbon.accumulateRibbonTraversal(ref workingSOE);
               if (workingSOE.offset <= 0.0) break;
            }
            if (workingSOE.offset > 0.0)
               return 1;
             }
             else if (workingSOE.offset < 0.0)
             {
            if (insideRibbons == null) return -1;

            workingSOE.offset *= -1.0;
            foreach (var aRibbon in insideRibbons)
            {
               aRibbon.accumulateRibbonTraversal(ref workingSOE);
               if (workingSOE.offset <= 0.0) break;
            }
            if (workingSOE.offset > 0.0)
               return -1;
             }
             else
            workingSOE.elevation = 0.0;

             soePoint.elevation = workingSOE.elevation;

             return 0;
        }
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            if (anSOE.station < this.BeginStation || anSOE.station > this.EndStation)
            return null;

             ptsPoint returnPoint = new ptsPoint();
             foreach (var segment in this.allChildSegments)
             {
            if (anSOE.station < segment.EndStation)
            {
               return segment.getXYZcoordinates(anSOE);
            }
             }
             return null;
        }
Beispiel #22
0
        public override ptsPoint getXYZcoordinates(StationOffsetElevation anSOE)
        {
            if (anSOE.station < this.BeginStation || anSOE.station > this.EndStation)
            return null;

             Double lengthIntoCurve = anSOE.station - this.BeginStation;

             Deflection deflToSOEpoint = new Deflection(this.BeginDegreeOfCurve.getAsRadians() * lengthIntoCurve / 100.0, this.deflDirection);
             Azimuth ccToSOEpointAzimuth = this.BeginRadiusVector.Azimuth + deflToSOEpoint;

             Double ccToSOEpointDistance = this.Radius - this.deflDirection * anSOE.offset.OFST;

             ptsVector ccToSOEpoint = new ptsVector(ccToSOEpointAzimuth, ccToSOEpointDistance);

             return this.ArcCenterPt + ccToSOEpoint;
        }
 public ptsPoint getXYZcoordinates(double station, double offset, double elevation)
 {
     var anSOE = new StationOffsetElevation(station, new Offset(offset), new Elevation(elevation));
      return getXYZcoordinates(anSOE);
 }
 public void ComplexRibbon_WhenAtStation1550offset18_remainderOffsetIs2()
 {
     String conditionString = "Offset remainder is 2.0 when 18.0' rt of station 15+50";
      Double expectedDbl = 2.0;
      var soe1 = new StationOffsetElevation();
      soe1.station = 1550.00;
      soe1.offset = 18.0;
      soe1.elevation = 0.0;
      complexRibbon.accumulateRibbonTraversal(ref soe1);
      Double actualDbl = (Double)soe1.offset;
      Assert.AreEqual(expected: expectedDbl, actual: actualDbl, message: conditionString);
 }
        public bool getCrossSlope(StationOffsetElevation soePoint, ref Slope xSlope)
        {
            foreach (var pglGr in allPGLgroupings)
             {
            int isOnThisPGLgrp = pglGr.getCrossSlope(soePoint, ref xSlope);
            if (isOnThisPGLgrp == 0)
               return true;
             }

             return false;
        }
Beispiel #26
0
        public virtual void accumulateRibbonTraversal(ref StationOffsetElevation aSOE)
        {
            double traversedWidth;
             tupleNullableDoubles result;
             double? availableWidth = getActualWidth((CogoStation) aSOE.station, out result);
             if (result.isSingleValue == false)
             { throw new NotImplementedException("Width discontinuity is not allowed. This happens at station = " + aSOE.station);}

             double? crossSlope = getCrossSlope((CogoStation)aSOE.station, out result);
             if (result.isSingleValue == false)
             { throw new NotImplementedException("Cross slope discontinuity is not allowed. This happens at station = " + aSOE.station); }

             if (availableWidth == null) availableWidth = 0.0;

             if ((double)availableWidth > aSOE.offset)
             {
            traversedWidth = aSOE.offset;
            aSOE.offset = 0.0;
             }
             else
             {
            traversedWidth = (double) availableWidth;
            aSOE.offset -= traversedWidth;
             }

             if (crossSlope == null) crossSlope = 0.0;
             if (aSOE.elevation == null) aSOE.elevation = new Elevation(0.0);
             aSOE.elevation += traversedWidth * (double)crossSlope;
        }
        /* * /
          public bool isUnitUSsurveyFoot { get { return thisUnit == Unit.SurveyFoot; } set { thisUnit = Unit.SurveyFoot; } }
          public bool isUnitFoot { get; set; }
          public bool isUnitMeter { get; set; }

          private enum Unit{Meter, Foot, SurveyFoot}
          private HorizontalAlignmentBase.Unit thisUnit { get; set; }  /*  */
        public virtual void drawHorizontalByOffset(IPersistantDrawer_Cogo drawer, StationOffsetElevation soe1, StationOffsetElevation soe2)
        {
        }
Beispiel #28
0
        public virtual void DrawCrossSection(IRM21cad2dDrawingContext cadContext, 
         ref StationOffsetElevation aSOE, int whichSide)
        {
            double LLH = LiederLineHeight;
             double ribbonWidth;
             double X1 = aSOE.offset;
             double Y1 = aSOE.elevation;
             this.moveToOuterEdge(ref aSOE, whichSide);
             if (X1 == aSOE.offset && Y1 == aSOE.elevation) return;

             cadContext.Draw(X1, Y1, aSOE.offset, aSOE.elevation);

             setupCrossSectionDrawing(cadContext);
             ribbonWidth = Math.Abs(aSOE.offset - X1);
             cadContext.setElementWeight(0.8);
             cadContext.setElementColor(Color.FromArgb(124, 255, 255, 255));
             cadContext.Draw(X1, LLH + 0.5, aSOE.offset, LLH + 0.5);
             cadContext.Draw(aSOE.offset, 0.5, aSOE.offset, LLH + 1.5);
             string widthStr = (Math.Round(ribbonWidth*10)/10).ToString();
             cadContext.Draw(widthStr, X1 + whichSide * ribbonWidth / 2, LLH + 0.5, 0.0);

             if (false == SuppressSlopeText)
             {
            Slope mySlope = new Slope((aSOE.elevation - Y1) / (aSOE.offset - X1));
            if (whichSide > 0)
               cadContext.Draw(mySlope.ToString(),
                  (X1 + aSOE.offset) / 2,
                  (Y1 + aSOE.elevation) / 2,
                  mySlope.getAsDegreesDouble());
            else
               cadContext.Draw(mySlope.FlipDirection().ToString(),
                  (X1 + aSOE.offset) / 2,
                  (Y1 + aSOE.elevation) / 2,
                  mySlope.getAsDegreesDouble());
             }
             SuppressSlopeText = false;
        }
Beispiel #29
0
        public StationOffsetElevation getOutsideEdgeStationOffsetElevation(CogoStation sta)
        {
            StationOffsetElevation returnItem = new StationOffsetElevation();
             returnItem.station = sta.trueStation;
             returnItem.offset = this.myOffsets.getElevation(sta);
             returnItem.elevation = 0.0;

             return returnItem;
        }
 public StationOffsetElevation(StationOffsetElevation soeOther)
 {
     station = soeOther.station;
      offset = soeOther.offset;
      elevation = soeOther.elevation;
 }