Exemplo n.º 1
0
        private void _paintDYNAMIC2(Graphics g)
        {
            Point loc = pictureBox1.PointToClient(MousePosition);

            if (_mouseOverCountry != null)
            {
                // outlines
                _drawCountryOutline(g, _mouseOverCountry, Pens.Red);
                if (Math.Abs(loc.X - _countryAnnotPos.X) > 20 || Math.Abs(loc.Y - _countryAnnotPos.Y) > 20)
                {
                    _countryAnnotPos = loc;
                }
                _drawStandoutString(g, _mouseOverCountry.Name, Brushes.White, _countryAnnotPos.X, _countryAnnotPos.Y - 20);
            }



            if (toolStripButtonPICK.Checked)
            {
                if (_pointerGeoCoordinate != null)
                {
                    List <PointF> ptList = new List <PointF>();
                    double        x, y;
                    for (double azimuth = 0; azimuth < 360; azimuth += 10)
                    {
                        GeoCoordinate gc = GeoCoordinateUtilities.GetEndPoint(_pointerGeoCoordinate, azimuth, _pickRadius);
                        if (_ortho.ToTangentPlane(gc.Latitude, gc.Longitude, out x, out y))
                        {
                            PointF pt = _convertF(x, y);
                            ptList.Add(pt);
                        }
                    }
                    if (ptList.Count > 2)
                    {
                        g.FillPolygon(_radBrush, ptList.ToArray());
                    }
                }
            }

            _drawStandoutString(g, _pointerText, Brushes.White, 2, pictureBox1.Height - 20);
        }
Exemplo n.º 2
0
        private void _updateProjection()
        {
            double x, y;

            double lat = trackBar1.Value / 100.0;

            labelLAT.Text = lat.ToString(CultureInfo.InvariantCulture);
            labelLAT.Refresh();
            double lon = trackBar2.Value / 100.0;

            labelLONG.Text = lon.ToString(CultureInfo.InvariantCulture);
            labelLONG.Refresh();
            _zoomRadius   = trackBar3.Value;
            labelRAD.Text = _zoomRadius.ToString(CultureInfo.InvariantCulture);
            labelRAD.Refresh();


            _ortho = new OrthographicProjection(lat, lon);

            _stressTable.ProjectToTangentPlane(_ortho, textBoxFILTER.Text);

            // extras
            StressTable.ProjectToTangentPlane(_ortho, _myList);
            StressTable.ProjectToTangentPlane(_ortho, _closeList);

            foreach (var mLine in mapLines)
            {
                foreach (var item in mLine.Collection)
                {
                    if (_ortho.ToTangentPlane(item.Latitude, item.Longitude, out x, out y))
                    {
                        item.ProjectedX = x;
                        item.ProjectedY = y;
                    }
                    else
                    {
                        item.ProjectedX = double.NaN;
                        item.ProjectedY = double.NaN;
                    }
                }
            }

            if (cities != null)
            {
                foreach (NamedCoordinate nC in cities.Collection)
                {
                    if (_ortho.ToTangentPlane(nC.Latitude, nC.Longitude, out x, out y))
                    {
                        nC.ProjectedX = x;
                        nC.ProjectedY = y;
                    }
                    else
                    {
                        nC.ProjectedX = double.NaN;
                        nC.ProjectedY = double.NaN;
                    }
                }
            }

            foreach (WSMCountry cDef in _rwmap.Collection)
            {
                var cc = cDef.CentralCoordinate;
                if (_ortho.ToTangentPlane(cc.Latitude, cc.Longitude, out x, out y))
                {
                    cc.ProjectedX = x;
                    cc.ProjectedY = y;
                }
                else
                {
                    cc.ProjectedX = double.NaN;
                    cc.ProjectedY = double.NaN;
                }

                foreach (WSMPolygon poly in cDef.Collection)
                {
                    int nOk = 0;
                    poly.MinX = poly.MinY = double.MaxValue;
                    poly.MaxX = poly.MaxY = double.MinValue;
                    foreach (BaseCoordinate item in poly.Collection)
                    {
                        if (_ortho.ToTangentPlane(item.Latitude, item.Longitude, out x, out y))
                        {
                            item.ProjectedX = x;
                            item.ProjectedY = y;
                            nOk++;
                            poly.MinX = Math.Min(poly.MinX, x);
                            poly.MinY = Math.Min(poly.MinY, y);
                            poly.MaxX = Math.Max(poly.MaxX, x);
                            poly.MaxY = Math.Max(poly.MaxY, y);
                        }
                        else
                        {
                            item.ProjectedX = double.NaN;
                            item.ProjectedY = double.NaN;
                        }
                    }
                    poly.Draw = nOk >= 3;
                }
            }


            _invalidateAllLayers(false);
        }