Exemple #1
0
        /// <summary>
        /// Update the extent parameters according to the map.extent parameters.
        /// </summary>
        private void UpdateExtentValues()
        {
            if (comboBoxUnits.SelectedItem != null)
            {
                mapunits = (MS_UNITS)comboBoxUnits.SelectedItem;
            }
            else
            {
                mapunits = map.units;
            }

            unitPrecision     = MapUtils.GetUnitPrecision(mapunits);
            textBoxX.Text     = Convert.ToString(Math.Round((map.extent.maxx + map.extent.minx) / 2, unitPrecision));
            textBoxY.Text     = Convert.ToString(Math.Round((map.extent.maxy + map.extent.miny) / 2, unitPrecision));
            labelUnit2.Text   = MapUtils.GetUnitName(mapunits);
            textBoxScale.Text = Convert.ToString(Convert.ToInt64(map.scaledenom));

            unitPrecision   = MapUtils.GetUnitPrecision(mapunits);
            labelUnit1.Text = MapUtils.GetUnitName(mapunits);

            double zoom = (map.extent.maxx - map.extent.minx);

            if (mapunits != map.units)
            {
                zoom = zoom * MapUtils.InchesPerUnit(map.units) / MapUtils.InchesPerUnit(mapunits);
            }

            textBoxZoomWidth.Text = Convert.ToString(Math.Round(zoom, unitPrecision));
        }
Exemple #2
0
        /// <summary>
        /// Refresh the controls according to the underlying object.
        /// </summary>
        public void RefreshView()
        {
            mapunits = map.units;

            unitPrecision     = MapUtils.GetUnitPrecision(mapunits);
            textBoxX.Text     = Convert.ToString(Math.Round((map.extent.maxx + map.extent.minx) / 2, unitPrecision));
            textBoxY.Text     = Convert.ToString(Math.Round((map.extent.maxy + map.extent.miny) / 2, unitPrecision));
            labelUnit2.Text   = MapUtils.GetUnitName(mapunits);
            textBoxScale.Text = Convert.ToString(Convert.ToInt32(map.scaledenom));

            labelUnit1.Text = MapUtils.GetUnitName(mapunits);

            double zoom = (map.extent.maxx - map.extent.minx);

            if (mapunits != map.units)
            {
                zoom = zoom * MapUtils.InchesPerUnit(map.units) / MapUtils.InchesPerUnit(mapunits);
            }

            textBoxZoomWidth.Text = Convert.ToString(Math.Round(zoom, unitPrecision));
        }