コード例 #1
0
ファイル: LiveObject.cs プロジェクト: slgrobotics/QuakeMap
 public Distance distanceFrom(GeoCoord from)
 {
     return(m_location.distanceFrom(from));
 }
コード例 #2
0
ファイル: TileSet.cs プロジェクト: slgrobotics/QuakeMap
        // returns number of LiveObject based objects added to the list:
        public override int getCloseObjects(SortedList list, GeoCoord loc, double radiusMeters)
        {
            int count = 0;

            try
            {
                for(int vv=0; vv < m_vCount ;vv++)
                {
                    for(int hh=0; hh < m_hCount ;hh++)
                    {
                        Tile tile = m_tiles[vv, hh];
                        Features features = tile.features;
                        if(features != null && !features.IsEmpty)
                        {
                            foreach(LiveObject lo in features.List)
                            {
                                double dMeters = loc.distanceFrom(lo.Location).Meters;
                                if(dMeters <= radiusMeters)
                                {
                                    list.Add(dMeters, lo);
                                    count++;
                                }
                            }
                        }
                    }
                }
            }
            catch {}

            return count;
        }
コード例 #3
0
        // returns number of LiveObject based objects added to the list:
        public override int getCloseObjects(SortedList list, GeoCoord loc, double radiusMeters)
        {
            int count = 0;

            // list of LiveObject by key=double (distance from loc)
            try
            {
                // WaypointsDisplayed contains trackpoints, we don't want them in the list so far
                foreach(Waypoint wpt in WaypointsCache.WaypointsAll)
                {
                    double dMeters = loc.distanceFrom(wpt.Location).Meters;
                    if(dMeters <= radiusMeters)
                    {
                        list.Add(dMeters, wpt);
                        count++;
                    }
                }
            }
            catch {}

            return count;
        }
コード例 #4
0
ファイル: CameraManager.cs プロジェクト: slgrobotics/QuakeMap
        public void pdaExportDragRectangle()
        {
            GeoCoord topLeft = toGeoLocation(new Point(dragRectangle.X, dragRectangle.Y));
            GeoCoord bottomRight = toGeoLocation(new Point(dragRectangle.X + dragRectangle.Width, dragRectangle.Y + dragRectangle.Height));

            // try to get the high-level map to reasonable extent:
            GeoCoord coverageTopLeft = new GeoCoord(m_coverageTopLeft);
            GeoCoord coverageBottomRight = new GeoCoord(m_coverageBottomRight);

            // to paint red rectangle indicating high-level coverage:
            double marginLat = (m_coverageTopLeft.Lat - m_coverageBottomRight.Lat) / 100.0d;
            double marginLng = (m_coverageBottomRight.Lng - m_coverageTopLeft.Lng) / 140.0d;

            Distance screenDiag = coverageTopLeft.distanceFrom(coverageBottomRight);

            this.resetDrag(true);
            Application.DoEvents();

            Graphics graphics = PictureManager.This.Graphics;
            if(screenDiag.Meters > 20000.0d)
            {
                // camera too far to preload all, get area around the well covered:
                coverageTopLeft.Lat = Math.Min(m_coverageTopLeft.Lat - marginLat, (topLeft.Lat + bottomRight.Lat) / 2.0d + 0.1d);
                coverageTopLeft.Lng = Math.Max(m_coverageTopLeft.Lng + marginLng, (topLeft.Lng + bottomRight.Lng) / 2.0d - 0.14d);

                coverageBottomRight.Lat = Math.Max(m_coverageBottomRight.Lat + marginLat, (topLeft.Lat + bottomRight.Lat) / 2.0d - 0.1d);
                coverageBottomRight.Lng = Math.Min(m_coverageBottomRight.Lng - marginLng, (topLeft.Lng + bottomRight.Lng) / 2.0d + 0.14d);
            }
            else
            {
                // just highlight the whole screen, reminding that the area will be saved:
                coverageTopLeft.Lat = m_coverageTopLeft.Lat - marginLat;
                coverageTopLeft.Lng = m_coverageTopLeft.Lng + marginLng;

                coverageBottomRight.Lat = m_coverageBottomRight.Lat + marginLat;
                coverageBottomRight.Lng = m_coverageBottomRight.Lng - marginLng;
            }
            this.PaintGeoRect(coverageTopLeft, coverageBottomRight, graphics, Pens.Red, "loading 16-64m");
            this.PaintGeoRect(topLeft, bottomRight, graphics, Pens.Yellow, "loading 1-64m");

            // the operations below will add to TerraserverCache.TileNamesCollection:

            TileSetTerraLayout.downloadPdaThemesAtLevel(coverageTopLeft, coverageBottomRight, 14, true);		// scales 16, 32, 64

            // now get the well coverage:
            TileSetTerraLayout.downloadPdaThemesAtLevel(topLeft, bottomRight, 10, true);

            Application.DoEvents();

            if(m_pdaMonitorThread == null)
            {
                m_pdaMonitorThread = new Thread( new ThreadStart(monitorPdaExportProgress));
                // see Entry.cs for how the current culture is set:
                m_pdaMonitorThread.CurrentCulture = Thread.CurrentThread.CurrentCulture; //new CultureInfo("en-US", false);
                m_pdaMonitorThread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; //new CultureInfo("en-US", false);
                m_pdaMonitorThread.IsBackground = true;	// terminate with the main process
                m_pdaMonitorThread.Name = "Monitoring PDA download";
                m_pdaMonitorThread.Start();
            }
        }