Beispiel #1
0
        internal void Draw()
        {
            // Highlight the line we are subdividing
            ISpatialDisplay draw = m_Cmd.ActiveDisplay;
            //IDrawStyle style = EditingController.Current.HighlightStyle;
            //m_Line.Render(draw, style);

            // Draw the points (except for the last one, which should
            // correspond with either the start or the end of the line
            // we are subdividing).
            List <IPosition> pts = Calculate();

            if (pts != null)
            {
                IDrawStyle style = EditingController.Current.Style(Color.Magenta);

                for (int i = 0; i < pts.Count - 1; i++)
                {
                    style.Render(draw, pts[i]);
                }
            }

            DistanceUnit entryUnit = EditingController.Current.EntryUnit;
            double       tot       = GetTotalDistance();
            string       s         = (tot < Double.Epsilon ? String.Empty : entryUnit.Format(tot));

            totalEnteredTextBox.Text = s;

            s = (tot < Double.Epsilon ? String.Empty : entryUnit.Format(m_GroundLength - tot));
            lengthLeftTextBox.Text = s;
        }
Beispiel #2
0
        void ShowResults(DistanceUnitType dunit)
        {
            DistanceUnit unit = EditingController.GetUnits(dunit);

            lengthTextBox.Text       = unit.Format(m_Length);
            totalEnteredTextBox.Text = unit.Format(m_Entered);
            lengthLeftTextBox.Text   = unit.Format(m_Length - m_Entered);
        }
Beispiel #3
0
        void ShowResults(DistanceUnitType type)
        {
            DistanceUnit unit = EditingController.GetUnits(type);

            if (unit == null)
            {
                return;
            }

            lengthLabel.Text        = unit.Format(m_Length, false, -1);
            deltaNorthingLabel.Text = unit.Format(m_DeltaN, false, -1);
            deltaEastingLabel.Text  = unit.Format(m_DeltaE, false, -1);
        }
Beispiel #4
0
        private void LineSubdivisionControl_Load(object sender, EventArgs e)
        {
            // Display at top left corner of the screen.
            //SetDesktopLocation(0, 0);

            // Display the length of the arc that is being subdivided (in
            // the current data entry units).
            DistanceUnit dunit = EditingController.Current.EntryUnit;

            lengthTextBox.Text = dunit.Format(m_GroundLength);

            // Check the radio button saying distances are from the
            // start of the line.
            startRadioButton.Checked = true;
            endRadioButton.Checked   = false;

            // If we have recalled distances from some earlier edit, load up the list.
            if (m_Distances != null)
            {
                string[] ds = new string[m_Distances.Count];
                for (int i = 0; i < ds.Length; i++)
                {
                    ds[i] = m_Distances[i].Format();
                }
                distancesTextBox.Lines = ds;
            }

            distancesTextBox.Focus();
            distancesTextBox.ScrollToCaret();
        }
Beispiel #5
0
        /// <summary>
        /// Returns a formatted distance string.
        /// </summary>
        /// <param name="metric">The distance on the mapping plane (in meters).</param>
        /// <param name="from">The start position.</param>
        /// <param name="to">The end position.</param>
        /// <returns>The formatted distance</returns>
        protected string Format(double metric, IPosition from, IPosition to)
        {
            if (m_Unit == null)
            {
                m_Distance = String.Empty;
            }
            else
            {
                // Get the fixed number of significant digits to show.
                int prec = -1;

                if (m_Unit.UnitType == DistanceUnitType.Meters)
                {
                    prec = 3;
                }
                else if (m_Unit.UnitType == DistanceUnitType.Feet)
                {
                    prec = 2;
                }
                else if (m_Unit.UnitType == DistanceUnitType.Chains)
                {
                    prec = 4;
                }

                // Get string for the planar distance.
                string pstring = m_Unit.Format(metric, true, prec);

                // Get string for the ground distance (don't bother with
                // units abbreviation).
                ISpatialSystem sys     = CadastralMapModel.Current.SpatialSystem;
                double         sfac    = sys.GetLineScaleFactor(from, to);
                double         gmetric = metric / sfac;
                string         gstring = m_Unit.Format(gmetric, false, prec);

                // Format the complete string.
                m_Distance = String.Format("{0} ({1} on ground)", pstring, gstring);
            }

            return(m_Distance);
        }
Beispiel #6
0
 /// <summary>
 /// Formats this distance in units that correspond to the original data entry unit.
 /// </summary>
 /// <param name="appendAbbrev">True if units abbreviation should be appended.</param>
 /// <returns></returns>
 internal string Format(bool appendAbbrev)
 {
     return(m_EnteredUnit == null ?
            String.Empty : m_EnteredUnit.Format(m_ObservedMetric, appendAbbrev));
 }
Beispiel #7
0
 /// <summary>
 /// Formats this distance in a specific unit of measurement.
 /// </summary>
 /// <param name="unit">The desired unit of measurement.</param>
 /// <param name="appendAbbrev">True if units abbreviation should be appended (default was TRUE)</param>
 /// <returns></returns>
 internal string Format(DistanceUnit unit, bool appendAbbrev)
 {
     return(unit.Format(m_ObservedMetric, appendAbbrev));
 }