Changeset - 5c6025642596
[Not reviewed]
default
0 2 0
mkanning@CL-ENS241-10.cedarville.edu - 13 years ago 2013-03-13 15:02:00
mkanning@CL-ENS241-10.cedarville.edu
Final changes. should also contain some map cache
2 files changed with 77 insertions and 86 deletions:
0 comments (0 inline, 0 general)
Demo.WindowsForms/Forms/MainForm.Designer.cs
Show inline comments
 
@@ -1077,144 +1077,144 @@
 
            this.textBoxCacheSize.Size = new System.Drawing.Size(220, 28);
 
            this.textBoxCacheSize.TabIndex = 49;
 
            this.textBoxCacheSize.Text = "...";
 
            // 
 
            // textBoxCacheStatus
 
            // 
 
            this.textBoxCacheStatus.Dock = System.Windows.Forms.DockStyle.Top;
 
            this.textBoxCacheStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
 
            this.textBoxCacheStatus.Location = new System.Drawing.Point(18, 301);
 
            this.textBoxCacheStatus.Name = "textBoxCacheStatus";
 
            this.textBoxCacheStatus.ReadOnly = true;
 
            this.textBoxCacheStatus.Size = new System.Drawing.Size(220, 28);
 
            this.textBoxCacheStatus.TabIndex = 46;
 
            this.textBoxCacheStatus.Text = "...";
 
            // 
 
            // btnCacheImport
 
            // 
 
            this.btnCacheImport.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.btnCacheImport.Location = new System.Drawing.Point(18, 19);
 
            this.btnCacheImport.Name = "btnCacheImport";
 
            this.btnCacheImport.Size = new System.Drawing.Size(220, 20);
 
            this.btnCacheImport.TabIndex = 5;
 
            this.btnCacheImport.Text = "Import";
 
            this.btnCacheImport.UseVisualStyleBackColor = true;
 
            this.btnCacheImport.Click += new System.EventHandler(this.button10_Click);
 
            this.btnCacheImport.Click += new System.EventHandler(this.btnCacheImport_Click);
 
            // 
 
            // textBoxMemory
 
            // 
 
            this.textBoxMemory.Dock = System.Windows.Forms.DockStyle.Top;
 
            this.textBoxMemory.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
 
            this.textBoxMemory.Location = new System.Drawing.Point(18, 175);
 
            this.textBoxMemory.Name = "textBoxMemory";
 
            this.textBoxMemory.ReadOnly = true;
 
            this.textBoxMemory.Size = new System.Drawing.Size(220, 28);
 
            this.textBoxMemory.TabIndex = 39;
 
            this.textBoxMemory.Text = "...";
 
            // 
 
            // checkBoxUseRouteCache
 
            // 
 
            this.checkBoxUseRouteCache.AutoSize = true;
 
            this.checkBoxUseRouteCache.Checked = true;
 
            this.checkBoxUseRouteCache.CheckState = System.Windows.Forms.CheckState.Checked;
 
            this.checkBoxUseRouteCache.Location = new System.Drawing.Point(18, 351);
 
            this.checkBoxUseRouteCache.Name = "checkBoxUseRouteCache";
 
            this.checkBoxUseRouteCache.Size = new System.Drawing.Size(160, 17);
 
            this.checkBoxUseRouteCache.TabIndex = 2;
 
            this.checkBoxUseRouteCache.Text = "cache routing/geocodig/etc";
 
            this.checkBoxUseRouteCache.UseVisualStyleBackColor = true;
 
            // 
 
            // btnCacheExport
 
            // 
 
            this.btnCacheExport.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.btnCacheExport.Location = new System.Drawing.Point(18, 45);
 
            this.btnCacheExport.Name = "btnCacheExport";
 
            this.btnCacheExport.Size = new System.Drawing.Size(220, 20);
 
            this.btnCacheExport.TabIndex = 4;
 
            this.btnCacheExport.Text = "Export";
 
            this.btnCacheExport.UseVisualStyleBackColor = true;
 
            this.btnCacheExport.Click += new System.EventHandler(this.button9_Click);
 
            this.btnCacheExport.Click += new System.EventHandler(this.btnCacheExport_Click);
 
            // 
 
            // btnCachePrefetch
 
            // 
 
            this.btnCachePrefetch.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.btnCachePrefetch.Location = new System.Drawing.Point(18, 71);
 
            this.btnCachePrefetch.Name = "btnCachePrefetch";
 
            this.btnCachePrefetch.Size = new System.Drawing.Size(220, 20);
 
            this.btnCachePrefetch.TabIndex = 38;
 
            this.btnCachePrefetch.Text = "Prefetch selected area";
 
            this.btnCachePrefetch.UseVisualStyleBackColor = true;
 
            this.btnCachePrefetch.Click += new System.EventHandler(this.button11_Click);
 
            this.btnCachePrefetch.Click += new System.EventHandler(this.btnCachePrefetch_Click);
 
            // 
 
            // label10
 
            // 
 
            this.label10.AutoSize = true;
 
            this.label10.Location = new System.Drawing.Point(18, 159);
 
            this.label10.Name = "label10";
 
            this.label10.Size = new System.Drawing.Size(111, 13);
 
            this.label10.TabIndex = 40;
 
            this.label10.Text = "memory cache usage:";
 
            // 
 
            // btnCacheClear
 
            // 
 
            this.btnCacheClear.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.btnCacheClear.Location = new System.Drawing.Point(18, 97);
 
            this.btnCacheClear.Name = "btnCacheClear";
 
            this.btnCacheClear.Size = new System.Drawing.Size(220, 20);
 
            this.btnCacheClear.TabIndex = 43;
 
            this.btnCacheClear.Text = "Clear tiles in disk cache";
 
            this.btnCacheClear.UseVisualStyleBackColor = true;
 
            this.btnCacheClear.Click += new System.EventHandler(this.button2_Click);
 
            this.btnCacheClear.Click += new System.EventHandler(this.btnCacheClear_Click);
 
            // 
 
            // label13
 
            // 
 
            this.label13.AutoSize = true;
 
            this.label13.Location = new System.Drawing.Point(18, 285);
 
            this.label13.Name = "label13";
 
            this.label13.Size = new System.Drawing.Size(93, 13);
 
            this.label13.TabIndex = 44;
 
            this.label13.Text = "disk cache status:";
 
            // 
 
            // label14
 
            // 
 
            this.label14.AutoSize = true;
 
            this.label14.Location = new System.Drawing.Point(18, 222);
 
            this.label14.Name = "label14";
 
            this.label14.Size = new System.Drawing.Size(83, 13);
 
            this.label14.TabIndex = 47;
 
            this.label14.Text = "disk cache size:";
 
            // 
 
            // btnCacheLocationOpen
 
            // 
 
            this.btnCacheLocationOpen.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.btnCacheLocationOpen.Location = new System.Drawing.Point(17, 122);
 
            this.btnCacheLocationOpen.Margin = new System.Windows.Forms.Padding(2);
 
            this.btnCacheLocationOpen.Name = "btnCacheLocationOpen";
 
            this.btnCacheLocationOpen.Size = new System.Drawing.Size(222, 19);
 
            this.btnCacheLocationOpen.TabIndex = 50;
 
            this.btnCacheLocationOpen.Text = "Open cache location";
 
            this.btnCacheLocationOpen.UseVisualStyleBackColor = true;
 
            this.btnCacheLocationOpen.Click += new System.EventHandler(this.button17_Click);
 
            this.btnCacheLocationOpen.Click += new System.EventHandler(this.btnCacheLocationOpen_Click);
 
            // 
 
            // tabControl
 
            // 
 
            this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.tabControl.Controls.Add(this.tabMap);
 
            this.tabControl.Controls.Add(this.tabGraphs);
 
            this.tabControl.Controls.Add(this.tabData);
 
            this.tabControl.Location = new System.Drawing.Point(0, 0);
 
            this.tabControl.Name = "tabControl";
 
            this.tabControl.SelectedIndex = 0;
 
            this.tabControl.Size = new System.Drawing.Size(871, 716);
 
            this.tabControl.TabIndex = 45;
 
            // 
 
            // tabGraphs
 
            // 
 
            this.tabGraphs.Controls.Add(this.pnlDataListDisplay);
 
            this.tabGraphs.Controls.Add(this.ctnParentChartHolder);
 
            this.tabGraphs.Location = new System.Drawing.Point(4, 22);
 
            this.tabGraphs.Name = "tabGraphs";
 
            this.tabGraphs.Padding = new System.Windows.Forms.Padding(3);
 
            this.tabGraphs.Size = new System.Drawing.Size(863, 690);
 
            this.tabGraphs.TabIndex = 2;
