/// <summary> /// Performs the data processing associated with this editing operation. /// </summary> /// <param name="ctx">The context in which the geometry is being calculated.</param> internal override void CalculateGeometry(EditingContext ctx) { // Get the rotation & scale factor to apply. PathInfo pd = new PathInfo(this); // Go through each leg, creating the geometry for each span... // (the following is based on the logic of PathInfo.Render) // Initialize position to the start of the path. IPosition gotend = m_From; // Initial bearing is whatever the desired rotation is. double bearing = pd.RotationInRadians; double sfac = pd.ScaleFactor; for (int i = 0; i < m_Legs.Count; i++) { Leg leg = m_Legs[i]; // Include any angle specified at the start of the leg StraightLeg sLeg = (leg as StraightLeg); if (sLeg != null) { bearing = sLeg.AddStartAngle(bearing); } // Determine exit bearing for circular leg (do it now, in case an extra leg complicates matters below) double exitBearing = bearing; CircularLeg cLeg = (leg as CircularLeg); if (cLeg != null) { IPosition center, ec; double bear2bc; cLeg.GetPositions(gotend, bearing, sfac, out center, out bear2bc, out ec, out exitBearing); // The circle should have been created already, but with an undefined radius Circle circle = cLeg.Circle; Debug.Assert(circle != null); circle.Radius = cLeg.RadiusInMeters * sfac; circle.CenterPoint.ApplyPointGeometry(ctx, PointGeometry.Create(center)); } // Obtain geometry for each span and assign to attached features SpanInfo[] spans = leg.PrimaryFace.Spans; ILineGeometry[] sections = leg.GetSpanSections(gotend, bearing, sfac, spans); AttachGeometry(ctx, spans, sections); // Note the position at the end of the leg IPointGeometry legEnd = sections[sections.Length - 1].End; // If we're dealing with the first face of a staggered leg, process the second face if (leg.AlternateFace != null) { // If this is the very last leg, make sure we use the path end point (there could // conceivably be some roundoff). if (i == m_Legs.Count - 1) { legEnd = m_To.PointGeometry; } spans = leg.AlternateFace.Spans; sections = leg.GetSpanSections(gotend, legEnd, spans); AttachGeometry(ctx, spans, sections); } // Get to the end of the leg gotend = legEnd; bearing = exitBearing; } }