Пример #1
0
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            double x, y, lat, lon;

            _getXY(e.Location, out x, out y);
            _ortho.ToSphere(x, y, out lat, out lon);
            string     text    = null;
            WSMCountry cDef    = _ttC.GetDataAtPointer(e) as WSMCountry;
            string     country = (cDef == null ? "Sea" : cDef.Name);

            if (!double.IsNaN(lat) && !double.IsNaN(lon))
            {
                text = "Latitude:" + GeoCoordinateUtilities.FormatLatitude(lat) + "   Longitude:" +
                       GeoCoordinateUtilities.FormatLongitude(lon);
                _pointerGeoCoordinate = new GeoCoordinate(lat, lon);
            }
            else
            {
                _pointerGeoCoordinate = null;
                country = "SPACE";
            }
            text        += ("   [" + country + "]");
            _pointerText = text;

            if (!toolStripButtonPICK.Checked && _mdOrtho != null)
            {
                // moving view
                double deltaDeg = 90.0 / _worldScreenRadius;
                double φ0       = _mdOrtho.φ0 + deltaDeg * (e.Location.Y - _mdsy);
                if (φ0 > 90)
                {
                    φ0 = 90;
                }
                if (φ0 < -90)
                {
                    φ0 = -90;
                }
                double λ0 = _mdOrtho.λ0 - deltaDeg * (e.Location.X - _mdsx);
                λ0 = OrthographicProjection.SanitizeLongitude(λ0);
                trackBar1.Value = (int)Math.Round(φ0 * 100);
                trackBar2.Value = (int)Math.Round(λ0 * 100);
                _updateProjection();
                _invalidateAllLayers(true);
                return;
            }

            // not moving view
            _mouseOverCountry    = cDef;
            _layerDynamic1.Dirty = true;
            _layerDynamic2.Dirty = true;
            pictureBox1.Refresh();
        }