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 96 insertions and 104 deletions:
0 comments (0 inline, 0 general)
Demo.WindowsForms/Forms/MainForm.Designer.cs
Show inline comments
 
@@ -1098,7 +1098,7 @@
 
            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
 
            // 
 
@@ -1132,7 +1132,7 @@
 
            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
 
            // 
 
@@ -1143,7 +1143,7 @@
 
            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
 
            // 
 
@@ -1163,7 +1163,7 @@
 
            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
 
            // 
 
@@ -1193,7 +1193,7 @@
 
            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
 
            // 
Demo.WindowsForms/Forms/MainForm.cs
Show inline comments
 
@@ -77,35 +77,28 @@ namespace Demo.WindowsForms
 
 
                //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.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
 
                    MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);
 
 
                    MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);
 
                    MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
 
                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.OnMarkerClick += new MarkerClick(MainMap_OnMarkerClick);
 
                MainMap.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter);
 
                MainMap.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave);
 
 
                    MainMap.OnRouteEnter += new RouteEnter(MainMap_OnRouteEnter);
 
                    MainMap.OnRouteLeave += new RouteLeave(MainMap_OnRouteLeave);
 
                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.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 ;]
 
@@ -135,15 +128,14 @@ namespace Demo.WindowsForms
 
 
                ToolStripManager.Renderer = new BSE.Windows.Forms.Office2007Renderer();
 
 
                // add custom layers  
 
                {
 
                    MainMap.Overlays.Add(routes);
 
                    MainMap.Overlays.Add(objects);
 
                    MainMap.Overlays.Add(top);
 
                /// 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);
 
                }
 
                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);
 
@@ -600,23 +592,6 @@ namespace Demo.WindowsForms
 
            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)
 
@@ -697,7 +672,7 @@ namespace Demo.WindowsForms
 
            }
 
        }
 
 
        // 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);
 
@@ -785,53 +760,6 @@ namespace Demo.WindowsForms
 
            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)
 
        {
 
@@ -968,8 +896,70 @@ namespace Demo.WindowsForms
 
            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
 
            {
 
@@ -985,7 +975,7 @@ namespace Demo.WindowsForms
 
        #endregion
 
 
        #region chart click events
 
        
 
 
        //this method clears the background of all charts
 
        private void ResetChartColors()
 
        {
 
@@ -1048,6 +1038,7 @@ namespace Demo.WindowsForms
 
        #endregion
 
 
        #region transmission handling
 
 
        //variable declarations
 
        string latitude;
 
        string longitude;
 
@@ -1549,5 +1540,6 @@ namespace Demo.WindowsForms
 
    }
 
}
 
//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
 
                  
 
\ No newline at end of file
0 comments (0 inline, 0 general)