/// <summary>
        /// Constructor for use when editing a connection path
        /// </summary>
        /// <param name="leg">The leg that's being edited</param>
        internal CulDeSacForm(CircularLeg leg)
        {
            InitializeComponent();

            CircularLegMetrics metrics = leg.Metrics;
            m_Radians = metrics.CentralAngle;
            m_Radius = new Distance(metrics.ObservedRadius);
            m_IsClockwise = metrics.IsClockwise;
            m_IsDefined = true;
        }
Exemple #2
0
        /// <summary>
        /// Constructor for use when editing a connection path
        /// </summary>
        /// <param name="leg">The leg that's being edited</param>
        internal CulDeSacForm(CircularLeg leg)
        {
            InitializeComponent();

            CircularLegMetrics metrics = leg.Metrics;

            m_Radians     = metrics.CentralAngle;
            m_Radius      = new Distance(metrics.ObservedRadius);
            m_IsClockwise = metrics.IsClockwise;
            m_IsDefined   = true;
        }
Exemple #3
0
        /// <summary>
        /// Constructor for use when editing a connection path
        /// </summary>
        /// <param name="leg">The leg that's being edited</param>
        internal ArcForm(CircularLeg leg)
        {
            InitializeComponent();

            CircularLegMetrics metrics = leg.Metrics;

            m_Angle1      = metrics.EntryAngle;
            m_Angle2      = metrics.ExitAngle;
            m_Radius      = new Distance(metrics.ObservedRadius);
            m_IsClockwise = metrics.IsClockwise;
            m_IsDefined   = true;
        }
Exemple #4
0
        /// <summary>
        /// Constructor for use when editing a connection path
        /// </summary>
        /// <param name="leg">The leg that's being edited</param>
        internal ArcForm(CircularLeg leg)
        {
            InitializeComponent();

            CircularLegMetrics metrics = leg.Metrics;

            m_Angle1 = metrics.EntryAngle;
            m_Angle2 = metrics.ExitAngle;
            m_Radius = new Distance(metrics.ObservedRadius);
            m_IsClockwise = metrics.IsClockwise;
            m_IsDefined = true;
        }
Exemple #5
0
        private void curveButton_Click(object sender, EventArgs e)
        {
            CircularLeg leg = (CurrentFace.Leg as CircularLeg);

            if (leg == null)
            {
                return;
            }

            CircularLegMetrics metrics = leg.Metrics;

            if (metrics.IsCulDeSac)
            {
                using (CulDeSacForm dial = new CulDeSacForm(leg))
                {
                    if (dial.ShowDialog() == DialogResult.OK)
                    {
                        metrics.SetCentralAngle(dial.CentralAngle);
                        metrics.SetRadius(dial.Radius);
                        metrics.IsClockwise = dial.IsClockwise;
                        var newMetrics = new CircularLegMetrics(dial.Radius, dial.IsClockwise, dial.CentralAngle);
                        m_Edits.SetArcMetrics(m_CurFaceIndex, newMetrics);
                        Rework();
                    }
                }
            }
            else
            {
                using (ArcForm dial = new ArcForm(leg))
                {
                    if (dial.ShowDialog() == DialogResult.OK)
                    {
                        metrics.SetEntryAngle(dial.EntryAngle);
                        metrics.SetExitAngle(dial.ExitAngle);
                        metrics.SetRadius(dial.Radius);
                        metrics.IsClockwise = dial.IsClockwise;
                        var newMetrics = new CircularLegMetrics(dial.Radius, dial.IsClockwise, dial.EntryAngle, dial.ExitAngle);
                        m_Edits.SetArcMetrics(m_CurFaceIndex, newMetrics);
                        Rework();
                    }
                }
            }
        }
Exemple #6
0
        /// <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;
            }
        }