Demo.WindowsForms/Forms/MainForm.cs
Show inline comments
 
@@ -56,115 +56,107 @@ namespace Demo.WindowsForms
 
                //GMap.NET.CacheProviders.MySQLPureImageCache ch = new GMap.NET.CacheProviders.MySQLPureImageCache();
 
                //ch.ConnectionString = @"server=sql2008;User Id=trolis;Persist Security Info=True;database=gmapnetcache;password=trolis;";
 
                //MainMap.Manager.SecondaryCache = ch;
 
 
                // set your proxy here if need
 
                //GMapProvider.WebProxy = new WebProxy("10.2.0.100", 8080);
 
                //GMapProvider.WebProxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeada");
 
 
                // set cache mode only if no internet avaible
 
                if (!Stuff.PingNetwork("pingtest.net"))
 
                {
 
                    MainMap.Manager.Mode = AccessMode.CacheOnly;
 
                    MessageBox.Show("No internet connection available, going to CacheOnly mode.", "GMap.NET - Demo.WindowsForms", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 
                }
 
 
                // config map - MDKEdit - init values ??
 
                MainMap.MapProvider = GMapProviders.OpenStreetMap;
 
                MainMap.Position = new PointLatLng(39.751248, -83.809848);
 
                MainMap.MinZoom = 0;
 
                MainMap.MaxZoom = 24;
 
                MainMap.Zoom = 15;
 
 
                //MainMap.ScaleMode = ScaleModes.Fractional;
 
 
                // map events
 
                {
 
                    //MainMap.OnPositionChanged += new PositionChanged(MainMap_OnPositionChanged);
 
 
                /// map events
 
                    MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
 
                    MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);
 
 
                    MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);
 
                    MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
 
 
                    MainMap.OnMarkerClick += new MarkerClick(MainMap_OnMarkerClick);
 
                    MainMap.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter);
 
                    MainMap.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave);
 
 
                    //MainMap.OnPolygonEnter += new PolygonEnter(MainMap_OnPolygonEnter);
 
                    //MainMap.OnPolygonLeave += new PolygonLeave(MainMap_OnPolygonLeave);
 
 
                    MainMap.OnRouteEnter += new RouteEnter(MainMap_OnRouteEnter);
 
                    MainMap.OnRouteLeave += new RouteLeave(MainMap_OnRouteLeave);
 
 
                    MainMap.Manager.OnTileCacheComplete += new TileCacheComplete(OnTileCacheComplete);
 
                    MainMap.Manager.OnTileCacheStart += new TileCacheStart(OnTileCacheStart);
 
                    MainMap.Manager.OnTileCacheProgress += new TileCacheProgress(OnTileCacheProgress);
 
                }
 
                
 
 
                MainMap.MouseMove += new MouseEventHandler(MainMap_MouseMove);
 
                MainMap.MouseDown += new MouseEventHandler(MainMap_MouseDown);
 
                MainMap.MouseUp += new MouseEventHandler(MainMap_MouseUp);
 
                //MainMap.MouseDoubleClick += new MouseEventHandler(MainMap_MouseDoubleClick);
 
 
                // get map types
 
