コード例 #1
0
        private void ApplyExtent()
        {
            double deltaX  = (map.extent.maxx - map.extent.minx) * zoomFactor / 2;
            double deltaY  = (map.extent.maxy - map.extent.miny) * zoomFactor / 2;
            double centerX = double.Parse(textBoxX.Text);
            double centerY = double.Parse(textBoxY.Text);

            map.setExtent(centerX - deltaX, centerY - deltaY, centerX + deltaX, centerY + deltaY);
            if (textBoxRotation.Text != "")
            {
                map.setRotation(double.Parse(textBoxRotation.Text));
            }

            if (target != null)
            {
                target.RaisePropertyChanged(this);
            }

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

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

            if (target != null)
            {
                target.RaiseZoomChanged(this, Math.Round(zoom, unitPrecision), map.scaledenom);
            }

            zoomFactor = 1.0;
        }
コード例 #2
0
        /// <summary>
        /// Click event handler of the buttonApply control.
        /// </summary>
        /// <param name="sender">The source object of this event.</param>
        /// <param name="e">The event parameters.</param>
        private void buttonApply_Click(object sender, EventArgs e)
        {
            double deltaX  = (map.extent.maxx - map.extent.minx) * zoomFactor / 2;
            double deltaY  = (map.extent.maxy - map.extent.miny) * zoomFactor / 2;
            double centerX = double.Parse(textBoxX.Text);
            double centerY = double.Parse(textBoxY.Text);

            map.setExtent(centerX - deltaX, centerY - deltaY, centerX + deltaX, centerY + deltaY);

            target.RaisePropertyChanged(this);

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

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

            target.RaiseZoomChanged(this, Math.Round(zoom, unitPrecision), map.scaledenom);

            zoomFactor = 1.0;
        }