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
 
@@ -1095,13 +1095,13 @@
 
            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);
 
@@ -1129,24 +1129,24 @@
 
            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";
 
@@ -1160,13 +1160,13 @@
 
            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";
 
@@ -1190,13 +1190,13 @@
 
            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)));
Demo.WindowsForms/Forms/MainForm.cs
Show inline comments
 
@@ -74,41 +74,34 @@ namespace Demo.WindowsForms
 
                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.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 ;]
 
                comboBoxMapType.ValueMember = "Name";
 
                comboBoxMapType.DataSource = GMapProviders.List;
 
                comboBoxMapType.SelectedItem = MainMap.MapProvider;
 
@@ -132,21 +125,20 @@ namespace Demo.WindowsForms
 
#if DEBUG
 
                xboxGrid.Checked = true;
 
#endif
 
 
                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);
 
                currentMarker.IsHitTestVisible = false;
 
                currentMarker.ToolTipText = "Current Marker";
 
                top.Markers.Add(currentMarker);
 
@@ -597,29 +589,12 @@ namespace Demo.WindowsForms
 
            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
 
@@ -694,13 +669,13 @@ namespace Demo.WindowsForms
 
 
                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;
 
@@ -782,59 +757,12 @@ namespace Demo.WindowsForms
 
        // 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())
 
@@ -965,14 +893,76 @@ namespace Demo.WindowsForms
 
        //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);
 
            }
 
@@ -982,13 +972,13 @@ namespace Demo.WindowsForms
 
            }
 
        }
 
 
        #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;
 
@@ -1045,12 +1035,13 @@ namespace Demo.WindowsForms
 
            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;
 
@@ -1546,8 +1537,9 @@ namespace Demo.WindowsForms
 
        #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
 
                  
 
\ No newline at end of file
0 comments (0 inline, 0 general)