#if !MONO   // mono doesn't handle it, so we 'lost' provider list ;]
 
                comboBoxMapType.ValueMember = "Name";
 
                comboBoxMapType.DataSource = GMapProviders.List;
 
                comboBoxMapType.SelectedItem = MainMap.MapProvider;
 
#endif
 
                // acccess mode
 
                comboBoxMode.DataSource = Enum.GetValues(typeof(AccessMode));
 
                comboBoxMode.SelectedItem = MainMap.Manager.Mode;
 
 
                // get position
 
                textBoxLat.Text = MainMap.Position.Lat.ToString(CultureInfo.InvariantCulture);
 
                textBoxLng.Text = MainMap.Position.Lng.ToString(CultureInfo.InvariantCulture);
 
 
                // get cache modes
 
                checkBoxUseRouteCache.Checked = MainMap.Manager.UseRouteCache;
 
 
                // get zoom  
 
                trackBarZoomLevel.Minimum = MainMap.MinZoom * 100;
 
                trackBarZoomLevel.Maximum = MainMap.MaxZoom * 100;
 
                trackBarZoomLevel.TickFrequency = 100;
 
 
#if DEBUG
 
                xboxGrid.Checked = true;
 
#endif
 
 
                ToolStripManager.Renderer = new BSE.Windows.Forms.Office2007Renderer();
 
 
                // add custom layers  
 
                {
 
                /// add custom layers  
 
                    MainMap.Overlays.Add(routes);
 
                    MainMap.Overlays.Add(objects);
 
                    MainMap.Overlays.Add(top);
 
 
                    routes.Routes.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Routes_CollectionChanged);
 
                    objects.Markers.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Markers_CollectionChanged);
 
                }
 
 
 
                // set current marker
 
                currentMarker = new GMarkerGoogle(MainMap.Position, GMarkerGoogleType.arrow);
 
                currentMarker.IsHitTestVisible = false;
 
                currentMarker.ToolTipText = "Current Marker";
 
                top.Markers.Add(currentMarker);
 
 
                if (objects.Markers.Count > 0)
 
                {
 
                    MainMap.ZoomAndCenterMarkers(null);
 
                }
 
 
                try
 
                {
 
                    GMapOverlay overlay = DeepClone<GMapOverlay>(objects);
 
                    Debug.WriteLine("ISerializable status for markers: OK");
 
 
                    GMapOverlay overlay3 = DeepClone<GMapOverlay>(routes);
 
                    Debug.WriteLine("ISerializable status for routes: OK");
 
                }
 
                catch (Exception ex)
 
                {
 
                    Debug.WriteLine("ISerializable failure: " + ex.Message);
 
 
@@ -579,65 +571,48 @@ namespace Demo.WindowsForms
 
 
                MainMap.Position = new PointLatLng(lat, lng);
 
            }
 
            catch (Exception ex)
 
            {
 
                MessageBox.Show("incorrect coordinate format: " + ex.Message);
 
            }
 
        }
 
 
        // reload map - MDKfunctional
 
        private void btnReload_Click(object sender, EventArgs e)
 
        {
 
            MainMap.ReloadMap();
 
        }
 
 
        // cache config - MDKfunctional
 
        private void checkBoxUseCache_CheckedChanged(object sender, EventArgs e)
 
        {
 
            MainMap.Manager.UseRouteCache = checkBoxUseRouteCache.Checked;
 
            MainMap.Manager.UseGeocoderCache = checkBoxUseRouteCache.Checked;
 
            MainMap.Manager.UsePlacemarkCache = checkBoxUseRouteCache.Checked;
 
            MainMap.Manager.UseDirectionsCache = checkBoxUseRouteCache.Checked;
 
        }
 
 
        // clear cache - MDKfunctional
 
        private void button2_Click(object sender, EventArgs e)
 
        {
 
            if (MessageBox.Show("Are You sure?", "Clear GMap.NET cache?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
 
            {
 
                try
 
                {
 
                    MainMap.Manager.PrimaryCache.DeleteOlderThan(DateTime.Now, null);
 
                    MessageBox.Show("Done. Cache is clear.");
 
                }
 
                catch (Exception ex)
 
                {
 
                    MessageBox.Show(ex.Message);
 
                }
 
            }
 
        }
 
 
        // set route start  - MDKfunctional
 
        bool hasStartMarker = false;
 
        private void buttonSetStart_Click(object sender, EventArgs e)
 
        {
 
            start = currentMarker.Position;
 
            // - MDKAdd
 
            GMarkerGoogle m = new GMarkerGoogle(currentMarker.Position, GMarkerGoogleType.green_small);
 
            
 
            //prevent multiple start markers from existing
 
            if(hasStartMarker){
 
                objects.Markers.RemoveAt(0);
 
            }
 
 
            //add the marker
 
            m.ToolTipText = "Start";
 
            m.ToolTipMode = MarkerTooltipMode.Always;
 
            objects.Markers.Insert(0, m);
 
 
            hasStartMarker = true;
 
        }
 
 
        // set route end - MDKfunctional
 
        bool hasEndMarker = false;
 
        private void buttonSetEnd_Click(object sender, EventArgs e)
 
@@ -676,49 +651,49 @@ namespace Demo.WindowsForms
 
            }
 
 
            MapRoute route = rp.GetRoute(start, end, false, false, (int)MainMap.Zoom);
 
            if (route != null)
 
            {
 
                // add route
 
                GMapRoute r = new GMapRoute(route.Points, route.Name);
 
                r.IsHitTestVisible = true;
 
                routes.Routes.Add(r);
 
 
                // add route start/end marks
 
                GMapMarker m1 = new GMarkerGoogle(start, GMarkerGoogleType.green_big_go);
 
                m1.ToolTipText = "Start: " + route.Name;
 
                m1.ToolTipMode = MarkerTooltipMode.Always;
 
 
                GMapMarker m2 = new GMarkerGoogle(end, GMarkerGoogleType.red_big_stop);
 
                m2.ToolTipText = "End: " + end.ToString();
 
                m2.ToolTipMode = MarkerTooltipMode.Always;
 
 
                objects.Markers.Add(m1);
 
                objects.Markers.Add(m2);
 
            }
 
        }
 
 
        // add marker on current position - MDKEdit
 
        // add marker on current position - MDKfunctional
 
        private void addUserMarker(object sender, EventArgs e)
 
        {
 
            GMarkerGoogle m = new GMarkerGoogle(currentMarker.Position, GMarkerGoogleType.blue_small);
 
 
            m.ToolTipText = "User";
 
            m.ToolTipMode = MarkerTooltipMode.Always;
 
            objects.Markers.Add(m);
 
        }
 
 
        // add marker from APRS transmission - MDKEdit - TODO: Function not needed; addUserMarker() replaces it ??
 
        private void addMarkerFromButton(object sender, EventArgs e)
 
        {
 
            GMarkerGoogle m = new GMarkerGoogle(currentMarker.Position, GMarkerGoogleType.blue_small);
 
 
            m.ToolTipText = "Tracker";
 
            m.ToolTipMode = MarkerTooltipMode.Always;
 
            objects.Markers.Add(m);
 
        }
 
 
        // clear routes - MDKfunctional
 
        private void btnClearRoutes_Click(object sender, EventArgs e)
 
        {
 
            routes.Routes.Clear();
 
 
@@ -764,95 +739,48 @@ namespace Demo.WindowsForms
 
            objects.Markers.Clear();
 
            routes.Routes.Clear();
 
            hasEndMarker = false;
 
            hasStartMarker = false;
 
        }
 
 
        // show current marker - MDKfunctional
 
        private void checkBoxCurrentMarker_CheckedChanged(object sender, EventArgs e)
 
        {
 
            currentMarker.IsVisible = xboxCurrentMarker.Checked;
 
        }
 
 
        // can drag - MDKfunctional
 
        private void checkBoxCanDrag_CheckedChanged(object sender, EventArgs e)
 
        {
 
            MainMap.CanDragMap = xboxCanDrag.Checked;
 
        }
 
 
        // zoom to max for markers - MDKfunctional
 
        private void button7_Click(object sender, EventArgs e)
 
        {
 
            MainMap.ZoomAndCenterMarkers("objects");
 
        }
 
 
        // export map data - MDKfunctional
 
        private void button9_Click(object sender, EventArgs e)
 
        {
 
            MainMap.ShowExportDialog();
 
        }
 
 
        // import map data - MDKfunctional
 
        private void button10_Click(object sender, EventArgs e)
 
        {
 
            MainMap.ShowImportDialog();
 
        }
 
 
        // prefetch - MDKfunctional
 
        private void button11_Click(object sender, EventArgs e)
 
        {
 
            RectLatLng area = MainMap.SelectedArea;
 
            if (!area.IsEmpty)
 
            {
 
                for (int i = (int)MainMap.Zoom; i <= MainMap.MaxZoom; i++)
 
                {
 
                    DialogResult res = MessageBox.Show("Ready ripp at Zoom = " + i + " ?", "GMap.NET", MessageBoxButtons.YesNoCancel);
 
 
                    if (res == DialogResult.Yes)
 
                    {
 
                        using (TilePrefetcher obj = new TilePrefetcher())
 
                        {
 
                            obj.Owner = this;
 
                            obj.ShowCompleteMessage = true;
 
                            obj.Start(area, i, MainMap.MapProvider, 100);
 
                        }
 
                    }
 
                    else if (res == DialogResult.No)
 
                    {
 
                        continue;
 
                    }
 
                    else if (res == DialogResult.Cancel)
 
                    {
 
                        break;
 
                    }
 
                }
 
            }
 
            else
 
            {
 
                MessageBox.Show("Select map area holding ALT", "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 
            }
 
        }
 
 
        // saves current map view - MDKfunctional
 
        private void btnSaveView_Click(object sender, EventArgs e)
 
        {
 
            try
 
            {
 
                using (SaveFileDialog sfd = new SaveFileDialog())
 
                {
 
                    sfd.Filter = "PNG (*.png)|*.png";
 
                    sfd.FileName = "GMap.NET image";
 
 
                    Image tmpImage = MainMap.ToImage();
 
                    if (tmpImage != null)
 
                    {
 
                        using (tmpImage)
 
                        {
 
                            if (sfd.ShowDialog() == DialogResult.OK)
 
                            {
 
                                tmpImage.Save(sfd.FileName);
 
 
                                MessageBox.Show("Image saved: " + sfd.FileName, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
                            }
 
                        }
 
                    }
 
                }
 
@@ -947,50 +875,112 @@ namespace Demo.WindowsForms
 
                }
 
                else if (e.KeyChar == 'a')
 
                {
 
                    MainMap.Bearing--;
 
                }
 
                else if (e.KeyChar == 'z')
 
                {
 
                    MainMap.Bearing++;
 
                }
 
            }
 
        }
 
 
        //changes zoom - MDKfunctional
 
        private void buttonZoomUp_Click(object sender, EventArgs e)
 
        {
 
            MainMap.Zoom = ((int)MainMap.Zoom) + 1;
 
        }
 
 
        //changes zoom - MDKfunctional
 
        private void buttonZoomDown_Click(object sender, EventArgs e)
 
        {
 
            MainMap.Zoom = ((int)(MainMap.Zoom + 0.99)) - 1;
 
        }
 
 
        // open disk cache location - MDKuntested
 
        private void button17_Click(object sender, EventArgs e)
 
 
 
        #endregion
 
 
        #region -- caching --
 
 
        // import map data - MDKfunctional
 
        private void btnCacheImport_Click(object sender, EventArgs e)
 
        {
 
            MainMap.ShowImportDialog();
 
        }
 
 
        // export map data - MDKfunctional
 
        private void btnCacheExport_Click(object sender, EventArgs e)
 
        {
 
            MainMap.ShowExportDialog();
 
        }
 
 
        // prefetch - MDKfunctional
 
        private void btnCachePrefetch_Click(object sender, EventArgs e)
 
        {
 
            RectLatLng area = MainMap.SelectedArea;
 
            if (!area.IsEmpty)
 
            {
 
                int zoom = (int)MainMap.Zoom;
 
                DialogResult res = MessageBox.Show("Ready ripp at Zoom = " + zoom + " and greater?", "GMap.NET Cache", MessageBoxButtons.YesNoCancel);
 
                if (res == DialogResult.Yes)
 
                {
 
                    for (int i = zoom; i <= 17; i++)
 
                    {
 
                        using (TilePrefetcher obj = new TilePrefetcher())
 
                        {
 
                            obj.Owner = this;
 
                            obj.ShowCompleteMessage = false;
 
                            obj.Start(area, i, MainMap.MapProvider, 100);
 
                        }
 
                    }
 
                }
 
            }
 
            else
 
            {
 
                MessageBox.Show("Select map area holding ALT", "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 
            }
 
        }
 
 
        // clear cache - MDKfunctional
 
        private void btnCacheClear_Click(object sender, EventArgs e)
 
        {
 
            if (MessageBox.Show("Are You sure?", "Clear GMap.NET cache?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
 
            {
 
                try
 
                {
 
                    MainMap.Manager.PrimaryCache.DeleteOlderThan(DateTime.Now, null);
 
                    MessageBox.Show("Done. Cache is clear.");
 
                }
 
                catch (Exception ex)
 
                {
 
                    MessageBox.Show(ex.Message);
 
                }
 
            }
 
        }
 
 
        // open disk cache location - MDKfunctional
 
        private void btnCacheLocationOpen_Click(object sender, EventArgs e)
 
        {
 
            try
 
            {
 
                string argument = "/select, \"" + MainMap.CacheLocation + "TileDBv5\"";
 
                System.Diagnostics.Process.Start("explorer.exe", argument);
 
            }
 
            catch (Exception ex)
 
            {
 
                MessageBox.Show("Failed to open: " + ex.Message, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
 
            }
 
        }
 
 
        #endregion
 
 
        #region chart click events
 
        
 
        //this method clears the background of all charts
 
        private void ResetChartColors()
 
        {
 
            chrtTopLeft.BackColor = Color.LightGray;
 
            chrtTopRight.BackColor = Color.LightGray;
 
            chrtBottomLeft.BackColor = Color.LightGray;
 
            chrtBottomRight.BackColor = Color.LightGray;
 
        }
 
@@ -1027,48 +1017,49 @@ namespace Demo.WindowsForms
 
            ResetChartColors();
 
            chrtBottomLeft.BackColor = Color.Gray;
 
            tboxChartData.Text = "Pressure";
 
            tboxCurrent.Text = tboxAtmoPressure.Text;
 
            tboxAverage.Text = (pressureSum / chrtBottomRight.Series.FindByName("pressureTrend").Points.Count).ToString();
 
            tboxMax.Text = chrtBottomRight.Series.FindByName("pressureTrend").Points.FindMaxByValue().ToString();
 
            tboxMin.Text = chrtBottomRight.Series.FindByName("pressureTrend").Points.FindMinByValue().ToString();
 
        }
 
 
        //highlight Bottom Right chart on click and set text box values based on this chart
 
        private void chrtBottomRight_Click(object sender, EventArgs e)
 
        {
 
            ResetChartColors();
 
            chrtBottomRight.BackColor = Color.Gray;
 
            tboxChartData.Text = "Velocity";
 
            tboxCurrent.Text = tboxMasterVelocity.Text;
 
            tboxAverage.Text = (velocitySum / chrtBottomRight.Series.FindByName("velocityTrend").Points.Count).ToString();
 
            tboxMax.Text = chrtBottomRight.Series.FindByName("velocityTrend").Points.FindMaxByValue().ToString();
 
            tboxMin.Text = chrtBottomRight.Series.FindByName("velocityTrend").Points.FindMinByValue().ToString();
 
        }
 
 
        #endregion
 
 
        #region transmission handling
 
 
        //variable declarations
 
        string latitude;
 
        string longitude;
 
        bool firstTransmissionDatum = false;
 
        double velocitySum = 0;
 
        double humiditySum = 0;
 
        double altitudeSum = 0;
 
        double pressureSum = 0;
 
        
 
        //runs on init 
 
        public void PrepareGraphs(){
 
 
            //set up for graphs MDKEdit
 
            // http://www.youtube.com/watch?v=zTod4-Fg6Ew - split containers
 
            // http://www.youtube.com/watch?v=bMXtgPk875I - chart controls
 
 
            chrtTopLeft.ChartAreas.Add("altitudeArea");
 
            chrtTopLeft.Series.Add("altitudeTrend");
 
 
            chrtTopRight.ChartAreas.Add("humidityArea");
 
            chrtTopRight.Series.Add("humidityTrend");
 
 
            chrtBottomLeft.Series.Add("pressureTrend");
 
            chrtBottomLeft.ChartAreas.Add("pressureArea");
 
@@ -1528,26 +1519,26 @@ namespace Demo.WindowsForms
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 9:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                default:
 
                    break;
 
            }
 
            testIteration++;
 
        }
 
 
        public double GetRandomNumber(double minimum, double maximum)
 
        {
 
            Random random = new Random();
 
            return random.NextDouble() * (maximum - minimum) + minimum;
 
        }
 
 
        #endregion
 
 
 
    }
 
}
 
//TODO: CSV logging, offline caching
 
//weekly changes: chart text display, map functionality[routes, layout, markers], find/remove unused code
 
//resume @: start/stop markers clear tracker markers after route clear
 
\ No newline at end of file
 
//weekly changes:   chart text display, map functionality[routes, layout, markers], find/remove unused code, 
 
//                  figured out caching but still needs to be tested
0 comments (0 inline, 0 general)