Esempio n. 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();
        }
Esempio n. 2
0
        private void Dbuffer_MouseDown(object sender, MouseEventArgs e)
        {
            fineControl  = false;
            moveWholePic = false;
            moveShadow   = false;
            startX       = e.X;
            startY       = e.Y;
            fcX          = mX = vX = e.X;
            fcY          = mY = vY = e.Y;


            if (ChartLib.ChartViewer.IsModifierHeld(Keys.Control))
            {
                moveShadow = true;
                toolStripButtonSHADOW.Checked = true;
                startShadowX = settings.ShadowOffset.X;
                startShadowY = settings.ShadowOffset.Y;
                return;
            }
            //{
            //    settings.Aux0 = new PointD(x, y);
            //    _geometryUpdate();
            //    dbuffer.Refresh();
            //}
            //else


            if (settings.PicCorner != null)
            {
                startPt = _data2screen(settings.PicCorner);
            }
            object data;

            data = ttC0.GetDataAtPointer(e);
            if (data != null)
            {
                pbActive = settings.Box0; activeIdx = (int)data; return;
            }
            data = ttC1.GetDataAtPointer(e);
            if (data != null)
            {
                pbActive = settings.Box1; activeIdx = (int)data; return;
            }
            data = ttcA.GetDataAtPointer(e);
            if (data != null)
            {
                auxActive    = data as PointD;
                moveWholePic = (settings.PicCorner == auxActive);
                return;
            }

            // nothing else, initialite the pic
            if (settings.PicCorner == null)
            {
                double x = scrolledDoubleBuffer1.Screen2dataX(e.X);
                double y = scrolledDoubleBuffer1.Screen2dataY(e.Y);
                settings.PicCorner = new PointD(x, y);
                startPt            = _data2screen(settings.PicCorner);
                moveWholePic       = true;
            }
        }