# HG changeset patch
# User mkanning@CL-ENS241-10.cedarville.edu
# Date 2013-02-07 15:51:48
# Node ID f660b906d4e029da2baacc989c302dc41d197f56
# Parent 65c134a3d619f075a7f66d616e37c0526395b1c4
Removing unneeded projects
diff --git a/Demo.WindowsMobile/Demo.WindowsMobile.csproj b/Demo.WindowsMobile/Demo.WindowsMobile.csproj
deleted file mode 100644
--- a/Demo.WindowsMobile/Demo.WindowsMobile.csproj
+++ /dev/null
@@ -1,149 +0,0 @@
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {27C6704C-040E-43BB-91CC-924EE351A6C7}
- WinExe
- Properties
- Demo.WindowsMobile
- GMap.NET
- {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- PocketPC
- b2c48bd2-963d-4549-9169-1fa021dce484
- 5.2
- GMap.NET
- v3.5
- Windows Mobile 6 Professional SDK
-
-
- %25CSIDL_PROGRAM_FILES%25
- Resources\ImageReady.ico
- true
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;PocketPC
- true
- true
- prompt
- 512
- 4
- Off
-
-
- none
- true
- bin\Release\
- TRACE;PocketPC
- true
- true
- prompt
- 512
- 4
- Off
-
-
-
- Source\DemoStuff.cs
-
-
- UserControl
-
-
- Search.cs
-
-
- UserControl
-
-
- GPS.cs
-
-
- Form
-
-
- MainForm.cs
-
-
- UserControl
-
-
- Transport.cs
-
-
-
-
-
- Search.cs
- Designer
-
-
- GPS.cs
- Designer
-
-
- MainForm.cs
- Designer
-
-
- Transport.cs
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
-
-
-
-
- {421813B1-A007-44B2-8C53-32751C45113E}
- GMap.NET.WindowsMobile %28GMap.NET\GMap.NET.WindowsMobile%29
-
-
-
-
-
-
-
-
-
- False
- ..\References\CompactFramework\System.Data.SQLite.dll
- True
-
-
-
-
-
-
-
- SQLite.Interop.081.dll
- PreserveNewest
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Forms/GPS.Designer.cs b/Demo.WindowsMobile/Forms/GPS.Designer.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/GPS.Designer.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-namespace Demo.WindowsMobile
-{
- partial class GPS
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if(disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.status = new System.Windows.Forms.Label();
- this.splitter1 = new System.Windows.Forms.Splitter();
- this.panelSignals = new System.Windows.Forms.Panel();
- this.SuspendLayout();
- //
- // status
- //
- this.status.BackColor = System.Drawing.Color.Navy;
- this.status.Dock = System.Windows.Forms.DockStyle.Top;
- this.status.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
- this.status.ForeColor = System.Drawing.Color.Lime;
- this.status.Location = new System.Drawing.Point(0, 0);
- this.status.Name = "status";
- this.status.Size = new System.Drawing.Size(391, 417);
- this.status.Text = "Loading...";
- //
- // splitter1
- //
- this.splitter1.BackColor = System.Drawing.Color.Black;
- this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
- this.splitter1.Location = new System.Drawing.Point(0, 417);
- this.splitter1.MinExtra = 0;
- this.splitter1.MinSize = 0;
- this.splitter1.Name = "splitter1";
- this.splitter1.Size = new System.Drawing.Size(391, 11);
- //
- // panelSignals
- //
- this.panelSignals.BackColor = System.Drawing.Color.DarkBlue;
- this.panelSignals.Dock = System.Windows.Forms.DockStyle.Fill;
- this.panelSignals.Location = new System.Drawing.Point(0, 428);
- this.panelSignals.Name = "panelSignals";
- this.panelSignals.Size = new System.Drawing.Size(391, 103);
- this.panelSignals.Paint += new System.Windows.Forms.PaintEventHandler(this.panelSignals_Paint);
- //
- // GPS
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.Controls.Add(this.panelSignals);
- this.Controls.Add(this.splitter1);
- this.Controls.Add(this.status);
- this.Name = "GPS";
- this.Size = new System.Drawing.Size(391, 531);
- this.Resize += new System.EventHandler(this.GPS_Resize);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.Splitter splitter1;
- internal System.Windows.Forms.Label status;
- internal System.Windows.Forms.Panel panelSignals;
- }
-}
diff --git a/Demo.WindowsMobile/Forms/GPS.cs b/Demo.WindowsMobile/Forms/GPS.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/GPS.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
-using System.Windows.Forms;
-
-namespace Demo.WindowsMobile
-{
- public partial class GPS : UserControl
- {
- MainForm Main;
-
- Pen penForSat = new Pen(Color.White, 3.0f);
- Brush brushForSatOk = new SolidBrush(Color.LimeGreen);
- Brush brushForSatNo = new SolidBrush(Color.Red);
- Font fSignal = new Font(FontFamily.GenericSansSerif, 6, FontStyle.Regular);
- Brush bSignal = new SolidBrush(Color.Blue);
- StringFormat sformat = new StringFormat();
-
- public GPS(MainForm main)
- {
- InitializeComponent();
- Main = main;
- sformat.LineAlignment = StringAlignment.Far;
- sformat.Alignment = StringAlignment.Center;
- }
-
- private void panelSignals_Paint(object sender, PaintEventArgs e)
- {
- lock(Main.Satellites)
- {
- if(Main.Satellites.Count > 0)
- {
- int cc = Width / Main.Satellites.Count;
- for(int i = 0; i < Main.Satellites.Count; i++)
- {
- int str = (int) (2.0 * (panelSignals.Height * Main.Satellites[i].SignalStrength)/100.0);
-
- if(Main.Satellites[i].InSolution)
- {
- e.Graphics.FillRectangle(brushForSatOk, new Rectangle(i*cc, panelSignals.Height - str, cc, str));
- }
- else
- {
- e.Graphics.FillRectangle(brushForSatNo, new Rectangle(i*cc, panelSignals.Height - str, cc, str));
- }
-
- e.Graphics.DrawRectangle(penForSat, new Rectangle(i*cc + (int) penForSat.Width/2, 0, cc - (int) penForSat.Width/2, panelSignals.Height));
-
- e.Graphics.DrawString(Main.Satellites[i].SignalStrength + "dB", fSignal, bSignal, new Rectangle(i*cc, 0, cc, (int)(panelSignals.Height-fSignal.Size/2)), sformat);
- }
- }
- }
- }
-
- private void GPS_Resize(object sender, EventArgs e)
- {
- if(Parent != null)
- {
- status.Height = Parent.Height - 44*5;
- }
- }
- }
-}
diff --git a/Demo.WindowsMobile/Forms/GPS.resx b/Demo.WindowsMobile/Forms/GPS.resx
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/GPS.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 2
-
-
- Pocket_PC_Phone
-
-
- Pocket_PC_Phone
-
-
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Forms/MainForm.Designer.cs b/Demo.WindowsMobile/Forms/MainForm.Designer.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/MainForm.Designer.cs
+++ /dev/null
@@ -1,450 +0,0 @@
-namespace Demo.WindowsMobile
-{
- partial class MainForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
- private System.Windows.Forms.MainMenu mainMenu1;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if(disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
- this.mainMenu1 = new System.Windows.Forms.MainMenu();
- this.menuItem1 = new System.Windows.Forms.MenuItem();
- this.menuItemGotoMap = new System.Windows.Forms.MenuItem();
- this.menuItemGotoGps = new System.Windows.Forms.MenuItem();
- this.menuItemSearch = new System.Windows.Forms.MenuItem();
- this.menuItemGotoTransport = new System.Windows.Forms.MenuItem();
- this.menuItem34 = new System.Windows.Forms.MenuItem();
- this.menuItem32 = new System.Windows.Forms.MenuItem();
- this.menuItem2 = new System.Windows.Forms.MenuItem();
- this.menuItem29 = new System.Windows.Forms.MenuItem();
- this.menuItemGPSenabled = new System.Windows.Forms.MenuItem();
- this.menuItem8 = new System.Windows.Forms.MenuItem();
- this.menuItem12 = new System.Windows.Forms.MenuItem();
- this.menuItem13 = new System.Windows.Forms.MenuItem();
- this.menuItem9 = new System.Windows.Forms.MenuItem();
- this.menuItem10 = new System.Windows.Forms.MenuItem();
- this.menuItem11 = new System.Windows.Forms.MenuItem();
- this.menuItem16 = new System.Windows.Forms.MenuItem();
- this.menuItem18 = new System.Windows.Forms.MenuItem();
- this.menuItem24 = new System.Windows.Forms.MenuItem();
- this.menuItem20 = new System.Windows.Forms.MenuItem();
- this.menuItem21 = new System.Windows.Forms.MenuItem();
- this.menuItem17 = new System.Windows.Forms.MenuItem();
- this.menuItem14 = new System.Windows.Forms.MenuItem();
- this.menuItem15 = new System.Windows.Forms.MenuItem();
- this.menuItem19 = new System.Windows.Forms.MenuItem();
- this.menuItem7 = new System.Windows.Forms.MenuItem();
- this.menuItemCacheOnly = new System.Windows.Forms.MenuItem();
- this.menuItemServerAndCache = new System.Windows.Forms.MenuItem();
- this.menuItemServerOnly = new System.Windows.Forms.MenuItem();
- this.menuItem30 = new System.Windows.Forms.MenuItem();
- this.menuItemEnableGrid = new System.Windows.Forms.MenuItem();
- this.menuItemDisableAutoSleep = new System.Windows.Forms.MenuItem();
- this.menuItemSnapToGps = new System.Windows.Forms.MenuItem();
- this.menuItem6 = new System.Windows.Forms.MenuItem();
- this.menuItem36 = new System.Windows.Forms.MenuItem();
- this.menuItem37 = new System.Windows.Forms.MenuItem();
- this.menuItem35 = new System.Windows.Forms.MenuItem();
- this.menuItem38 = new System.Windows.Forms.MenuItem();
- this.menuItem41 = new System.Windows.Forms.MenuItem();
- this.menuItem42 = new System.Windows.Forms.MenuItem();
- this.menuItem43 = new System.Windows.Forms.MenuItem();
- this.menuItem40 = new System.Windows.Forms.MenuItem();
- this.menuItem39 = new System.Windows.Forms.MenuItem();
- this.menuItem27 = new System.Windows.Forms.MenuItem();
- this.menuItem28 = new System.Windows.Forms.MenuItem();
- this.menuItem3 = new System.Windows.Forms.MenuItem();
- this.timerKeeperOfLife = new System.Windows.Forms.Timer();
- this.MainMap = new Map();
- this.menuItemshowDestination = new System.Windows.Forms.MenuItem();
- this.menuItemSetDestination = new System.Windows.Forms.MenuItem();
- this.SuspendLayout();
- //
- // mainMenu1
- //
- this.mainMenu1.MenuItems.Add(this.menuItem1);
- this.mainMenu1.MenuItems.Add(this.menuItem2);
- //
- // menuItem1
- //
- this.menuItem1.MenuItems.Add(this.menuItemGotoMap);
- this.menuItem1.MenuItems.Add(this.menuItemGotoGps);
- this.menuItem1.MenuItems.Add(this.menuItemSearch);
- this.menuItem1.MenuItems.Add(this.menuItemGotoTransport);
- this.menuItem1.MenuItems.Add(this.menuItem34);
- this.menuItem1.MenuItems.Add(this.menuItem32);
- this.menuItem1.Text = "Page";
- //
- // menuItemGotoMap
- //
- this.menuItemGotoMap.Checked = true;
- this.menuItemGotoMap.Text = "Map";
- this.menuItemGotoMap.Click += new System.EventHandler(this.menuItemGotoMap_Click);
- //
- // menuItemGotoGps
- //
- this.menuItemGotoGps.Text = "GPS";
- this.menuItemGotoGps.Click += new System.EventHandler(this.menuItemGotoGps_Click);
- //
- // menuItemSearch
- //
- this.menuItemSearch.Text = "Search";
- this.menuItemSearch.Click += new System.EventHandler(this.menuItemSearch_Click);
- //
- // menuItemGotoTransport
- //
- this.menuItemGotoTransport.Text = "Vilnius Transport";
- this.menuItemGotoTransport.Click += new System.EventHandler(this.menuItemGotoTransport_Click);
- //
- // menuItem34
- //
- this.menuItem34.Text = "-";
- //
- // menuItem32
- //
- this.menuItem32.Text = "Hide";
- this.menuItem32.Click += new System.EventHandler(this.menuItem32_Click);
- //
- // menuItem2
- //
- this.menuItem2.MenuItems.Add(this.menuItem29);
- this.menuItem2.MenuItems.Add(this.menuItem8);
- this.menuItem2.MenuItems.Add(this.menuItem7);
- this.menuItem2.MenuItems.Add(this.menuItem30);
- this.menuItem2.MenuItems.Add(this.menuItem6);
- this.menuItem2.MenuItems.Add(this.menuItem36);
- this.menuItem2.MenuItems.Add(this.menuItem38);
- this.menuItem2.MenuItems.Add(this.menuItem27);
- this.menuItem2.MenuItems.Add(this.menuItem28);
- this.menuItem2.MenuItems.Add(this.menuItem3);
- this.menuItem2.Text = "Menu";
- //
- // menuItem29
- //
- this.menuItem29.MenuItems.Add(this.menuItemGPSenabled);
- this.menuItem29.Text = "GPS";
- //
- // menuItemGPSenabled
- //
- this.menuItemGPSenabled.Checked = true;
- this.menuItemGPSenabled.Text = "Enabled";
- this.menuItemGPSenabled.Click += new System.EventHandler(this.menuItemGPSenabled_Click);
- //
- // menuItem8
- //
- this.menuItem8.MenuItems.Add(this.menuItem12);
- this.menuItem8.MenuItems.Add(this.menuItem13);
- this.menuItem8.MenuItems.Add(this.menuItem9);
- this.menuItem8.MenuItems.Add(this.menuItem10);
- this.menuItem8.MenuItems.Add(this.menuItem11);
- this.menuItem8.MenuItems.Add(this.menuItem16);
- this.menuItem8.MenuItems.Add(this.menuItem18);
- this.menuItem8.MenuItems.Add(this.menuItem24);
- this.menuItem8.MenuItems.Add(this.menuItem20);
- this.menuItem8.MenuItems.Add(this.menuItem21);
- this.menuItem8.MenuItems.Add(this.menuItem17);
- this.menuItem8.MenuItems.Add(this.menuItem14);
- this.menuItem8.MenuItems.Add(this.menuItem15);
- this.menuItem8.MenuItems.Add(this.menuItem19);
- this.menuItem8.Text = "Map";
- //
- // menuItem12
- //
- this.menuItem12.Text = "OpenStreetMap";
- this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
- //
- // menuItem13
- //
- this.menuItem13.Text = "-";
- //
- // menuItem9
- //
- this.menuItem9.Text = "GoogleMap";
- this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
- //
- // menuItem10
- //
- this.menuItem10.Text = "Google Hybrid";
- this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
- //
- // menuItem11
- //
- this.menuItem11.Text = "-";
- //
- // menuItem16
- //
- this.menuItem16.Text = "Bing";
- this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click);
- //
- // menuItem18
- //
- this.menuItem18.Text = "Bing Hybrid";
- this.menuItem18.Click += new System.EventHandler(this.menuItem18_Click);
- //
- // menuItem24
- //
- this.menuItem24.Text = "-";
- //
- // menuItem20
- //
- this.menuItem20.Text = "Yahoo";
- this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
- //
- // menuItem21
- //
- this.menuItem21.Text = "Yahoo Hybrid";
- this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
- //
- // menuItem17
- //
- this.menuItem17.Text = "-";
- //
- // menuItem14
- //
- this.menuItem14.Text = "Maps.LT";
- this.menuItem14.Click += new System.EventHandler(this.menuItem14_Click);
- //
- // menuItem15
- //
- this.menuItem15.Text = "Maps.LT Hybrid";
- this.menuItem15.Click += new System.EventHandler(this.menuItem15_Click);
- //
- // menuItem19
- //
- this.menuItem19.Text = "-";
- //
- // menuItem7
- //
- this.menuItem7.MenuItems.Add(this.menuItemCacheOnly);
- this.menuItem7.MenuItems.Add(this.menuItemServerAndCache);
- this.menuItem7.MenuItems.Add(this.menuItemServerOnly);
- this.menuItem7.Text = "Mode";
- //
- // menuItemCacheOnly
- //
- this.menuItemCacheOnly.Text = "CacheOnly";
- this.menuItemCacheOnly.Click += new System.EventHandler(this.menuItemCacheOnly_Click);
- //
- // menuItemServerAndCache
- //
- this.menuItemServerAndCache.Text = "ServerAndCache";
- this.menuItemServerAndCache.Click += new System.EventHandler(this.menuItemServerAndCache_Click);
- //
- // menuItemServerOnly
- //
- this.menuItemServerOnly.Text = "ServerOnly";
- this.menuItemServerOnly.Click += new System.EventHandler(this.menuItemServerOnly_Click);
- //
- // menuItem30
- //
- this.menuItem30.MenuItems.Add(this.menuItemshowDestination);
- this.menuItem30.MenuItems.Add(this.menuItemSnapToGps);
- this.menuItem30.MenuItems.Add(this.menuItemDisableAutoSleep);
- this.menuItem30.MenuItems.Add(this.menuItemEnableGrid);
- this.menuItem30.Text = "Options";
- //
- // menuItemEnableGrid
- //
- this.menuItemEnableGrid.Text = "Enable Grid";
- this.menuItemEnableGrid.Click += new System.EventHandler(this.menuItemEnableGrid_Click);
- //
- // menuItemDisableAutoSleep
- //
- this.menuItemDisableAutoSleep.Checked = true;
- this.menuItemDisableAutoSleep.Text = "Disable Auto Sleep";
- this.menuItemDisableAutoSleep.Click += new System.EventHandler(this.menuItemDisableAutoSleep_Click);
- //
- // menuItemSnapToGps
- //
- this.menuItemSnapToGps.Checked = true;
- this.menuItemSnapToGps.Text = "Snap To GPS";
- this.menuItemSnapToGps.Click += new System.EventHandler(this.menuItemSnapToGps_Click);
- //
- // menuItem6
- //
- this.menuItem6.Text = "-";
- //
- // menuItem36
- //
- this.menuItem36.MenuItems.Add(this.menuItem37);
- this.menuItem36.MenuItems.Add(this.menuItem35);
- this.menuItem36.MenuItems.Add(this.menuItemSetDestination);
- this.menuItem36.Text = "Markers";
- //
- // menuItem37
- //
- this.menuItem37.Text = "Clear";
- this.menuItem37.Click += new System.EventHandler(this.menuItem37_Click);
- //
- // menuItem35
- //
- this.menuItem35.Text = "Fit to All";
- this.menuItem35.Click += new System.EventHandler(this.menuItem35_Click);
- //
- // menuItem38
- //
- this.menuItem38.MenuItems.Add(this.menuItem41);
- this.menuItem38.MenuItems.Add(this.menuItem42);
- this.menuItem38.MenuItems.Add(this.menuItem43);
- this.menuItem38.MenuItems.Add(this.menuItem40);
- this.menuItem38.MenuItems.Add(this.menuItem39);
- this.menuItem38.Text = "Zoom";
- //
- // menuItem41
- //
- this.menuItem41.Text = "In";
- this.menuItem41.Click += new System.EventHandler(this.menuItem4_Click);
- //
- // menuItem42
- //
- this.menuItem42.Text = "Out";
- this.menuItem42.Click += new System.EventHandler(this.menuItem5_Click);
- //
- // menuItem43
- //
- this.menuItem43.Text = "-";
- //
- // menuItem40
- //
- this.menuItem40.Text = "Max";
- this.menuItem40.Click += new System.EventHandler(this.menuItem33_Click);
- //
- // menuItem39
- //
- this.menuItem39.Text = "Min";
- this.menuItem39.Click += new System.EventHandler(this.menuItem31_Click);
- //
- // menuItem27
- //
- this.menuItem27.Text = "Reload";
- this.menuItem27.Click += new System.EventHandler(this.menuItem27_Click);
- //
- // menuItem28
- //
- this.menuItem28.Text = "-";
- //
- // menuItem3
- //
- this.menuItem3.Text = "Exit";
- this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
- //
- // timerKeeperOfLife
- //
- this.timerKeeperOfLife.Tick += new System.EventHandler(this.timerKeeperOfLife_Tick);
- //
- // MainMap
- //
- this.MainMap.BackColor = System.Drawing.Color.White;
- this.MainMap.Dock = System.Windows.Forms.DockStyle.Fill;
- this.MainMap.Location = new System.Drawing.Point(0, 0);
- this.MainMap.Name = "MainMap";
- this.MainMap.Size = new System.Drawing.Size(480, 696);
- this.MainMap.TabIndex = 0;
- //
- // menuItemshowDestination
- //
- this.menuItemshowDestination.Text = "Show Destination";
- this.menuItemshowDestination.Click += new System.EventHandler(this.menuItemshowDestination_Click);
- //
- // menuItemSetDestination
- //
- this.menuItemSetDestination.Text = "Set Destination";
- this.menuItemSetDestination.Click += new System.EventHandler(this.menuItemSetDestination_Click);
- //
- // MainForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.AutoScroll = true;
- this.ClientSize = new System.Drawing.Size(480, 696);
- this.Controls.Add(this.MainMap);
- this.KeyPreview = true;
- this.Location = new System.Drawing.Point(0, 52);
- this.Menu = this.mainMenu1;
- this.Name = "MainForm";
- this.Text = "GMap.NET";
- this.Load += new System.EventHandler(this.MainForm_Load);
- this.Closed += new System.EventHandler(this.MainForm_Closed);
- this.Activated += new System.EventHandler(this.MainForm_Activated);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- internal Map MainMap;
- private System.Windows.Forms.MenuItem menuItem1;
- private System.Windows.Forms.MenuItem menuItem2;
- private System.Windows.Forms.MenuItem menuItem3;
- private System.Windows.Forms.MenuItem menuItem6;
- private System.Windows.Forms.MenuItem menuItem8;
- private System.Windows.Forms.MenuItem menuItem12;
- private System.Windows.Forms.MenuItem menuItem13;
- private System.Windows.Forms.MenuItem menuItem9;
- private System.Windows.Forms.MenuItem menuItem10;
- private System.Windows.Forms.MenuItem menuItem11;
- private System.Windows.Forms.MenuItem menuItem14;
- private System.Windows.Forms.MenuItem menuItem15;
- private System.Windows.Forms.MenuItem menuItem16;
- private System.Windows.Forms.MenuItem menuItem18;
- private System.Windows.Forms.MenuItem menuItem24;
- private System.Windows.Forms.MenuItem menuItem21;
- private System.Windows.Forms.MenuItem menuItem20;
- private System.Windows.Forms.MenuItem menuItem17;
- private System.Windows.Forms.MenuItem menuItem19;
- private System.Windows.Forms.MenuItem menuItem27;
- private System.Windows.Forms.MenuItem menuItem28;
- private System.Windows.Forms.MenuItem menuItem7;
- private System.Windows.Forms.MenuItem menuItemServerAndCache;
- private System.Windows.Forms.MenuItem menuItemCacheOnly;
- private System.Windows.Forms.MenuItem menuItem29;
- private System.Windows.Forms.MenuItem menuItemGPSenabled;
- private System.Windows.Forms.MenuItem menuItem30;
- private System.Windows.Forms.MenuItem menuItemEnableGrid;
- private System.Windows.Forms.Timer timerKeeperOfLife;
- private System.Windows.Forms.MenuItem menuItemDisableAutoSleep;
- private System.Windows.Forms.MenuItem menuItemGotoMap;
- private System.Windows.Forms.MenuItem menuItemGotoGps;
- private System.Windows.Forms.MenuItem menuItem34;
- private System.Windows.Forms.MenuItem menuItem32;
- private System.Windows.Forms.MenuItem menuItemServerOnly;
- private System.Windows.Forms.MenuItem menuItemGotoTransport;
- private System.Windows.Forms.MenuItem menuItem36;
- private System.Windows.Forms.MenuItem menuItem37;
- private System.Windows.Forms.MenuItem menuItem35;
- private System.Windows.Forms.MenuItem menuItemSearch;
- private System.Windows.Forms.MenuItem menuItem38;
- private System.Windows.Forms.MenuItem menuItem41;
- private System.Windows.Forms.MenuItem menuItem42;
- private System.Windows.Forms.MenuItem menuItem43;
- private System.Windows.Forms.MenuItem menuItem40;
- private System.Windows.Forms.MenuItem menuItem39;
- private System.Windows.Forms.MenuItem menuItemSnapToGps;
- internal System.Windows.Forms.MenuItem menuItemshowDestination;
- private System.Windows.Forms.MenuItem menuItemSetDestination;
- }
-}
-
diff --git a/Demo.WindowsMobile/Forms/MainForm.cs b/Demo.WindowsMobile/Forms/MainForm.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/MainForm.cs
+++ /dev/null
@@ -1,1215 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-using System.Data.SQLite;
-using System.Diagnostics;
-using System.Drawing;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Windows.Forms;
-using GMap.NET;
-using GMap.NET.GPS;
-using GMap.NET.Internals;
-using GMap.NET.WindowsForms;
-using GMap.NET.WindowsForms.Markers;
-using Microsoft.Win32;
-using Microsoft.WindowsCE.Forms;
-using GMap.NET.MapProviders;
-
-namespace Demo.WindowsMobile
-{
- public partial class MainForm : Form
- {
- PointLatLng start = new PointLatLng(54.6961334816182, 25.2985095977783);
- PointLatLng destinationPoint = new PointLatLng(54.6961334816182, 25.2985095977783);
-
- // marker
- GMarkerCross gpsPos;
-
- // layers
- GMapOverlay top;
- internal GMapOverlay objects;
-
- #region -- variables --
- string LogDb;
- SQLiteConnection cn;
- DbCommand cmd;
- DateTime LastFlush = DateTime.Now;
- TimeSpan FlushDelay = TimeSpan.FromSeconds(60);
-
- readonly Gps gps = new Gps();
- GpsDeviceState device = null;
-
- int count = 0;
- int countReal = 0;
- double Total = 0;
-
- EventHandler updateDataHandler;
- TimeSpan delay = TimeSpan.FromSeconds(1);
- DateTime? TimeUTC;
- double? Lat = 0;
- double? Lng = 0;
- double Delta = 0;
- internal readonly List Satellites = new List();
-
- IntPtr gpsPowerHandle = IntPtr.Zero;
-
- GPS pageGps;
- Transport pageTransport;
- Search pageSearch;
-
- readonly HookKeys hook = new HookKeys();
- #endregion
-
- public MainForm()
- {
- InitializeComponent();
-
- pageGps = new GPS(this);
- pageTransport = new Transport(this);
- pageSearch = new Search(this);
-
-#if DEBUG
- MainMap.Manager.Mode = AccessMode.ServerAndCache;
- menuItemServerAndCache.Checked = true;
- menuItemEnableGrid.Checked = true;
- menuItemGPSenabled.Checked = false;
- MainMap.ShowTileGridLines = true;
-#else
- menuItemGPSenabled.Checked = false;
- MainMap.Manager.Mode = AccessMode.CacheOnly;
- menuItemCacheOnly.Checked = true;
-#endif
- MainMap.MapProvider = GMapProviders.LithuaniaMap;
- MainMap.MaxZoom = 11;
- MainMap.MinZoom = 1;
- MainMap.Zoom = MainMap.MinZoom + 1;
- MainMap.Position = start;
-
- MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
- MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);
- MainMap.OnPositionChanged += new PositionChanged(MainMap_OnPositionChanged);
-
- // add custom layers
- {
- objects = new GMapOverlay("objects");
- MainMap.Overlays.Add(objects);
-
- top = new GMapOverlay("top");
- MainMap.Overlays.Add(top);
- }
-
- // gps pos
- gpsPos = new GMarkerCross(MainMap.Position);
- gpsPos.IsVisible = false;
- top.Markers.Add(gpsPos);
-
-#if DEBUG
- // transparent marker test
- GMapMarkerTransparentGoogleGreen goo = new GMapMarkerTransparentGoogleGreen(MainMap.Position);
- goo.ToolTipMode = MarkerTooltipMode.Always;
- goo.ToolTipText = "Welcome to Lithuania! ;}";
- objects.Markers.Add(goo);
-#endif
-
- // hook for volume up/down zooming
- hook.HookEvent += new HookKeys.HookEventHandler(hook_HookEvent);
-
- // test performance
- if(PerfTestEnabled)
- {
- timer.Interval = 111;
- timer.Tick += new EventHandler(timer_Tick);
- timer.Enabled = true;
- }
- }
-
- void MainMap_OnPositionChanged(PointLatLng point)
- {
- if(menuItemshowDestination.Checked && !menuItemGPSenabled.Checked)
- {
- UpdateDestinationRoute(true, menuItemSnapToGps.Checked ? MainMap.Position : gpsPos.Position);
- }
- }
-
- readonly IntPtr volumeUp = new IntPtr(257);
-
- bool hook_HookEvent(HookEventArgs e, KeyBoardInfo keyBoardInfo)
- {
- if(keyBoardInfo.vkCode == 117)
- {
- if(e.wParam == volumeUp)
- {
- MainMap.Zoom = (int) (MainMap.Zoom) + 1;
- }
- }
- else if(keyBoardInfo.vkCode == 118)
- {
- if(e.wParam == volumeUp)
- {
- MainMap.Zoom = (int) (MainMap.Zoom) - 1;
- }
- }
- return true;
- }
-
- #region -- performance test--
-
- bool PerfTestEnabled = false;
-
- double NextDouble(Random rng, double min, double max)
- {
- return min + (rng.NextDouble() * (max - min));
- }
-
- Random r = new Random();
-
- int tt = 0;
- void timer_Tick(object sender, EventArgs e)
- {
- var pos = new PointLatLng(NextDouble(r, MainMap.ViewArea.Top, MainMap.ViewArea.Bottom), NextDouble(r, MainMap.ViewArea.Left, MainMap.ViewArea.Right));
- GMapMarker m = new GMapMarkerGoogleGreen(pos);
- {
- m.ToolTipText = (tt++).ToString();
- m.ToolTipMode = MarkerTooltipMode.Always;
- m.Offset = new System.Drawing.Point(-m.Size.Width, -m.Size.Height);
- }
-
- objects.Markers.Add(m);
-
- if(tt >= 44)
- {
- timer.Enabled = false;
- tt = 0;
- }
- }
-
- Timer timer = new Timer();
- #endregion
-
- public void ZoomToFitMarkers()
- {
- if(objects.Markers.Count > 0)
- {
- RectLatLng? m = MainMap.GetRectOfAllMarkers(null);
- if(m.HasValue)
- {
- MainMap.SetZoomToFitRect(m.Value);
- }
- }
- }
-
- void MainMap_OnMapZoomChanged()
- {
- this.Text = "GMap.NET: " + (int) MainMap.Zoom;
- }
-
- void MainMap_OnMapTypeChanged(GMapProvider type)
- {
- //if(routes.Routes.Count > 0)
- //{
- // MainMap.ZoomAndCenterRoutes(null);
- //}
- }
-
- private void menuItem3_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- // zoom in
- private void menuItem4_Click(object sender, EventArgs e)
- {
- MainMap.Zoom = (int) (MainMap.Zoom) + 1;
- }
-
- // zoom out
- private void menuItem5_Click(object sender, EventArgs e)
- {
- MainMap.Zoom = (int) (MainMap.Zoom) - 1;
- }
-
- private void menuItem15_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.LithuaniaOrtoFotoMap;
- }
-
- private void menuItem10_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.GoogleHybridMap;
- }
-
- private void menuItem12_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.OpenStreetMap;
- }
-
- private void menuItem22_Click(object sender, EventArgs e)
- {
- //MainMap.MapProvider = GMapProviders.OpenStreetMapSurfer;
- }
-
- private void menuItem23_Click(object sender, EventArgs e)
- {
- //MainMap.MapProvider = GMapProviders.OpenStreetOsm;
- }
-
- private void menuItem9_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.GoogleMap;
- }
-
- private void menuItem16_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.BingMap;
- }
-
- private void menuItem18_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.BingHybridMap;
- }
-
- private void menuItem20_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.YahooMap;
- }
-
- private void menuItem21_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.YahooHybridMap;
- }
-
- private void menuItem14_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.LithuaniaMap;
- }
-
- private void menuItem25_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.ArcGIS_World_Topo_Map;
- }
-
- private void menuItem26_Click(object sender, EventArgs e)
- {
- MainMap.MapProvider = GMapProviders.ArcGIS_World_Physical_Map;
- }
-
- private void menuItem27_Click(object sender, EventArgs e)
- {
- MainMap.ReloadMap();
- }
-
- private void menuItemCacheOnly_Click(object sender, EventArgs e)
- {
- MainMap.Manager.Mode = AccessMode.CacheOnly;
- menuItemCacheOnly.Checked = true;
- menuItemServerAndCache.Checked = false;
- menuItemServerOnly.Checked = false;
- }
-
- private void menuItemServerAndCache_Click(object sender, EventArgs e)
- {
- MainMap.Manager.Mode = AccessMode.ServerAndCache;
- menuItemServerAndCache.Checked = true;
- menuItemCacheOnly.Checked = false;
- menuItemServerOnly.Checked = false;
- }
-
- private void menuItemServerOnly_Click(object sender, EventArgs e)
- {
- MainMap.Manager.Mode = AccessMode.ServerOnly;
- menuItemServerOnly.Checked = true;
- menuItemServerAndCache.Checked = false;
- menuItemCacheOnly.Checked = false;
- }
-
- private void menuItemGPSenabled_Click(object sender, EventArgs e)
- {
- menuItemGPSenabled.Checked = !menuItemGPSenabled.Checked;
-
- if(!menuItemGPSenabled.Checked)
- {
- if(gps.Opened)
- {
- gps.Close();
- SetOffGPSPower();
- }
-
- count = 0;
- countReal = 0;
- Total = 0;
- {
- TimeUTC = null;
- Lat = null;
- Lng = null;
- Delta = 0;
- }
- lock(Satellites)
- {
- Satellites.Clear();
- Satellites.TrimExcess();
- }
-
- if(Controls.Contains(pageGps))
- {
- pageGps.panelSignals.Invalidate();
- }
-
- TryCommitData();
-
- gpsPos.Pen.Color = Color.Blue;
- }
- else // start tracking
- {
- gpsPos.Pen.Color = Color.Red;
- gpsPos.IsVisible = true;
-
- if(!gps.Opened)
- {
- gps.Open();
- SetOnGPSPower();
- }
- }
- }
-
- public new void Hide()
- {
- Native.ShowWindow(this.Handle, Native.SW_MINIMIZED);
- timerKeeperOfLife.Enabled = false;
- IsVisible = false;
-
- hook.Stop();
- }
-
- object visibleLock = new object();
- bool visible = true;
- public bool IsVisible
- {
- get
- {
- lock(visibleLock)
- {
- return visible;
- }
- }
- set
- {
- lock(visibleLock)
- {
- visible = value;
- }
- }
- }
-
- public bool AddToLogCurrentInfo(GpsPosition data)
- {
- if(string.IsNullOrEmpty(LogDb))
- {
- return false;
- }
-
- bool ret = true;
- try
- {
- {
- if(cmd.Transaction == null)
- {
- cmd.Transaction = cn.BeginTransaction(IsolationLevel.Serializable);
- Debug.WriteLine("BeginTransaction: " + DateTime.Now.ToLongTimeString());
- }
-
- cmd.Parameters["@p1"].Value = data.Time.Value;
- cmd.Parameters["@p2"].Value = countReal++;
- cmd.Parameters["@p3"].Value = Delta;
- cmd.Parameters["@p4"].Value = data.Speed;
- cmd.Parameters["@p5"].Value = data.SeaLevelAltitude;
- cmd.Parameters["@p6"].Value = data.EllipsoidAltitude;
- cmd.Parameters["@p7"].Value = (short?) data.SatellitesInViewCount;
- cmd.Parameters["@p8"].Value = (short?) data.SatelliteCount;
- cmd.Parameters["@p9"].Value = data.Latitude.Value;
- cmd.Parameters["@p10"].Value = data.Longitude.Value;
- cmd.Parameters["@p11"].Value = data.PositionDilutionOfPrecision;
- cmd.Parameters["@p12"].Value = data.HorizontalDilutionOfPrecision;
- cmd.Parameters["@p13"].Value = data.VerticalDilutionOfPrecision;
- cmd.Parameters["@p14"].Value = (byte) data.FixQuality;
- cmd.Parameters["@p15"].Value = (byte) data.FixType;
- cmd.Parameters["@p16"].Value = (byte) data.FixSelection;
-
- cmd.ExecuteNonQuery();
- }
-
- if(DateTime.Now - LastFlush >= FlushDelay)
- {
- TryCommitData();
- }
- }
- catch(Exception ex)
- {
- Debug.WriteLine("AddToLog: " + ex.ToString());
- ret = false;
- }
-
- return ret;
- }
-
- void TryCommitData()
- {
- try
- {
- if(cmd.Transaction != null)
- {
- using(cmd.Transaction)
- {
- cmd.Transaction.Commit();
- LastFlush = DateTime.Now;
- }
- cmd.Transaction = null;
- Debug.WriteLine("TryCommitData: OK " + LastFlush.ToLongTimeString());
- }
- }
- catch(Exception ex)
- {
- Debug.WriteLine("TryCommitData: " + ex.ToString());
- }
- }
-
- public bool CheckLogDb(string file)
- {
- bool ret = true;
-
- try
- {
- string dir = Path.GetDirectoryName(file);
- if(!Directory.Exists(dir))
- {
- Directory.CreateDirectory(dir);
- }
-
- cn = new SQLiteConnection();
- {
- cn.ConnectionString = string.Format("Data Source=\"{0}\";FailIfMissing=False;", file);
- cn.Open();
- {
- using(DbTransaction tr = cn.BeginTransaction())
- {
- try
- {
- using(DbCommand cmd = cn.CreateCommand())
- {
- cmd.Transaction = tr;
- cmd.CommandText = @"CREATE TABLE IF NOT EXISTS GPS (id INTEGER NOT NULL PRIMARY KEY,
- TimeUTC DATETIME NOT NULL,
- SessionCounter INTEGER NOT NULL,
- Delta DOUBLE,
- Speed DOUBLE,
- SeaLevelAltitude DOUBLE,
- EllipsoidAltitude DOUBLE,
- SatellitesInView TINYINT,
- SatelliteCount TINYINT,
- Lat DOUBLE NOT NULL,
- Lng DOUBLE NOT NULL,
- PositionDilutionOfPrecision DOUBLE,
- HorizontalDilutionOfPrecision DOUBLE,
- VerticalDilutionOfPrecision DOUBLE,
- FixQuality TINYINT NOT NULL,
- FixType TINYINT NOT NULL,
- FixSelection TINYINT NOT NULL);
- CREATE INDEX IF NOT EXISTS IndexOfGPS ON GPS (TimeUTC, PositionDilutionOfPrecision);";
- cmd.ExecuteNonQuery();
- }
-
- this.cmd = cn.CreateCommand();
- {
- cmd.CommandText = @"INSERT INTO GPS
- (TimeUTC,
- SessionCounter,
- Delta,
- Speed,
- SeaLevelAltitude,
- EllipsoidAltitude,
- SatellitesInView,
- SatelliteCount,
- Lat,
- Lng,
- PositionDilutionOfPrecision,
- HorizontalDilutionOfPrecision,
- VerticalDilutionOfPrecision,
- FixQuality,
- FixType,
- FixSelection) VALUES(@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16);";
-
- cmd.Parameters.Add(new SQLiteParameter("@p1"));
- cmd.Parameters.Add(new SQLiteParameter("@p2"));
- cmd.Parameters.Add(new SQLiteParameter("@p3"));
- cmd.Parameters.Add(new SQLiteParameter("@p4"));
- cmd.Parameters.Add(new SQLiteParameter("@p5"));
- cmd.Parameters.Add(new SQLiteParameter("@p6"));
- cmd.Parameters.Add(new SQLiteParameter("@p7"));
- cmd.Parameters.Add(new SQLiteParameter("@p8"));
- cmd.Parameters.Add(new SQLiteParameter("@p9"));
- cmd.Parameters.Add(new SQLiteParameter("@p10"));
- cmd.Parameters.Add(new SQLiteParameter("@p11"));
- cmd.Parameters.Add(new SQLiteParameter("@p12"));
- cmd.Parameters.Add(new SQLiteParameter("@p13"));
- cmd.Parameters.Add(new SQLiteParameter("@p14"));
- cmd.Parameters.Add(new SQLiteParameter("@p15"));
- cmd.Parameters.Add(new SQLiteParameter("@p16"));
- cmd.Prepare();
- }
-
- tr.Commit();
- }
- catch
- {
- tr.Rollback();
- ret = false;
- }
- }
- }
- }
- }
- catch(Exception ex)
- {
- if(cn != null)
- {
- cn.Dispose();
- cn = null;
- }
- if(cmd != null)
- {
- cmd.Dispose();
- cmd = null;
- }
- Debug.WriteLine("CreateEmptyDB: " + ex.ToString());
- ret = false;
- }
-
- if(ret)
- {
- LogDb = file;
- }
- else
- {
- LogDb = null;
- }
-
- return ret;
- }
-
- private void MainForm_Load(object sender, EventArgs e)
- {
- updateDataHandler = new EventHandler(UpdateData);
-
- gps.DeviceStateChanged += new DeviceStateChangedEventHandler(gps_DeviceStateChanged);
- gps.LocationChanged += new LocationChangedEventHandler(gps_LocationChanged);
-
- string sd = Native.GetRemovableStorageDirectory();
- if(!string.IsNullOrEmpty(sd))
- {
- var fileName = sd + Path.DirectorySeparatorChar + "GMap.NET" + Path.DirectorySeparatorChar + "log.gpsd";
- {
- CheckLogDb(fileName);
- }
- }
-
- timerKeeperOfLife.Interval = ShortestTimeoutInterval() * 1000;
- timerKeeperOfLife.Enabled = true;
-
- if(menuItemGPSenabled.Checked)
- {
- if(!gps.Opened)
- {
- gps.Open();
- gpsPos.Pen.Color = Color.Red;
- gpsPos.IsVisible = true;
-
- SetOnGPSPower();
- }
- }
- else
- {
- gpsPos.Pen.Color = Color.Blue;
- gpsPos.IsVisible = false;
- }
-
- try
- {
- // Config AutoRotate
- {
- using(RegistryKey Config = Registry.CurrentUser.OpenSubKey(@"Software\HTC\HTCSENSOR\GSensor\ModuleName", true))
- {
- if(Config != null)
- {
- string gmapnet = Config.GetValue("GMapNET", null) as string;
- if(string.IsNullOrEmpty(gmapnet))
- {
- Config.SetValue("GMapNET", @"\Program files\gmap.net\GMap.NET.exe");
- }
- }
- }
-
- using(RegistryKey Config = Registry.CurrentUser.OpenSubKey(@"Software\HTC\HTCSENSOR\GSensor\WhiteList", true))
- {
- if(Config != null)
- {
- string gmapnet = Config.GetValue("GMapNET", null) as string;
- if(string.IsNullOrEmpty(gmapnet))
- {
- Config.SetValue("GMapNET", "#NETCF_AGL_BASE_");
- }
- }
- }
- }
- }
- catch(Exception ex)
- {
- Debug.WriteLine(ex.ToString());
- }
- }
-
- void gps_LocationChanged(object sender, GpsPosition position)
- {
- try
- {
- if(position != null)
- {
- count++;
-
- //Debug.WriteLine("LocationChanged: " + DateTime.Now.ToLongTimeString() + " -> " + count);
-
- if(position.Time.HasValue && position.Latitude.HasValue && position.Longitude.HasValue)
- {
- //Debug.WriteLine("Location: " + position.Latitude.Value + "|" + position.Longitude.Value);
-
- // first time
- if(!TimeUTC.HasValue)
- {
- TimeUTC = position.Time;
- Lat = position.Latitude;
- Lng = position.Longitude;
- }
-
- if(TimeUTC.HasValue && position.Time - TimeUTC.Value >= delay)
- {
- Delta = gps.GetDistance(position.Latitude.Value, position.Longitude.Value, Lat.Value, Lng.Value);
- Total += Delta;
- Lat = position.Latitude;
- Lng = position.Longitude;
- TimeUTC = position.Time;
-
- AddToLogCurrentInfo(position);
- }
- }
- else
- {
- Lat = position.Latitude;
- Lng = position.Longitude;
- TimeUTC = position.Time;
- }
-
- // do not update if user is idling
- if(IsVisible)
- {
- lock(Satellites)
- {
- Satellites.Clear();
- Satellites.AddRange(position.GetSatellitesInView());
- Satellites.TrimExcess();
- }
-
- Invoke(updateDataHandler, position);
- }
- }
- }
- catch(Exception ex)
- {
- Debug.WriteLine("gps_LocationChanged: " + ex);
- }
- }
-
- void gps_DeviceStateChanged(object sender, GpsDeviceState args)
- {
- device = args;
-
- if(IsVisible)
- {
- Invoke(updateDataHandler);
- }
- }
-
- private void MainForm_Closed(object sender, EventArgs e)
- {
- hook.Stop();
-
- if(gps.Opened)
- {
- gps.Close();
- }
-
- SetOffGPSPower();
-
- if(cn != null)
- {
- TryCommitData();
-
- if(cn.State == ConnectionState.Open)
- {
- cn.Close();
- }
- cn.Dispose();
- cn = null;
- }
- if(cmd != null)
- {
- cmd.Dispose();
- cmd = null;
- }
- }
-
- void SetOnGPSPower()
- {
- // Keep the GPS and device alive
- bool power = Native.PowerPolicyNotify(Native.PPN_UNATTENDEDMODE, true);
- if(!power)
- {
- Debug.WriteLine("PowerPolicyNotify failed for PPN_UNATTENDEDMODE");
- }
- else
- {
- if(gpsPowerHandle == IntPtr.Zero)
- {
- gpsPowerHandle = Native.SetPowerRequirement("gps0:", Native.CedevicePowerStateState.D0, Native.POWER_NAME | Native.POWER_FORCE, null, 0);
- if(gpsPowerHandle == IntPtr.Zero)
- {
- Debug.WriteLine("SetPowerRequirement failed for GPS");
- }
- }
- }
- }
-
- void SetOffGPSPower()
- {
- if(gpsPowerHandle != IntPtr.Zero)
- {
- Native.ReleasePowerRequirement(gpsPowerHandle);
- gpsPowerHandle = IntPtr.Zero;
- }
- Native.PowerPolicyNotify(Native.PPN_UNATTENDEDMODE, false);
- }
-
- ~MainForm()
- {
- MainForm_Closed(null, null);
- }
-
- void UpdateData(object sender, System.EventArgs args)
- {
- try
- {
- var lastData = sender as GpsPosition;
-
- // update signals
- if(Controls.Contains(pageGps))
- {
- pageGps.panelSignals.Invalidate();
-
- string str = Environment.NewLine;
-
- str += "GPS: " + device.DeviceState + ", Driver: " + device.ServiceState + ", " + count + " | " + countReal + "\n";
-
- if(lastData != null)
- {
- if(lastData.Time.HasValue && lastData.Longitude.HasValue && lastData.Longitude.HasValue)
- {
- int deltaClock = ((int) (DateTime.UtcNow - lastData.Time.Value).TotalSeconds);
-
- str += "Time(UTC): " + lastData.Time.Value.ToLongTimeString() + ", delay: " + deltaClock + "s \n";
- str += "Delta: " + string.Format("{0:0.00}m, total: {1:0.00km}\n", Delta * 1000.0, Total);
- str += "Latitude: " + lastData.Latitude.Value + "\n";
- str += "Longitude: " + lastData.Longitude.Value + "\n\n";
-
- if(Math.Abs(deltaClock) > 5) // 5s
- {
- UpdateTime(lastData.Time.Value);
- }
- }
- else
- {
- str += "Time(UTC): -" + "\n";
- str += "Delta: - \n";
- str += "Latitude: -" + "\n";
- str += "Longitude: -" + "\n\n";
- }
-
- if(lastData.Speed.HasValue)
- {
- str += "Speed: " + string.Format("{0:0.0}km/h | {1:0.0}m/s, head: {2}\n", lastData.Speed, lastData.Speed / 3.6, (int) (lastData.Heading.HasValue ? lastData.Heading.Value : 0));
- }
- else
- {
- str += "Speed: -\n";
- }
-
- if(lastData.SeaLevelAltitude.HasValue)
- {
- str += "SeaLevelAltitude: " + string.Format("{0:0.00}m\n", lastData.SeaLevelAltitude);
- }
- else
- {
- str += "SeaLevelAltitude: -\n";
- }
-
- if(lastData.PositionDilutionOfPrecision.HasValue)
- {
- str += "PositionDilutionOfPrecision: " + string.Format("{0:0.00}\n", lastData.PositionDilutionOfPrecision);
- }
- else
- {
- str += "PositionDilutionOfPrecision: -\n";
- }
-
- if(lastData.HorizontalDilutionOfPrecision.HasValue)
- {
- str += "HorizontalDilutionOfPrecision: " + string.Format("{0:0.00}\n", lastData.HorizontalDilutionOfPrecision);
- }
- else
- {
- str += "HorizontalDilutionOfPrecision: -\n";
- }
-
- if(lastData.VerticalDilutionOfPrecision.HasValue)
- {
- str += "VerticalDilutionOfPrecision: " + string.Format("{0:0.00}\n", lastData.VerticalDilutionOfPrecision);
- }
- else
- {
- str += "VerticalDilutionOfPrecision: -\n";
- }
-
- if(lastData.SatellitesInViewCount.HasValue)
- {
- str += "SatellitesInView: " + lastData.SatellitesInViewCount + "\n";
- }
- else
- {
- str += "SatellitesInView: -" + "\n";
- }
-
- if(lastData.SatelliteCount.HasValue)
- {
- str += "SatelliteCount: " + lastData.SatelliteCount + "\n";
- }
- else
- {
- str += "SatelliteCount: -" + "\n";
- }
- }
- pageGps.status.Text = str;
- }
- else if(Controls.Contains(MainMap))
- {
- if(lastData != null)
- {
- if(lastData.Time.HasValue && lastData.Longitude.HasValue && lastData.Longitude.HasValue)
- {
- // center map
- if(menuItemGPSenabled.Checked)
- {
- if(menuItemSnapToGps.Checked && !MainMap.IsDragging)
- {
- var newPos = new PointLatLng(lastData.Latitude.Value, lastData.Longitude.Value);
-
- if(menuItemshowDestination.Checked)
- {
- UpdateDestinationRoute(false, newPos);
- }
-
- MainMap.Position = newPos;
- }
- else
- {
- gpsPos.Position = new PointLatLng(lastData.Latitude.Value, lastData.Longitude.Value);
-
- if(menuItemshowDestination.Checked)
- {
- UpdateDestinationRoute(true, gpsPos.Position);
- }
- }
- }
- }
- }
- }
- }
- catch(Exception ex)
- {
- pageGps.status.Text = "\n" + ex.ToString();
- }
- }
-
- int ShortestTimeoutInterval()
- {
- int retVal = 1000;
-
- try
- {
- RegistryKey key = Registry.LocalMachine.OpenSubKey(@"\SYSTEM\CurrentControlSet\Control\Power");
- object oBatteryTimeout = key.GetValue("BattPowerOff");
- object oACTimeOut = key.GetValue("ExtPowerOff");
- object oScreenPowerOff = key.GetValue("ScreenPowerOff");
- key.Close();
-
- if(oBatteryTimeout is int)
- {
- int v = (int) oBatteryTimeout;
- if(v > 0)
- retVal = Math.Min(retVal, v);
- }
- if(oACTimeOut is int)
- {
- int v = (int) oACTimeOut;
- if(v > 0)
- retVal = Math.Min(retVal, v);
- }
- if(oScreenPowerOff is int)
- {
- int v = (int) oScreenPowerOff;
- if(v > 0)
- retVal = Math.Min(retVal, v);
- }
- }
- catch(Exception ex)
- {
- Debug.WriteLine("ShortestTimeoutInterval: " + ex.ToString());
- }
-
- return retVal * 9 / 10;
- }
-
- private void menuItemEnableGrid_Click(object sender, EventArgs e)
- {
- menuItemEnableGrid.Checked = !menuItemEnableGrid.Checked;
- MainMap.ShowTileGridLines = menuItemEnableGrid.Checked;
- }
-
- private void timerKeeperOfLife_Tick(object sender, EventArgs e)
- {
- Native.SystemIdleTimerReset();
- }
-
- private void menuItemDisableAutoSleep_Click(object sender, EventArgs e)
- {
- menuItemDisableAutoSleep.Checked = !menuItemDisableAutoSleep.Checked;
- timerKeeperOfLife.Enabled = menuItemDisableAutoSleep.Checked;
- }
-
- private void MainForm_Activated(object sender, EventArgs e)
- {
- timerKeeperOfLife.Enabled = menuItemDisableAutoSleep.Checked;
- IsVisible = true;
- hook.Start();
- }
-
- private void menuItem32_Click(object sender, EventArgs e)
- {
- this.Hide();
- }
-
- internal void menuItemGotoMap_Click(object sender, EventArgs e)
- {
- menuItemGotoMap.Checked = true;
- menuItemGotoGps.Checked = false;
- menuItemGotoTransport.Checked = false;
- menuItemSearch.Checked = false;
-
- this.SuspendLayout();
- this.Controls.Clear();
- this.Controls.Add(this.MainMap);
- this.ResumeLayout(false);
- }
-
- private void menuItemGotoGps_Click(object sender, EventArgs e)
- {
- menuItemGotoGps.Checked = true;
- menuItemGotoTransport.Checked = false;
- menuItemGotoMap.Checked = false;
- menuItemSearch.Checked = false;
-
- this.SuspendLayout();
- this.Controls.Clear();
- this.pageGps.Dock = DockStyle.Fill;
- this.Controls.Add(pageGps);
- this.ResumeLayout(false);
-
- pageGps.panelSignals.Invalidate();
- }
-
- internal void menuItemGotoTransport_Click(object sender, EventArgs e)
- {
- menuItemGotoTransport.Checked = true;
- menuItemGotoMap.Checked = false;
- menuItemGotoGps.Checked = false;
- menuItemSearch.Checked = false;
-
- this.SuspendLayout();
- this.Controls.Clear();
- this.pageTransport.Dock = DockStyle.Fill;
- this.Controls.Add(pageTransport);
- this.ResumeLayout(false);
- }
-
- private void menuItemSearch_Click(object sender, EventArgs e)
- {
- menuItemSearch.Checked = true;
- menuItemGotoTransport.Checked = false;
- menuItemGotoMap.Checked = false;
- menuItemGotoGps.Checked = false;
-
- this.SuspendLayout();
- this.Controls.Clear();
- this.pageSearch.Dock = DockStyle.Fill;
- this.Controls.Add(pageSearch);
- this.ResumeLayout(false);
- }
-
- private void menuItem35_Click(object sender, EventArgs e)
- {
- ZoomToFitMarkers();
- }
-
- private void menuItem31_Click(object sender, EventArgs e)
- {
- MainMap.Zoom = MainMap.MinZoom;
- }
-
- private void menuItem33_Click(object sender, EventArgs e)
- {
- MainMap.Zoom = MainMap.MaxZoom;
- }
-
- // clear markers
- private void menuItem37_Click(object sender, EventArgs e)
- {
- objects.Markers.Clear();
- }
-
- private struct SYSTEMTIME
- {
- public short Year;
- public short Month;
- public short DayOfWeek;
- public short Day;
- public short Hour;
- public short Minute;
- public short Second;
- public short Milliseconds;
- }
-
- [DllImport("coredll.dll")]
- private static extern bool SetSystemTime(ref SYSTEMTIME time);
-
- private void UpdateTime(DateTime gpsTime)
- {
- SYSTEMTIME s = new SYSTEMTIME();
- s.Year = (short) gpsTime.Year;
- s.Month = (short) gpsTime.Month;
- s.DayOfWeek = (short) gpsTime.DayOfWeek;
- s.Day = (short) gpsTime.Day;
- s.Hour = (short) gpsTime.Hour;
- s.Minute = (short) gpsTime.Minute;
- s.Second = (short) gpsTime.Second;
- s.Milliseconds = (short) gpsTime.Millisecond;
-
- bool t = SetSystemTime(ref s);
- Debug.WriteLine("SetSystemTime: " + t);
- }
-
- private void menuItemSnapToGps_Click(object sender, EventArgs e)
- {
- menuItemSnapToGps.Checked = !menuItemSnapToGps.Checked;
- if(!menuItemSnapToGps.Checked)
- {
- gpsPos.Position = MainMap.Position;
- }
- }
-
- private void menuItemSetDestination_Click(object sender, EventArgs e)
- {
- {
- destinationPoint = MainMap.Position;
-
- if(menuItemshowDestination.Checked)
- {
- UpdateDestinationRoute(true, menuItemSnapToGps.Checked ? MainMap.Position : gpsPos.Position);
- }
- }
- }
-
- internal GMapRoute destinationRoute;
-
- private void menuItemshowDestination_Click(object sender, EventArgs e)
- {
- menuItemshowDestination.Checked = !menuItemshowDestination.Checked;
-
- if(menuItemshowDestination.Checked)
- {
- if(MainMap.panel == null)
- {
- MainMap.panel = this;
- }
- UpdateDestinationRoute(true, menuItemSnapToGps.Checked ? MainMap.Position : gpsPos.Position);
- }
-
- if(destinationRoute != null)
- {
- destinationRoute.IsVisible = menuItemshowDestination.Checked;
- }
- }
-
- void UpdateDestinationRoute(bool forceUpdate, PointLatLng startPoint)
- {
- if(destinationRoute == null)
- {
- destinationRoute = new GMapRoute("destination route");
-
- destinationRoute.Stroke.Color = Color.Red;
- destinationRoute.Stroke.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
- destinationRoute.Stroke.Width = 1.0f;
-
- objects.Routes.Add(destinationRoute);
- }
- else
- {
- destinationRoute.Points.Clear();
- }
-
- destinationRoute.Points.Add(startPoint);
- destinationRoute.Points.Add(destinationPoint);
- if(forceUpdate)
- {
- MainMap.UpdateRouteLocalPosition(destinationRoute);
- MainMap.Invalidate();
- }
- }
- }
-
- public class Map : GMapControl
- {
- readonly Brush screenBrush = new SolidBrush(Color.Navy);
- readonly Font screenFont = new Font(FontFamily.GenericSansSerif, 7, FontStyle.Regular);
-
- public MainForm panel;
-
- protected override void OnPaintOverlays(Graphics g)
- {
- base.OnPaintOverlays(g);
-
- if(panel != null && panel.menuItemshowDestination.Checked)
- {
- g.DrawString(string.Format("destination: {0:0.00} km", panel.destinationRoute.Distance), screenFont, screenBrush, screenFont.Size, screenFont.Size);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Forms/MainForm.resx b/Demo.WindowsMobile/Forms/MainForm.resx
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/MainForm.resx
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- 151, 17
-
-
- Pocket_PC_Phone_VGA
-
-
- Pocket_PC_Phone_VGA
-
-
- False
-
-
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Forms/Search.cs b/Demo.WindowsMobile/Forms/Search.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/Search.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using GMap.NET;
-using GMap.NET.WindowsForms;
-using GMap.NET.WindowsForms.Markers;
-using GMap.NET.MapProviders;
-
-namespace Demo.WindowsMobile
-{
- public partial class Search : UserControl
- {
- MainForm Main;
-
- public Search(MainForm main)
- {
- InitializeComponent();
- Main = main;
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- GeoCoderStatusCode status = GeoCoderStatusCode.Unknow;
- {
- PointLatLng? pos = GMapProviders.GoogleMap.GetPoint(textAddress.Text, out status);
- if(pos != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- GMapMarker address = new GMapMarkerTransparentGoogleGreen(pos.Value);
- address.ToolTipMode = MarkerTooltipMode.Always;
- address.ToolTipText = textAddress.Text;
- Main.objects.Markers.Add(address);
-
- Main.MainMap.Position = address.Position;
- Main.menuItemGotoMap_Click(null, null);
- }
- else
- {
- labelstatus.Text = status.ToString();
- }
- }
- }
- catch(Exception ex)
- {
- labelstatus.Text = ex.ToString();
- }
- }
- }
-}
diff --git a/Demo.WindowsMobile/Forms/Search.designer.cs b/Demo.WindowsMobile/Forms/Search.designer.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/Search.designer.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-namespace Demo.WindowsMobile
-{
- partial class Search
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if(disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.textAddress = new System.Windows.Forms.TextBox();
- this.labelstatus = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // textAddress
- //
- this.textAddress.BackColor = System.Drawing.Color.Navy;
- this.textAddress.Dock = System.Windows.Forms.DockStyle.Top;
- this.textAddress.Font = new System.Drawing.Font("Tahoma", 22F, System.Drawing.FontStyle.Regular);
- this.textAddress.ForeColor = System.Drawing.Color.AliceBlue;
- this.textAddress.Location = new System.Drawing.Point(0, 0);
- this.textAddress.Multiline = true;
- this.textAddress.Name = "textAddress";
- this.textAddress.Size = new System.Drawing.Size(239, 199);
- this.textAddress.TabIndex = 4;
- this.textAddress.Text = "Lithuania, Vilnius";
- //
- // labelstatus
- //
- this.labelstatus.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelstatus.Location = new System.Drawing.Point(0, 199);
- this.labelstatus.Name = "labelstatus";
- this.labelstatus.Size = new System.Drawing.Size(239, 127);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.BackColor = System.Drawing.Color.Blue;
- this.button1.ForeColor = System.Drawing.Color.White;
- this.button1.Location = new System.Drawing.Point(19, 242);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(197, 53);
- this.button1.TabIndex = 7;
- this.button1.Text = "Search Address";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // Search
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.Controls.Add(this.button1);
- this.Controls.Add(this.labelstatus);
- this.Controls.Add(this.textAddress);
- this.Name = "Search";
- this.Size = new System.Drawing.Size(239, 326);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TextBox textAddress;
- private System.Windows.Forms.Label labelstatus;
- private System.Windows.Forms.Button button1;
-
- }
-}
diff --git a/Demo.WindowsMobile/Forms/Search.resx b/Demo.WindowsMobile/Forms/Search.resx
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/Search.resx
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Pocket_PC_Phone
-
-
- Pocket_PC_Phone
-
-
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Forms/Transport.Designer.cs b/Demo.WindowsMobile/Forms/Transport.Designer.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/Transport.Designer.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-namespace Demo.WindowsMobile
-{
- partial class Transport
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if(disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.textBoxTrolley = new System.Windows.Forms.TextBox();
- this.checkBoxTrolley = new System.Windows.Forms.CheckBox();
- this.checkBoxBus = new System.Windows.Forms.CheckBox();
- this.textBoxBus = new System.Windows.Forms.TextBox();
- this.checkBoxRefresh = new System.Windows.Forms.CheckBox();
- this.timerRefresh = new System.Windows.Forms.Timer();
- this.labelstatus = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // textBoxTrolley
- //
- this.textBoxTrolley.BackColor = System.Drawing.Color.Navy;
- this.textBoxTrolley.Dock = System.Windows.Forms.DockStyle.Top;
- this.textBoxTrolley.Font = new System.Drawing.Font("Tahoma", 26F, System.Drawing.FontStyle.Regular);
- this.textBoxTrolley.ForeColor = System.Drawing.Color.AliceBlue;
- this.textBoxTrolley.Location = new System.Drawing.Point(0, 48);
- this.textBoxTrolley.Name = "textBoxTrolley";
- this.textBoxTrolley.Size = new System.Drawing.Size(310, 59);
- this.textBoxTrolley.TabIndex = 0;
- this.textBoxTrolley.Text = "13,17";
- //
- // checkBoxTrolley
- //
- this.checkBoxTrolley.Checked = true;
- this.checkBoxTrolley.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBoxTrolley.Dock = System.Windows.Forms.DockStyle.Top;
- this.checkBoxTrolley.Font = new System.Drawing.Font("Tahoma", 18F, System.Drawing.FontStyle.Regular);
- this.checkBoxTrolley.Location = new System.Drawing.Point(0, 0);
- this.checkBoxTrolley.Name = "checkBoxTrolley";
- this.checkBoxTrolley.Size = new System.Drawing.Size(310, 48);
- this.checkBoxTrolley.TabIndex = 2;
- this.checkBoxTrolley.Text = "Trolley";
- this.checkBoxTrolley.CheckStateChanged += new System.EventHandler(this.checkBoxTrolley_CheckStateChanged);
- //
- // checkBoxBus
- //
- this.checkBoxBus.Dock = System.Windows.Forms.DockStyle.Top;
- this.checkBoxBus.Font = new System.Drawing.Font("Tahoma", 18F, System.Drawing.FontStyle.Regular);
- this.checkBoxBus.Location = new System.Drawing.Point(0, 107);
- this.checkBoxBus.Name = "checkBoxBus";
- this.checkBoxBus.Size = new System.Drawing.Size(310, 48);
- this.checkBoxBus.TabIndex = 5;
- this.checkBoxBus.Text = "Bus";
- this.checkBoxBus.CheckStateChanged += new System.EventHandler(this.checkBoxBus_CheckStateChanged);
- //
- // textBoxBus
- //
- this.textBoxBus.BackColor = System.Drawing.Color.Navy;
- this.textBoxBus.Dock = System.Windows.Forms.DockStyle.Top;
- this.textBoxBus.Font = new System.Drawing.Font("Tahoma", 26F, System.Drawing.FontStyle.Regular);
- this.textBoxBus.ForeColor = System.Drawing.Color.AliceBlue;
- this.textBoxBus.Location = new System.Drawing.Point(0, 155);
- this.textBoxBus.Name = "textBoxBus";
- this.textBoxBus.Size = new System.Drawing.Size(310, 59);
- this.textBoxBus.TabIndex = 4;
- this.textBoxBus.Text = "50";
- //
- // checkBoxRefresh
- //
- this.checkBoxRefresh.BackColor = System.Drawing.Color.Navy;
- this.checkBoxRefresh.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.checkBoxRefresh.Font = new System.Drawing.Font("Tahoma", 16F, System.Drawing.FontStyle.Regular);
- this.checkBoxRefresh.ForeColor = System.Drawing.Color.Lime;
- this.checkBoxRefresh.Location = new System.Drawing.Point(0, 388);
- this.checkBoxRefresh.Name = "checkBoxRefresh";
- this.checkBoxRefresh.Size = new System.Drawing.Size(310, 59);
- this.checkBoxRefresh.TabIndex = 6;
- this.checkBoxRefresh.Text = "AutoRefresh 15s";
- this.checkBoxRefresh.CheckStateChanged += new System.EventHandler(this.checkBoxRefresh_CheckStateChanged);
- //
- // timerRefresh
- //
- this.timerRefresh.Interval = 15000;
- this.timerRefresh.Tick += new System.EventHandler(this.timerRefresh_Tick);
- //
- // labelstatus
- //
- this.labelstatus.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelstatus.Location = new System.Drawing.Point(0, 214);
- this.labelstatus.Name = "labelstatus";
- this.labelstatus.Size = new System.Drawing.Size(310, 174);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.BackColor = System.Drawing.Color.Blue;
- this.button1.ForeColor = System.Drawing.Color.White;
- this.button1.Location = new System.Drawing.Point(237, 391);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(70, 53);
- this.button1.TabIndex = 7;
- this.button1.Text = "Manual";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // Transport
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.Controls.Add(this.button1);
- this.Controls.Add(this.labelstatus);
- this.Controls.Add(this.textBoxBus);
- this.Controls.Add(this.checkBoxBus);
- this.Controls.Add(this.textBoxTrolley);
- this.Controls.Add(this.checkBoxTrolley);
- this.Controls.Add(this.checkBoxRefresh);
- this.Name = "Transport";
- this.Size = new System.Drawing.Size(310, 447);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TextBox textBoxTrolley;
- private System.Windows.Forms.CheckBox checkBoxTrolley;
- private System.Windows.Forms.CheckBox checkBoxBus;
- private System.Windows.Forms.TextBox textBoxBus;
- private System.Windows.Forms.CheckBox checkBoxRefresh;
- private System.Windows.Forms.Timer timerRefresh;
- private System.Windows.Forms.Label labelstatus;
- private System.Windows.Forms.Button button1;
-
- }
-}
diff --git a/Demo.WindowsMobile/Forms/Transport.cs b/Demo.WindowsMobile/Forms/Transport.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/Transport.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using GMap.NET;
-using GMap.NET.WindowsForms;
-using GMap.NET.WindowsForms.Markers;
-using Demo.WindowsForms;
-using System.Linq;
-using System.IO;
-
-namespace Demo.WindowsMobile
-{
- public partial class Transport : UserControl
- {
- MainForm Main;
- int Count = 0;
-
- readonly List Bus = new List();
- readonly List Trolley = new List();
-
- readonly List BusMarkers = new List();
- readonly List TrolleyMarkers = new List();
-
- public Transport(MainForm main)
- {
- InitializeComponent();
- Main = main;
- }
-
- private void checkBoxRefresh_CheckStateChanged(object sender, EventArgs e)
- {
- timerRefresh.Enabled = checkBoxRefresh.Checked;
- labelstatus.Text = string.Empty;
- Count = 0;
- }
-
- private void checkBoxBus_CheckStateChanged(object sender, EventArgs e)
- {
- if(!checkBoxBus.Checked)
- {
- foreach(var b in BusMarkers)
- {
- Main.objects.Markers.Remove(b);
- }
- }
- }
-
- private void checkBoxTrolley_CheckStateChanged(object sender, EventArgs e)
- {
- if(!checkBoxTrolley.Checked)
- {
- foreach(var b in TrolleyMarkers)
- {
- Main.objects.Markers.Remove(b);
- }
- }
- }
-
- // update data
- private void timerRefresh_Tick(object sender, EventArgs e)
- {
- timerRefresh.Enabled = false;
-
- try
- {
- DateTime tstart = DateTime.Now;
- {
- if(checkBoxBus.Checked)
- {
- foreach(var b in BusMarkers)
- {
- Main.objects.Markers.Remove(b);
- }
-
- Stuff.GetVilniusTransportData(TransportType.Bus, textBoxBus.Text, Bus);
-
- foreach(var t in Bus)
- {
- if (textBoxBus.Text.Split(',').Contains(t.Line))
- {
- var r = new GMapMarkerTransparent(new PointLatLng(t.Lat, t.Lng));
- {
- r.ToolTipMode = MarkerTooltipMode.Always;
- r.ToolTipText = "B " + t.Id + Environment.NewLine + t.Line + " @ " + t.Time;
- r.Data = t;
- }
- Main.objects.Markers.Add(r);
- BusMarkers.Add(r);
- }
- }
- }
-
- if(checkBoxTrolley.Checked)
- {
- foreach(var b in TrolleyMarkers)
- {
- Main.objects.Markers.Remove(b);
- }
-
- Stuff.GetVilniusTransportData(TransportType.TrolleyBus, textBoxTrolley.Text, Trolley);
-
- foreach(var t in Trolley)
- {
- if (textBoxTrolley.Text.Split(',').Contains(t.Line))
- {
- var r = new GMapMarkerTransparent(new PointLatLng(t.Lat, t.Lng));
- {
- r.ToolTipMode = MarkerTooltipMode.Always;
- r.ToolTipText = "T " + t.Id + Environment.NewLine + t.Line + " @ " + t.Time;
- r.Data = t;
- }
- Main.objects.Markers.Add(r);
- TrolleyMarkers.Add(r);
- }
- }
- }
- }
- labelstatus.Text = ++Count + " -> " + DateTime.Now.ToLongTimeString() + ", request: " + (DateTime.Now - tstart).TotalSeconds+ "s";
- }
- catch(Exception ex)
- {
- labelstatus.Text = ex.ToString();
- }
- timerRefresh.Enabled = checkBoxRefresh.Checked;
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- labelstatus.Text = "Connecting manualy once...";
- labelstatus.Invalidate();
- timerRefresh_Tick(null, null);
- Main.ZoomToFitMarkers();
- Main.menuItemGotoMap_Click(null, null);
- }
- }
-
- public class GMapMarkerTransparent : GMapMarkerTransparentGoogleGreen
- {
- public VehicleData Data;
-
- public GMapMarkerTransparent(PointLatLng p)
- : base(p)
- {
-
- }
- }
-}
diff --git a/Demo.WindowsMobile/Forms/Transport.resx b/Demo.WindowsMobile/Forms/Transport.resx
deleted file mode 100644
--- a/Demo.WindowsMobile/Forms/Transport.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- Pocket_PC_Phone
-
-
- Pocket_PC_Phone
-
-
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Properties/AssemblyInfo.cs b/Demo.WindowsMobile/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Demo.WindowsMobile")]
-[assembly: AssemblyDescription("Demo for GMap.NET.WindowsMobile")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Universe")]
-[assembly: AssemblyProduct("Demo.WindowsMobile")]
-[assembly: AssemblyCopyright("Copyright © Universe 2010")]
-[assembly: AssemblyTrademark("email@radioman.lt")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("545e643b-a82a-481b-9df8-96ee8c774d5c")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.0.0")]
-
-// Below attribute is to suppress FxCop warning "CA2232 : Microsoft.Usage : Add STAThreadAttribute to assembly"
-// as Device app does not support STA thread.
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2232:MarkWindowsFormsEntryPointsWithStaThread")]
diff --git a/Demo.WindowsMobile/Properties/Resources.Designer.cs b/Demo.WindowsMobile/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Demo.WindowsMobile.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the Strongly Typed Resource Builder
- // class via a tool like ResGen or Visual Studio.NET.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- class Resources
- {
-
- private static System.Resources.ResourceManager _resMgr;
-
- private static System.Globalization.CultureInfo _resCulture;
-
- /*FamANDAssem*/
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
- public static System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if((_resMgr == null))
- {
- System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Demo.WindowsMobile.Properties.Resources", typeof(Resources).Assembly);
- _resMgr = temp;
- }
- return _resMgr;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
- public static System.Globalization.CultureInfo Culture
- {
- get
- {
- return _resCulture;
- }
- set
- {
- _resCulture = value;
- }
- }
- }
-}
diff --git a/Demo.WindowsMobile/Properties/Resources.resx b/Demo.WindowsMobile/Properties/Resources.resx
deleted file mode 100644
--- a/Demo.WindowsMobile/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Demo.WindowsMobile/Resources/ImageReady.ico b/Demo.WindowsMobile/Resources/ImageReady.ico
deleted file mode 100644
index b7fee32d3a43a405ef2fce56fd05b74ec6720489..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@= 0)
- {
- HookEventArgs hookArgs = new HookEventArgs();
- hookArgs.Code = code;
- hookArgs.wParam = wParam;
- hookArgs.lParam = lParam;
- KeyBoardInfo keyBoardInfo = new KeyBoardInfo();
- keyBoardInfo.vkCode = kbdllhookstruct.vkCode;
- keyBoardInfo.scanCode = kbdllhookstruct.scanCode;
- if(this.OnHookEvent(hookArgs, keyBoardInfo))
- {
- return 1;
- }
- }
- return CallNextHookEx(this.hookDeleg, code, wParam, lParam);
- }
-
- public bool isRunning()
- {
- if(hHook == 0)
- {
- return false;
- }
- return true;
- }
-
- protected virtual bool OnHookEvent(HookEventArgs hookArgs, KeyBoardInfo keyBoardInfo)
- {
- return ((this.HookEvent != null) && this.HookEvent(hookArgs, keyBoardInfo));
- }
-
- [DllImport("coredll.dll")]
- private static extern int SetWindowsHookEx(int type, HookProc hookProc, IntPtr hInstance, int m);
- public void Start()
- {
- if(isRunning())
- {
- this.Stop();
- }
- this.hookDeleg = new HookProc(this.HookProcedure);
- hHook = SetWindowsHookEx(20, this.hookDeleg, GetModuleHandle(null), 0);
- if(hHook == 0)
- {
- throw new SystemException("Failed acquiring of the hook.");
- }
- }
-
- public void Stop()
- {
- if(isRunning())
- {
- UnhookWindowsHookEx(hHook);
- hHook = 0;
- }
- }
-
- [DllImport("coredll.dll", SetLastError=true)]
- private static extern int UnhookWindowsHookEx(int idHook);
-
- public delegate bool HookEventHandler(HookEventArgs e, KeyBoardInfo keyBoardInfo);
-
- public delegate int HookProc(int code, IntPtr wParam, IntPtr lParam);
-
- [StructLayout(LayoutKind.Sequential)]
- private struct KBDLLHOOKSTRUCT
- {
- public int vkCode;
- public int scanCode;
- public int flags;
- public int time;
- public IntPtr dwExtraInfo;
- }
- }
-
- public class HookEventArgs : EventArgs
- {
- public int Code;
- public IntPtr lParam;
- public IntPtr wParam;
- }
-
- public class KeyBoardInfo
- {
- public int flags;
- public int scanCode;
- public int time;
- public int vkCode;
- }
-}
-
diff --git a/Demo.WindowsMobile/Source/Program.cs b/Demo.WindowsMobile/Source/Program.cs
deleted file mode 100644
--- a/Demo.WindowsMobile/Source/Program.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-
-using System.Collections.Generic;
-using System.Windows.Forms;
-
-namespace Demo.WindowsMobile
-{
- static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [MTAThread]
- static void Main()
- {
- Application.Run(new MainForm());
- }
- }
-}
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/Controls/TrolleyTooltip.xaml b/Demo.WindowsPresentation/Controls/TrolleyTooltip.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/Controls/TrolleyTooltip.xaml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Demo.WindowsPresentation/Controls/TrolleyTooltip.xaml.cs b/Demo.WindowsPresentation/Controls/TrolleyTooltip.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/Controls/TrolleyTooltip.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Windows.Controls;
-using GMap.NET;
-using Demo.WindowsForms;
-
-namespace Demo.WindowsPresentation.Controls
-{
- ///
- /// Interaction logic for TrolleyTooltip.xaml
- ///
- public partial class TrolleyTooltip : UserControl
- {
- public TrolleyTooltip()
- {
- InitializeComponent();
- }
-
- public void SetValues(string type, VehicleData vl)
- {
- Device.Text = vl.Id.ToString();
- LineNum.Text = type + " " + vl.Line;
- StopName.Text = vl.LastStop;
- TrackType.Text = vl.TrackType;
- TimeGps.Text = vl.Time;
- Area.Text = vl.AreaName;
- Street.Text = vl.StreetName;
- }
- }
-}
diff --git a/Demo.WindowsPresentation/CustomMarkers/Circle.xaml b/Demo.WindowsPresentation/CustomMarkers/Circle.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/Circle.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Demo.WindowsPresentation/CustomMarkers/Circle.xaml.cs b/Demo.WindowsPresentation/CustomMarkers/Circle.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/Circle.xaml.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using GMap.NET;
-
-namespace Demo.WindowsPresentation.CustomMarkers
-{
- ///
- /// Interaction logic for Circle.xaml
- ///
- public partial class Circle : UserControl
- {
- public Circle()
- {
- InitializeComponent();
- }
-
- public PointLatLng Center;
- public PointLatLng Bound;
- }
-}
diff --git a/Demo.WindowsPresentation/CustomMarkers/CircleVisual.cs b/Demo.WindowsPresentation/CustomMarkers/CircleVisual.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/CircleVisual.cs
+++ /dev/null
@@ -1,333 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Effects;
-using Demo.WindowsPresentation.Controls;
-using GMap.NET.WindowsPresentation;
-
-namespace Demo.WindowsPresentation.CustomMarkers
-{
- public class CircleVisual : FrameworkElement
- {
- public readonly Popup Popup = new Popup();
- public readonly TrolleyTooltip Tooltip = new TrolleyTooltip();
- public readonly GMapMarker Marker;
-
- public CircleVisual(GMapMarker m, Brush background)
- {
- Marker = m;
- Marker.ZIndex = 100;
-
- Popup.AllowsTransparency = true;
- Popup.PlacementTarget = this;
- Popup.Placement = PlacementMode.Mouse;
- Popup.Child = Tooltip;
- Popup.Child.Opacity = 0.777;
-
- SizeChanged += new SizeChangedEventHandler(CircleVisual_SizeChanged);
- MouseEnter += new System.Windows.Input.MouseEventHandler(CircleVisual_MouseEnter);
- MouseLeave += new System.Windows.Input.MouseEventHandler(CircleVisual_MouseLeave);
- Loaded += new RoutedEventHandler(OnLoaded);
-
- Text = "?";
-
- StrokeArrow.EndLineCap = PenLineCap.Triangle;
- StrokeArrow.LineJoin = PenLineJoin.Round;
-
- RenderTransform = scale;
-
- Width = Height = 22;
- FontSize = (Width/1.55);
-
- Background = background;
- Angle = null;
- }
-
- void CircleVisual_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- Marker.Offset = new System.Windows.Point(-e.NewSize.Width/2, -e.NewSize.Height/2);
- scale.CenterX = -Marker.Offset.X;
- scale.CenterY = -Marker.Offset.Y;
- }
-
- void OnLoaded(object sender, RoutedEventArgs e)
- {
- UpdateVisual(true);
- }
-
- readonly ScaleTransform scale = new ScaleTransform(1, 1);
-
- void CircleVisual_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
- {
- if(Popup.IsOpen)
- {
- Popup.IsOpen = false;
- }
-
- Marker.ZIndex -= 10000;
- Cursor = Cursors.Arrow;
-
- this.Effect = null;
-
- scale.ScaleY = 1;
- scale.ScaleX = 1;
- }
-
- void CircleVisual_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
- {
- if(!Popup.IsOpen)
- {
- Popup.IsOpen = true;
- }
-
- Marker.ZIndex += 10000;
- Cursor = Cursors.Hand;
-
- this.Effect = ShadowEffect;
-
- scale.ScaleY = 1.5;
- scale.ScaleX = 1.5;
- }
-
- public DropShadowEffect ShadowEffect;
-
- static readonly Typeface Font = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal);
- FormattedText FText;
-
- private Brush background = Brushes.Blue;
- public Brush Background
- {
- get
- {
- return background;
- }
- set
- {
- if(background != value)
- {
- background = value;
- IsChanged = true;
- }
- }
- }
-
- private Brush foreground = Brushes.White;
- public Brush Foreground
- {
- get
- {
- return foreground;
- }
- set
- {
- if(foreground != value)
- {
- foreground = value;
- IsChanged = true;
-
- ForceUpdateText();
- }
- }
- }
-
- private Pen stroke = new Pen(Brushes.Blue, 2.0);
- public Pen Stroke
- {
- get
- {
- return stroke;
- }
- set
- {
- if(stroke != value)
- {
- stroke = value;
- IsChanged = true;
- }
- }
- }
-
- private Pen strokeArrow = new Pen(Brushes.Blue, 2.0);
- public Pen StrokeArrow
- {
- get
- {
- return strokeArrow;
- }
- set
- {
- if(strokeArrow != value)
- {
- strokeArrow = value;
- IsChanged = true;
- }
- }
- }
-
- public double FontSize = 16;
-
- private double? angle = 0;
- public double? Angle
- {
- get
- {
- return angle;
- }
- set
- {
- if(!Angle.HasValue || !value.HasValue || (Angle.HasValue && value.HasValue && Math.Abs(angle.Value - value.Value) > 11))
- {
- angle = value;
- IsChanged = true;
- }
- }
- }
- public bool IsChanged = true;
-
- void ForceUpdateText()
- {
- FText = new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Font, FontSize, Foreground);
- IsChanged = true;
- }
-
- string text;
- public string Text
- {
- get
- {
- return text;
- }
- set
- {
- if(text != value)
- {
- text = value;
- ForceUpdateText();
- }
- }
- }
-
- Visual _child;
- public virtual Visual Child
- {
- get
- {
- return _child;
- }
- set
- {
- if(_child != value)
- {
- if(_child != null)
- {
- RemoveLogicalChild(_child);
- RemoveVisualChild(_child);
- }
-
- if(value != null)
- {
- AddVisualChild(value);
- AddLogicalChild(value);
- }
-
- // cache the new child
- _child = value;
-
- InvalidateVisual();
- }
- }
- }
-
- public bool UpdateVisual(bool forceUpdate)
- {
- if(forceUpdate || IsChanged)
- {
- Child = Create();
- IsChanged = false;
- return true;
- }
-
- return false;
- }
-
- int countCreate = 0;
-
- private DrawingVisual Create()
- {
- countCreate++;
-
- var square = new DrawingVisualFx();
-
- using(DrawingContext dc = square.RenderOpen())
- {
- dc.DrawEllipse(null, Stroke, new Point(Width/2, Height/2), Width/2 + Stroke.Thickness/2, Height/2 + Stroke.Thickness/2);
-
- if(Angle.HasValue)
- {
- dc.PushTransform(new RotateTransform(Angle.Value, Width/2, Height/2));
- {
- PolyLineSegment polySeg = new PolyLineSegment(new Point[] { new Point(Width*0.2, Height*0.3), new Point(Width*0.8, Height*0.3) }, true);
- PathFigure pathFig = new PathFigure(new Point(Width*0.5, -Height*0.22), new PathSegment[] { polySeg }, true);
- PathGeometry pathGeo = new PathGeometry(new PathFigure[] { pathFig });
- dc.DrawGeometry(Brushes.AliceBlue, StrokeArrow, pathGeo);
- }
- dc.Pop();
- }
-
- dc.DrawEllipse(Background, null, new Point(Width/2, Height/2), Width/2, Height/2);
- dc.DrawText(FText, new Point(Width/2 - FText.Width/2, Height/2 - FText.Height/2));
- }
-
- return square;
- }
-
- #region Necessary Overrides -- Needed by WPF to maintain bookkeeping of our hosted visuals
- protected override int VisualChildrenCount
- {
- get
- {
- return (Child == null ? 0 : 1);
- }
- }
-
- protected override Visual GetVisualChild(int index)
- {
- return Child;
- }
- #endregion
- }
-
- public class DrawingVisualFx : DrawingVisual
- {
- public static readonly DependencyProperty EffectProperty = DependencyProperty.Register("Effect", typeof(Effect), typeof(DrawingVisualFx),
- new FrameworkPropertyMetadata(null, (FrameworkPropertyMetadataOptions.AffectsRender), new PropertyChangedCallback(OnEffectChanged)));
- public Effect Effect
- {
- get
- {
- return (Effect) GetValue(EffectProperty);
- }
- set
- {
- SetValue(EffectProperty, value);
- }
- }
-
- private static void OnEffectChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
- {
- DrawingVisualFx drawingVisualFx = o as DrawingVisualFx;
- if(drawingVisualFx != null)
- {
- drawingVisualFx.setMyProtectedVisualEffect((Effect) e.NewValue);
- }
- }
-
- private void setMyProtectedVisualEffect(Effect effect)
- {
- VisualEffect = effect;
- }
- }
-}
diff --git a/Demo.WindowsPresentation/CustomMarkers/Cross.xaml b/Demo.WindowsPresentation/CustomMarkers/Cross.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/Cross.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
diff --git a/Demo.WindowsPresentation/CustomMarkers/Cross.xaml.cs b/Demo.WindowsPresentation/CustomMarkers/Cross.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/Cross.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Windows.Controls;
-
-namespace Demo.WindowsPresentation.CustomMarkers
-{
- ///
- /// Interaction logic for Cross.xaml
- ///
- public partial class Cross : UserControl
- {
- public Cross()
- {
- InitializeComponent();
- this.IsHitTestVisible = false;
- }
- }
-}
diff --git a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerDemo.xaml b/Demo.WindowsPresentation/CustomMarkers/CustomMarkerDemo.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerDemo.xaml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerDemo.xaml.cs b/Demo.WindowsPresentation/CustomMarkers/CustomMarkerDemo.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerDemo.xaml.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Media;
-using GMap.NET.WindowsPresentation;
-using System.Diagnostics;
-
-namespace Demo.WindowsPresentation.CustomMarkers
-{
- ///
- /// Interaction logic for CustomMarkerDemo.xaml
- ///
- public partial class CustomMarkerDemo
- {
- Popup Popup;
- Label Label;
- GMapMarker Marker;
- MainWindow MainWindow;
-
- public CustomMarkerDemo(MainWindow window, GMapMarker marker, string title)
- {
- this.InitializeComponent();
-
- this.MainWindow = window;
- this.Marker = marker;
-
- Popup = new Popup();
- Label = new Label();
-
- this.Unloaded += new RoutedEventHandler(CustomMarkerDemo_Unloaded);
- this.Loaded += new RoutedEventHandler(CustomMarkerDemo_Loaded);
- this.SizeChanged += new SizeChangedEventHandler(CustomMarkerDemo_SizeChanged);
- this.MouseEnter += new MouseEventHandler(MarkerControl_MouseEnter);
- this.MouseLeave += new MouseEventHandler(MarkerControl_MouseLeave);
- this.MouseMove += new MouseEventHandler(CustomMarkerDemo_MouseMove);
- this.MouseLeftButtonUp += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonUp);
- this.MouseLeftButtonDown += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonDown);
-
- Popup.Placement = PlacementMode.Mouse;
- {
- Label.Background = Brushes.Blue;
- Label.Foreground = Brushes.White;
- Label.BorderBrush = Brushes.WhiteSmoke;
- Label.BorderThickness = new Thickness(2);
- Label.Padding = new Thickness(5);
- Label.FontSize = 22;
- Label.Content = title;
- }
- Popup.Child = Label;
- }
-
- void CustomMarkerDemo_Loaded(object sender, RoutedEventArgs e)
- {
- if(icon.Source.CanFreeze)
- {
- icon.Source.Freeze();
- }
- }
-
- void CustomMarkerDemo_Unloaded(object sender, RoutedEventArgs e)
- {
- this.Unloaded -= new RoutedEventHandler(CustomMarkerDemo_Unloaded);
- this.Loaded -= new RoutedEventHandler(CustomMarkerDemo_Loaded);
- this.SizeChanged-= new SizeChangedEventHandler(CustomMarkerDemo_SizeChanged);
- this.MouseEnter -= new MouseEventHandler(MarkerControl_MouseEnter);
- this.MouseLeave -= new MouseEventHandler(MarkerControl_MouseLeave);
- this.MouseMove -= new MouseEventHandler(CustomMarkerDemo_MouseMove);
- this.MouseLeftButtonUp -= new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonUp);
- this.MouseLeftButtonDown -= new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonDown);
-
- Marker.Shape = null;
- icon.Source = null;
- icon = null;
- Popup = null;
- Label = null;
- }
-
- void CustomMarkerDemo_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- Marker.Offset = new Point(-e.NewSize.Width/2, -e.NewSize.Height);
- }
-
- void CustomMarkerDemo_MouseMove(object sender, MouseEventArgs e)
- {
- if(e.LeftButton == MouseButtonState.Pressed && IsMouseCaptured)
- {
- Point p = e.GetPosition(MainWindow.MainMap);
- Marker.Position = MainWindow.MainMap.FromLocalToLatLng((int) (p.X), (int) (p.Y));
- }
- }
-
- void CustomMarkerDemo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if(!IsMouseCaptured)
- {
- Mouse.Capture(this);
- }
- }
-
- void CustomMarkerDemo_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- if(IsMouseCaptured)
- {
- Mouse.Capture(null);
- }
- }
-
- void MarkerControl_MouseLeave(object sender, MouseEventArgs e)
- {
- Marker.ZIndex -= 10000;
- Popup.IsOpen = false;
- }
-
- void MarkerControl_MouseEnter(object sender, MouseEventArgs e)
- {
- Marker.ZIndex += 10000;
- Popup.IsOpen = true;
- }
- }
-}
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerRed.xaml b/Demo.WindowsPresentation/CustomMarkers/CustomMarkerRed.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerRed.xaml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerRed.xaml.cs b/Demo.WindowsPresentation/CustomMarkers/CustomMarkerRed.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/CustomMarkerRed.xaml.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Media;
-using GMap.NET.WindowsPresentation;
-
-namespace Demo.WindowsPresentation.CustomMarkers
-{
- ///
- /// Interaction logic for CustomMarkerDemo.xaml
- ///
- public partial class CustomMarkerRed
- {
- Popup Popup;
- Label Label;
- GMapMarker Marker;
- MainWindow MainWindow;
-
- public CustomMarkerRed(MainWindow window, GMapMarker marker, string title)
- {
- this.InitializeComponent();
-
- this.MainWindow = window;
- this.Marker = marker;
-
- Popup = new Popup();
- Label = new Label();
-
- this.Loaded += new RoutedEventHandler(CustomMarkerDemo_Loaded);
- this.SizeChanged += new SizeChangedEventHandler(CustomMarkerDemo_SizeChanged);
- this.MouseEnter += new MouseEventHandler(MarkerControl_MouseEnter);
- this.MouseLeave += new MouseEventHandler(MarkerControl_MouseLeave);
- this.MouseMove += new MouseEventHandler(CustomMarkerDemo_MouseMove);
- this.MouseLeftButtonUp += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonUp);
- this.MouseLeftButtonDown += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonDown);
-
- Popup.Placement = PlacementMode.Mouse;
- {
- Label.Background = Brushes.Blue;
- Label.Foreground = Brushes.White;
- Label.BorderBrush = Brushes.WhiteSmoke;
- Label.BorderThickness = new Thickness(2);
- Label.Padding = new Thickness(5);
- Label.FontSize = 22;
- Label.Content = title;
- }
- Popup.Child = Label;
- }
-
- void CustomMarkerDemo_Loaded(object sender, RoutedEventArgs e)
- {
- if(icon.Source.CanFreeze)
- {
- icon.Source.Freeze();
- }
- }
-
- void CustomMarkerDemo_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- Marker.Offset = new Point(-e.NewSize.Width/2, -e.NewSize.Height);
- }
-
- void CustomMarkerDemo_MouseMove(object sender, MouseEventArgs e)
- {
- if(e.LeftButton == MouseButtonState.Pressed && IsMouseCaptured)
- {
- Point p = e.GetPosition(MainWindow.MainMap);
- Marker.Position = MainWindow.MainMap.FromLocalToLatLng((int) p.X, (int) p.Y);
- }
- }
-
- void CustomMarkerDemo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if(!IsMouseCaptured)
- {
- Mouse.Capture(this);
- }
- }
-
- void CustomMarkerDemo_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- if(IsMouseCaptured)
- {
- Mouse.Capture(null);
- }
- }
-
- void MarkerControl_MouseLeave(object sender, MouseEventArgs e)
- {
- Marker.ZIndex -= 10000;
- Popup.IsOpen = false;
- }
-
- void MarkerControl_MouseEnter(object sender, MouseEventArgs e)
- {
- Marker.ZIndex += 10000;
- Popup.IsOpen = true;
- }
- }
-}
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/CustomMarkers/Test.xaml b/Demo.WindowsPresentation/CustomMarkers/Test.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/Test.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 44
-
-
diff --git a/Demo.WindowsPresentation/CustomMarkers/Test.xaml.cs b/Demo.WindowsPresentation/CustomMarkers/Test.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/CustomMarkers/Test.xaml.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Windows.Controls;
-
-namespace Demo.WindowsPresentation.CustomMarkers
-{
- ///
- /// Interaction logic for Test.xaml
- ///
- public partial class Test : UserControl
- {
- public Test(string txt)
- {
- InitializeComponent();
-
- text.Text = txt;
- }
- }
-}
diff --git a/Demo.WindowsPresentation/CustomMarkers/bigMarkerGreen.png b/Demo.WindowsPresentation/CustomMarkers/bigMarkerGreen.png
deleted file mode 100644
index 4aed804959cd7450939446ca75515003033a8543..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {83195AEF-0071-471C-9E8B-E67211F5D028}
- WinExe
- Properties
- Demo.WindowsPresentation
- Demo.WindowsPresentation
- v3.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- Resources\ImageReady.ico
-
-
- 3.5
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
-
- true
-
-
- sn.snk
-
-
-
- LocalIntranet
-
-
- true
-
-
-
-
-
- Properties\app.manifest
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- ..\Build\Debug\Demo.WindowsPresentation.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
- ..\Build\Release\
- TRACE
- true
- AnyCPU
- ..\Build\Release\Demo.WindowsPresentation.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- false
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- false
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
-
-
- 3.5
-
-
-
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
- 4.0
-
-
-
-
- Source\DemoStuff.cs
-
-
- Message.xaml
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- Properties\VersionInfo.cs
-
-
- MainWindow.xaml
- Code
-
-
- Designer
- MSBuild:Compile
-
-
-
-
- TrolleyTooltip.xaml
-
-
- Circle.xaml
-
-
-
- CustomMarkerRed.xaml
-
-
- Cross.xaml
-
-
- CustomMarkerDemo.xaml
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
-
- Test.xaml
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {644FE7D4-0184-400F-B2D7-99CB41360658}
- GMap.NET.WindowsPresentation
-
-
-
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- true
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/Properties/AssemblyInfo.cs b/Demo.WindowsPresentation/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Demo.WindowsPresentation")]
-[assembly: AssemblyDescription("Demo for GMap.NET.WindowsPresentation")]
-[assembly: AssemblyProduct("Demo.WindowsPresentation")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-//[assembly: AssemblyVersion("1.0.0.0")]
-//[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Demo.WindowsPresentation/Properties/Resources.Designer.cs b/Demo.WindowsPresentation/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.235
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Demo.WindowsPresentation.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Demo.WindowsPresentation.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Demo.WindowsPresentation/Properties/Resources.resx b/Demo.WindowsPresentation/Properties/Resources.resx
deleted file mode 100644
--- a/Demo.WindowsPresentation/Properties/Resources.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/Properties/app.manifest b/Demo.WindowsPresentation/Properties/app.manifest
deleted file mode 100644
--- a/Demo.WindowsPresentation/Properties/app.manifest
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Demo.WindowsPresentation/Resources/ImageReady.ico b/Demo.WindowsPresentation/Resources/ImageReady.ico
deleted file mode 100644
index b7fee32d3a43a405ef2fce56fd05b74ec6720489..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
- /// the custom map f GMapControl
- ///
- public class Map : GMapControl
- {
- public long ElapsedMilliseconds;
-
-#if DEBUG
- DateTime start;
- DateTime end;
- int delta;
-
- private int counter;
- readonly Typeface tf = new Typeface("GenericSansSerif");
- readonly System.Windows.FlowDirection fd = new System.Windows.FlowDirection();
-
- ///
- /// any custom drawing here
- ///
- ///
- protected override void OnRender(DrawingContext drawingContext)
- {
- start = DateTime.Now;
-
- base.OnRender(drawingContext);
-
- end = DateTime.Now;
- delta = (int)(end - start).TotalMilliseconds;
-
- FormattedText text = new FormattedText(string.Format(CultureInfo.InvariantCulture, "{0:0.0}", Zoom) + "z, " + MapProvider + ", refresh: " + counter++ + ", load: " + ElapsedMilliseconds + "ms, render: " + delta + "ms", CultureInfo.InvariantCulture, fd, tf, 20, Brushes.Blue);
- drawingContext.DrawText(text, new Point(text.Height, text.Height));
- text = null;
- }
-#endif
- }
-}
diff --git a/Demo.WindowsPresentation/Windows/MainWindow.xaml b/Demo.WindowsPresentation/Windows/MainWindow.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/Windows/MainWindow.xaml
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Drag Map
- Current Marker
-
-
-
- Grid
-
-
-
-
-
-
-
- lietuva vilnius
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- routing
- geocoding
-
-
-
-
- Transport demo
- Performance
- None
-
-
-
-
-
-
- place info
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Demo.WindowsPresentation/Windows/MainWindow.xaml.cs b/Demo.WindowsPresentation/Windows/MainWindow.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/Windows/MainWindow.xaml.cs
+++ /dev/null
@@ -1,990 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Threading;
-using Demo.WindowsForms;
-using Demo.WindowsPresentation.CustomMarkers;
-using GMap.NET;
-using GMap.NET.MapProviders;
-using GMap.NET.WindowsPresentation;
-
-namespace Demo.WindowsPresentation
-{
- public partial class MainWindow : Window
- {
- PointLatLng start;
- PointLatLng end;
-
- // marker
- GMapMarker currentMarker;
-
- // zones list
- List Circles = new List();
-
- public MainWindow()
- {
- InitializeComponent();
-
- // add your custom map db provider
- //MySQLPureImageCache ch = new 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.WindowsPresentation", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
- // config map
- MainMap.MapProvider = GMapProviders.OpenStreetMap;
- MainMap.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
-
- //MainMap.ScaleMode = ScaleModes.Dynamic;
-
- // map events
- MainMap.OnPositionChanged += new PositionChanged(MainMap_OnCurrentPositionChanged);
- MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);
- MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
- MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
- MainMap.MouseMove += new System.Windows.Input.MouseEventHandler(MainMap_MouseMove);
- MainMap.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(MainMap_MouseLeftButtonDown);
- MainMap.MouseEnter += new MouseEventHandler(MainMap_MouseEnter);
-
- // get map types
- comboBoxMapType.ItemsSource = GMapProviders.List;
- comboBoxMapType.DisplayMemberPath = "Name";
- comboBoxMapType.SelectedItem = MainMap.MapProvider;
-
- // acccess mode
- comboBoxMode.ItemsSource = Enum.GetValues(typeof(AccessMode));
- comboBoxMode.SelectedItem = MainMap.Manager.Mode;
-
- // get cache modes
- checkBoxCacheRoute.IsChecked = MainMap.Manager.UseRouteCache;
- checkBoxGeoCache.IsChecked = MainMap.Manager.UseGeocoderCache;
-
- // setup zoom min/max
- sliderZoom.Maximum = MainMap.MaxZoom;
- sliderZoom.Minimum = MainMap.MinZoom;
-
- // get position
- textBoxLat.Text = MainMap.Position.Lat.ToString(CultureInfo.InvariantCulture);
- textBoxLng.Text = MainMap.Position.Lng.ToString(CultureInfo.InvariantCulture);
-
- // get marker state
- checkBoxCurrentMarker.IsChecked = true;
-
- // can drag map
- checkBoxDragMap.IsChecked = MainMap.CanDragMap;
-
-#if DEBUG
- checkBoxDebug.IsChecked = true;
-#endif
-
- //validator.Window = this;
-
- // set current marker
- currentMarker = new GMapMarker(MainMap.Position);
- {
- currentMarker.Shape = new CustomMarkerRed(this, currentMarker, "custom position marker");
- currentMarker.Offset = new System.Windows.Point(-15, -15);
- currentMarker.ZIndex = int.MaxValue;
- MainMap.Markers.Add(currentMarker);
- }
-
- //if(false)
- {
- // add my city location for demo
- GeoCoderStatusCode status = GeoCoderStatusCode.Unknow;
-
- PointLatLng? city = GMapProviders.GoogleMap.GetPoint("Lithuania, Vilnius", out status);
- if(city != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- GMapMarker it = new GMapMarker(city.Value);
- {
- it.ZIndex = 55;
- it.Shape = new CustomMarkerDemo(this, it, "Welcome to Lithuania! ;}");
- }
- MainMap.Markers.Add(it);
-
- #region -- add some markers and zone around them --
- //if(false)
- {
- List objects = new List();
- {
- string area = "Antakalnis";
- PointLatLng? pos = GMapProviders.GoogleMap.GetPoint("Lithuania, Vilnius, " + area, out status);
- if(pos != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- objects.Add(new PointAndInfo(pos.Value, area));
- }
- }
- {
- string area = "Senamiestis";
- PointLatLng? pos = GMapProviders.GoogleMap.GetPoint("Lithuania, Vilnius, " + area, out status);
- if(pos != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- objects.Add(new PointAndInfo(pos.Value, area));
- }
- }
- {
- string area = "Pilaite";
- PointLatLng? pos = GMapProviders.GoogleMap.GetPoint("Lithuania, Vilnius, " + area, out status);
- if(pos != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- objects.Add(new PointAndInfo(pos.Value, area));
- }
- }
- AddDemoZone(8.8, city.Value, objects);
- }
- #endregion
- }
-
- if(MainMap.Markers.Count > 1)
- {
- MainMap.ZoomAndCenterMarkers(null);
- }
- }
-
- // perfromance test
- timer.Interval = TimeSpan.FromMilliseconds(44);
- timer.Tick += new EventHandler(timer_Tick);
-
- // transport demo
- transport.DoWork += new DoWorkEventHandler(transport_DoWork);
- transport.ProgressChanged += new ProgressChangedEventHandler(transport_ProgressChanged);
- transport.WorkerSupportsCancellation = true;
- transport.WorkerReportsProgress = true;
- }
-
- void MainMap_MouseEnter(object sender, MouseEventArgs e)
- {
- MainMap.Focus();
- }
-
- #region -- performance test--
- public RenderTargetBitmap ToImageSource(FrameworkElement obj)
- {
- // Save current canvas transform
- Transform transform = obj.LayoutTransform;
- obj.LayoutTransform = null;
-
- // fix margin offset as well
- Thickness margin = obj.Margin;
- obj.Margin = new Thickness(0, 0, margin.Right - margin.Left, margin.Bottom - margin.Top);
-
- // Get the size of canvas
- System.Windows.Size size = new System.Windows.Size(obj.Width, obj.Height);
-
- // force control to Update
- obj.Measure(size);
- obj.Arrange(new Rect(size));
-
- RenderTargetBitmap bmp = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Pbgra32);
- bmp.Render(obj);
-
- if(bmp.CanFreeze)
- {
- bmp.Freeze();
- }
-
- // return values as they were before
- obj.LayoutTransform = transform;
- obj.Margin = margin;
-
- return bmp;
- }
-
- double NextDouble(Random rng, double min, double max)
- {
- return min + (rng.NextDouble() * (max - min));
- }
-
- Random r = new Random();
-
- int tt = 0;
- void timer_Tick(object sender, EventArgs e)
- {
- var pos = new PointLatLng(NextDouble(r, MainMap.ViewArea.Top, MainMap.ViewArea.Bottom), NextDouble(r, MainMap.ViewArea.Left, MainMap.ViewArea.Right));
- GMapMarker m = new GMapMarker(pos);
- {
- var s = new Test((tt++).ToString());
-
- var image = new Image();
- {
- RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.LowQuality);
- image.Stretch = Stretch.None;
- image.Opacity = s.Opacity;
-
- image.MouseEnter += new System.Windows.Input.MouseEventHandler(image_MouseEnter);
- image.MouseLeave += new System.Windows.Input.MouseEventHandler(image_MouseLeave);
-
- image.Source = ToImageSource(s);
- }
-
- m.Shape = image;
-
- m.Offset = new System.Windows.Point(-s.Width, -s.Height);
- }
- MainMap.Markers.Add(m);
-
- if(tt >= 333)
- {
- timer.Stop();
- tt = 0;
- }
- }
-
- void image_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
- {
- Image img = sender as Image;
- img.RenderTransform = null;
- }
-
- void image_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
- {
- Image img = sender as Image;
- img.RenderTransform = new ScaleTransform(1.2, 1.2, 12.5, 12.5);
- }
-
- DispatcherTimer timer = new DispatcherTimer();
- #endregion
-
- #region -- transport demo --
- BackgroundWorker transport = new BackgroundWorker();
-
- readonly List trolleybus = new List();
- readonly Dictionary trolleybusMarkers = new Dictionary();
-
- readonly List bus = new List();
- readonly Dictionary busMarkers = new Dictionary();
-
- bool firstLoadTrasport = true;
-
- void transport_ProgressChanged(object sender, ProgressChangedEventArgs e)
- {
- using(Dispatcher.DisableProcessing())
- {
- lock(trolleybus)
- {
- foreach(VehicleData d in trolleybus)
- {
- GMapMarker marker;
-
- if(!trolleybusMarkers.TryGetValue(d.Id, out marker))
- {
- marker = new GMapMarker(new PointLatLng(d.Lat, d.Lng));
- marker.Tag = d.Id;
- marker.Shape = new CircleVisual(marker, Brushes.Red);
-
- trolleybusMarkers[d.Id] = marker;
- MainMap.Markers.Add(marker);
- }
- else
- {
- marker.Position = new PointLatLng(d.Lat, d.Lng);
- var shape = (marker.Shape as CircleVisual);
- {
- shape.Text = d.Line;
- shape.Angle = d.Bearing;
- shape.Tooltip.SetValues("TrolleyBus", d);
-
- if(shape.IsChanged)
- {
- shape.UpdateVisual(false);
- }
- }
- }
- }
- }
-
- lock(bus)
- {
- foreach(VehicleData d in bus)
- {
- GMapMarker marker;
-
- if(!busMarkers.TryGetValue(d.Id, out marker))
- {
- marker = new GMapMarker(new PointLatLng(d.Lat, d.Lng));
- marker.Tag = d.Id;
-
- var v = new CircleVisual(marker, Brushes.Blue);
- {
- v.Stroke = new Pen(Brushes.Gray, 2.0);
- }
- marker.Shape = v;
-
- busMarkers[d.Id] = marker;
- MainMap.Markers.Add(marker);
- }
- else
- {
- marker.Position = new PointLatLng(d.Lat, d.Lng);
- var shape = (marker.Shape as CircleVisual);
- {
- shape.Text = d.Line;
- shape.Angle = d.Bearing;
- shape.Tooltip.SetValues("Bus", d);
-
- if(shape.IsChanged)
- {
- shape.UpdateVisual(false);
- }
- }
- }
- }
- }
-
- if(firstLoadTrasport)
- {
- firstLoadTrasport = false;
- }
- }
- }
-
- void transport_DoWork(object sender, DoWorkEventArgs e)
- {
- while(!transport.CancellationPending)
- {
- try
- {
- lock(trolleybus)
- {
- Stuff.GetVilniusTransportData(TransportType.TrolleyBus, string.Empty, trolleybus);
- }
-
- lock(bus)
- {
- Stuff.GetVilniusTransportData(TransportType.Bus, string.Empty, bus);
- }
-
- transport.ReportProgress(100);
- }
- catch(Exception ex)
- {
- Debug.WriteLine("transport_DoWork: " + ex.ToString());
- }
- Thread.Sleep(3333);
- }
- trolleybusMarkers.Clear();
- busMarkers.Clear();
- }
-
- #endregion
-
- // add objects and zone around them
- void AddDemoZone(double areaRadius, PointLatLng center, List objects)
- {
- var objectsInArea = from p in objects
- where MainMap.MapProvider.Projection.GetDistance(center, p.Point) <= areaRadius
- select new
- {
- Obj = p,
- Dist = MainMap.MapProvider.Projection.GetDistance(center, p.Point)
- };
- if(objectsInArea.Any())
- {
- var maxDistObject = (from p in objectsInArea
- orderby p.Dist descending
- select p).First();
-
- // add objects to zone
- foreach(var o in objectsInArea)
- {
- GMapMarker it = new GMapMarker(o.Obj.Point);
- {
- it.ZIndex = 55;
- var s = new CustomMarkerDemo(this, it, o.Obj.Info + ", distance from center: " + o.Dist + "km.");
- it.Shape = s;
- }
-
- MainMap.Markers.Add(it);
- }
-
- // add zone circle
- //if(false)
- {
- GMapMarker it = new GMapMarker(center);
- it.ZIndex = -1;
-
- Circle c = new Circle();
- c.Center = center;
- c.Bound = maxDistObject.Obj.Point;
- c.Tag = it;
- c.IsHitTestVisible = false;
-
- UpdateCircle(c);
- Circles.Add(it);
-
- it.Shape = c;
- MainMap.Markers.Add(it);
- }
- }
- }
-
- // calculates circle radius
- void UpdateCircle(Circle c)
- {
- var pxCenter = MainMap.FromLatLngToLocal(c.Center);
- var pxBounds = MainMap.FromLatLngToLocal(c.Bound);
-
- double a = (double)(pxBounds.X - pxCenter.X);
- double b = (double)(pxBounds.Y - pxCenter.Y);
- var pxCircleRadius = Math.Sqrt(a * a + b * b);
-
- c.Width = 55 + pxCircleRadius * 2;
- c.Height = 55 + pxCircleRadius * 2;
- (c.Tag as GMapMarker).Offset = new System.Windows.Point(-c.Width / 2, -c.Height / 2);
- }
-
- void MainMap_OnMapTypeChanged(GMapProvider type)
- {
- sliderZoom.Minimum = MainMap.MinZoom;
- sliderZoom.Maximum = MainMap.MaxZoom;
- }
-
- void MainMap_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- System.Windows.Point p = e.GetPosition(MainMap);
- currentMarker.Position = MainMap.FromLocalToLatLng((int)p.X, (int)p.Y);
- }
-
- // move current marker with left holding
- void MainMap_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
- {
- if(e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
- {
- System.Windows.Point p = e.GetPosition(MainMap);
- currentMarker.Position = MainMap.FromLocalToLatLng((int)p.X, (int)p.Y);
- }
- }
-
- // zoo max & center markers
- private void button13_Click(object sender, RoutedEventArgs e)
- {
- MainMap.ZoomAndCenterMarkers(null);
-
- /*
- PointAnimation panMap = new PointAnimation();
- panMap.Duration = TimeSpan.FromSeconds(1);
- panMap.From = new Point(MainMap.Position.Lat, MainMap.Position.Lng);
- panMap.To = new Point(0, 0);
- Storyboard.SetTarget(panMap, MainMap);
- Storyboard.SetTargetProperty(panMap, new PropertyPath(GMapControl.MapPointProperty));
-
- Storyboard panMapStoryBoard = new Storyboard();
- panMapStoryBoard.Children.Add(panMap);
- panMapStoryBoard.Begin(this);
- */
- }
-
- // tile louading starts
- void MainMap_OnTileLoadStart()
- {
- System.Windows.Forms.MethodInvoker m = delegate()
- {
- progressBar1.Visibility = Visibility.Visible;
- };
-
- try
- {
- this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, m);
- }
- catch
- {
- }
- }
-
- // tile loading stops
- void MainMap_OnTileLoadComplete(long ElapsedMilliseconds)
- {
- MainMap.ElapsedMilliseconds = ElapsedMilliseconds;
-
- System.Windows.Forms.MethodInvoker m = delegate()
- {
- progressBar1.Visibility = Visibility.Hidden;
- groupBox3.Header = "loading, last in " + MainMap.ElapsedMilliseconds + "ms";
- };
-
- try
- {
- this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, m);
- }
- catch
- {
- }
- }
-
- // current location changed
- void MainMap_OnCurrentPositionChanged(PointLatLng point)
- {
- mapgroup.Header = "gmap: " + point;
- }
-
- // reload
- private void button1_Click(object sender, RoutedEventArgs e)
- {
- MainMap.ReloadMap();
- }
-
- // enable current marker
- private void checkBoxCurrentMarker_Checked(object sender, RoutedEventArgs e)
- {
- if(currentMarker != null)
- {
- MainMap.Markers.Add(currentMarker);
- }
- }
-
- // disable current marker
- private void checkBoxCurrentMarker_Unchecked(object sender, RoutedEventArgs e)
- {
- if(currentMarker != null)
- {
- MainMap.Markers.Remove(currentMarker);
- }
- }
-
- // enable map dragging
- private void checkBoxDragMap_Checked(object sender, RoutedEventArgs e)
- {
- MainMap.CanDragMap = true;
- }
-
- // disable map dragging
- private void checkBoxDragMap_Unchecked(object sender, RoutedEventArgs e)
- {
- MainMap.CanDragMap = false;
- }
-
- // goto!
- private void button2_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- double lat = double.Parse(textBoxLat.Text, CultureInfo.InvariantCulture);
- double lng = double.Parse(textBoxLng.Text, CultureInfo.InvariantCulture);
-
- MainMap.Position = new PointLatLng(lat, lng);
- }
- catch(Exception ex)
- {
- MessageBox.Show("incorrect coordinate format: " + ex.Message);
- }
- }
-
- // goto by geocoder
- private void textBoxGeo_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
- {
- if(e.Key == System.Windows.Input.Key.Enter)
- {
- GeoCoderStatusCode status = MainMap.SetCurrentPositionByKeywords(textBoxGeo.Text);
- if(status != GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- MessageBox.Show("Google Maps Geocoder can't find: '" + textBoxGeo.Text + "', reason: " + status.ToString(), "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Exclamation);
- }
- else
- {
- currentMarker.Position = MainMap.Position;
- }
- }
- }
-
- // zoom changed
- private void sliderZoom_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
- {
- // updates circles on map
- foreach(var c in Circles)
- {
- UpdateCircle(c.Shape as Circle);
- }
- }
-
- // zoom up
- private void czuZoomUp_Click(object sender, RoutedEventArgs e)
- {
- MainMap.Zoom = ((int)MainMap.Zoom) + 1;
- }
-
- // zoom down
- private void czuZoomDown_Click(object sender, RoutedEventArgs e)
- {
- MainMap.Zoom = ((int)(MainMap.Zoom + 0.99)) - 1;
- }
-
- // prefetch
- private void button3_Click(object sender, RoutedEventArgs e)
- {
- RectLatLng area = MainMap.SelectedArea;
- if(!area.IsEmpty)
- {
- for(int i = (int)MainMap.Zoom; i <= MainMap.MaxZoom; i++)
- {
- MessageBoxResult res = MessageBox.Show("Ready ripp at Zoom = " + i + " ?", "GMap.NET", MessageBoxButton.YesNoCancel);
-
- if(res == MessageBoxResult.Yes)
- {
- TilePrefetcher obj = new TilePrefetcher();
- obj.Owner = this;
- obj.ShowCompleteMessage = true;
- obj.Start(area, i, MainMap.MapProvider, 100);
- }
- else if(res == MessageBoxResult.No)
- {
- continue;
- }
- else if(res == MessageBoxResult.Cancel)
- {
- break;
- }
- }
- }
- else
- {
- MessageBox.Show("Select map area holding ALT", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Exclamation);
- }
- }
-
- // access mode
- private void comboBoxMode_DropDownClosed(object sender, EventArgs e)
- {
- MainMap.Manager.Mode = (AccessMode)comboBoxMode.SelectedItem;
- MainMap.ReloadMap();
- }
-
- // clear cache
- private void button4_Click(object sender, RoutedEventArgs e)
- {
- if(MessageBox.Show("Are You sure?", "Clear GMap.NET cache?", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK)
- {
- try
- {
- MainMap.Manager.PrimaryCache.DeleteOlderThan(DateTime.Now, null);
- MessageBox.Show("Done. Cache is clear.");
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
-
- // export
- private void button6_Click(object sender, RoutedEventArgs e)
- {
- MainMap.ShowExportDialog();
- }
-
- // import
- private void button5_Click(object sender, RoutedEventArgs e)
- {
- MainMap.ShowImportDialog();
- }
-
- // use route cache
- private void checkBoxCacheRoute_Checked(object sender, RoutedEventArgs e)
- {
- MainMap.Manager.UseRouteCache = checkBoxCacheRoute.IsChecked.Value;
- }
-
- // use geocoding cahce
- private void checkBoxGeoCache_Checked(object sender, RoutedEventArgs e)
- {
- MainMap.Manager.UseGeocoderCache = checkBoxGeoCache.IsChecked.Value;
- MainMap.Manager.UsePlacemarkCache = MainMap.Manager.UseGeocoderCache;
- }
-
- // save currnt view
- private void button7_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- ImageSource img = MainMap.ToImageSource();
- PngBitmapEncoder en = new PngBitmapEncoder();
- en.Frames.Add(BitmapFrame.Create(img as BitmapSource));
-
- Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
- dlg.FileName = "GMap.NET Image"; // Default file name
- dlg.DefaultExt = ".png"; // Default file extension
- dlg.Filter = "Image (.png)|*.png"; // Filter files by extension
- dlg.AddExtension = true;
- dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
-
- // Show save file dialog box
- bool? result = dlg.ShowDialog();
-
- // Process save file dialog box results
- if(result == true)
- {
- // Save document
- string filename = dlg.FileName;
-
- using(System.IO.Stream st = System.IO.File.OpenWrite(filename))
- {
- en.Save(st);
- }
- }
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- // clear all markers
- private void button10_Click(object sender, RoutedEventArgs e)
- {
- var clear = MainMap.Markers.Where(p => p != null && p != currentMarker);
- if(clear != null)
- {
- for(int i = 0; i < clear.Count(); i++)
- {
- MainMap.Markers.Remove(clear.ElementAt(i));
- i--;
- }
- }
-
- if(radioButtonPerformance.IsChecked == true)
- {
- tt = 0;
- if(!timer.IsEnabled)
- {
- timer.Start();
- }
- }
- }
-
- // add marker
- private void button8_Click(object sender, RoutedEventArgs e)
- {
- GMapMarker m = new GMapMarker(currentMarker.Position);
- {
- Placemark? p = null;
- if(checkBoxPlace.IsChecked.Value)
- {
- GeoCoderStatusCode status;
- var plret = GMapProviders.GoogleMap.GetPlacemark(currentMarker.Position, out status);
- if(status == GeoCoderStatusCode.G_GEO_SUCCESS && plret != null)
- {
- p = plret;
- }
- }
-
- string ToolTipText;
- if(p != null)
- {
- ToolTipText = p.Value.Address;
- }
- else
- {
- ToolTipText = currentMarker.Position.ToString();
- }
-
- m.Shape = new CustomMarkerDemo(this, m, ToolTipText);
- m.ZIndex = 55;
- }
- MainMap.Markers.Add(m);
- }
-
- // sets route start
- private void button11_Click(object sender, RoutedEventArgs e)
- {
- start = currentMarker.Position;
- }
-
- // sets route end
- private void button9_Click(object sender, RoutedEventArgs e)
- {
- end = currentMarker.Position;
- }
-
- // adds route
- private void button12_Click(object sender, RoutedEventArgs e)
- {
- RoutingProvider rp = MainMap.MapProvider as RoutingProvider;
- if(rp == null)
- {
- rp = GMapProviders.GoogleMap; // use google if provider does not implement routing
- }
-
- MapRoute route = rp.GetRoute(start, end, false, false, (int)MainMap.Zoom);
- if(route != null)
- {
- GMapMarker m1 = new GMapMarker(start);
- m1.Shape = new CustomMarkerDemo(this, m1, "Start: " + route.Name);
-
- GMapMarker m2 = new GMapMarker(end);
- m2.Shape = new CustomMarkerDemo(this, m2, "End: " + start.ToString());
-
- GMapMarker mRoute = new GMapMarker(start);
- {
- mRoute.Route.AddRange(route.Points);
- mRoute.RegenerateRouteShape(MainMap);
-
- mRoute.ZIndex = -1;
- }
-
- MainMap.Markers.Add(m1);
- MainMap.Markers.Add(m2);
- MainMap.Markers.Add(mRoute);
-
- MainMap.ZoomAndCenterMarkers(null);
- }
- }
-
- // enables tile grid view
- private void checkBox1_Checked(object sender, RoutedEventArgs e)
- {
- MainMap.ShowTileGridLines = true;
- }
-
- // disables tile grid view
- private void checkBox1_Unchecked(object sender, RoutedEventArgs e)
- {
- MainMap.ShowTileGridLines = false;
- }
-
- private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
- {
- int offset = 22;
-
- if(MainMap.IsFocused)
- {
- if(e.Key == Key.Left)
- {
- MainMap.Offset(-offset, 0);
- }
- else if(e.Key == Key.Right)
- {
- MainMap.Offset(offset, 0);
- }
- else if(e.Key == Key.Up)
- {
- MainMap.Offset(0, -offset);
- }
- else if(e.Key == Key.Down)
- {
- MainMap.Offset(0, offset);
- }
- else if(e.Key == Key.Add)
- {
- czuZoomUp_Click(null, null);
- }
- else if(e.Key == Key.Subtract)
- {
- czuZoomDown_Click(null, null);
- }
- }
- }
-
- // set real time demo
- private void realTimeChanged(object sender, RoutedEventArgs e)
- {
- MainMap.Markers.Clear();
-
- // start performance test
- if(radioButtonPerformance.IsChecked == true)
- {
- timer.Start();
- }
- else
- {
- // stop performance test
- timer.Stop();
- }
-
- // start realtime transport tracking demo
- if(radioButtonTransport.IsChecked == true)
- {
- if(!transport.IsBusy)
- {
- firstLoadTrasport = true;
- transport.RunWorkerAsync();
- }
- }
- else
- {
- if(transport.IsBusy)
- {
- transport.CancelAsync();
- }
- }
- }
-
- private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
- {
- if(e.Key == Key.A)
- {
- MainMap.Bearing--;
- }
- else if(e.Key == Key.Z)
- {
- MainMap.Bearing++;
- }
- }
- }
-
- public class MapValidationRule : ValidationRule
- {
- bool UserAcceptedLicenseOnce = false;
- internal MainWindow Window;
-
- public override ValidationResult Validate(object value, CultureInfo cultureInfo)
- {
- if(!(value is OpenStreetMapProviderBase))
- {
- if(!UserAcceptedLicenseOnce)
- {
- if(File.Exists(AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "License.txt"))
- {
- string ctn = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "License.txt");
- int li = ctn.IndexOf("License");
- string txt = ctn.Substring(li);
-
- var d = new Demo.WindowsPresentation.Windows.Message();
- d.richTextBox1.Text = txt;
-
- if(true == d.ShowDialog())
- {
- UserAcceptedLicenseOnce = true;
- if(Window != null)
- {
- Window.Title += " - license accepted by " + Environment.UserName + " at " + DateTime.Now;
- }
- }
- }
- else
- {
- // user deleted License.txt ;}
- UserAcceptedLicenseOnce = true;
- }
- }
-
- if(!UserAcceptedLicenseOnce)
- {
- return new ValidationResult(false, "user do not accepted license ;/");
- }
- }
-
- return new ValidationResult(true, null);
- }
- }
-}
diff --git a/Demo.WindowsPresentation/Windows/Message.xaml b/Demo.WindowsPresentation/Windows/Message.xaml
deleted file mode 100644
--- a/Demo.WindowsPresentation/Windows/Message.xaml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Demo.WindowsPresentation/Windows/Message.xaml.cs b/Demo.WindowsPresentation/Windows/Message.xaml.cs
deleted file mode 100644
--- a/Demo.WindowsPresentation/Windows/Message.xaml.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Demo.WindowsPresentation.Windows
-{
- ///
- /// Interaction logic for Message.xaml
- ///
- public partial class Message : Window
- {
- public Message()
- {
- InitializeComponent();
- }
-
- private void button1_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = true;
- Close();
- }
- }
-}
diff --git a/Demo.WindowsPresentation/sn.snk b/Demo.WindowsPresentation/sn.snk
deleted file mode 100644
index 5d3f356338012a684961ee80096fa2174233ecb1..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
- /// class that represents a gps coordinate in degrees, minutes, and seconds.
- ///
- public class DegreesMinutesSeconds
- {
-
- bool isPositive;
- ///
- /// Returns true if the degrees, minutes and seconds refer to a positive value,
- /// false otherwise.
- ///
- public bool IsPositive
- {
- get
- {
- return isPositive;
- }
- }
-
- uint degrees;
- ///
- /// The degrees unit of the coordinate
- ///
- public uint Degrees
- {
- get
- {
- return degrees;
- }
- }
-
- uint minutes;
- ///
- /// The minutes unit of the coordinate
- ///
- public uint Minutes
- {
- get
- {
- return minutes;
- }
- }
-
- double seconds;
- ///
- /// The seconds unit of the coordinate
- ///
- public double Seconds
- {
- get
- {
- return seconds;
- }
- }
-
- ///
- /// Constructs a new instance of DegreesMinutesSeconds converting
- /// from decimal degrees
- ///
- /// Initial value as decimal degrees
- public DegreesMinutesSeconds(double decimalDegrees)
- {
- isPositive = (decimalDegrees > 0);
-
- degrees = (uint) Math.Abs(decimalDegrees);
-
- double doubleMinutes = (Math.Abs(decimalDegrees) - Math.Abs((double) degrees)) * 60.0;
- minutes = (uint) doubleMinutes;
-
- seconds = (doubleMinutes - (double) minutes) * 60.0;
- }
-
- ///
- /// Constructs a new instance of DegreesMinutesSeconds
- ///
- /// True if the coordinates are positive coordinate, false if they
- /// are negative coordinates.
- /// Degrees unit of the coordinate
- /// Minutes unit of the coordinate
- /// Seconds unit of the coordinate. This should be a positive value.
- public DegreesMinutesSeconds(bool isPositive, uint degrees, uint minutes, double seconds)
- {
- this.isPositive = isPositive;
- this.degrees = degrees;
- this.minutes = minutes;
- this.seconds = seconds;
- }
-
- ///
- /// Converts the decimal, minutes, seconds coordinate to
- /// decimal degrees
- ///
- ///
- public double ToDecimalDegrees()
- {
- double val = (double) degrees + ((double) minutes / 60.0) + ((double) seconds / 3600.0);
- val = isPositive ? val : val * -1;
- return val;
- }
-
- ///
- /// Converts the instance to a string in format: D M' S"
- ///
- /// string representation of degrees, minutes, seconds
- public override string ToString()
- {
- return degrees + "d " + minutes + "' " + seconds + "\"";
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.GPS/GPS.cs b/GMap.NET.WindowsMobile/GMap.NET.GPS/GPS.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.GPS/GPS.cs
+++ /dev/null
@@ -1,390 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Use of this sample source code is subject to the terms of the Microsoft
-// license agreement under which you licensed this sample source code. If
-// you did not accept the terms of the license agreement, you are not
-// authorized to use this sample source code. For the terms of the license,
-// please see the license agreement between you and Microsoft or, if applicable,
-// see the LICENSE.RTF on your install media or the root of your tools installation.
-// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
-//
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-#if PocketPC
-using OpenNETCF.ComponentModel;
-using OpenNETCF.Threading;
-using Thread=OpenNETCF.Threading.Thread2;
-using System.Diagnostics;
-#endif
-
-namespace GMap.NET.GPS
-{
- public delegate void LocationChangedEventHandler(object sender, GpsPosition args);
- public delegate void DeviceStateChangedEventHandler(object sender, GpsDeviceState args);
-
- ///
- /// Summary description for GPS.
- ///
- public class Gps
- {
- // handle to the gps device
- IntPtr gpsHandle = IntPtr.Zero;
-
- // handle to the native event that is signalled when the GPS
- // devices gets a new location
- IntPtr newLocationHandle = IntPtr.Zero;
-
- // handle to the native event that is signalled when the GPS
- // device state changes
- IntPtr deviceStateChangedHandle = IntPtr.Zero;
-
- // handle to the native event that we use to stop our event
- // thread
- IntPtr stopHandle = IntPtr.Zero;
-
- // holds our event thread instance
- Thread gpsEventThread = null;
-
-
- event LocationChangedEventHandler locationChanged;
-
- ///
- /// Event that is raised when the GPS locaction data changes
- ///
- public event LocationChangedEventHandler LocationChanged
- {
- add
- {
- locationChanged += value;
-
- // create our event thread only if the user decides to listen
- CreateGpsEventThread();
- }
- remove
- {
- locationChanged -= value;
- }
- }
-
-
- event DeviceStateChangedEventHandler deviceStateChanged;
-
- ///
- /// Event that is raised when the GPS device state changes
- ///
- public event DeviceStateChangedEventHandler DeviceStateChanged
- {
- add
- {
- deviceStateChanged += value;
-
- // create our event thread only if the user decides to listen
- CreateGpsEventThread();
- }
- remove
- {
- deviceStateChanged -= value;
- }
- }
-
- ///
- /// True: The GPS device has been opened. False: It has not been opened
- ///
- public bool Opened
- {
- get
- {
- return gpsHandle != IntPtr.Zero;
- }
- }
-
- ~Gps()
- {
- // make sure that the GPS was closed.
- Close();
- }
-
- ///
- /// Opens the GPS device and prepares to receive data from it.
- ///
- public void Open()
- {
- if(!Opened)
- {
- // create handles for GPS events
- newLocationHandle = CreateEvent(IntPtr.Zero, 0, 0, null);
- deviceStateChangedHandle = CreateEvent(IntPtr.Zero, 0, 0, null);
- stopHandle = CreateEvent(IntPtr.Zero, 0, 0, null);
-
- gpsHandle = GPSOpenDevice(newLocationHandle, deviceStateChangedHandle, null, 0);
-
- // if events were hooked up before the device was opened, we'll need
- // to create the gps event thread.
- if(locationChanged != null || deviceStateChanged != null)
- {
- CreateGpsEventThread();
- }
- }
- }
-
- ///
- /// Closes the gps device.
- ///
- public void Close()
- {
- if(gpsHandle != IntPtr.Zero)
- {
- GPSCloseDevice(gpsHandle);
- gpsHandle = IntPtr.Zero;
- }
-
- // Set our native stop event so we can exit our event thread.
- if(stopHandle != IntPtr.Zero)
- {
- EventModify(stopHandle, eventSet);
- }
-
- // wait exit
- if(gpsEventThread != null && gpsEventThread.IsAlive)
- {
- //gpsEventThread.Join(4444);
- }
- }
-
- ///
- /// Get the position reported by the GPS receiver
- ///
- /// GpsPosition class with all the position details
- public GpsPosition GetPosition()
- {
- return GetPosition(TimeSpan.Zero);
- }
-
- ///
- /// Get the position reported by the GPS receiver that is no older than
- /// the maxAge passed in
- ///
- /// Max age of the gps position data that you want back.
- /// If there is no data within the required age, null is returned.
- /// if maxAge == TimeSpan.Zero, then the age of the data is ignored
- /// GpsPosition class with all the position details
- public GpsPosition GetPosition(TimeSpan maxAge)
- {
- GpsPosition gpsPosition = null;
- if(Opened)
- {
- // allocate the necessary memory on the native side. We have a class (GpsPosition) that
- // has the same memory layout as its native counterpart
- IntPtr ptr = Utils.LocalAlloc(Marshal.SizeOf(typeof(GpsPosition)));
-
- // fill in the required fields
- gpsPosition = new GpsPosition();
- gpsPosition.dwVersion = 1;
- gpsPosition.dwSize = Marshal.SizeOf(typeof(GpsPosition));
-
- // Marshal our data to the native pointer we allocated.
- Marshal.StructureToPtr(gpsPosition, ptr, false);
-
- // call native method passing in our native buffer
- int result = GPSGetPosition(gpsHandle, ptr, 500000, 0);
- if(result == 0)
- {
- // native call succeeded, marshal native data to our managed data
- gpsPosition = (GpsPosition) Marshal.PtrToStructure(ptr, typeof(GpsPosition));
-
- if(maxAge != TimeSpan.Zero)
- {
- // check to see if the data is recent enough.
- if(!gpsPosition.Time.HasValue || DateTime.UtcNow - maxAge > gpsPosition.Time)
- {
- gpsPosition = null;
- }
- }
- }
-
- // free our native memory
- Utils.LocalFree(ptr);
- }
-
- return gpsPosition;
- }
-
- ///
- /// Queries the device state.
- ///
- /// Device state information
- public GpsDeviceState GetDeviceState()
- {
- GpsDeviceState device = null;
-
- // allocate a buffer on the native side. Since the
- IntPtr pGpsDevice = Utils.LocalAlloc(GpsDeviceState.GpsDeviceStructureSize);
-
- // GPS_DEVICE structure has arrays of characters, it's easier to just
- // write directly into memory rather than create a managed structure with
- // the same layout.
- Marshal.WriteInt32(pGpsDevice, 1); // write out GPS version of 1
- Marshal.WriteInt32(pGpsDevice, 4, GpsDeviceState.GpsDeviceStructureSize); // write out dwSize of structure
-
- int result = GPSGetDeviceState(pGpsDevice);
-
- if(result == 0)
- {
- // instantiate the GpsDeviceState class passing in the native pointer
- device = new GpsDeviceState(pGpsDevice);
- }
-
- // free our native memory
- Utils.LocalFree(pGpsDevice);
-
- return device;
- }
-
- ///
- /// Creates our event thread that will receive native events
- ///
- private void CreateGpsEventThread()
- {
- // we only want to create the thread if we don't have one created already
- // and we have opened the gps device
- if(gpsEventThread == null && gpsHandle != IntPtr.Zero)
- {
- // Create and start thread to listen for GPS events
- gpsEventThread = new Thread(new System.Threading.ThreadStart(WaitForGpsEvents));
- gpsEventThread.IsBackground = false;
- gpsEventThread.Name = "GMap.NET GpsEvents";
- gpsEventThread.Start();
- }
- }
-
- ///
- /// Method used to listen for native events from the GPS.
- ///
- private void WaitForGpsEvents()
- {
- //lock (this)
- {
- bool listening = true;
- // allocate 3 handles worth of memory to pass to WaitForMultipleObjects
- IntPtr handles = Utils.LocalAlloc(12);
-
- // write the three handles we are listening for.
- Marshal.WriteInt32(handles, 0, stopHandle.ToInt32());
- Marshal.WriteInt32(handles, 4, deviceStateChangedHandle.ToInt32());
- Marshal.WriteInt32(handles, 8, newLocationHandle.ToInt32());
-
- while(listening)
- {
- int obj = WaitForMultipleObjects(3, handles, 0, -1);
- if(obj != waitFailed)
- {
- switch(obj)
- {
- case 0:
- // we've been signalled to stop
- listening = false;
- break;
-
- case 1:
- // device state has changed
- if(deviceStateChanged != null)
- {
- deviceStateChanged(this, GetDeviceState());
- }
- break;
-
- case 2:
- // location has changed
- if(locationChanged != null)
- {
- locationChanged(this, GetPosition());
- }
- break;
- }
- }
- }
-
- // free the memory we allocated for the native handles
- Utils.LocalFree(handles);
-
- if(newLocationHandle != IntPtr.Zero)
- {
- CloseHandle(newLocationHandle);
- newLocationHandle = IntPtr.Zero;
- }
-
- if(deviceStateChangedHandle != IntPtr.Zero)
- {
- CloseHandle(deviceStateChangedHandle);
- deviceStateChangedHandle = IntPtr.Zero;
- }
-
- if(stopHandle != IntPtr.Zero)
- {
- CloseHandle(stopHandle);
- stopHandle = IntPtr.Zero;
- }
-
- // clear our gpsEventThread so that we can recreate this thread again
- // if the events are hooked up again.
- gpsEventThread = null;
-
- Debug.WriteLine("gps device stopped...");
- }
- }
-
- public double GetDistance(double p1Lat, double p1Lng, double p2Lat, double p2Lng)
- {
- double dLat1InRad = p1Lat * (Math.PI / 180);
- double dLong1InRad = p1Lng * (Math.PI / 180);
- double dLat2InRad = p2Lat * (Math.PI / 180);
- double dLong2InRad = p2Lng * (Math.PI / 180);
- double dLongitude = dLong2InRad - dLong1InRad;
- double dLatitude = dLat2InRad - dLat1InRad;
- double a = Math.Pow(Math.Sin(dLatitude / 2), 2) + Math.Cos(dLat1InRad) * Math.Cos(dLat2InRad) * Math.Pow(Math.Sin(dLongitude / 2), 2);
- double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
- double dDistance = EarthRadiusKm * c;
- return dDistance;
- }
-
- ///
- /// Radius of the Earth
- ///
- public double EarthRadiusKm = 6378.137; // WGS-84
-
- #region PInvokes to gpsapi.dll
- [DllImport("gpsapi.dll")]
- static extern IntPtr GPSOpenDevice(IntPtr hNewLocationData, IntPtr hDeviceStateChange, string szDeviceName, int dwFlags);
-
- [DllImport("gpsapi.dll")]
- static extern int GPSCloseDevice(IntPtr hGPSDevice);
-
- [DllImport("gpsapi.dll")]
- static extern int GPSGetPosition(IntPtr hGPSDevice, IntPtr pGPSPosition, int dwMaximumAge, int dwFlags);
-
- [DllImport("gpsapi.dll")]
- static extern int GPSGetDeviceState(IntPtr pGPSDevice);
- #endregion
-
- #region PInvokes to coredll.dll
- [DllImport("coredll.dll")]
- static extern IntPtr CreateEvent(IntPtr lpEventAttributes, int bManualReset, int bInitialState, StringBuilder lpName);
-
- [DllImport("coredll.dll")]
- static extern int CloseHandle(IntPtr hObject);
-
- const int waitFailed = -1;
- [DllImport("coredll.dll")]
- static extern int WaitForMultipleObjects(int nCount, IntPtr lpHandles, int fWaitAll, int dwMilliseconds);
-
- const int eventSet = 3;
- [DllImport("coredll.dll")]
- static extern int EventModify(IntPtr hHandle, int dwFunc);
-
- #endregion
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.GPS/GpsDeviceState.cs b/GMap.NET.WindowsMobile/GMap.NET.GPS/GpsDeviceState.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.GPS/GpsDeviceState.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Use of this sample source code is subject to the terms of the Microsoft
-// license agreement under which you licensed this sample source code. If
-// you did not accept the terms of the license agreement, you are not
-// authorized to use this sample source code. For the terms of the license,
-// please see the license agreement between you and Microsoft or, if applicable,
-// see the LICENSE.RTF on your install media or the root of your tools installation.
-// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
-//
-#region Using directives
-
-using System;
-using System.Runtime.InteropServices;
-
-#endregion
-
-namespace GMap.NET.GPS
-{
- public enum GpsServiceState : int
- {
- Off=0,
- On=1,
- StartingUp=2,
- ShuttingDown=3,
- Unloading=4,
- Uninitialized=5,
- Unknown=-1
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct FileTime
- {
- int dwLowDateTime;
- int dwHighDateTime;
- }
-
- ///
- /// GpsDeviceState holds the state of the gps device and the friendly name if the
- /// gps supports them.
- ///
- [StructLayout(LayoutKind.Sequential)]
- public class GpsDeviceState
- {
- public static int GpsMaxFriendlyName = 64;
- public static int GpsDeviceStructureSize = 216;
-
- int serviceState = 0;
- ///
- /// State of the GPS Intermediate Driver service
- ///
- public GpsServiceState ServiceState
- {
- get
- {
- return (GpsServiceState) serviceState;
- }
- }
-
- int deviceState = 0;
- ///
- /// Status of the actual GPS device driver.
- ///
- public GpsServiceState DeviceState
- {
- get
- {
- return (GpsServiceState) deviceState;
- }
- }
-
- string friendlyName = "";
- ///
- /// Friendly name of the real GPS device we are currently using.
- ///
- public string FriendlyName
- {
- get
- {
- return friendlyName;
- }
- }
-
- ///
- /// Constructor of GpsDeviceState. It copies values from the native pointer
- /// passed in.
- ///
- /// Native pointer to memory that contains
- /// the GPS_DEVICE data
- public GpsDeviceState(IntPtr pGpsDevice)
- {
- // make sure our pointer is valid
- if(pGpsDevice == IntPtr.Zero)
- {
- throw new ArgumentException();
- }
-
- // read in the service state which starts at offset 8
- serviceState = Marshal.ReadInt32(pGpsDevice, 8);
- // read in the device state which starts at offset 12
- deviceState = Marshal.ReadInt32(pGpsDevice, 12);
-
- // the friendly name starts at offset 88
- IntPtr pFriendlyName = (IntPtr) (pGpsDevice.ToInt32() + 88);
- // marshal the native string into our gpsFriendlyName
- friendlyName = Marshal.PtrToStringUni(pFriendlyName);
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.GPS/GpsPosition.cs b/GMap.NET.WindowsMobile/GMap.NET.GPS/GpsPosition.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.GPS/GpsPosition.cs
+++ /dev/null
@@ -1,477 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Use of this sample source code is subject to the terms of the Microsoft
-// license agreement under which you licensed this sample source code. If
-// you did not accept the terms of the license agreement, you are not
-// authorized to use this sample source code. For the terms of the license,
-// please see the license agreement between you and Microsoft or, if applicable,
-// see the LICENSE.RTF on your install media or the root of your tools installation.
-// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
-//
-#region Using directives
-
-using System;
-using System.Runtime.InteropServices;
-using System.Collections;
-using System.Collections.Generic;
-
-#endregion
-
-namespace GMap.NET.GPS
-{
- #region Internal Native Structures
- [StructLayout(LayoutKind.Sequential)]
- internal struct SystemTime
- {
- internal short year;
- internal short month;
- internal short dayOfWeek;
- internal short day;
- internal short hour;
- internal short minute;
- internal short second;
- internal short millisecond;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct SatelliteArray
- {
- int a, b, c, d, e, f, g, h, i, j, k, l;
-
- public int Count
- {
- get
- {
- return 12;
- }
- }
-
- public int this[int value]
- {
- get
- {
- if(value == 0)
- return a;
- else if(value == 1)
- return b;
- else if(value == 2)
- return c;
- else if(value == 3)
- return d;
- else if(value == 4)
- return e;
- else if(value == 5)
- return f;
- else if(value == 6)
- return g;
- else if(value == 7)
- return h;
- else if(value == 8)
- return i;
- else if(value == 9)
- return j;
- else if(value == 10)
- return k;
- else if(value == 11)
- return l;
- else
- throw new ArgumentOutOfRangeException("value must be 0 - 11");
- }
- }
- }
- #endregion
-
- public enum FixQuality : int
- {
- Unknown=0,
- Gps,
- DGps
- }
- public enum FixType : int
- {
- Unknown=0,
- XyD,
- XyzD
- }
-
- public enum FixSelection : int
- {
- Unknown=0,
- Auto,
- Manual
- }
-
- public struct Satellite
- {
- public Satellite(int id, int elevation, int azimuth, int signalStrength, bool inUse)
- {
- this.id = id;
- this.elevation = elevation;
- this.azimuth = azimuth;
- this.signalStrength = signalStrength;
- this.inUse = inUse;
- }
-
- bool inUse;
- public bool InSolution
- {
- get
- {
- return inUse;
- }
- set
- {
- inUse = value;
- }
- }
-
- int id;
- ///
- /// Id of the satellite
- ///
- public int Id
- {
- get
- {
- return id;
- }
- set
- {
- id = value;
- }
- }
-
-
- int elevation;
- ///
- /// Elevation of the satellite
- ///
- public int Elevation
- {
- get
- {
- return elevation;
- }
- set
- {
- elevation = value;
- }
- }
-
-
- int azimuth;
- ///
- /// Azimuth of the satellite
- ///
- public int Azimuth
- {
- get
- {
- return azimuth;
- }
- set
- {
- azimuth = value;
- }
- }
-
-
- int signalStrength;
- ///
- /// SignalStrenth of the satellite
- ///
- public int SignalStrength
- {
- get
- {
- return signalStrength;
- }
- set
- {
- signalStrength = value;
- }
- }
-
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public class GpsPosition
- {
- internal GpsPosition()
- {
- }
-
- internal static int GPS_VALID_UTC_TIME = 0x00000001;
- internal static int GPS_VALID_LATITUDE = 0x00000002;
- internal static int GPS_VALID_LONGITUDE = 0x00000004;
- internal static int GPS_VALID_SPEED = 0x00000008;
- internal static int GPS_VALID_HEADING = 0x00000010;
- internal static int GPS_VALID_MAGNETIC_VARIATION = 0x00000020;
- internal static int GPS_VALID_ALTITUDE_WRT_SEA_LEVEL = 0x00000040;
- internal static int GPS_VALID_ALTITUDE_WRT_ELLIPSOID = 0x00000080;
- internal static int GPS_VALID_POSITION_DILUTION_OF_PRECISION = 0x00000100;
- internal static int GPS_VALID_HORIZONTAL_DILUTION_OF_PRECISION = 0x00000200;
- internal static int GPS_VALID_VERTICAL_DILUTION_OF_PRECISION = 0x00000400;
- internal static int GPS_VALID_SATELLITE_COUNT = 0x00000800;
- internal static int GPS_VALID_SATELLITES_USED_PRNS = 0x00001000;
- internal static int GPS_VALID_SATELLITES_IN_VIEW = 0x00002000;
- internal static int GPS_VALID_SATELLITES_IN_VIEW_PRNS = 0x00004000;
- internal static int GPS_VALID_SATELLITES_IN_VIEW_ELEVATION = 0x00008000;
- internal static int GPS_VALID_SATELLITES_IN_VIEW_AZIMUTH = 0x00010000;
- internal static int GPS_VALID_SATELLITES_IN_VIEW_SIGNAL_TO_NOISE_RATIO = 0x00020000;
-
- internal int dwVersion = 1; // Current version of GPSID client is using.
- internal int dwSize = 0; // sizeof(_GPS_POSITION)
-
- // Not all fields in the structure below are guaranteed to be valid.
- // Which fields are valid depend on GPS device being used, how stale the API allows
- // the data to be, and current signal.
- // Valid fields are specified in dwValidFields, based on GPS_VALID_XXX flags.
- internal int dwValidFields = 0;
-
- // Additional information about this location structure (GPS_DATA_FLAGS_XXX)
- internal int dwFlags = 0;
-
- //** Time related
- internal SystemTime stUTCTime = new SystemTime(); // UTC according to GPS clock.
-
- //** Position + heading related
- internal double dblLatitude = 0.0; // Degrees latitude. North is positive
- internal double dblLongitude = 0.0; // Degrees longitude. East is positive
- internal float flSpeed = 0.0f; // Speed in knots
- internal float flHeading = 0.0f; // Degrees heading (course made good). True North=0
- internal double dblMagneticVariation = 0.0; // Magnetic variation. East is positive
- internal float flAltitudeWRTSeaLevel = 0.0f; // Altitute with regards to sea level, in meters
- internal float flAltitudeWRTEllipsoid = 0.0f; // Altitude with regards to ellipsoid, in meters
-
- // Where did we get fix from?
- internal FixQuality fixQuality = FixQuality.Unknown;
-
- // Is this 2d or 3d fix?
- internal FixType fixType = FixType.Unknown;
-
- // Auto or manual selection between 2d or 3d mode
- internal FixSelection selectionType = FixSelection.Unknown;
-
- // Position Dilution Of Precision
- internal float flPositionDilutionOfPrecision = 0.0f;
-
- // Horizontal Dilution Of Precision
- internal float flHorizontalDilutionOfPrecision = 0.0f;
-
- // Vertical Dilution Of Precision
- internal float flVerticalDilutionOfPrecision = 0.0f;
-
- // Number of satellites used in solution
- internal int dwSatelliteCount = 0;
-
- // PRN numbers of satellites used in the solution
- internal SatelliteArray rgdwSatellitesUsedPRNs = new SatelliteArray();
-
- // Number of satellites in view. From 0-GPS_MAX_SATELLITES
- internal int dwSatellitesInView = 0;
-
- // PRN numbers of satellites in view
- internal SatelliteArray rgdwSatellitesInViewPRNs = new SatelliteArray();
-
- // Elevation of each satellite in view
- internal SatelliteArray rgdwSatellitesInViewElevation = new SatelliteArray();
-
- // Azimuth of each satellite in view
- internal SatelliteArray rgdwSatellitesInViewAzimuth = new SatelliteArray();
-
- // Signal to noise ratio of each satellite in view
- internal SatelliteArray rgdwSatellitesInViewSignalToNoiseRatio = new SatelliteArray();
-
- // ...
-
- public FixQuality FixQuality
- {
- get
- {
- return fixQuality;
- }
- }
-
- public FixType FixType
- {
- get
- {
- return fixType;
- }
- }
-
- public FixSelection FixSelection
- {
- get
- {
- return selectionType;
- }
- }
-
- ///
- /// UTC according to GPS clock.
- ///
- public DateTime? Time
- {
- get
- {
- return ((dwValidFields & GPS_VALID_UTC_TIME) != 0) ? ((DateTime?) new DateTime(stUTCTime.year, stUTCTime.month, stUTCTime.day, stUTCTime.hour, stUTCTime.minute, stUTCTime.second, stUTCTime.millisecond)) : null;
- }
- }
-
- ///
- /// Satellites in view
- ///
- /// Array of Satellites
- public IEnumerable GetSatellitesInView()
- {
- // if valid view
- if((dwValidFields & GPS_VALID_SATELLITES_IN_VIEW) != 0 && dwSatellitesInView != 0)
- {
- for(int index = 0; index < dwSatellitesInView; index++)
- {
- Satellite ret = new Satellite(rgdwSatellitesInViewPRNs[index], rgdwSatellitesInViewElevation[index], rgdwSatellitesInViewAzimuth[index], rgdwSatellitesInViewSignalToNoiseRatio[index], false);
-
- // if valid solution
- if((dwValidFields & GPS_VALID_SATELLITES_USED_PRNS) != 0)
- {
- for(int index2 = 0; index2 < dwSatelliteCount; index2++)
- {
- if(rgdwSatellitesUsedPRNs[index2] == ret.Id)
- {
- ret.InSolution = true;
- break;
- }
- }
- }
-
- yield return ret;
- }
- }
- }
-
- ///
- /// Number of satellites used in solution
- ///
- public int? SatelliteCount
- {
- get
- {
- return (((dwValidFields & GPS_VALID_SATELLITE_COUNT) != 0) ? (int?) dwSatelliteCount : null);
- }
- }
-
- ///
- /// Number of satellites in view.
- ///
- public int? SatellitesInViewCount
- {
- get
- {
- return ((dwValidFields & GPS_VALID_SATELLITES_IN_VIEW) != 0) ? (int?) dwSatellitesInView : null;
- }
- }
-
- ///
- /// Speed in km/h
- ///
- public float? Speed
- {
- get
- {
- return ((dwValidFields & GPS_VALID_SPEED) != 0) ? (float?) (flSpeed*1.852f) : null;
- }
- }
-
- ///
- /// Altitude with regards to ellipsoid, in meters
- ///
- public float? EllipsoidAltitude
- {
- get
- {
- return ((dwValidFields & GPS_VALID_ALTITUDE_WRT_ELLIPSOID) != 0) ? (float?) flAltitudeWRTEllipsoid : null;
- }
- }
-
- ///
- /// Altitute with regards to sea level, in meters
- ///
- public float? SeaLevelAltitude
- {
- get
- {
- return ((dwValidFields & GPS_VALID_ALTITUDE_WRT_SEA_LEVEL) != 0) ? (float?) flAltitudeWRTSeaLevel : null;
- }
- }
-
- ///
- /// Latitude in decimal degrees. North is positive
- ///
- public double? Latitude
- {
- get
- {
- return ((dwValidFields & GPS_VALID_LATITUDE) != 0) ? (float?) dblLatitude : null;
- }
- }
-
- ///
- /// Longitude in decimal degrees. East is positive
- ///
- public double? Longitude
- {
- get
- {
- return ((dwValidFields & GPS_VALID_LONGITUDE) != 0) ? (float?) dblLongitude : null;
- }
- }
-
- ///
- /// Degrees heading (course made good). True North=0
- ///
- public float? Heading
- {
- get
- {
- return ((dwValidFields & GPS_VALID_HEADING) != 0) ? (float?) flHeading : null;
- }
- }
-
- ///
- /// Position Dilution Of Precision
- ///
- public float? PositionDilutionOfPrecision
- {
- get
- {
- return ((dwValidFields & GPS_VALID_POSITION_DILUTION_OF_PRECISION) != 0) ? (float?) flPositionDilutionOfPrecision : null;
- }
- }
-
- ///
- /// Horizontal Dilution Of Precision
- ///
- public float? HorizontalDilutionOfPrecision
- {
- get
- {
- return ((dwValidFields & GPS_VALID_HORIZONTAL_DILUTION_OF_PRECISION) != 0) ? (float?) flHorizontalDilutionOfPrecision : null;
- }
- }
-
- ///
- /// Vertical Dilution Of Precision
- ///
- public float? VerticalDilutionOfPrecision
- {
- get
- {
- return ((dwValidFields & GPS_VALID_VERTICAL_DILUTION_OF_PRECISION) != 0) ? (float?) flVerticalDilutionOfPrecision : null;
- }
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.GPS/Utils.cs b/GMap.NET.WindowsMobile/GMap.NET.GPS/Utils.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.GPS/Utils.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Use of this sample source code is subject to the terms of the Microsoft
-// license agreement under which you licensed this sample source code. If
-// you did not accept the terms of the license agreement, you are not
-// authorized to use this sample source code. For the terms of the license,
-// please see the license agreement between you and Microsoft or, if applicable,
-// see the LICENSE.RTF on your install media or the root of your tools installation.
-// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
-//
-#region Using directives
-
-using System;
-
-#endregion
-
-namespace GMap.NET.GPS
-{
- ///
- /// Summary description for Utils.
- ///
- public class Utils
- {
- public Utils()
- {
- }
-
- public static IntPtr LocalAlloc(int byteCount)
- {
- IntPtr ptr = Win32.LocalAlloc(Win32.LMEM_ZEROINIT, byteCount);
- if(ptr == IntPtr.Zero)
- {
- throw new OutOfMemoryException();
- }
-
- return ptr;
- }
-
- public static void LocalFree(IntPtr hMem)
- {
- IntPtr ptr = Win32.LocalFree(hMem);
- if(ptr != IntPtr.Zero)
- {
- throw new ArgumentException();
- }
- }
- }
-
- public class Win32
- {
- public const int LMEM_ZEROINIT = 0x40;
- [System.Runtime.InteropServices.DllImport("coredll.dll", EntryPoint="#33", SetLastError=true)]
- public static extern IntPtr LocalAlloc(int flags, int byteCount);
-
- [System.Runtime.InteropServices.DllImport("coredll.dll", EntryPoint="#36", SetLastError=true)]
- public static extern IntPtr LocalFree(IntPtr hMem);
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.Internals/FastReaderWriterLock.cs b/GMap.NET.WindowsMobile/GMap.NET.Internals/FastReaderWriterLock.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.Internals/FastReaderWriterLock.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-
-namespace GMap.NET.Internals
-{
-#if PocketPC
- internal class FastReaderWriterLock
- {
- object rlock = new object();
-
- internal void AcquireReaderLock()
- {
- System.Threading.Monitor.Enter(rlock);
- }
-
- internal void ReleaseReaderLock()
- {
- System.Threading.Monitor.Exit(rlock);
- }
-
- internal void AcquireWriterLock()
- {
- System.Threading.Monitor.Enter(rlock);
- }
-
- internal void ReleaseWriterLock()
- {
- System.Threading.Monitor.Exit(rlock);
- }
-
- internal void Dispose()
- {
- rlock = null;
- }
- }
-#endif
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.Internals/Native.cs b/GMap.NET.WindowsMobile/GMap.NET.Internals/Native.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.Internals/Native.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-
-namespace GMap.NET.Internals
-{
- using System;
- using System.Runtime.InteropServices;
-
- public class Native
- {
- static readonly IntPtr INVALID_HANDLE_VALUE = (IntPtr) (-1);
-
- // The CharSet must match the CharSet of the corresponding PInvoke signature
- [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
- struct WIN32_FIND_DATA
- {
- public int dwFileAttributes;
- public FILETIME ftCreationTime;
- public FILETIME ftLastAccessTime;
- public FILETIME ftLastWriteTime;
- public int nFileSizeHigh;
- public int nFileSizeLow;
- public int dwOID;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
- public string cFileName;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)]
- public string cAlternateFileName;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- struct FILETIME
- {
- public int dwLowDateTime;
- public int dwHighDateTime;
- };
-
- [DllImport("note_prj", EntryPoint="FindFirstFlashCard")]
- extern static IntPtr FindFirstFlashCard(ref WIN32_FIND_DATA findData);
-
- [DllImport("note_prj", EntryPoint="FindNextFlashCard")]
- [return: MarshalAs(UnmanagedType.Bool)]
- extern static bool FindNextFlashCard(IntPtr hFlashCard, ref WIN32_FIND_DATA findData);
-
- [DllImport("coredll")]
- static extern bool FindClose(IntPtr hFindFile);
-
- public static string GetRemovableStorageDirectory()
- {
- string removableStorageDirectory = null;
- IntPtr handle = IntPtr.Zero;
- try
- {
- WIN32_FIND_DATA findData = new WIN32_FIND_DATA();
-
- handle = FindFirstFlashCard(ref findData);
-
- if(handle != INVALID_HANDLE_VALUE)
- {
- do
- {
- if(!string.IsNullOrEmpty(findData.cFileName))
- {
- removableStorageDirectory = findData.cFileName;
- break;
- }
- }
- while(FindNextFlashCard(handle, ref findData));
- }
- }
- catch
- {
- removableStorageDirectory = null;
- }
- finally
- {
- if(handle != INVALID_HANDLE_VALUE)
- {
- FindClose(handle);
- }
- }
- return removableStorageDirectory;
- }
-
- [DllImport("coredll.dll")]
- public static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
-
- public const int SW_MINIMIZED = 6;
-
- public const int PPN_UNATTENDEDMODE = 0x0003;
- public const int POWER_NAME = 0x00000001;
- public const int POWER_FORCE = 0x00001000;
-
- [DllImport("coredll.dll")]
- public static extern bool PowerPolicyNotify(int dwMessage, bool dwData);
-
- [DllImport("coredll.dll", SetLastError=true)]
- public static extern IntPtr SetPowerRequirement(string pvDevice, CedevicePowerStateState deviceState, uint deviceFlags, string pvSystemState, ulong stateFlags);
-
- [DllImport("coredll.dll", SetLastError=true)]
- public static extern int ReleasePowerRequirement(IntPtr hPowerReq);
-
- public enum CedevicePowerStateState : int
- {
- PwrDeviceUnspecified=-1,
- D0=0,
- D1,
- D2,
- D3,
- D4,
- }
-
- [DllImport("coredll")]
- public static extern void SystemIdleTimerReset();
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerGoogleGreen.cs b/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerGoogleGreen.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerGoogleGreen.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-
-namespace GMap.NET.WindowsForms.Markers
-{
- using System.Drawing;
-
-#if !PocketPC
- using System.Windows.Forms.Properties;
-#else
- using GMap.NET.WindowsMobile.Properties;
-#endif
-
- public class GMapMarkerGoogleGreen : GMapMarker
- {
- public float? Bearing;
-
- static readonly Bitmap shadow = Resources.shadow50;
- static readonly Bitmap marker = Resources.bigMarkerGreen;
- static readonly System.Drawing.Size SizeSt = new System.Drawing.Size(marker.Width, marker.Height);
-
- public GMapMarkerGoogleGreen(PointLatLng p)
- : base(p)
- {
- Size = SizeSt;
- Offset = new Point(-10, -34);
- }
-
- static readonly Point[] Arrow = new Point[] { new Point(-7, 7), new Point(0, -22), new Point(7, 7), new Point(0, 2) };
-
- public override void OnRender(Graphics g)
- {
-#if !PocketPC
- if(!Bearing.HasValue)
- {
- g.DrawImageUnscaled(shadow, LocalPosition.X, LocalPosition.Y);
- }
- else
- {
- //g.TranslateTransform(ToolTipPosition.X, ToolTipPosition.Y);
- //g.RotateTransform(Bearing.Value - Overlay.Control.Bearing);
- //g.FillPolygon(Brushes.Lime, Arrow);
- //g.ResetTransform();
- }
-
- if(!Bearing.HasValue)
- {
- g.DrawImageUnscaled(marker, LocalPosition.X, LocalPosition.Y);
- }
-#else
- DrawImageUnscaled(g, shadow, LocalPosition.X, LocalPosition.Y);
- DrawImageUnscaled(g, marker, LocalPosition.X, LocalPosition.Y);
-#endif
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerGoogleRed.cs b/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerGoogleRed.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerGoogleRed.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-
-namespace GMap.NET.WindowsForms.Markers
-{
- using System.Drawing;
-
-#if !PocketPC
- using System.Windows.Forms.Properties;
-#else
- using GMap.NET.WindowsMobile.Properties;
-#endif
-
- public class GMapMarkerGoogleRed : GMapMarker
- {
- public float? Bearing;
-
- static readonly Bitmap shadow = Resources.shadow50;
- static readonly Bitmap marker = Resources.marker;
- static readonly System.Drawing.Size SizeSt = new System.Drawing.Size(marker.Width, marker.Height);
-
- public GMapMarkerGoogleRed(PointLatLng p)
- : base(p)
- {
- Size = SizeSt;
- Offset = new Point(-10, -34);
- }
-
- static readonly Point[] Arrow = new Point[] { new Point(-7, 7), new Point(0, -22), new Point(7, 7), new Point(0, 2) };
-
- public override void OnRender(Graphics g)
- {
-#if !PocketPC
- if(!Bearing.HasValue)
- {
- g.DrawImageUnscaled(shadow, LocalPosition.X, LocalPosition.Y);
- }
- else
- {
- //g.TranslateTransform(ToolTipPosition.X, ToolTipPosition.Y);
- //g.RotateTransform(Bearing.Value - Overlay.Control.Bearing);
- //g.FillPolygon(Brushes.Red, Arrow);
- //g.ResetTransform();
- }
-
- if(!Bearing.HasValue)
- {
- g.DrawImageUnscaled(marker, LocalPosition.X, LocalPosition.Y);
- }
-#else
- DrawImageUnscaled(g, shadow, LocalPosition.X, LocalPosition.Y);
- DrawImageUnscaled(g, marker, LocalPosition.X, LocalPosition.Y);
-#endif
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerTransparent.cs b/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerTransparent.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerTransparent.cs
+++ /dev/null
@@ -1,503 +0,0 @@
-
-namespace GMap.NET.WindowsForms.Markers
-{
- using System;
- using System.Drawing;
- using System.Drawing.Imaging;
- using System.IO;
- using System.Runtime.InteropServices;
-
- public abstract class GMapMarkerTransparent : GMapMarker
- {
- protected GMapMarkerTransparent(PointLatLng pos)
- : base(pos)
- {
- }
-
- public override void OnRender(Graphics g)
- {
- for(Int32 i = 0; i < this.BitmapCount; i++)
- {
- IGMapTransparentBitmap bitmap = GetBitmap(i);
- if(bitmap == null)
- {
- continue;
- }
-
- System.Drawing.Rectangle src = new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height);
- System.Drawing.Rectangle dst = new System.Drawing.Rectangle(LocalPosition.X + bitmap.DrawOffset.X, LocalPosition.Y + bitmap.DrawOffset.Y, bitmap.Width, bitmap.Height);
- bitmap.Draw(g, dst, src);
- }
- }
-
- #region Abstract Members
-
- protected abstract Int32 BitmapCount
- {
- get;
- }
- protected abstract IGMapTransparentBitmap GetBitmap(Int32 index);
-
- #endregion
-
- #region Load Bitmap
-
- public static IGMapTransparentBitmap LoadTransparentBitmap(Stream stream)
- {
- return LoadTransparentBitmap(stream, true);
- }
-
- public static IGMapTransparentBitmap LoadTransparentBitmap(Stream stream, Boolean hasAlpha)
- {
- try
- {
- if(hasAlpha && Environment.OSVersion.Platform == PlatformID.WinCE)
- return new WinCEImagingBitmap(stream);
- return new StandardBitmap(stream);
- }
- catch(Exception)
- {
- return null;
- }
- }
-
- #endregion
- }
-
- #region Transparent Bitmap Wrappers
-
- public interface IGMapTransparentBitmap : IDisposable
- {
- Int32 Width
- {
- get;
- }
- Int32 Height
- {
- get;
- }
- Point DrawOffset
- {
- get;
- set;
- }
- void Draw(Graphics graphics, System.Drawing.Rectangle destRect, System.Drawing.Rectangle sourceRect);
- }
-
- public class WinCEImagingBitmap : IGMapTransparentBitmap
- {
- IImage myImage;
- ImageInfo myInfo;
- double myScaleFactorX = 0;
- double myScaleFactorY = 0;
- IntPtr myBuffer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RECT)));
- static IImagingFactory myImagingFactory;
-
- public WinCEImagingBitmap(Stream stream)
- {
- // this class should only be used in WinCE
- System.Diagnostics.Debug.Assert(Environment.OSVersion.Platform == PlatformID.WinCE);
-
- if(myImagingFactory == null)
- myImagingFactory = (IImagingFactory) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
-
- int bytesLength;
- byte[] bytes;
- MemoryStream memStream = stream as MemoryStream;
- if(memStream != null)
- {
- bytesLength = (int) memStream.Length;
- bytes = memStream.GetBuffer();
- }
- else
- {
- bytesLength = (int) stream.Length;
- bytes = new byte[bytesLength];
- stream.Read(bytes, 0, bytesLength);
- }
-
- uint hresult = myImagingFactory.CreateImageFromBuffer(bytes, (uint) bytesLength, BufferDisposalFlag.BufferDisposalFlagNone, out myImage);
- myImage.GetImageInfo(out myInfo);
- myScaleFactorX = 1 / myInfo.Xdpi * 2540;
- myScaleFactorY = 1 / myInfo.Ydpi * 2540;
-
- IBitmapImage bitmap;
- myImagingFactory.CreateBitmapFromImage(myImage, 0, 0, PixelFormatID.PixelFormat32bppARGB, InterpolationHint.InterpolationHintDefault, out bitmap);
- Marshal.FinalReleaseComObject(myImage);
- myImage = bitmap as IImage;
- }
-
- #region IGMapTransparentBitmap Members
-
- public Int32 Width
- {
- get
- {
- return myInfo.Width;
- }
- }
-
- public Int32 Height
- {
- get
- {
- return myInfo.Height;
- }
- }
-
- Point drawOffset = new Point(0, 0);
-
- public Point DrawOffset
- {
- get
- {
- return drawOffset;
- }
- set
- {
- drawOffset = value;
- }
- }
-
- public void Draw(Graphics graphics, System.Drawing.Rectangle destRect, System.Drawing.Rectangle sourceRect)
- {
- RECT dst = new RECT(destRect);
-
- if(destRect == sourceRect)
- {
- IntPtr hdc = graphics.GetHdc();
- myImage.Draw(hdc, ref dst, IntPtr.Zero);
- graphics.ReleaseHdc(hdc);
- }
- else
- {
- RECT src = new RECT(sourceRect);
- src.Left = (int) (src.Left * myScaleFactorX);
- src.Top = (int) (src.Top * myScaleFactorY);
- src.Right = (int) (src.Right * myScaleFactorX);
- src.Bottom = (int) (src.Bottom * myScaleFactorY);
- Marshal.StructureToPtr(src, myBuffer, false);
- IntPtr hdc = graphics.GetHdc();
- myImage.Draw(hdc, ref dst, myBuffer);
- graphics.ReleaseHdc(hdc);
- }
- }
-
- #endregion
-
- #region IDisposable Members
-
- public void Dispose()
- {
- if(myImage != null)
- {
- Marshal.FinalReleaseComObject(myImage);
- myImage = null;
- }
- if(myBuffer != IntPtr.Zero)
- {
- Marshal.FreeHGlobal(myBuffer);
- }
- }
-
- #endregion
- }
-
- public class StandardBitmap : IGMapTransparentBitmap
- {
- Bitmap myBitmap;
-
- public Bitmap Bitmap
- {
- get
- {
- return myBitmap;
- }
- set
- {
- myBitmap = value;
- }
- }
-
- ImageAttributes myImageAttributes;
- public StandardBitmap(Bitmap bitmap, ImageAttributes imageAttributes)
- {
- if(Environment.OSVersion.Platform == PlatformID.WinCE)
- {
- // reduce the bpp to native WinCE resolution for performance
- myBitmap = new Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format16bppRgb565);
- using(Graphics g = Graphics.FromImage(myBitmap))
- {
- g.DrawImage(bitmap, 0, 0);
- }
- }
- else
- {
- myBitmap = bitmap;
- }
- myImageAttributes = imageAttributes;
- }
-
- public StandardBitmap(Stream bitmapStream, ImageAttributes imageAttributes)
- : this(new Bitmap(bitmapStream), imageAttributes)
- {
- }
-
- public StandardBitmap(Stream bitmapStream)
- : this(bitmapStream, null)
- {
- }
-
- public StandardBitmap(Bitmap bitmap)
- : this(bitmap, null)
- {
- }
-
- #region IGMapTransparentBitmap Members
-
- public Int32 Width
- {
- get
- {
- return myBitmap.Width;
- }
- }
-
- public Int32 Height
- {
- get
- {
- return myBitmap.Height;
- }
- }
-
- Point drawOffset = new Point(0, 0);
-
- public Point DrawOffset
- {
- get
- {
- return drawOffset;
- }
- set
- {
- drawOffset = value;
- }
- }
-
- public void Draw(Graphics graphics, System.Drawing.Rectangle destRect, System.Drawing.Rectangle sourceRect)
- {
- if(myImageAttributes == null)
- graphics.DrawImage(myBitmap, destRect, sourceRect, GraphicsUnit.Pixel);
- else
- graphics.DrawImage(myBitmap, destRect, sourceRect.X, sourceRect.Y, sourceRect.Width, sourceRect.Height, GraphicsUnit.Pixel, myImageAttributes);
- }
-
- #endregion
-
- #region IDisposable Members
-
- public void Dispose()
- {
- if(myBitmap != null)
- {
- myBitmap.Dispose();
- myBitmap = null;
- }
- }
-
- #endregion
- }
-
- #endregion
-
- #region IImage
-
- // Pulled from gdipluspixelformats.h in the Windows Mobile 5.0 Pocket PC SDK
- enum PixelFormatID : int
- {
- PixelFormatIndexed=0x00010000, // Indexes into a palette
- PixelFormatGDI=0x00020000, // Is a GDI-supported format
- PixelFormatAlpha=0x00040000, // Has an alpha component
- PixelFormatPAlpha=0x00080000, // Pre-multiplied alpha
- PixelFormatExtended=0x00100000, // Extended color 16 bits/channel
- PixelFormatCanonical=0x00200000,
-
- PixelFormatUndefined=0,
- PixelFormatDontCare=0,
-
- PixelFormat1bppIndexed=(1 | (1 << 8) | PixelFormatIndexed | PixelFormatGDI),
- PixelFormat4bppIndexed=(2 | (4 << 8) | PixelFormatIndexed | PixelFormatGDI),
- PixelFormat8bppIndexed=(3 | (8 << 8) | PixelFormatIndexed | PixelFormatGDI),
- PixelFormat16bppRGB555=(5 | (16 << 8) | PixelFormatGDI),
- PixelFormat16bppRGB565=(6 | (16 << 8) | PixelFormatGDI),
- PixelFormat16bppARGB1555=(7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI),
- PixelFormat24bppRGB=(8 | (24 << 8) | PixelFormatGDI),
- PixelFormat32bppRGB=(9 | (32 << 8) | PixelFormatGDI),
- PixelFormat32bppARGB=(10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical),
- PixelFormat32bppPARGB=(11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI),
- PixelFormat48bppRGB=(12 | (48 << 8) | PixelFormatExtended),
- PixelFormat64bppARGB=(13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended),
- PixelFormat64bppPARGB=(14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended),
- PixelFormatMax=15
- }
-
- // Pulled from imaging.h in the Windows Mobile 5.0 Pocket PC SDK
- enum BufferDisposalFlag : int
- {
- BufferDisposalFlagNone,
- BufferDisposalFlagGlobalFree,
- BufferDisposalFlagCoTaskMemFree,
- BufferDisposalFlagUnmapView
- }
-
- // Pulled from imaging.h in the Windows Mobile 5.0 Pocket PC SDK
- enum InterpolationHint : int
- {
- InterpolationHintDefault,
- InterpolationHintNearestNeighbor,
- InterpolationHintBilinear,
- InterpolationHintAveraging,
- InterpolationHintBicubic
- }
-
- [Flags]
- enum ImageLockMode
- {
- ImageLockModeRead=0x0001,
- ImageLockModeWrite=0x0002,
- ImageLockModeUserInputBuf=0x0004,
- };
-
-#pragma warning disable 0649
- // Pulled from gdiplusimaging.h in the Windows Mobile 5.0 Pocket PC SDK
- struct BitmapImageData
- {
- public uint Width;
- public uint Height;
- public int Stride;
- public PixelFormatID PixelFormat;
- public IntPtr Scan0;
- public IntPtr Reserved;
- }
-
- // Pulled from imaging.h in the Windows Mobile 5.0 Pocket PC SDK
- struct ImageInfo
- {
- public uint GuidPart1; // I am being lazy here, I don't care at this point about the RawDataFormat GUID
- public uint GuidPart2; // I am being lazy here, I don't care at this point about the RawDataFormat GUID
- public uint GuidPart3; // I am being lazy here, I don't care at this point about the RawDataFormat GUID
- public uint GuidPart4; // I am being lazy here, I don't care at this point about the RawDataFormat GUID
- public PixelFormatID pixelFormat;
- public int Width;
- public int Height;
- public uint TileWidth;
- public uint TileHeight;
- public double Xdpi;
- public double Ydpi;
- public uint Flags;
- }
-#pragma warning restore 0649
-
- // Pulled from imaging.h in the Windows Mobile 5.0 Pocket PC SDK
- [ComImport, Guid("327ABDA7-072B-11D3-9D7B-0000F81EF32E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComVisible(true)]
- interface IImagingFactory
- {
- uint CreateImageFromStream(); // This is a place holder, note the lack of arguments
- uint CreateImageFromFile(string filename, out IImage image);
- // We need the MarshalAs attribute here to keep COM interop from sending the buffer down as a Safe Array.
- uint CreateImageFromBuffer([MarshalAs(UnmanagedType.LPArray)] byte[] buffer, uint size, BufferDisposalFlag disposalFlag, out IImage image);
- uint CreateNewBitmap(uint width, uint height, PixelFormatID pixelFormat, out IBitmapImage bitmap);
- uint CreateBitmapFromImage(IImage image, uint width, uint height, PixelFormatID pixelFormat, InterpolationHint hints, out IBitmapImage bitmap);
- uint CreateBitmapFromBuffer(); // This is a place holder, note the lack of arguments
- uint CreateImageDecoder(); // This is a place holder, note the lack of arguments
- uint CreateImageEncoderToStream(); // This is a place holder, note the lack of arguments
- uint CreateImageEncoderToFile(); // This is a place holder, note the lack of arguments
- uint GetInstalledDecoders(); // This is a place holder, note the lack of arguments
- uint GetInstalledEncoders(); // This is a place holder, note the lack of arguments
- uint InstallImageCodec(); // This is a place holder, note the lack of arguments
- uint UninstallImageCodec(); // This is a place holder, note the lack of arguments
- }
-
- struct RECT
- {
- public int Left;
- public int Top;
- public int Right;
- public int Bottom;
-
- public int Width
- {
- get
- {
- return Right - Left;
- }
- set
- {
- Right = Left + value;
- }
- }
-
- public int Height
- {
- get
- {
- return Bottom - Top;
- }
- set
- {
- Bottom = Top + value;
- }
- }
-
- public RECT(System.Drawing.Rectangle rect)
- {
- Left = rect.Left;
- Top = rect.Top;
- Right = rect.Right;
- Bottom = rect.Bottom;
- }
-
- public RECT(int left, int top, int width, int height)
- {
- Left = left;
- Top = top;
- Right = left + width;
- Bottom = top + height;
- }
-
- public static implicit operator RECT(System.Drawing.Rectangle rect)
- {
- return new RECT(rect);
- }
- }
-
- // Pulled from imaging.h in the Windows Mobile 5.0 Pocket PC SDK
- [ComImport, Guid("327ABDA9-072B-11D3-9D7B-0000F81EF32E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComVisible(true)]
- interface IImage
- {
- uint GetPhysicalDimension(out Size size);
- uint GetImageInfo(out ImageInfo info);
- uint SetImageFlags(uint flags);
- uint Draw(IntPtr hdc, ref RECT dstRect, IntPtr srcRect); // "Correct" declaration: uint Draw(IntPtr hdc, ref Rectangle dstRect, ref Rectangle srcRect);
- uint PushIntoSink(); // This is a place holder, note the lack of arguments
- uint GetThumbnail(uint thumbWidth, uint thumbHeight, out IImage thumbImage);
- }
-
- // Pulled from imaging.h in the Windows Mobile 5.0 Pocket PC SDK
- [ComImport, Guid("327ABDAA-072B-11D3-9D7B-0000F81EF32E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComVisible(true)]
- interface IBitmapImage
- {
- uint GetSize(out Size size);
- uint GetPixelFormatID(out PixelFormatID pixelFormat);
- uint LockBits(ref RECT rect, ImageLockMode flags, PixelFormatID pixelFormat, out BitmapImageData lockedBitmapData);
- uint UnlockBits(ref BitmapImageData lockedBitmapData);
- uint GetPalette(); // This is a place holder, note the lack of arguments
- uint SetPalette(); // This is a place holder, note the lack of arguments
- }
-
- #endregion
-}
\ No newline at end of file
diff --git a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerTransparentGoogleGreen.cs b/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerTransparentGoogleGreen.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.WindowsForms/Markers/GMapMarkerTransparentGoogleGreen.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-
-namespace GMap.NET.WindowsForms.Markers
-{
- using System;
-
- public class GMapMarkerTransparentGoogleGreen : GMapMarkerTransparent
- {
- IGMapTransparentBitmap[] bitmaps;
-
- public GMapMarkerTransparentGoogleGreen(PointLatLng p)
- : base(p)
- {
- System.Reflection.Assembly ass = System.Reflection.Assembly.GetExecutingAssembly();
-
- String resShadow = "GMap.NET.WindowsMobile.Resources.shadow50.png";
- String resMarker = "GMap.NET.WindowsMobile.Resources.bigMarkerGreen.png";
-
- IGMapTransparentBitmap shadow = GMapMarkerTransparent.LoadTransparentBitmap(ass.GetManifestResourceStream(resShadow));
- IGMapTransparentBitmap marker = GMapMarkerTransparent.LoadTransparentBitmap(ass.GetManifestResourceStream(resMarker));
-
- bitmaps = new IGMapTransparentBitmap[] { shadow, marker };
-
- Size = new System.Drawing.Size(marker.Width, marker.Height);
- Offset = new System.Drawing.Point(-10, -34);
- }
-
- protected override Int32 BitmapCount
- {
- get
- {
- return bitmaps.Length;
- }
- }
-
- protected override IGMapTransparentBitmap GetBitmap(Int32 index)
- {
- return bitmaps[index];
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/GMap.NET.WindowsMobile.csproj b/GMap.NET.WindowsMobile/GMap.NET.WindowsMobile.csproj
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/GMap.NET.WindowsMobile.csproj
+++ /dev/null
@@ -1,519 +0,0 @@
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {421813B1-A007-44B2-8C53-32751C45113E}
- Library
- Properties
- GMap.NET.WindowsMobile
- GMap.NET.WindowsMobile
- {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- PocketPC
- b2c48bd2-963d-4549-9169-1fa021dce484
- 5.2
- GMap.NET
- v3.5
- Windows Mobile 6 Professional SDK
-
-
- true
- sn.snk
- %25CSIDL_PROGRAM_FILES%25
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;PocketPC; SQLite; DESIGN_disabled
- true
- true
- prompt
- 512
- 4
- Off
-
-
- none
- true
- bin\Release\
- TRACE;PocketPC; SQLite; DESIGN_disabled
- true
- true
- prompt
- 512
- 4
- Off
-
-
-
-
- False
- ..\References\CompactFramework\OpenNETCF.dll
-
-
-
-
- False
- ..\References\CompactFramework\System.Data.SqlClient.dll
- False
-
-
- False
- ..\References\CompactFramework\System.Data.SQLite.dll
- True
-
-
- False
- ..\References\CompactFramework\System.Data.SqlServerCe.dll
- False
-
-
-
-
-
-
-
-
- GMap.NET.CacheProviders\MemoryCache.cs
-
-
- GMap.NET.CacheProviders\MSSQLCEPureImageCache.cs
-
-
- GMap.NET.CacheProviders\MSSQLPureImageCache.cs
-
-
- GMap.NET.CacheProviders\SQLitePureImageCache.cs
-
-
- GMap.NET.Internals\Cache.cs
-
-
- GMap.NET.Internals\CacheQueueItem.cs
-
-
- GMap.NET.Internals\Core.cs
-
-
- GMap.NET.Internals\DrawTile.cs
-
-
- GMap.NET.Internals\KiberTileCache.cs
-
-
- GMap.NET.Internals\LoadTask.cs
-
-
- GMap.NET.Internals\PureImage.cs
-
-
- GMap.NET.Internals\RawTile.cs
-
-
- GMap.NET.Internals\Stuff.cs
-
-
- GMap.NET.Internals\Tile.cs
-
-
- GMap.NET.Internals\TileMatrix.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_DarbAE_Q2_2011_NAVTQ_Eng_V5_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_Imagery_World_2D_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_ShadedRelief_World_2D_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_StreetMap_World_2D_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_Topo_US_2D_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Physical_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Shaded_Relief_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Street_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Terrain_Base_MapProvider.cs
-
-
- GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Topo_MapProvider.cs
-
-
- GMap.NET.MapProviders\Bing\BingHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Bing\BingMapProvider.cs
-
-
- GMap.NET.MapProviders\Bing\BingSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Czech\CzechHistoryMapProvider.cs
-
-
- GMap.NET.MapProviders\Czech\CzechHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Czech\CzechMapProvider.cs
-
-
- GMap.NET.MapProviders\Czech\CzechSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Czech\CzechTuristMapProvider.cs
-
-
- GMap.NET.MapProviders\Etc\CloudMadeMapProvider.cs
-
-
- GMap.NET.MapProviders\Etc\LatviaMapProvider.cs
-
-
- GMap.NET.MapProviders\Etc\MapBenderWMSProvider.cs
-
-
- GMap.NET.MapProviders\Etc\SpainMapProvider.cs
-
-
- GMap.NET.MapProviders\Etc\TurkeyMapProvider.cs
-
-
- GMap.NET.MapProviders\Etc\WikimapiaMapProvider.cs
-
-
- GMap.NET.MapProviders\GMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\China\GoogleChinaHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\China\GoogleChinaMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\China\GoogleChinaSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\China\GoogleChinaTerrainMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\GoogleHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\GoogleMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\GoogleSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\GoogleTerrainMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\Korea\GoogleKoreaHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\Korea\GoogleKoreaMapProvider.cs
-
-
- GMap.NET.MapProviders\Google\Korea\GoogleKoreaSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Lithuania\Lithuania3dMapProvider.cs
-
-
- GMap.NET.MapProviders\Lithuania\LithuaniaHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Lithuania\LithuaniaHybridOldMapProvider.cs
-
-
- GMap.NET.MapProviders\Lithuania\LithuaniaMapProvider.cs
-
-
- GMap.NET.MapProviders\Lithuania\LithuaniaOrtoFotoMapProvider.cs
-
-
- GMap.NET.MapProviders\Lithuania\LithuaniaOrtoFotoOldMapProvider.cs
-
-
- GMap.NET.MapProviders\NearMap\NearHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\NearMap\NearMapProvider.cs
-
-
- GMap.NET.MapProviders\NearMap\NearSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenCycleLandscapeMapProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenCycleMapProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenCycleTransportMapProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenSeaMapHybridProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapQuestHybridProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapQuestProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapQuestSatteliteProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapSurferProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapSurferTerrainProvider.cs
-
-
- GMap.NET.MapProviders\OpenStreetMap\OpenStreetOsmProvider.cs
-
-
- GMap.NET.MapProviders\Ovi\OviHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Ovi\OviMapProvider.cs
-
-
- GMap.NET.MapProviders\Ovi\OviSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Ovi\OviTerrainMapProvider.cs
-
-
- GMap.NET.MapProviders\Yahoo\YahooHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Yahoo\YahooMapProvider.cs
-
-
- GMap.NET.MapProviders\Yahoo\YahooSatelliteMapProvider.cs
-
-
- GMap.NET.MapProviders\Yandex\YandexHybridMapProvider.cs
-
-
- GMap.NET.MapProviders\Yandex\YandexMapProvider.cs
-
-
- GMap.NET.MapProviders\Yandex\YandexSatelliteMapProvider.cs
-
-
- GMap.NET.Projections\MapsLTProjection.cs
-
-
- GMap.NET.Projections\MapsLVProjection.cs
-
-
- GMap.NET.Projections\MapyCZProjection.cs
-
-
- GMap.NET.Projections\MercatorProjection.cs
-
-
- GMap.NET.Projections\MercatorProjectionYandex.cs
-
-
- GMap.NET.Projections\PlateCarreeProjection.cs
-
-
- GMap.NET.Projections\PlateCarreeProjectionDarbAe.cs
-
-
- GMap.NET.Projections\PlateCarreeProjectionPergo.cs
-
-
- GMap.NET\AccessMode.cs
-
-
- GMap.NET\Delegates.cs
-
-
- GMap.NET\DirectionsProvider.cs
-
-
- GMap.NET\GDirections.cs
-
-
- GMap.NET\GeocodingProvider.cs
-
-
- GMap.NET\GMaps.cs
-
-
- GMap.NET\GPoint.cs
-
-
- GMap.NET\GpsLog.cs
-
-
- GMap.NET\gpx.cs
-
-
- GMap.NET\GRect.cs
-
-
- GMap.NET\GSize.cs
-
-
- GMap.NET\Interface.cs
-
-
- GMap.NET\LanguageType.cs
-
-
- GMap.NET\MapRoute.cs
-
-
- GMap.NET\MapType.cs
-
-
- GMap.NET\MouseWheelZoomType.cs
-
-
- GMap.NET\Placemark.cs
-
-
- GMap.NET\PointLatLng.cs
-
-
- GMap.NET\PureImageCache.cs
-
-
- GMap.NET\PureProjection.cs
-
-
- GMap.NET\RectLatLng.cs
-
-
- GMap.NET\RenderMode.cs
-
-
- GMap.NET\RoutingProvider.cs
-
-
- GMap.NET\Singleton.cs
-
-
- GMap.NET\SizeLatLng.cs
-
-
- GMap.NET\StatusCodes.cs
-
-
- GMap.NET.ObjectModel\ObservableCollection.cs
-
-
- GMap.NET.ObjectModel\ObservableCollectionThreadSafe.cs
-
-
- GMap.NET.WindowsForms\GMapControl.cs
- UserControl
-
-
- GMap.NET.WindowsForms\GMapMarker.cs
-
-
- GMap.NET.WindowsForms\GMapOverlay.cs
-
-
- GMap.NET.WindowsForms\GMapPolygon.cs
-
-
- GMap.NET.WindowsForms\GMapRoute.cs
-
-
- GMap.NET.WindowsForms\GMapToolTip.cs
-
-
- GMap.NET.WindowsForms\Markers\GMarkerCross.cs
-
-
- GMap.NET.WindowsForms\ToolTips\GMapBaloonToolTip.cs
-
-
- GMap.NET.WindowsForms\ToolTips\GMapRoundedToolTip.cs
-
-
- GMap.NET.WindowsForms\WindowsFormsImage.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- Resources.resx
-
-
-
-
-
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/GMap.NET.WindowsMobile/Properties/AssemblyInfo.cs b/GMap.NET.WindowsMobile/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("GMap.NET.WindowsMobile")]
-[assembly: AssemblyDescription("GMap.NET - Great Maps for Windows Mobile")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Universe")]
-[assembly: AssemblyProduct("GMap.NET.WindowsMobile")]
-[assembly: AssemblyCopyright("Copyright © Universe 2010")]
-[assembly: AssemblyTrademark("GMap.NET.WindowsMobile")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("6ee21dc0-23c4-4502-8913-87bbf98c2859")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.4.9.3")]
-
diff --git a/GMap.NET.WindowsMobile/Properties/Resources.Designer.cs b/GMap.NET.WindowsMobile/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace GMap.NET.WindowsMobile.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GMap.NET.WindowsMobile.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- internal static System.Drawing.Bitmap bigMarkerGreen {
- get {
- object obj = ResourceManager.GetObject("bigMarkerGreen", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized string similar to CREATE TABLE IF NOT EXISTS Tiles (id INTEGER NOT NULL PRIMARY KEY, X INTEGER NOT NULL, Y INTEGER NOT NULL, Zoom INTEGER NOT NULL, Type INTEGER NOT NULL, CacheTime DATETIME);
- ///CREATE INDEX IF NOT EXISTS IndexOfTiles ON Tiles (X, Y, Zoom, Type);
- ///
- ///CREATE TABLE IF NOT EXISTS TilesData (id INTEGER NOT NULL PRIMARY KEY CONSTRAINT fk_Tiles_id REFERENCES Tiles(id) ON DELETE CASCADE, Tile BLOB NULL);
- ///
- ///-- Foreign Key Preventing insert
- ///CREATE TRIGGER fki_TilesData_id_Tiles_id
- ///BEFORE INSERT ON [TilesData]
- ///FOR E [rest of string was truncated]";.
- ///
- internal static string CreateTileDb {
- get {
- return ResourceManager.GetString("CreateTileDb", resourceCulture);
- }
- }
-
- internal static System.Drawing.Bitmap drag_cross_67_16 {
- get {
- object obj = ResourceManager.GetObject("drag_cross_67_16", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap marker {
- get {
- object obj = ResourceManager.GetObject("marker", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- internal static System.Drawing.Bitmap shadow50 {
- get {
- object obj = ResourceManager.GetObject("shadow50", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
- }
-}
diff --git a/GMap.NET.WindowsMobile/Properties/Resources.resx b/GMap.NET.WindowsMobile/Properties/Resources.resx
deleted file mode 100644
--- a/GMap.NET.WindowsMobile/Properties/Resources.resx
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- ..\Resources\bigMarkerGreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- CREATE TABLE IF NOT EXISTS Tiles (id INTEGER NOT NULL PRIMARY KEY, X INTEGER NOT NULL, Y INTEGER NOT NULL, Zoom INTEGER NOT NULL, Type INTEGER NOT NULL, CacheTime DATETIME);
-CREATE INDEX IF NOT EXISTS IndexOfTiles ON Tiles (X, Y, Zoom, Type);
-
-CREATE TABLE IF NOT EXISTS TilesData (id INTEGER NOT NULL PRIMARY KEY CONSTRAINT fk_Tiles_id REFERENCES Tiles(id) ON DELETE CASCADE, Tile BLOB NULL);
-
--- Foreign Key Preventing insert
-CREATE TRIGGER fki_TilesData_id_Tiles_id
-BEFORE INSERT ON [TilesData]
-FOR EACH ROW BEGIN
- SELECT RAISE(ROLLBACK, 'insert on table "TilesData" violates foreign key constraint "fki_TilesData_id_Tiles_id"')
- WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL;
-END;
-
--- Foreign key preventing update
-CREATE TRIGGER fku_TilesData_id_Tiles_id
-BEFORE UPDATE ON [TilesData]
-FOR EACH ROW BEGIN
- SELECT RAISE(ROLLBACK, 'update on table "TilesData" violates foreign key constraint "fku_TilesData_id_Tiles_id"')
- WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL;
-END;
-
--- Cascading Delete
-CREATE TRIGGER fkdc_TilesData_id_Tiles_id
-BEFORE DELETE ON Tiles
-FOR EACH ROW BEGIN
- DELETE FROM TilesData WHERE TilesData.id = OLD.id;
-END;
-
-
- ..\Resources\drag_cross_67_16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\marker.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\shadow50.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
\ No newline at end of file
diff --git a/GMap.NET.WindowsMobile/Resources/bigMarkerGreen.png b/GMap.NET.WindowsMobile/Resources/bigMarkerGreen.png
deleted file mode 100644
index 4aed804959cd7450939446ca75515003033a8543..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {644FE7D4-0184-400F-B2D7-99CB41360658}
- library
- Properties
- GMap.NET.WindowsPresentation
- GMap.NET.WindowsPresentation
- v3.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- sn.snk
-
-
- 3.5
-
-
-
- true
- bin\Debug\
- TRACE;DEBUG
- full
- AnyCPU
- bin\x86\Debug\GMap.NET.WindowsPresentation.dll.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- false
-
-
- bin\Release\
- TRACE
- bin\x86\Release\GMap.NET.WindowsPresentation.XML
- true
- AnyCPU
- bin\x86\Release\GMap.NET.WindowsPresentation.dll.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
-
-
-
-
- 3.5
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
- 4.0
-
-
-
-
- Properties\VersionInfo.cs
-
-
-
-
-
-
-
-
- Code
-
-
- TilePrefetcher.xaml
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
-
-
-
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
-
-
-
\ No newline at end of file
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/CompositionTargetEx.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/CompositionTargetEx.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/CompositionTargetEx.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Windows.Media;
-
-namespace GMap.NET.WindowsPresentation
-{
- public static class CompositionTargetEx
- {
- static TimeSpan _last = TimeSpan.Zero;
- static event EventHandler _FrameUpdating;
-
- public static event EventHandler FrameUpdating
- {
- add
- {
- if(_FrameUpdating == null)
- CompositionTarget.Rendering += CompositionTarget_Rendering;
-
- _FrameUpdating += value;
- }
-
- remove
- {
- _FrameUpdating -= value;
- if(_FrameUpdating == null)
- CompositionTarget.Rendering -= CompositionTarget_Rendering;
- }
- }
-
- static void CompositionTarget_Rendering(object sender, EventArgs e)
- {
- RenderingEventArgs args = e as RenderingEventArgs;
- if(args.RenderingTime != _last)
- {
- _last = args.RenderingTime;
- _FrameUpdating(sender, args);
- }
- }
- }
-}
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapControl.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapControl.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapControl.cs
+++ /dev/null
@@ -1,2279 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Globalization;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Effects;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- using GMap.NET;
- using GMap.NET.Internals;
- using System.Diagnostics;
- using GMap.NET.MapProviders;
- using System.Windows.Media.Animation;
- using GMap.NET.Projections;
-
- ///
- /// GMap.NET control for Windows Presentation
- ///
- public partial class GMapControl : ItemsControl, Interface, IDisposable
- {
- #region DependencyProperties and related stuff
-
- public System.Windows.Point MapPoint
- {
- get
- {
- return (System.Windows.Point)GetValue(MapPointProperty);
- }
- set
- {
- SetValue(MapPointProperty, value);
- }
- }
-
-
- // Using a DependencyProperty as the backing store for point. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty MapPointProperty =
- DependencyProperty.Register("MapPoint", typeof(System.Windows.Point), typeof(GMapControl), new PropertyMetadata(new Point(), OnMapPointPropertyChanged));
-
-
- private static void OnMapPointPropertyChanged(DependencyObject source,
- DependencyPropertyChangedEventArgs e)
- {
- Point temp = (Point)e.NewValue;
- (source as GMapControl).Position = new PointLatLng(temp.X, temp.Y);
- }
-
- public static readonly DependencyProperty MapProviderProperty = DependencyProperty.Register("MapProvider", typeof(GMapProvider), typeof(GMapControl), new UIPropertyMetadata(EmptyProvider.Instance, new PropertyChangedCallback(MapProviderPropertyChanged)));
-
- ///
- /// type of map
- ///
- [Browsable(false)]
- public GMapProvider MapProvider
- {
- get
- {
- return GetValue(MapProviderProperty) as GMapProvider;
- }
- set
- {
- SetValue(MapProviderProperty, value);
- }
- }
-
- private static void MapProviderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- GMapControl map = (GMapControl)d;
- if(map != null)
- {
- Debug.WriteLine("MapType: " + e.OldValue + " -> " + e.NewValue);
-
- RectLatLng viewarea = map.SelectedArea;
- if(viewarea != RectLatLng.Empty)
- {
- map.Position = new PointLatLng(viewarea.Lat - viewarea.HeightLat / 2, viewarea.Lng + viewarea.WidthLng / 2);
- }
- else
- {
- viewarea = map.ViewArea;
- }
-
- map.Core.Provider = e.NewValue as GMapProvider;
-
- map.Copyright = null;
- if(!string.IsNullOrEmpty(map.Core.Provider.Copyright))
- {
- map.Copyright = new FormattedText(map.Core.Provider.Copyright, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("GenericSansSerif"), 9, Brushes.Navy);
- }
-
- if(map.Core.IsStarted && map.Core.zoomToArea)
- {
- // restore zoomrect as close as possible
- if(viewarea != RectLatLng.Empty && viewarea != map.ViewArea)
- {
- int bestZoom = map.Core.GetMaxZoomToFitRect(viewarea);
- if(bestZoom > 0 && map.Zoom != bestZoom)
- {
- map.Zoom = bestZoom;
- }
- }
- }
- }
- }
-
- public static readonly DependencyProperty ZoomProperty = DependencyProperty.Register("Zoom", typeof(double), typeof(GMapControl), new UIPropertyMetadata(0.0, new PropertyChangedCallback(ZoomPropertyChanged), new CoerceValueCallback(OnCoerceZoom)));
-
- ///
- /// map zoom
- ///
- [Category("GMap.NET")]
- public double Zoom
- {
- get
- {
- return (double)(GetValue(ZoomProperty));
- }
- set
- {
- SetValue(ZoomProperty, value);
- }
- }
-
- private static object OnCoerceZoom(DependencyObject o, object value)
- {
- GMapControl map = o as GMapControl;
- if(map != null)
- {
- double result = (double)value;
- if(result > map.MaxZoom)
- {
- result = map.MaxZoom;
- }
- if(result < map.MinZoom)
- {
- result = map.MinZoom;
- }
-
- return result;
- }
- else
- {
- return value;
- }
- }
-
- private ScaleModes scaleMode = ScaleModes.Integer;
-
- ///
- /// Specifies, if a floating map scale is displayed using a
- /// stretched, or a narrowed map.
- /// If ScaleMode is ScaleDown,
- /// then a scale of 12.3 is displayed using a map zoom level of 13
- /// resized to the lower level. If the parameter is ScaleUp ,
- /// then the same scale is displayed using a zoom level of 12 with an
- /// enlarged scale. If the value is Dynamic, then until a
- /// remainder of 0.25 ScaleUp is applied, for bigger
- /// remainders ScaleDown.
- ///
- [Category("GMap.NET")]
- [Description("map scale type")]
- public ScaleModes ScaleMode
- {
- get
- {
- return scaleMode;
- }
- set
- {
- scaleMode = value;
- InvalidateVisual();
- }
- }
-
- private static void ZoomPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- GMapControl map = (GMapControl)d;
- if(map != null && map.MapProvider.Projection != null)
- {
- double value = (double)e.NewValue;
-
- Debug.WriteLine("Zoom: " + e.OldValue + " -> " + value);
-
- double remainder = value % 1;
- if(map.ScaleMode != ScaleModes.Integer && remainder != 0 && map.ActualWidth > 0)
- {
- bool scaleDown;
-
- switch(map.ScaleMode)
- {
- case ScaleModes.ScaleDown:
- scaleDown = true;
- break;
-
- case ScaleModes.Dynamic:
- scaleDown = remainder > 0.25;
- break;
-
- default:
- scaleDown = false;
- break;
- }
-
- if(scaleDown)
- remainder--;
-
- double scaleValue = Math.Pow(2d, remainder);
- {
- if(map.MapScaleTransform == null)
- {
- map.MapScaleTransform = map.lastScaleTransform;
- }
- map.MapScaleTransform.ScaleX = scaleValue;
- map.MapScaleTransform.ScaleY = scaleValue;
-
- map.Core.scaleX = 1 / scaleValue;
- map.Core.scaleY = 1 / scaleValue;
-
- map.MapScaleTransform.CenterX = map.ActualWidth / 2;
- map.MapScaleTransform.CenterY = map.ActualHeight / 2;
- }
-
- map.Core.Zoom = Convert.ToInt32(scaleDown ? Math.Ceiling(value) : value - remainder);
- }
- else
- {
- map.MapScaleTransform = null;
- map.Core.scaleX = 1;
- map.Core.scaleY = 1;
- map.Core.Zoom = (int)Math.Floor(value);
- }
-
- if(map.IsLoaded)
- {
- map.ForceUpdateOverlays();
- map.InvalidateVisual(true);
- }
- }
- }
-
- readonly ScaleTransform lastScaleTransform = new ScaleTransform();
-
- #endregion
-
- readonly Core Core = new Core();
- //GRect region;
- delegate void MethodInvoker();
- PointLatLng selectionStart;
- PointLatLng selectionEnd;
- Typeface tileTypeface = new Typeface("Arial");
- bool showTileGridLines = false;
-
- FormattedText Copyright;
-
- ///
- /// enables filling empty tiles using lower level images
- ///
- [Browsable(false)]
- public bool FillEmptyTiles
- {
- get
- {
- return Core.fillEmptyTiles;
- }
- set
- {
- Core.fillEmptyTiles = value;
- }
- }
-
- ///
- /// max zoom
- ///
- [Category("GMap.NET")]
- [Description("maximum zoom level of map")]
- public int MaxZoom
- {
- get
- {
- return Core.maxZoom;
- }
- set
- {
- Core.maxZoom = value;
- }
- }
-
- ///
- /// min zoom
- ///
- [Category("GMap.NET")]
- [Description("minimum zoom level of map")]
- public int MinZoom
- {
- get
- {
- return Core.minZoom;
- }
- set
- {
- Core.minZoom = value;
- }
- }
-
- ///
- /// pen for empty tile borders
- ///
- public Pen EmptyTileBorders = new Pen(Brushes.White, 1.0);
-
- ///
- /// pen for Selection
- ///
- public Pen SelectionPen = new Pen(Brushes.Blue, 2.0);
-
- ///
- /// background of selected area
- ///
- public Brush SelectedAreaFill = new SolidColorBrush(Color.FromArgb(33, Colors.RoyalBlue.R, Colors.RoyalBlue.G, Colors.RoyalBlue.B));
-
- ///
- /// ///
- /// pen for empty tile background
- ///
- public Brush EmptytileBrush = Brushes.Navy;
-
- ///
- /// text on empty tiles
- ///
- public FormattedText EmptyTileText = new FormattedText("We are sorry, but we don't\nhave imagery at this zoom\n level for this region.", System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("Arial"), 16, Brushes.Blue);
-
- ///
- /// map zooming type for mouse wheel
- ///
- [Category("GMap.NET")]
- [Description("map zooming type for mouse wheel")]
- public MouseWheelZoomType MouseWheelZoomType
- {
- get
- {
- return Core.MouseWheelZoomType;
- }
- set
- {
- Core.MouseWheelZoomType = value;
- }
- }
-
- ///
- /// map dragg button
- ///
- [Category("GMap.NET")]
- public MouseButton DragButton = MouseButton.Right;
-
- ///
- /// use circle for selection
- ///
- public bool SelectionUseCircle = false;
-
- ///
- /// shows tile gridlines
- ///
- [Category("GMap.NET")]
- public bool ShowTileGridLines
- {
- get
- {
- return showTileGridLines;
- }
- set
- {
- showTileGridLines = value;
- InvalidateVisual();
- }
- }
-
- ///
- /// retry count to get tile
- ///
- [Browsable(false)]
- public int RetryLoadTile
- {
- get
- {
- return Core.RetryLoadTile;
- }
- set
- {
- Core.RetryLoadTile = value;
- }
- }
-
- ///
- /// how many levels of tiles are staying decompresed in memory
- ///
- [Browsable(false)]
- public int LevelsKeepInMemmory
- {
- get
- {
- return Core.LevelsKeepInMemmory;
- }
-
- set
- {
- Core.LevelsKeepInMemmory = value;
- }
- }
-
- ///
- /// current selected area in map
- ///
- private RectLatLng selectedArea;
-
- [Browsable(false)]
- public RectLatLng SelectedArea
- {
- get
- {
- return selectedArea;
- }
- set
- {
- selectedArea = value;
- InvalidateVisual();
- }
- }
-
- ///
- /// is touch control enabled
- ///
- bool TouchEnabled = true;
-
- ///
- /// map boundaries
- ///
- public RectLatLng? BoundsOfMap = null;
-
- ///
- /// occurs when mouse selection is changed
- ///
- public event SelectionChange OnSelectionChange;
-
- ///
- /// list of markers
- ///
- public readonly ObservableCollection Markers = new ObservableCollection();
-
- ///
- /// current markers overlay offset
- ///
- internal readonly TranslateTransform MapTranslateTransform = new TranslateTransform();
- internal readonly TranslateTransform MapOverlayTranslateTransform = new TranslateTransform();
-
- internal ScaleTransform MapScaleTransform = new ScaleTransform();
- internal RotateTransform MapRotateTransform = new RotateTransform();
-
- protected bool DesignModeInConstruct
- {
- get
- {
- return System.ComponentModel.DesignerProperties.GetIsInDesignMode(this);
- }
- }
-
- Canvas mapCanvas = null;
-
- ///
- /// markers overlay
- ///
- internal Canvas MapCanvas
- {
- get
- {
- if(mapCanvas == null)
- {
- if(this.VisualChildrenCount > 0)
- {
- Border border = VisualTreeHelper.GetChild(this, 0) as Border;
- ItemsPresenter items = border.Child as ItemsPresenter;
- DependencyObject target = VisualTreeHelper.GetChild(items, 0);
- mapCanvas = target as Canvas;
-
- mapCanvas.RenderTransform = MapTranslateTransform;
- }
- }
-
- return mapCanvas;
- }
- }
-
- public GMaps Manager
- {
- get
- {
- return GMaps.Instance;
- }
- }
-
- static DataTemplate DataTemplateInstance;
- static ItemsPanelTemplate ItemsPanelTemplateInstance;
- static Style StyleInstance;
-
- public GMapControl()
- {
- if(!DesignModeInConstruct)
- {
- #region -- templates --
-
- #region -- xaml --
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- #endregion
-
- if(DataTemplateInstance == null)
- {
- DataTemplateInstance = new DataTemplate(typeof(GMapMarker));
- {
- FrameworkElementFactory fef = new FrameworkElementFactory(typeof(ContentPresenter));
- fef.SetBinding(ContentPresenter.ContentProperty, new Binding("Shape"));
- DataTemplateInstance.VisualTree = fef;
- }
- }
- ItemTemplate = DataTemplateInstance;
-
- if(ItemsPanelTemplateInstance == null)
- {
- var factoryPanel = new FrameworkElementFactory(typeof(Canvas));
- {
- factoryPanel.SetValue(Canvas.IsItemsHostProperty, true);
-
- ItemsPanelTemplateInstance = new ItemsPanelTemplate();
- {
- ItemsPanelTemplateInstance.VisualTree = factoryPanel;
- }
- }
- }
- ItemsPanel = ItemsPanelTemplateInstance;
-
- if(StyleInstance == null)
- {
- StyleInstance = new Style();
- {
- StyleInstance.Setters.Add(new Setter(Canvas.LeftProperty, new Binding("LocalPositionX")));
- StyleInstance.Setters.Add(new Setter(Canvas.TopProperty, new Binding("LocalPositionY")));
- StyleInstance.Setters.Add(new Setter(Canvas.ZIndexProperty, new Binding("ZIndex")));
- }
- }
- ItemContainerStyle = StyleInstance;
- #endregion
-
- Manager.SQLitePing();
-
- ClipToBounds = true;
- SnapsToDevicePixels = true;
-
- GMapProvider.TileImageProxy = WindowsPresentationImageProxy.Instance;
-
- Core.SystemType = "WindowsPresentation";
-
- Core.RenderMode = GMap.NET.RenderMode.WPF;
-
- Core.OnMapZoomChanged += new MapZoomChanged(ForceUpdateOverlays);
- Loaded += new RoutedEventHandler(GMapControl_Loaded);
- Dispatcher.ShutdownStarted += new EventHandler(Dispatcher_ShutdownStarted);
- SizeChanged += new SizeChangedEventHandler(GMapControl_SizeChanged);
-
- // by default its internal property, feel free to use your own
- if(ItemsSource == null)
- {
- ItemsSource = Markers;
- }
-
- Core.Zoom = (int)((double)ZoomProperty.DefaultMetadata.DefaultValue);
- }
- }
-
- void invalidatorEngage(object sender, ProgressChangedEventArgs e)
- {
- base.InvalidateVisual();
- }
-
- ///
- /// enque built-in thread safe invalidation
- ///
- public new void InvalidateVisual()
- {
- if(Core.Refresh != null)
- {
- Core.Refresh.Set();
- }
- }
-
- ///
- /// Invalidates the rendering of the element, and forces a complete new layout
- /// pass. System.Windows.UIElement.OnRender(System.Windows.Media.DrawingContext)
- /// is called after the layout cycle is completed. If not forced enques built-in thread safe invalidation
- ///
- ///
- public void InvalidateVisual(bool forced)
- {
- if(forced)
- {
- lock(Core.invalidationLock)
- {
- Core.lastInvalidation = DateTime.Now;
- }
- base.InvalidateVisual();
- }
- else
- {
- InvalidateVisual();
- }
- }
-
- protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
- {
- if(e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
- {
- foreach(GMapMarker marker in e.NewItems)
- {
- marker.ForceUpdateLocalPosition(this);
- }
- }
-
- base.OnItemsChanged(e);
- }
-
- ///
- /// inits core system
- ///
- ///
- ///
- void GMapControl_Loaded(object sender, RoutedEventArgs e)
- {
- if(!Core.IsStarted)
- {
- if(lazyEvents)
- {
- lazyEvents = false;
-
- if(lazySetZoomToFitRect.HasValue)
- {
- SetZoomToFitRect(lazySetZoomToFitRect.Value);
- lazySetZoomToFitRect = null;
- }
- }
- Core.OnMapOpen().ProgressChanged += new ProgressChangedEventHandler(invalidatorEngage);
- ForceUpdateOverlays();
-
- if(Application.Current != null)
- {
- loadedApp = Application.Current;
-
- loadedApp.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle,
- new Action(delegate()
- {
- loadedApp.SessionEnding += new SessionEndingCancelEventHandler(Current_SessionEnding);
- }
- ));
- }
- }
- }
-
- Application loadedApp;
-
- void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
- {
- GMaps.Instance.CancelTileCaching();
- }
-
- void Dispatcher_ShutdownStarted(object sender, EventArgs e)
- {
- Dispose();
- }
-
- ///
- /// recalculates size
- ///
- ///
- ///
- void GMapControl_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- System.Windows.Size constraint = e.NewSize;
-
- // 50px outside control
- //region = new GRect(-50, -50, (int)constraint.Width + 100, (int)constraint.Height + 100);
-
- Core.OnMapSizeChanged((int)constraint.Width, (int)constraint.Height);
-
- if(Core.IsStarted)
- {
- if(IsRotated)
- {
- UpdateRotationMatrix();
- }
-
- ForceUpdateOverlays();
- }
- }
-
- void ForceUpdateOverlays()
- {
- using(Dispatcher.DisableProcessing())
- {
- UpdateMarkersOffset();
-
- foreach(GMapMarker i in ItemsSource)
- {
- if(i != null)
- {
- i.ForceUpdateLocalPosition(this);
-
- if(i.Route.Count > 0)
- {
- i.RegenerateRouteShape(this);
- }
-
- if(i.Polygon.Count > 0)
- {
- i.RegeneratePolygonShape(this);
- }
- }
- }
- }
- }
-
- ///
- /// updates markers overlay offset
- ///
- void UpdateMarkersOffset()
- {
- if(MapCanvas != null)
- {
- if(MapScaleTransform != null)
- {
- var tp = MapScaleTransform.Transform(new System.Windows.Point(Core.renderOffset.X, Core.renderOffset.Y));
- MapOverlayTranslateTransform.X = tp.X;
- MapOverlayTranslateTransform.Y = tp.Y;
-
- // map is scaled already
- MapTranslateTransform.X = Core.renderOffset.X;
- MapTranslateTransform.Y = Core.renderOffset.Y;
- }
- else
- {
- MapTranslateTransform.X = Core.renderOffset.X;
- MapTranslateTransform.Y = Core.renderOffset.Y;
-
- MapOverlayTranslateTransform.X = MapTranslateTransform.X;
- MapOverlayTranslateTransform.Y = MapTranslateTransform.Y;
- }
- }
- }
-
- public Brush EmptyMapBackground = Brushes.WhiteSmoke;
-
- ///
- /// render map in WPF
- ///
- ///
- void DrawMap(DrawingContext g)
- {
- if(MapProvider == EmptyProvider.Instance || MapProvider == null)
- {
- return;
- }
-
- Core.tileDrawingListLock.AcquireReaderLock();
- Core.Matrix.EnterReadLock();
- try
- {
- foreach(var tilePoint in Core.tileDrawingList)
- {
- Core.tileRect.Location = tilePoint.PosPixel;
- Core.tileRect.OffsetNegative(Core.compensationOffset);
-
- //if(region.IntersectsWith(Core.tileRect) || IsRotated)
- {
- bool found = false;
-
- Tile t = Core.Matrix.GetTileWithNoLock(Core.Zoom, tilePoint.PosXY);
- if(t.NotEmpty)
- {
- foreach(WindowsPresentationImage img in t.Overlays)
- {
- if(img != null && img.Img != null)
- {
- if(!found)
- found = true;
-
- var imgRect = new Rect(Core.tileRect.X + 0.6, Core.tileRect.Y + 0.6, Core.tileRect.Width + 0.6, Core.tileRect.Height + 0.6);
- if(!img.IsParent)
- {
- g.DrawImage(img.Img, imgRect);
- }
- else
- {
- // TODO: move calculations to loader thread
- var geometry = new RectangleGeometry(imgRect);
- var parentImgRect = new Rect(Core.tileRect.X - Core.tileRect.Width * img.Xoff + 0.6, Core.tileRect.Y - Core.tileRect.Height * img.Yoff + 0.6, Core.tileRect.Width * img.Ix + 0.6, Core.tileRect.Height * img.Ix + 0.6);
-
- g.PushClip(geometry);
- g.DrawImage(img.Img, parentImgRect);
- g.Pop();
- geometry = null;
- }
- }
- }
- }
- else if(FillEmptyTiles && MapProvider.Projection is MercatorProjection)
- {
- #region -- fill empty tiles --
- int zoomOffset = 1;
- Tile parentTile = Tile.Empty;
- long Ix = 0;
-
- while(!parentTile.NotEmpty && zoomOffset < Core.Zoom && zoomOffset <= LevelsKeepInMemmory)
- {
- Ix = (long)Math.Pow(2, zoomOffset);
- parentTile = Core.Matrix.GetTileWithNoLock(Core.Zoom - zoomOffset++, new GMap.NET.GPoint((int)(tilePoint.PosXY.X / Ix), (int)(tilePoint.PosXY.Y / Ix)));
- }
-
- if(parentTile.NotEmpty)
- {
- long Xoff = Math.Abs(tilePoint.PosXY.X - (parentTile.Pos.X * Ix));
- long Yoff = Math.Abs(tilePoint.PosXY.Y - (parentTile.Pos.Y * Ix));
-
- var geometry = new RectangleGeometry(new Rect(Core.tileRect.X + 0.6, Core.tileRect.Y + 0.6, Core.tileRect.Width + 0.6, Core.tileRect.Height + 0.6));
- var parentImgRect = new Rect(Core.tileRect.X - Core.tileRect.Width * Xoff + 0.6, Core.tileRect.Y - Core.tileRect.Height * Yoff + 0.6, Core.tileRect.Width * Ix + 0.6, Core.tileRect.Height * Ix + 0.6);
-
- // render tile
- {
- foreach(WindowsPresentationImage img in parentTile.Overlays)
- {
- if(img != null && img.Img != null && !img.IsParent)
- {
- if(!found)
- found = true;
-
- g.PushClip(geometry);
- g.DrawImage(img.Img, parentImgRect);
- g.DrawRectangle(SelectedAreaFill, null, geometry.Bounds);
- g.Pop();
- }
- }
- }
-
- geometry = null;
- }
- #endregion
- }
-
- // add text if tile is missing
- if(!found)
- {
- lock(Core.FailedLoads)
- {
- var lt = new LoadTask(tilePoint.PosXY, Core.Zoom);
-
- if(Core.FailedLoads.ContainsKey(lt))
- {
- g.DrawRectangle(EmptytileBrush, EmptyTileBorders, new Rect(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height));
-
- var ex = Core.FailedLoads[lt];
- FormattedText TileText = new FormattedText("Exception: " + ex.Message, System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, tileTypeface, 14, Brushes.Red);
- TileText.MaxTextWidth = Core.tileRect.Width - 11;
-
- g.DrawText(TileText, new System.Windows.Point(Core.tileRect.X + 11, Core.tileRect.Y + 11));
-
- g.DrawText(EmptyTileText, new System.Windows.Point(Core.tileRect.X + Core.tileRect.Width / 2 - EmptyTileText.Width / 2, Core.tileRect.Y + Core.tileRect.Height / 2 - EmptyTileText.Height / 2));
- }
- }
- }
-
- if(ShowTileGridLines)
- {
- g.DrawRectangle(null, EmptyTileBorders, new Rect(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height));
-
- if(tilePoint.PosXY == Core.centerTileXYLocation)
- {
- FormattedText TileText = new FormattedText("CENTER:" + tilePoint.ToString(), System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, tileTypeface, 16, Brushes.Red);
- TileText.MaxTextWidth = Core.tileRect.Width;
- g.DrawText(TileText, new System.Windows.Point(Core.tileRect.X + Core.tileRect.Width / 2 - EmptyTileText.Width / 2, Core.tileRect.Y + Core.tileRect.Height / 2 - TileText.Height / 2));
- }
- else
- {
- FormattedText TileText = new FormattedText("TILE: " + tilePoint.ToString(), System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, tileTypeface, 16, Brushes.Red);
- TileText.MaxTextWidth = Core.tileRect.Width;
- g.DrawText(TileText, new System.Windows.Point(Core.tileRect.X + Core.tileRect.Width / 2 - EmptyTileText.Width / 2, Core.tileRect.Y + Core.tileRect.Height / 2 - TileText.Height / 2));
- }
- }
- }
- }
- }
- finally
- {
- Core.Matrix.LeaveReadLock();
- Core.tileDrawingListLock.ReleaseReaderLock();
- }
- }
-
- ///
- /// gets image of the current view
- ///
- ///
- public ImageSource ToImageSource()
- {
- FrameworkElement obj = this;
-
- // Save current canvas transform
- Transform transform = obj.LayoutTransform;
- obj.LayoutTransform = null;
-
- // fix margin offset as well
- Thickness margin = obj.Margin;
- obj.Margin = new Thickness(0, 0,
- margin.Right - margin.Left, margin.Bottom - margin.Top);
-
- // Get the size of canvas
- Size size = new Size(obj.ActualWidth, obj.ActualHeight);
-
- // force control to Update
- obj.Measure(size);
- obj.Arrange(new Rect(size));
-
- RenderTargetBitmap bmp = new RenderTargetBitmap(
- (int)size.Width, (int)size.Height, 96, 96, PixelFormats.Pbgra32);
-
- bmp.Render(obj);
-
- if(bmp.CanFreeze)
- {
- bmp.Freeze();
- }
-
- // return values as they were before
- obj.LayoutTransform = transform;
- obj.Margin = margin;
-
- return bmp;
- }
-
- ///
- /// creates path from list of points
- ///
- ///
- ///
- public virtual Path CreateRoutePath(List localPath)
- {
- // Create a StreamGeometry to use to specify myPath.
- StreamGeometry geometry = new StreamGeometry();
-
- using(StreamGeometryContext ctx = geometry.Open())
- {
- ctx.BeginFigure(localPath[0], false, false);
-
- // Draw a line to the next specified point.
- ctx.PolyLineTo(localPath, true, true);
- }
-
- // Freeze the geometry (make it unmodifiable)
- // for additional performance benefits.
- geometry.Freeze();
-
- // Create a path to draw a geometry with.
- Path myPath = new Path();
- {
- // Specify the shape of the Path using the StreamGeometry.
- myPath.Data = geometry;
-
- BlurEffect ef = new BlurEffect();
- {
- ef.KernelType = KernelType.Gaussian;
- ef.Radius = 3.0;
- ef.RenderingBias = RenderingBias.Quality;
- }
-
- myPath.Effect = ef;
-
- myPath.Stroke = Brushes.Navy;
- myPath.StrokeThickness = 5;
- myPath.StrokeLineJoin = PenLineJoin.Round;
- myPath.StrokeStartLineCap = PenLineCap.Triangle;
- myPath.StrokeEndLineCap = PenLineCap.Square;
-
- myPath.Opacity = 0.6;
- myPath.IsHitTestVisible = false;
- }
- return myPath;
- }
-
- ///
- /// creates path from list of points
- ///
- ///
- ///
- public virtual Path CreatePolygonPath(List localPath)
- {
- // Create a StreamGeometry to use to specify myPath.
- StreamGeometry geometry = new StreamGeometry();
-
- using(StreamGeometryContext ctx = geometry.Open())
- {
- ctx.BeginFigure(localPath[0], true, true);
-
- // Draw a line to the next specified point.
- ctx.PolyLineTo(localPath, true, true);
- }
-
- // Freeze the geometry (make it unmodifiable)
- // for additional performance benefits.
- geometry.Freeze();
-
- // Create a path to draw a geometry with.
- Path myPath = new Path();
- {
- // Specify the shape of the Path using the StreamGeometry.
- myPath.Data = geometry;
-
- BlurEffect ef = new BlurEffect();
- {
- ef.KernelType = KernelType.Gaussian;
- ef.Radius = 3.0;
- ef.RenderingBias = RenderingBias.Quality;
- }
-
- myPath.Effect = ef;
-
- myPath.Stroke = Brushes.MidnightBlue;
- myPath.StrokeThickness = 5;
- myPath.StrokeLineJoin = PenLineJoin.Round;
- myPath.StrokeStartLineCap = PenLineCap.Triangle;
- myPath.StrokeEndLineCap = PenLineCap.Square;
-
- myPath.Fill = Brushes.AliceBlue;
-
- myPath.Opacity = 0.6;
- myPath.IsHitTestVisible = false;
- }
- return myPath;
- }
-
- ///
- /// sets zoom to max to fit rect
- ///
- /// area
- ///
- public bool SetZoomToFitRect(RectLatLng rect)
- {
- if(lazyEvents)
- {
- lazySetZoomToFitRect = rect;
- }
- else
- {
- int maxZoom = Core.GetMaxZoomToFitRect(rect);
- if(maxZoom > 0)
- {
- PointLatLng center = new PointLatLng(rect.Lat - (rect.HeightLat / 2), rect.Lng + (rect.WidthLng / 2));
- Position = center;
-
- if(maxZoom > MaxZoom)
- {
- maxZoom = MaxZoom;
- }
-
- if(Core.Zoom != maxZoom)
- {
- Zoom = maxZoom;
- }
-
- return true;
- }
- }
- return false;
- }
-
- RectLatLng? lazySetZoomToFitRect = null;
- bool lazyEvents = true;
-
- ///
- /// sets to max zoom to fit all markers and centers them in map
- ///
- /// z index or null to check all
- ///
- public bool ZoomAndCenterMarkers(int? ZIndex)
- {
- RectLatLng? rect = GetRectOfAllMarkers(ZIndex);
- if(rect.HasValue)
- {
- return SetZoomToFitRect(rect.Value);
- }
-
- return false;
- }
-
- ///
- /// gets rectangle with all objects inside
- ///
- /// z index or null to check all
- ///
- public RectLatLng? GetRectOfAllMarkers(int? ZIndex)
- {
- RectLatLng? ret = null;
-
- double left = double.MaxValue;
- double top = double.MinValue;
- double right = double.MinValue;
- double bottom = double.MaxValue;
- IEnumerable Overlays;
-
- if(ZIndex.HasValue)
- {
- Overlays = ItemsSource.Cast().Where(p => p != null && p.ZIndex == ZIndex);
- }
- else
- {
- Overlays = ItemsSource.Cast();
- }
-
- if(Overlays != null)
- {
- foreach(var m in Overlays)
- {
- if(m.Shape != null && m.Shape.Visibility == System.Windows.Visibility.Visible)
- {
- // left
- if(m.Position.Lng < left)
- {
- left = m.Position.Lng;
- }
-
- // top
- if(m.Position.Lat > top)
- {
- top = m.Position.Lat;
- }
-
- // right
- if(m.Position.Lng > right)
- {
- right = m.Position.Lng;
- }
-
- // bottom
- if(m.Position.Lat < bottom)
- {
- bottom = m.Position.Lat;
- }
- }
- }
- }
-
- if(left != double.MaxValue && right != double.MinValue && top != double.MinValue && bottom != double.MaxValue)
- {
- ret = RectLatLng.FromLTRB(left, top, right, bottom);
- }
-
- return ret;
- }
-
- ///
- /// offset position in pixels
- ///
- ///
- ///
- public void Offset(int x, int y)
- {
- if(IsLoaded)
- {
- Core.DragOffset(new GPoint(x, y));
-
- UpdateMarkersOffset();
- InvalidateVisual(true);
- }
- }
-
- readonly RotateTransform rotationMatrix = new RotateTransform();
- GeneralTransform rotationMatrixInvert = new RotateTransform();
-
- ///
- /// updates rotation matrix
- ///
- void UpdateRotationMatrix()
- {
- System.Windows.Point center = new System.Windows.Point(ActualWidth / 2.0, ActualHeight / 2.0);
-
- rotationMatrix.Angle = -Bearing;
- rotationMatrix.CenterY = center.Y;
- rotationMatrix.CenterX = center.X;
-
- rotationMatrixInvert = rotationMatrix.Inverse;
- }
-
- ///
- /// returs true if map bearing is not zero
- ///
- public bool IsRotated
- {
- get
- {
- return Core.IsRotated;
- }
- }
-
- ///
- /// bearing for rotation of the map
- ///
- [Category("GMap.NET")]
- public float Bearing
- {
- get
- {
- return Core.bearing;
- }
- set
- {
- //if(Core.bearing != value)
- //{
- // bool resize = Core.bearing == 0;
- // Core.bearing = value;
-
- // UpdateRotationMatrix();
-
- // if(value != 0 && value % 360 != 0)
- // {
- // Core.IsRotated = true;
-
- // if(Core.tileRectBearing.Size == Core.tileRect.Size)
- // {
- // Core.tileRectBearing = Core.tileRect;
- // Core.tileRectBearing.Inflate(1, 1);
- // }
- // }
- // else
- // {
- // Core.IsRotated = false;
- // Core.tileRectBearing = Core.tileRect;
- // }
-
- // if(resize)
- // {
- // Core.OnMapSizeChanged((int)ActualWidth, (int)ActualHeight);
- // }
-
- // Core_OnMapZoomChanged();
-
- // InvalidateVisual();
- //}
- }
- }
-
- ///
- /// apply transformation if in rotation mode
- ///
- System.Windows.Point ApplyRotation(double x, double y)
- {
- System.Windows.Point ret = new System.Windows.Point(x, y);
-
- if(IsRotated)
- {
- ret = rotationMatrix.Transform(ret);
- }
-
- return ret;
- }
-
- ///
- /// apply transformation if in rotation mode
- ///
- System.Windows.Point ApplyRotationInversion(double x, double y)
- {
- System.Windows.Point ret = new System.Windows.Point(x, y);
-
- if(IsRotated)
- {
- ret = rotationMatrixInvert.Transform(ret);
- }
-
- return ret;
- }
-
- #region UserControl Events
- protected override void OnRender(DrawingContext drawingContext)
- {
- if(!Core.IsStarted)
- return;
-
- drawingContext.DrawRectangle(EmptyMapBackground, null, new Rect(RenderSize));
-
- if(IsRotated)
- {
- drawingContext.PushTransform(rotationMatrix);
-
- if(MapScaleTransform != null)
- {
- drawingContext.PushTransform(MapScaleTransform);
- {
- DrawMap(drawingContext);
- }
- drawingContext.Pop();
- }
- else
- {
- DrawMap(drawingContext);
- }
-
- drawingContext.Pop();
- }
- else
- {
- if(MapScaleTransform != null)
- {
- drawingContext.PushTransform(MapScaleTransform);
- drawingContext.PushTransform(MapTranslateTransform);
- {
- DrawMap(drawingContext);
-
-#if DEBUG
- drawingContext.DrawLine(VirtualCenterCrossPen, new Point(-20, 0), new Point(20, 0));
- drawingContext.DrawLine(VirtualCenterCrossPen, new Point(0, -20), new Point(0, 20));
-#endif
- }
- drawingContext.Pop();
- drawingContext.Pop();
- }
- else
- {
- drawingContext.PushTransform(MapTranslateTransform);
- {
- DrawMap(drawingContext);
-#if DEBUG
- drawingContext.DrawLine(VirtualCenterCrossPen, new Point(-20, 0), new Point(20, 0));
- drawingContext.DrawLine(VirtualCenterCrossPen, new Point(0, -20), new Point(0, 20));
-#endif
- }
- drawingContext.Pop();
- }
- }
-
- // selection
- if(!SelectedArea.IsEmpty)
- {
- GPoint p1 = FromLatLngToLocal(SelectedArea.LocationTopLeft);
- GPoint p2 = FromLatLngToLocal(SelectedArea.LocationRightBottom);
-
- long x1 = p1.X;
- long y1 = p1.Y;
- long x2 = p2.X;
- long y2 = p2.Y;
-
- if(SelectionUseCircle)
- {
- drawingContext.DrawEllipse(SelectedAreaFill, SelectionPen, new System.Windows.Point(x1 + (x2 - x1) / 2, y1 + (y2 - y1) / 2), (x2 - x1) / 2, (y2 - y1) / 2);
- }
- else
- {
- drawingContext.DrawRoundedRectangle(SelectedAreaFill, SelectionPen, new Rect(x1, y1, x2 - x1, y2 - y1), 5, 5);
- }
- }
-
- if(ShowCenter)
- {
- drawingContext.DrawLine(CenterCrossPen, new System.Windows.Point((ActualWidth / 2) - 5, ActualHeight / 2), new System.Windows.Point((ActualWidth / 2) + 5, ActualHeight / 2));
- drawingContext.DrawLine(CenterCrossPen, new System.Windows.Point(ActualWidth / 2, (ActualHeight / 2) - 5), new System.Windows.Point(ActualWidth / 2, (ActualHeight / 2) + 5));
- }
-
- if(renderHelperLine)
- {
- var p = Mouse.GetPosition(this);
-
- drawingContext.DrawLine(HelperLinePen, new Point(p.X, 0), new Point(p.X, ActualHeight));
- drawingContext.DrawLine(HelperLinePen, new Point(0, p.Y), new Point(ActualWidth, p.Y));
- }
-
- #region -- copyright --
-
- if(Copyright != null)
- {
- drawingContext.DrawText(Copyright, new System.Windows.Point(5, ActualHeight - Copyright.Height - 5));
- }
-
- #endregion
-
- base.OnRender(drawingContext);
- }
-
- public Pen CenterCrossPen = new Pen(Brushes.Red, 1);
- public bool ShowCenter = true;
-
-#if DEBUG
- readonly Pen VirtualCenterCrossPen = new Pen(Brushes.Blue, 1);
-#endif
-
- HelperLineOptions helperLineOption = HelperLineOptions.DontShow;
-
- ///
- /// draw lines at the mouse pointer position
- ///
- [Browsable(false)]
- public HelperLineOptions HelperLineOption
- {
- get
- {
- return helperLineOption;
- }
- set
- {
- helperLineOption = value;
- renderHelperLine = (helperLineOption == HelperLineOptions.ShowAlways);
- if(Core.IsStarted)
- {
- InvalidateVisual();
- }
- }
- }
-
- public Pen HelperLinePen = new Pen(Brushes.Blue, 1);
- bool renderHelperLine = false;
-
- protected override void OnKeyUp(KeyEventArgs e)
- {
- if(HelperLineOption == HelperLineOptions.ShowOnModifierKey)
- {
- renderHelperLine = !(e.IsUp && (e.Key == Key.LeftShift || e.SystemKey == Key.LeftAlt));
- if(!renderHelperLine)
- {
- InvalidateVisual();
- }
- }
- base.OnKeyUp(e);
- }
-
- protected override void OnKeyDown(KeyEventArgs e)
- {
- if(HelperLineOption == HelperLineOptions.ShowOnModifierKey)
- {
- renderHelperLine = e.IsDown && (e.Key == Key.LeftShift || e.SystemKey == Key.LeftAlt);
- if(renderHelperLine)
- {
- InvalidateVisual();
- }
- }
- base.OnKeyDown(e);
- }
-
- ///
- /// reverses MouseWheel zooming direction
- ///
- public bool InvertedMouseWheelZooming = false;
-
- ///
- /// lets you zoom by MouseWheel even when pointer is in area of marker
- ///
- public bool IgnoreMarkerOnMouseWheel = false;
-
- protected override void OnMouseWheel(MouseWheelEventArgs e)
- {
- base.OnMouseWheel(e);
-
- if((IsMouseDirectlyOver || IgnoreMarkerOnMouseWheel) && !Core.IsDragging)
- {
- System.Windows.Point p = e.GetPosition(this);
- //p = ApplyRotationInversion(p.X, p.Y);
-
- if(Core.mouseLastZoom.X != (int)p.X && Core.mouseLastZoom.Y != (int)p.Y)
- {
- if(MouseWheelZoomType == MouseWheelZoomType.MousePositionAndCenter)
- {
- Core.position = FromLocalToLatLng((int)p.X, (int)p.Y);
- }
- else if(MouseWheelZoomType == MouseWheelZoomType.ViewCenter)
- {
- Core.position = FromLocalToLatLng((int)ActualWidth / 2, (int)ActualHeight / 2);
- }
- else if(MouseWheelZoomType == MouseWheelZoomType.MousePositionWithoutCenter)
- {
- Core.position = FromLocalToLatLng((int)p.X, (int)p.Y);
- }
-
- Core.mouseLastZoom.X = (int)p.X;
- Core.mouseLastZoom.Y = (int)p.Y;
- }
-
- // set mouse position to map center
- if(MouseWheelZoomType != MouseWheelZoomType.MousePositionWithoutCenter)
- {
- System.Windows.Point ps = PointToScreen(new System.Windows.Point(ActualWidth / 2, ActualHeight / 2));
- Stuff.SetCursorPos((int)ps.X, (int)ps.Y);
- }
-
- Core.MouseWheelZooming = true;
-
- if(e.Delta > 0)
- {
- if(!InvertedMouseWheelZooming)
- {
- Zoom = ((int)Zoom) + 1;
- }
- else
- {
- Zoom = ((int)(Zoom + 0.99)) - 1;
- }
- }
- else
- {
- if(InvertedMouseWheelZooming)
- {
- Zoom = ((int)Zoom) + 1;
- }
- else
- {
- Zoom = ((int)(Zoom + 0.99)) - 1;
- }
- }
-
- Core.MouseWheelZooming = false;
- }
-
- base.OnMouseWheel(e);
- }
-
- bool isSelected = false;
-
- protected override void OnMouseDown(MouseButtonEventArgs e)
- {
- if(CanDragMap && e.ChangedButton == DragButton)
- {
- Point p = e.GetPosition(this);
-
- if(MapScaleTransform != null)
- {
- p = MapScaleTransform.Inverse.Transform(p);
- }
-
- p = ApplyRotationInversion(p.X, p.Y);
-
- Core.mouseDown.X = (int)p.X;
- Core.mouseDown.Y = (int)p.Y;
-
- InvalidateVisual();
- }
- else
- {
- if(!isSelected)
- {
- Point p = e.GetPosition(this);
- isSelected = true;
- SelectedArea = RectLatLng.Empty;
- selectionEnd = PointLatLng.Empty;
- selectionStart = FromLocalToLatLng((int)p.X, (int)p.Y);
- }
- }
- base.OnMouseDown(e);
- }
-
- int onMouseUpTimestamp = 0;
-
- protected override void OnMouseUp(MouseButtonEventArgs e)
- {
- if(isSelected)
- {
- isSelected = false;
- }
-
- if(Core.IsDragging)
- {
- if(isDragging)
- {
- onMouseUpTimestamp = e.Timestamp;
- isDragging = false;
- Debug.WriteLine("IsDragging = " + isDragging);
- Cursor = cursorBefore;
- Mouse.Capture(null);
- }
- Core.EndDrag();
-
- if(BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
- {
- if(Core.LastLocationInBounds.HasValue)
- {
- Position = Core.LastLocationInBounds.Value;
- }
- }
- }
- else
- {
- if(e.ChangedButton == DragButton)
- {
- Core.mouseDown = GPoint.Empty;
- }
-
- if(!selectionEnd.IsEmpty && !selectionStart.IsEmpty)
- {
- bool zoomtofit = false;
-
- if(!SelectedArea.IsEmpty && Keyboard.Modifiers == ModifierKeys.Shift)
- {
- zoomtofit = SetZoomToFitRect(SelectedArea);
- }
-
- if(OnSelectionChange != null)
- {
- OnSelectionChange(SelectedArea, zoomtofit);
- }
- }
- else
- {
- InvalidateVisual();
- }
- }
-
- base.OnMouseUp(e);
- }
-
- Cursor cursorBefore = Cursors.Arrow;
-
- protected override void OnMouseMove(MouseEventArgs e)
- {
- // wpf generates to many events if mouse is over some visual
- // and OnMouseUp is fired, wtf, anyway...
- // http://greatmaps.codeplex.com/workitem/16013
- if(e.Timestamp - onMouseUpTimestamp < 55)
- {
- Debug.WriteLine("OnMouseMove skipped: " + (e.Timestamp - onMouseUpTimestamp) + "ms");
- return;
- }
-
- if(!Core.IsDragging && !Core.mouseDown.IsEmpty)
- {
- Point p = e.GetPosition(this);
-
- if(MapScaleTransform != null)
- {
- p = MapScaleTransform.Inverse.Transform(p);
- }
-
- p = ApplyRotationInversion(p.X, p.Y);
-
- // cursor has moved beyond drag tolerance
- if(Math.Abs(p.X - Core.mouseDown.X) * 2 >= SystemParameters.MinimumHorizontalDragDistance || Math.Abs(p.Y - Core.mouseDown.Y) * 2 >= SystemParameters.MinimumVerticalDragDistance)
- {
- Core.BeginDrag(Core.mouseDown);
- }
- }
-
- if(Core.IsDragging)
- {
- if(!isDragging)
- {
- isDragging = true;
- Debug.WriteLine("IsDragging = " + isDragging);
- cursorBefore = Cursor;
- Cursor = Cursors.SizeAll;
- Mouse.Capture(this);
- }
-
- if(BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
- {
- // ...
- }
- else
- {
- Point p = e.GetPosition(this);
-
- if(MapScaleTransform != null)
- {
- p = MapScaleTransform.Inverse.Transform(p);
- }
-
- p = ApplyRotationInversion(p.X, p.Y);
-
- Core.mouseCurrent.X = (int)p.X;
- Core.mouseCurrent.Y = (int)p.Y;
- {
- Core.Drag(Core.mouseCurrent);
- }
-
- if(IsRotated || scaleMode != ScaleModes.Integer)
- {
- ForceUpdateOverlays();
- }
- else
- {
- UpdateMarkersOffset();
- }
- }
- InvalidateVisual(true);
- }
- else
- {
- if(isSelected && !selectionStart.IsEmpty && (Keyboard.Modifiers == ModifierKeys.Shift || Keyboard.Modifiers == ModifierKeys.Alt || DisableAltForSelection))
- {
- System.Windows.Point p = e.GetPosition(this);
- selectionEnd = FromLocalToLatLng((int)p.X, (int)p.Y);
- {
- GMap.NET.PointLatLng p1 = selectionStart;
- GMap.NET.PointLatLng p2 = selectionEnd;
-
- double x1 = Math.Min(p1.Lng, p2.Lng);
- double y1 = Math.Max(p1.Lat, p2.Lat);
- double x2 = Math.Max(p1.Lng, p2.Lng);
- double y2 = Math.Min(p1.Lat, p2.Lat);
-
- SelectedArea = new RectLatLng(y1, x1, x2 - x1, y1 - y2);
- }
- }
-
- if(renderHelperLine)
- {
- InvalidateVisual(true);
- }
- }
-
- base.OnMouseMove(e);
- }
-
- ///
- /// if true, selects area just by holding mouse and moving
- ///
- public bool DisableAltForSelection = false;
-
- protected override void OnStylusDown(StylusDownEventArgs e)
- {
- if(TouchEnabled && CanDragMap && !e.InAir)
- {
- Point p = e.GetPosition(this);
-
- if(MapScaleTransform != null)
- {
- p = MapScaleTransform.Inverse.Transform(p);
- }
-
- p = ApplyRotationInversion(p.X, p.Y);
-
- Core.mouseDown.X = (int)p.X;
- Core.mouseDown.Y = (int)p.Y;
-
- InvalidateVisual();
- }
-
- base.OnStylusDown(e);
- }
-
- protected override void OnStylusUp(StylusEventArgs e)
- {
- if(TouchEnabled)
- {
- if(isSelected)
- {
- isSelected = false;
- }
-
- if(Core.IsDragging)
- {
- if(isDragging)
- {
- onMouseUpTimestamp = e.Timestamp;
- isDragging = false;
- Debug.WriteLine("IsDragging = " + isDragging);
- Cursor = cursorBefore;
- Mouse.Capture(null);
- }
- Core.EndDrag();
-
- if(BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
- {
- if(Core.LastLocationInBounds.HasValue)
- {
- Position = Core.LastLocationInBounds.Value;
- }
- }
- }
- else
- {
- Core.mouseDown = GPoint.Empty;
- InvalidateVisual();
- }
- }
- base.OnStylusUp(e);
- }
-
- protected override void OnStylusMove(StylusEventArgs e)
- {
- if(TouchEnabled)
- {
- // wpf generates to many events if mouse is over some visual
- // and OnMouseUp is fired, wtf, anyway...
- // http://greatmaps.codeplex.com/workitem/16013
- if(e.Timestamp - onMouseUpTimestamp < 55)
- {
- Debug.WriteLine("OnMouseMove skipped: " + (e.Timestamp - onMouseUpTimestamp) + "ms");
- return;
- }
-
- if(!Core.IsDragging && !Core.mouseDown.IsEmpty)
- {
- Point p = e.GetPosition(this);
-
- if(MapScaleTransform != null)
- {
- p = MapScaleTransform.Inverse.Transform(p);
- }
-
- p = ApplyRotationInversion(p.X, p.Y);
-
- // cursor has moved beyond drag tolerance
- if(Math.Abs(p.X - Core.mouseDown.X) * 2 >= SystemParameters.MinimumHorizontalDragDistance || Math.Abs(p.Y - Core.mouseDown.Y) * 2 >= SystemParameters.MinimumVerticalDragDistance)
- {
- Core.BeginDrag(Core.mouseDown);
- }
- }
-
- if(Core.IsDragging)
- {
- if(!isDragging)
- {
- isDragging = true;
- Debug.WriteLine("IsDragging = " + isDragging);
- cursorBefore = Cursor;
- Cursor = Cursors.SizeAll;
- Mouse.Capture(this);
- }
-
- if(BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
- {
- // ...
- }
- else
- {
- Point p = e.GetPosition(this);
-
- if(MapScaleTransform != null)
- {
- p = MapScaleTransform.Inverse.Transform(p);
- }
-
- p = ApplyRotationInversion(p.X, p.Y);
-
- Core.mouseCurrent.X = (int)p.X;
- Core.mouseCurrent.Y = (int)p.Y;
- {
- Core.Drag(Core.mouseCurrent);
- }
-
- if(IsRotated)
- {
- ForceUpdateOverlays();
- }
- else
- {
- UpdateMarkersOffset();
- }
- }
- InvalidateVisual();
- }
- }
-
- base.OnStylusMove(e);
- }
-
- #endregion
-
- #region IGControl Members
-
- ///
- /// Call it to empty tile cache & reload tiles
- ///
- public void ReloadMap()
- {
- Core.ReloadMap();
- }
-
- ///
- /// sets position using geocoder
- ///
- ///
- ///
- public GeoCoderStatusCode SetCurrentPositionByKeywords(string keys)
- {
- GeoCoderStatusCode status = GeoCoderStatusCode.Unknow;
-
- GeocodingProvider gp = MapProvider as GeocodingProvider;
- if(gp == null)
- {
- gp = GMapProviders.OpenStreetMap as GeocodingProvider;
- }
-
- if(gp != null)
- {
- var pt = gp.GetPoint(keys, out status);
- if(status == GeoCoderStatusCode.G_GEO_SUCCESS && pt.HasValue)
- {
- Position = pt.Value;
- }
- }
-
- return status;
- }
-
- public PointLatLng FromLocalToLatLng(int x, int y)
- {
- if(MapScaleTransform != null)
- {
- var tp = MapScaleTransform.Inverse.Transform(new System.Windows.Point(x, y));
- x = (int)tp.X;
- y = (int)tp.Y;
- }
-
- if(IsRotated)
- {
- var f = rotationMatrixInvert.Transform(new System.Windows.Point(x, y));
-
- x = (int)f.X;
- y = (int)f.Y;
- }
-
- return Core.FromLocalToLatLng(x, y);
- }
-
- public GPoint FromLatLngToLocal(PointLatLng point)
- {
- GPoint ret = Core.FromLatLngToLocal(point);
-
- if(MapScaleTransform != null)
- {
- var tp = MapScaleTransform.Transform(new System.Windows.Point(ret.X, ret.Y));
- ret.X = (int)tp.X;
- ret.Y = (int)tp.Y;
- }
-
- if(IsRotated)
- {
- var f = rotationMatrix.Transform(new System.Windows.Point(ret.X, ret.Y));
-
- ret.X = (int)f.X;
- ret.Y = (int)f.Y;
- }
-
- return ret;
- }
-
- public bool ShowExportDialog()
- {
- var dlg = new Microsoft.Win32.SaveFileDialog();
- {
- dlg.CheckPathExists = true;
- dlg.CheckFileExists = false;
- dlg.AddExtension = true;
- dlg.DefaultExt = "gmdb";
- dlg.ValidateNames = true;
- dlg.Title = "GMap.NET: Export map to db, if file exsist only new data will be added";
- dlg.FileName = "DataExp";
- dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- dlg.Filter = "GMap.NET DB files (*.gmdb)|*.gmdb";
- dlg.FilterIndex = 1;
- dlg.RestoreDirectory = true;
-
- if(dlg.ShowDialog() == true)
- {
- bool ok = GMaps.Instance.ExportToGMDB(dlg.FileName);
- if(ok)
- {
- MessageBox.Show("Complete!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- else
- {
- MessageBox.Show(" Failed!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
- return ok;
- }
- }
-
- return false;
- }
-
- public bool ShowImportDialog()
- {
- var dlg = new Microsoft.Win32.OpenFileDialog();
- {
- dlg.CheckPathExists = true;
- dlg.CheckFileExists = false;
- dlg.AddExtension = true;
- dlg.DefaultExt = "gmdb";
- dlg.ValidateNames = true;
- dlg.Title = "GMap.NET: Import to db, only new data will be added";
- dlg.FileName = "DataImport";
- dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- dlg.Filter = "GMap.NET DB files (*.gmdb)|*.gmdb";
- dlg.FilterIndex = 1;
- dlg.RestoreDirectory = true;
-
- if(dlg.ShowDialog() == true)
- {
- Cursor = Cursors.Wait;
-
- bool ok = GMaps.Instance.ImportFromGMDB(dlg.FileName);
- if(ok)
- {
- MessageBox.Show("Complete!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Information);
- ReloadMap();
- }
- else
- {
- MessageBox.Show(" Failed!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
- Cursor = Cursors.Arrow;
-
- return ok;
- }
- }
-
- return false;
- }
-
- ///
- /// current coordinates of the map center
- ///
- [Browsable(false)]
- public PointLatLng Position
- {
- get
- {
- return Core.Position;
- }
- set
- {
- Core.Position = value;
-
- if(Core.IsStarted)
- {
- ForceUpdateOverlays();
- }
- }
- }
-
- [Browsable(false)]
- public GPoint PositionPixel
- {
- get
- {
- return Core.PositionPixel;
- }
- }
-
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- [Browsable(false)]
- public string CacheLocation
- {
- get
- {
- return CacheLocator.Location;
- }
- set
- {
- CacheLocator.Location = value;
- }
- }
-
- bool isDragging = false;
-
- [Browsable(false)]
- public bool IsDragging
- {
- get
- {
- return isDragging;
- }
- }
-
- [Browsable(false)]
- public RectLatLng ViewArea
- {
- get
- {
- return Core.ViewArea;
- }
- }
-
- [Category("GMap.NET")]
- public bool CanDragMap
- {
- get
- {
- return Core.CanDragMap;
- }
- set
- {
- Core.CanDragMap = value;
- }
- }
-
- public GMap.NET.RenderMode RenderMode
- {
- get
- {
- return GMap.NET.RenderMode.WPF;
- }
- }
-
- #endregion
-
- #region IGControl event Members
-
- public event PositionChanged OnPositionChanged
- {
- add
- {
- Core.OnCurrentPositionChanged += value;
- }
- remove
- {
- Core.OnCurrentPositionChanged -= value;
- }
- }
-
- public event TileLoadComplete OnTileLoadComplete
- {
- add
- {
- Core.OnTileLoadComplete += value;
- }
- remove
- {
- Core.OnTileLoadComplete -= value;
- }
- }
-
- public event TileLoadStart OnTileLoadStart
- {
- add
- {
- Core.OnTileLoadStart += value;
- }
- remove
- {
- Core.OnTileLoadStart -= value;
- }
- }
-
- public event MapDrag OnMapDrag
- {
- add
- {
- Core.OnMapDrag += value;
- }
- remove
- {
- Core.OnMapDrag -= value;
- }
- }
-
- public event MapZoomChanged OnMapZoomChanged
- {
- add
- {
- Core.OnMapZoomChanged += value;
- }
- remove
- {
- Core.OnMapZoomChanged -= value;
- }
- }
-
- ///
- /// occures on map type changed
- ///
- public event MapTypeChanged OnMapTypeChanged
- {
- add
- {
- Core.OnMapTypeChanged += value;
- }
- remove
- {
- Core.OnMapTypeChanged -= value;
- }
- }
-
- ///
- /// occurs on empty tile displayed
- ///
- public event EmptyTileError OnEmptyTileError
- {
- add
- {
- Core.OnEmptyTileError += value;
- }
- remove
- {
- Core.OnEmptyTileError -= value;
- }
- }
- #endregion
-
- #region IDisposable Members
-
- public virtual void Dispose()
- {
- if(Core.IsStarted)
- {
- Core.OnMapZoomChanged -= new MapZoomChanged(ForceUpdateOverlays);
- Loaded -= new RoutedEventHandler(GMapControl_Loaded);
- Dispatcher.ShutdownStarted -= new EventHandler(Dispatcher_ShutdownStarted);
- SizeChanged -= new SizeChangedEventHandler(GMapControl_SizeChanged);
- if(loadedApp != null)
- {
- loadedApp.SessionEnding -= new SessionEndingCancelEventHandler(Current_SessionEnding);
- }
- Core.OnMapClose();
- }
- }
-
- #endregion
- }
-
- public enum HelperLineOptions
- {
- DontShow = 0,
- ShowAlways = 1,
- ShowOnModifierKey = 2
- }
-
- public enum ScaleModes
- {
- ///
- /// no scaling
- ///
- Integer,
-
- ///
- /// scales to fractional level using a stretched tiles, CURRENT VERSION DOESN'T HANDLE OBJECT POSITIONS CORRECLTY,
- /// http://greatmaps.codeplex.com/workitem/16046
- ///
- ScaleUp,
-
- ///
- /// scales to fractional level using a narrowed tiles, CURRENT VERSION DOESN'T HANDLE OBJECT POSITIONS CORRECLTY,
- /// http://greatmaps.codeplex.com/workitem/16046
- ///
- ScaleDown,
-
- ///
- /// scales to fractional level using a combination both stretched and narrowed tiles, CURRENT VERSION DOESN'T HANDLE OBJECT POSITIONS CORRECLTY,
- /// http://greatmaps.codeplex.com/workitem/16046
- ///
- Dynamic
- }
-
- public delegate void SelectionChange(RectLatLng Selection, bool ZoomToFit);
-}
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapMarker.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapMarker.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapMarker.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Windows;
- using System.Windows.Controls;
- using GMap.NET;
- using System.Windows.Media;
- using System.Diagnostics;
- using System.Windows.Shapes;
- using System;
-
- //public interface IGMapMarker : INotifyPropertyChanged
- //{
- // UIElement Shape
- // {
- // get;
- // set;
- // }
-
- // int LocalPositionX
- // {
- // get;
- // set;
- // }
-
- // int LocalPositionY
- // {
- // get;
- // set;
- // }
-
- // PointLatLng Position
- // {
- // get;
- // set;
- // }
-
- // System.Windows.Point Offset
- // {
- // get;
- // set;
- // }
-
- // int ZIndex
- // {
- // get;
- // set;
- // }
-
- // List Route
- // {
- // get;
- // }
- // List Polygon
- // {
- // get;
- // }
- //}
-
- ///
- /// GMap.NET marker
- ///
- public class GMapMarker : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string name)
- {
- if(PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(name));
- }
- }
-
- protected void OnPropertyChanged(PropertyChangedEventArgs name)
- {
- if(PropertyChanged != null)
- {
- PropertyChanged(this, name);
- }
- }
-
- UIElement shape;
- static readonly PropertyChangedEventArgs Shape_PropertyChangedEventArgs = new PropertyChangedEventArgs("Shape");
-
- ///
- /// marker visual
- ///
- public UIElement Shape
- {
- get
- {
- return shape;
- }
- set
- {
- if(shape != value)
- {
- shape = value;
- OnPropertyChanged(Shape_PropertyChangedEventArgs);
-
- UpdateLocalPosition();
- }
- }
- }
-
- private PointLatLng position;
-
- ///
- /// coordinate of marker
- ///
- public PointLatLng Position
- {
- get
- {
- return position;
- }
- set
- {
- if(position != value)
- {
- position = value;
- UpdateLocalPosition();
- }
- }
- }
-
- GMapControl map;
-
- ///
- /// the map of this marker
- ///
- public GMapControl Map
- {
- get
- {
- if(Shape != null && map == null)
- {
- DependencyObject visual = Shape;
- while(visual != null && !(visual is GMapControl))
- {
- visual = VisualTreeHelper.GetParent(visual);
- }
-
- map = visual as GMapControl;
- }
-
- return map;
- }
- }
-
- ///
- /// custom object
- ///
- public object Tag;
-
- System.Windows.Point offset;
- ///
- /// offset of marker
- ///
- public System.Windows.Point Offset
- {
- get
- {
- return offset;
- }
- set
- {
- if(offset != value)
- {
- offset = value;
- UpdateLocalPosition();
- }
- }
- }
-
- int localPositionX;
- static readonly PropertyChangedEventArgs LocalPositionX_PropertyChangedEventArgs = new PropertyChangedEventArgs("LocalPositionX");
-
- ///
- /// local X position of marker
- ///
- public int LocalPositionX
- {
- get
- {
- return localPositionX;
- }
- internal set
- {
- if(localPositionX != value)
- {
- localPositionX = value;
- OnPropertyChanged(LocalPositionX_PropertyChangedEventArgs);
- }
- }
- }
-
- int localPositionY;
- static readonly PropertyChangedEventArgs LocalPositionY_PropertyChangedEventArgs = new PropertyChangedEventArgs("LocalPositionY");
-
- ///
- /// local Y position of marker
- ///
- public int LocalPositionY
- {
- get
- {
- return localPositionY;
- }
- internal set
- {
- if(localPositionY != value)
- {
- localPositionY = value;
- OnPropertyChanged(LocalPositionY_PropertyChangedEventArgs);
- }
- }
- }
-
- int zIndex;
- static readonly PropertyChangedEventArgs ZIndex_PropertyChangedEventArgs = new PropertyChangedEventArgs("ZIndex");
-
- ///
- /// the index of Z, render order
- ///
- public int ZIndex
- {
- get
- {
- return zIndex;
- }
- set
- {
- if(zIndex != value)
- {
- zIndex = value;
- OnPropertyChanged(ZIndex_PropertyChangedEventArgs);
- }
- }
- }
-
- ///
- /// if marker is a route that is a path of it's coordinates
- ///
- public readonly List Route = new List();
-
- ///
- /// if marker is a polygon that is a path of it's coordinates
- ///
- public readonly List Polygon = new List();
-
- public GMapMarker(PointLatLng pos)
- {
- Position = pos;
- }
-
- ///
- /// calls Dispose on shape if it implements IDisposable, sets shape to null and clears route
- ///
- public void Clear()
- {
- var s = (Shape as IDisposable);
- if(s != null)
- {
- s.Dispose();
- s = null;
- }
- Shape = null;
-
- Route.Clear();
- Polygon.Clear();
- }
-
- ///
- /// updates marker position, internal access usualy
- ///
- internal void UpdateLocalPosition()
- {
- if(Map != null)
- {
- GPoint p = Map.FromLatLngToLocal(Position);
- p.Offset(-(long)Map.MapTranslateTransform.X, -(long)Map.MapTranslateTransform.Y);
-
- LocalPositionX = (int)(p.X + (long)(Offset.X));
- LocalPositionY = (int)(p.Y + (long)(Offset.Y));
- }
- }
-
- ///
- /// forces to update local marker position
- /// dot not call it if you don't really need to ;}
- ///
- ///
- internal void ForceUpdateLocalPosition(GMapControl m)
- {
- if(m != null)
- {
- map = m;
- }
- UpdateLocalPosition();
- }
-
- ///
- /// regenerates shape of route
- ///
- public virtual void RegenerateRouteShape(GMapControl map)
- {
- this.map = map;
-
- if(map != null)
- {
- if(Route.Count > 1)
- {
- var localPath = new List();
- var offset = Map.FromLatLngToLocal(Route[0]);
- foreach(var i in Route)
- {
- var p = Map.FromLatLngToLocal(new PointLatLng(i.Lat, i.Lng));
- localPath.Add(new System.Windows.Point(p.X - offset.X, p.Y - offset.Y));
- }
-
- var shape = map.CreateRoutePath(localPath);
-
- if(this.Shape != null && this.Shape is Path)
- {
- (this.Shape as Path).Data = shape.Data;
- }
- else
- {
- this.Shape = shape;
- }
- }
- else
- {
- this.Shape = null;
- }
- }
- }
-
- ///
- /// regenerates shape of polygon
- ///
- public virtual void RegeneratePolygonShape(GMapControl map)
- {
- this.map = map;
-
- if(map != null)
- {
- if(Polygon.Count > 1)
- {
- var localPath = new List();
- var offset = Map.FromLatLngToLocal(Polygon[0]);
- foreach(var i in Polygon)
- {
- var p = Map.FromLatLngToLocal(new PointLatLng(i.Lat, i.Lng));
- localPath.Add(new System.Windows.Point(p.X - offset.X, p.Y - offset.Y));
- }
-
- var shape = map.CreatePolygonPath(localPath);
-
- if(this.Shape != null && this.Shape is Path)
- {
- (this.Shape as Path).Data = shape.Data;
- }
- else
- {
- this.Shape = shape;
- }
- }
- else
- {
- this.Shape = null;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/PerfTimer.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/PerfTimer.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/PerfTimer.cs
+++ /dev/null
@@ -1,189 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System;
- using System.Runtime.InteropServices;
-
- ///
- /// This class implements a high precision timer using the Win32 QueryPerformanceCounter API.
- /// Typical usage:
- ///
- /// PerfTimer t = new PerfTimer();
- /// t.Start();
- /// ...
- /// t.Stop();
- /// long ms = t.GetDuration();
- ///
- /// You can also use it to add up a bunch of times in a loop and report average, mininum
- /// and maximum times.
- ///
- public class PerfTimer
- {
- long _start;
- long _end;
- long _freq;
- long _min;
- long _max;
- long _count;
- long _sum;
-
- ///
- ///
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806")]
- public PerfTimer()
- {
- _start = _end = 0;
- QueryPerformanceFrequency(ref _freq);
- _min = _max = _count = _sum = 0;
- }
-
- ///
- /// Set current time as the start time.
- ///
- public void Start()
- {
- _start = GetCurrentTime();
- _end = _start;
- }
-
- ///
- /// Set the current time as the end time.
- ///
- public void Stop()
- {
- _end = GetCurrentTime();
- }
-
- ///
- /// Get the time in milliseconds between Start() and Stop().
- ///
- /// Milliseconds
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024")]
- public long GetDuration()
- { // in milliseconds.
- return GetMilliseconds(GetDurationInTicks());
- }
-
- ///
- /// Convert the given argument from "ticks" to milliseconds.
- ///
- /// Number of ticks returned from GetTicks()
- /// Milliseconds
- public long GetMilliseconds(long ticks)
- {
- return (ticks * (long) 1000) / _freq;
- }
-
- ///
- /// Get the time between Start() and Stop() in the highest fidelity possible
- /// as defined by Windows QueryPerformanceFrequency. Usually this is nanoseconds.
- ///
- /// High fidelity tick count
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024")]
- public long GetDurationInTicks()
- { // in nanoseconds.
- return (_end - _start);
- }
-
- ///
- /// Get current time in ighest fidelity possible as defined by Windows QueryPerformanceCounter.
- /// Usually this is nanoseconds.
- ///
- /// High fidelity tick count
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024")]
- public static long GetCurrentTime()
- { // in nanoseconds.
- long i = 0;
- QueryPerformanceCounter(ref i);
- return i;
- }
-
- // These methods allow you to count up multiple iterations and
- // then get the median, average and percent variation.
-
- ///
- /// Add the given time to a running total so we can compute minimum, maximum and average.
- ///
- /// The time to record
- public void Count(long time)
- {
- if(_min == 0)
- _min = time;
- if(time < _min)
- _min = time;
- if(time > _max)
- _max = time;
- _sum += time;
- _count++;
- }
-
- ///
- /// Return the minimum time recorded by the Count() method since the last Clear
- ///
- /// The minimum value
- public long Minimum()
- {
- return _min;
- }
-
- ///
- /// Return the maximum time recorded by the Count() method since the last Clear
- ///
- /// The maximum value
- public long Max()
- {
- return _max;
- }
-
- ///
- /// Return the median of the values recorded by the Count() method since the last Clear
- ///
- /// The median value
- public double Median()
- {
- return (_min + ((_max - _min) / 2.0));
- }
-
- ///
- /// Return the variance in the numbers recorded by the Count() method since the last Clear
- ///
- /// Percentage between 0 and 100
- public double PercentError()
- {
- double spread = (_max - _min) / 2.0;
- double percent = ((double) (spread * 100.0) / (double) (_min));
- return percent;
- }
-
- ///
- /// Return the avergae of the values recorded by the Count() method since the last Clear
- ///
- /// The average value
- public long Average()
- {
- if(_count == 0)
- return 0;
- return _sum / _count;
- }
-
- ///
- /// Reset the timer to its initial state.
- ///
- public void Clear()
- {
- _start = _end = _min = _max = _sum = _count = 0;
- }
-
- [DllImport("KERNEL32.DLL", EntryPoint = "QueryPerformanceCounter", SetLastError = true,
- CharSet = CharSet.Unicode, ExactSpelling = true,
- CallingConvention = CallingConvention.StdCall)]
- static extern int QueryPerformanceCounter(ref long time);
-
- [DllImport("KERNEL32.DLL", EntryPoint = "QueryPerformanceFrequency", SetLastError = true,
- CharSet = CharSet.Unicode, ExactSpelling = true,
- CallingConvention = CallingConvention.StdCall)]
- static extern int QueryPerformanceFrequency(ref long freq);
- }
-}
\ No newline at end of file
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/QuadTree.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/QuadTree.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/QuadTree.cs
+++ /dev/null
@@ -1,677 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Windows;
-#if DEBUG_DUMP
- using System.Windows.Controls;
- using System.Windows.Shapes;
- using System.Windows.Media;
- using System.Xml;
-#endif
-
- ///
- /// This class efficiently stores and retrieves arbitrarily sized and positioned
- /// objects in a quad-tree data structure. This can be used to do efficient hit
- /// detection or visiblility checks on objects in a virtualized canvas.
- /// The object does not need to implement any special interface because the Rect Bounds
- /// of those objects is handled as a separate argument to Insert.
- ///
- public class QuadTree where T : class
- {
- Rect _bounds; // overall bounds we are indexing.
- Quadrant _root;
- IDictionary _table;
-
- ///
- /// Each node stored in the tree has a position, width & height.
- ///
- internal class QuadNode
- {
- Rect _bounds;
- QuadNode _next; // linked in a circular list.
- T _node; // the actual visual object being stored here.
-
- ///
- /// Construct new QuadNode to wrap the given node with given bounds
- ///
- /// The node
- /// The bounds of that node
- public QuadNode(T node, Rect bounds)
- {
- _node = node;
- _bounds = bounds;
- }
-
- ///
- /// The node
- ///
- public T Node
- {
- get
- {
- return _node;
- }
- set
- {
- _node = value;
- }
- }
-
- ///
- /// The Rect bounds of the node
- ///
- public Rect Bounds
- {
- get
- {
- return _bounds;
- }
- }
-
- ///
- /// QuadNodes form a linked list in the Quadrant.
- ///
- public QuadNode Next
- {
- get
- {
- return _next;
- }
- set
- {
- _next = value;
- }
- }
- }
-
-
- ///
- /// The canvas is split up into four Quadrants and objects are stored in the quadrant that contains them
- /// and each quadrant is split up into four child Quadrants recurrsively. Objects that overlap more than
- /// one quadrant are stored in the _nodes list for this Quadrant.
- ///
- internal class Quadrant
- {
- Quadrant _parent;
- Rect _bounds; // quadrant bounds.
-
- QuadNode _nodes; // nodes that overlap the sub quadrant boundaries.
-
- // The quadrant is subdivided when nodes are inserted that are
- // completely contained within those subdivisions.
- Quadrant _topLeft;
- Quadrant _topRight;
- Quadrant _bottomLeft;
- Quadrant _bottomRight;
-
-#if DEBUG_DUMP
- public void ShowQuadTree(Canvas c)
- {
- Rectangle r = new Rectangle();
- r.Width = _bounds.Width;
- r.Height = _bounds.Height;
- Canvas.SetLeft(r, _bounds.Left);
- Canvas.SetTop(r, _bounds.Top);
- r.Stroke = Brushes.DarkRed;
- r.StrokeThickness = 1;
- r.StrokeDashArray = new DoubleCollection(new double[] { 2.0, 3.0 });
- c.Children.Add(r);
-
- if (_topLeft != null) _topLeft.ShowQuadTree(c);
- if (_topRight != null) _topRight.ShowQuadTree(c);
- if (_bottomLeft != null) _bottomLeft.ShowQuadTree(c);
- if (_bottomRight != null) _bottomRight.ShowQuadTree(c);
- }
-
- public void Dump(LogWriter w)
- {
- w.WriteAttribute("Bounds", _bounds.ToString());
- if (_nodes != null)
- {
- QuadNode n = _nodes;
- do
- {
- n = n.Next; // first node.
- w.Open("node");
- w.WriteAttribute("Bounds", n.Bounds.ToString());
- w.Close();
- } while (n != _nodes);
- }
- DumpQuadrant("TopLeft", _topLeft, w);
- DumpQuadrant("TopRight", _topRight, w);
- DumpQuadrant("BottomLeft", _bottomLeft, w);
- DumpQuadrant("BottomRight", _bottomRight, w);
- }
-
- public void DumpQuadrant(string label, Quadrant q, LogWriter w)
- {
- if (q != null)
- {
- w.Open("Quadrant");
- w.WriteAttribute("Name", label);
- q.Dump(w);
- w.Close();
- }
- }
-#endif
-
- ///
- /// Construct new Quadrant with a given bounds all nodes stored inside this quadrant
- /// will fit inside this bounds.
- ///
- /// The parent quadrant (if any)
- /// The bounds of this quadrant
- public Quadrant(Quadrant parent, Rect bounds)
- {
- _parent = parent;
- Debug.Assert(bounds.Width != 0 && bounds.Height != 0);
- if(bounds.Width == 0 || bounds.Height == 0)
- {
- // todo: localize
- throw new ArgumentException("Bounds of quadrant cannot be zero width or height");
- }
- _bounds = bounds;
- }
-
- ///
- /// The parent Quadrant or null if this is the root
- ///
- internal Quadrant Parent
- {
- get
- {
- return _parent;
- }
- }
-
- ///
- /// The bounds of this quadrant
- ///
- internal Rect Bounds
- {
- get
- {
- return _bounds;
- }
- }
-
- ///
- /// Insert the given node
- ///
- /// The node
- /// The bounds of that node
- ///
- internal Quadrant Insert(T node, Rect bounds)
- {
- Debug.Assert(bounds.Width != 0 && bounds.Height != 0);
- if(bounds.Width == 0 || bounds.Height == 0)
- {
- // todo: localize
- throw new ArgumentException("Bounds of quadrant cannot be zero width or height");
- }
-
- double w = _bounds.Width / 2;
- if(w == 0)
- {
- w = 1;
- }
- double h = _bounds.Height / 2;
- if(h == 0)
- {
- h = 1;
- }
-
- // assumption that the Rect struct is almost as fast as doing the operations
- // manually since Rect is a value type.
-
- Rect topLeft = new Rect(_bounds.Left, _bounds.Top, w, h);
- Rect topRight = new Rect(_bounds.Left + w, _bounds.Top, w, h);
- Rect bottomLeft = new Rect(_bounds.Left, _bounds.Top + h, w, h);
- Rect bottomRight = new Rect(_bounds.Left + w, _bounds.Top + h, w, h);
-
- Quadrant child = null;
-
- // See if any child quadrants completely contain this node.
- if(topLeft.Contains(bounds))
- {
- if(_topLeft == null)
- {
- _topLeft = new Quadrant(this, topLeft);
- }
- child = _topLeft;
- }
- else if(topRight.Contains(bounds))
- {
- if(_topRight == null)
- {
- _topRight = new Quadrant(this, topRight);
- }
- child = _topRight;
- }
- else if(bottomLeft.Contains(bounds))
- {
- if(_bottomLeft == null)
- {
- _bottomLeft = new Quadrant(this, bottomLeft);
- }
- child = _bottomLeft;
- }
- else if(bottomRight.Contains(bounds))
- {
- if(_bottomRight == null)
- {
- _bottomRight = new Quadrant(this, bottomRight);
- }
- child = _bottomRight;
- }
-
- if(child != null)
- {
- return child.Insert(node, bounds);
- }
- else
- {
- QuadNode n = new QuadNode(node, bounds);
- if(_nodes == null)
- {
- n.Next = n;
- }
- else
- {
- // link up in circular link list.
- QuadNode x = _nodes;
- n.Next = x.Next;
- x.Next = n;
- }
- _nodes = n;
- return this;
- }
- }
-
- ///
- /// Returns all nodes in this quadrant that intersect the given bounds.
- /// The nodes are returned in pretty much random order as far as the caller is concerned.
- ///
- /// List of nodes found in the given bounds
- /// The bounds that contains the nodes you want returned
- internal void GetIntersectingNodes(List nodes, Rect bounds)
- {
- if(bounds.IsEmpty)
- return;
- double w = _bounds.Width / 2;
- double h = _bounds.Height / 2;
-
- // assumption that the Rect struct is almost as fast as doing the operations
- // manually since Rect is a value type.
-
- Rect topLeft = new Rect(_bounds.Left, _bounds.Top, w, h);
- Rect topRight = new Rect(_bounds.Left + w, _bounds.Top, w, h);
- Rect bottomLeft = new Rect(_bounds.Left, _bounds.Top + h, w, h);
- Rect bottomRight = new Rect(_bounds.Left + w, _bounds.Top + h, w, h);
-
- // See if any child quadrants completely contain this node.
- if(topLeft.IntersectsWith(bounds) && _topLeft != null)
- {
- _topLeft.GetIntersectingNodes(nodes, bounds);
- }
-
- if(topRight.IntersectsWith(bounds) && _topRight != null)
- {
- _topRight.GetIntersectingNodes(nodes, bounds);
- }
-
- if(bottomLeft.IntersectsWith(bounds) && _bottomLeft != null)
- {
- _bottomLeft.GetIntersectingNodes(nodes, bounds);
- }
-
- if(bottomRight.IntersectsWith(bounds) && _bottomRight != null)
- {
- _bottomRight.GetIntersectingNodes(nodes, bounds);
- }
-
- GetIntersectingNodes(_nodes, nodes, bounds);
- }
-
- ///
- /// Walk the given linked list of QuadNodes and check them against the given bounds.
- /// Add all nodes that intersect the bounds in to the list.
- ///
- /// The last QuadNode in a circularly linked list
- /// The resulting nodes are added to this list
- /// The bounds to test against each node
- static void GetIntersectingNodes(QuadNode last, List nodes, Rect bounds)
- {
- if(last != null)
- {
- QuadNode n = last;
- do
- {
- n = n.Next; // first node.
- if(n.Bounds.IntersectsWith(bounds))
- {
- nodes.Add(n);
- }
- } while(n != last);
- }
- }
-
- ///
- /// Return true if there are any nodes in this Quadrant that intersect the given bounds.
- ///
- /// The bounds to test
- /// boolean
- internal bool HasIntersectingNodes(Rect bounds)
- {
- if(bounds.IsEmpty)
- return false;
- double w = _bounds.Width / 2;
- double h = _bounds.Height / 2;
-
- // assumption that the Rect struct is almost as fast as doing the operations
- // manually since Rect is a value type.
-
- Rect topLeft = new Rect(_bounds.Left, _bounds.Top, w, h);
- Rect topRight = new Rect(_bounds.Left + w, _bounds.Top, w, h);
- Rect bottomLeft = new Rect(_bounds.Left, _bounds.Top + h, w, h);
- Rect bottomRight = new Rect(_bounds.Left + w, _bounds.Top + h, w, h);
-
- bool found = false;
-
- // See if any child quadrants completely contain this node.
- if(topLeft.IntersectsWith(bounds) && _topLeft != null)
- {
- found = _topLeft.HasIntersectingNodes(bounds);
- }
-
- if(!found && topRight.IntersectsWith(bounds) && _topRight != null)
- {
- found = _topRight.HasIntersectingNodes(bounds);
- }
-
- if(!found && bottomLeft.IntersectsWith(bounds) && _bottomLeft != null)
- {
- found = _bottomLeft.HasIntersectingNodes(bounds);
- }
-
- if(!found && bottomRight.IntersectsWith(bounds) && _bottomRight != null)
- {
- found = _bottomRight.HasIntersectingNodes(bounds);
- }
- if(!found)
- {
- found = HasIntersectingNodes(_nodes, bounds);
- }
- return found;
- }
-
- ///
- /// Walk the given linked list and test each node against the given bounds/
- ///
- /// The last node in the circularly linked list.
- /// Bounds to test
- /// Return true if a node in the list intersects the bounds
- static bool HasIntersectingNodes(QuadNode last, Rect bounds)
- {
- if(last != null)
- {
- QuadNode n = last;
- do
- {
- n = n.Next; // first node.
- if(n.Bounds.IntersectsWith(bounds))
- {
- return true;
- }
- } while(n != last);
- }
- return false;
- }
-
- ///
- /// Remove the given node from this Quadrant.
- ///
- /// The node to remove
- /// Returns true if the node was found and removed.
- internal bool RemoveNode(T node)
- {
- bool rc = false;
- if(_nodes != null)
- {
- QuadNode p = _nodes;
- while(p.Next.Node != node && p.Next != _nodes)
- {
- p = p.Next;
- }
- if(p.Next.Node == node)
- {
- rc = true;
- QuadNode n = p.Next;
- if(p == n)
- {
- // list goes to empty
- _nodes = null;
- }
- else
- {
- if(_nodes == n)
- _nodes = p;
- p.Next = n.Next;
- }
- }
- }
- return rc;
- }
-
- }
-
- ///
- /// This determines the overall quad-tree indexing strategy, changing this bounds
- /// is expensive since it has to re-divide the entire thing - like a re-hash operation.
- ///
- public Rect Bounds
- {
- get
- {
- return _bounds;
- }
- set
- {
- _bounds = value;
- ReIndex();
- }
- }
-
- ///
- /// Insert a node with given bounds into this QuadTree.
- ///
- /// The node to insert
- /// The bounds of this node
- public void Insert(T node, Rect bounds)
- {
- if(_bounds.Width == 0 || _bounds.Height == 0)
- {
- // todo: localize.
- throw new InvalidOperationException("You must set a non-zero bounds on the QuadTree first");
- }
- if(bounds.Width == 0 || bounds.Height == 0)
- {
- // todo: localize.
- throw new InvalidOperationException("Inserted node must have a non-zero width and height");
- }
- if(_root == null)
- {
- _root = new Quadrant(null, _bounds);
- }
-
- Quadrant parent = _root.Insert(node, bounds);
-
- if(_table == null)
- {
- _table = new Dictionary();
- }
- _table[node] = parent;
- }
-
- ///
- /// Get a list of the nodes that intersect the given bounds.
- ///
- /// The bounds to test
- /// List of zero or mode nodes found inside the given bounds
- public IEnumerable GetNodesInside(Rect bounds)
- {
- foreach(QuadNode n in GetNodes(bounds))
- {
- yield return n.Node;
- }
- }
-
- ///
- /// Get a list of the nodes that intersect the given bounds.
- ///
- /// The bounds to test
- /// List of zero or mode nodes found inside the given bounds
- public bool HasNodesInside(Rect bounds)
- {
- if(_root != null)
- {
- _root.HasIntersectingNodes(bounds);
- }
- return false;
- }
-
- ///
- /// Get list of nodes that intersect the given bounds.
- ///
- /// The bounds to test
- /// The list of nodes intersecting the given bounds
- IEnumerable GetNodes(Rect bounds)
- {
- List result = new List();
- if(_root != null)
- {
- _root.GetIntersectingNodes(result, bounds);
- }
- return result;
- }
-
- ///
- /// Remove the given node from this QuadTree.
- ///
- /// The node to remove
- /// True if the node was found and removed.
- public bool Remove(T node)
- {
- if(_table != null)
- {
- Quadrant parent = null;
- if(_table.TryGetValue(node, out parent))
- {
- parent.RemoveNode(node);
- _table.Remove(node);
- return true;
- }
- }
- return false;
- }
-
- ///
- /// Rebuild all the Quadrants according to the current QuadTree Bounds.
- ///
- void ReIndex()
- {
- _root = null;
- foreach(QuadNode n in GetNodes(_bounds))
- {
- // todo: it would be more efficient if we added a code path that allowed
- // reuse of the QuadNode wrappers.
- Insert(n.Node, n.Bounds);
- }
- }
-#if DEBUG_DUMP
- public void ShowQuadTree(Canvas container)
- {
- if (_root != null)
- {
- _root.ShowQuadTree(container);
- }
- }
-
- public void Dump(LogWriter w)
- {
- if (_root != null)
- {
- _root.Dump(w);
- }
- }
-#endif
- }
-
-#if DEBUG_DUMP
- public class LogWriter : IDisposable
- {
- XmlWriter _xw;
- int _indent;
- int _maxdepth;
-
- public LogWriter(TextWriter w)
- {
- XmlWriterSettings s = new XmlWriterSettings();
- s.Indent = true;
- _xw = XmlWriter.Create(w, s);
- }
-
- public int MaxDepth
- {
- get
- {
- return _maxdepth;
- }
- }
-
- public void Open(string label)
- {
- _xw.WriteStartElement(label);
- _indent++;
- if (_indent > _maxdepth) _maxdepth = _indent;
-
- }
- public void Close()
- {
- _indent--;
- _xw.WriteEndElement();
- }
- public void WriteAttribute(string name, string value)
- {
- _xw.WriteAttributeString(name, value);
- }
-
- #region IDisposable Members
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing && _xw != null)
- {
- using (_xw)
- {
- _xw.Flush();
- }
- _xw = null;
- }
- }
-
- #endregion
- }
-#endif
-
-}
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/TilePrefetcher.xaml b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/TilePrefetcher.xaml
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/TilePrefetcher.xaml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/TilePrefetcher.xaml.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/TilePrefetcher.xaml.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/TilePrefetcher.xaml.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Windows;
- using System.Windows.Input;
- using GMap.NET.Internals;
- using GMap.NET;
- using GMap.NET.MapProviders;
- using System.Threading;
- using System.Windows.Threading;
-
- ///
- /// form helping to prefetch tiles on local db
- ///
- public partial class TilePrefetcher : Window
- {
- BackgroundWorker worker = new BackgroundWorker();
- List list = new List();
- int zoom;
- GMapProvider provider;
- int sleep;
- int all;
- public bool ShowCompleteMessage = false;
- RectLatLng area;
- GMap.NET.GSize maxOfTiles;
-
- public TilePrefetcher()
- {
- InitializeComponent();
-
- GMaps.Instance.OnTileCacheComplete += new TileCacheComplete(OnTileCacheComplete);
- GMaps.Instance.OnTileCacheStart += new TileCacheStart(OnTileCacheStart);
- GMaps.Instance.OnTileCacheProgress += new TileCacheProgress(OnTileCacheProgress);
-
- worker.WorkerReportsProgress = true;
- worker.WorkerSupportsCancellation = true;
- worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
- worker.DoWork += new DoWorkEventHandler(worker_DoWork);
- worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
- }
-
- readonly AutoResetEvent done = new AutoResetEvent(true);
-
- void OnTileCacheComplete()
- {
- if(IsVisible)
- {
- done.Set();
-
- Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
- {
- label2.Text = "all tiles saved";
- }));
- }
- }
-
- void OnTileCacheStart()
- {
- if(IsVisible)
- {
- done.Reset();
-
- Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
- {
- label2.Text = "saving tiles...";
- }));
- }
- }
-
- void OnTileCacheProgress(int left)
- {
- if(IsVisible)
- {
- Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
- {
- label2.Text = left + " tile to save...";
- }));
- }
- }
-
- public void Start(RectLatLng area, int zoom, GMapProvider provider, int sleep)
- {
- if(!worker.IsBusy)
- {
- this.label1.Text = "...";
- this.progressBar1.Value = 0;
-
- this.area = area;
- this.zoom = zoom;
- this.provider = provider;
- this.sleep = sleep;
-
- GMaps.Instance.UseMemoryCache = false;
- GMaps.Instance.CacheOnIdleRead = false;
- GMaps.Instance.BoostCacheEngine = true;
-
- worker.RunWorkerAsync();
-
- this.ShowDialog();
- }
- }
-
- volatile bool stopped = false;
-
- public void Stop()
- {
- GMaps.Instance.OnTileCacheComplete -= new TileCacheComplete(OnTileCacheComplete);
- GMaps.Instance.OnTileCacheStart -= new TileCacheStart(OnTileCacheStart);
- GMaps.Instance.OnTileCacheProgress -= new TileCacheProgress(OnTileCacheProgress);
-
- done.Set();
-
- if(worker.IsBusy)
- {
- worker.CancelAsync();
- }
-
- GMaps.Instance.CancelTileCaching();
-
- stopped = true;
-
- done.Close();
- }
-
- void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- if(ShowCompleteMessage)
- {
- if(!e.Cancelled)
- {
- MessageBox.Show("Prefetch Complete! => " + ((int)e.Result).ToString() + " of " + all);
- }
- else
- {
- MessageBox.Show("Prefetch Canceled! => " + ((int)e.Result).ToString() + " of " + all);
- }
- }
-
- list.Clear();
-
- GMaps.Instance.UseMemoryCache = true;
- GMaps.Instance.CacheOnIdleRead = true;
- GMaps.Instance.BoostCacheEngine = false;
-
- this.Close();
- }
-
- bool CacheTiles(int zoom, GPoint p)
- {
- foreach(var type in provider.Overlays)
- {
- Exception ex;
- PureImage img;
-
- // tile number inversion(BottomLeft -> TopLeft) for pergo maps
- if(type is TurkeyMapProvider)
- {
- img = GMaps.Instance.GetImageFrom(type, new GPoint(p.X, maxOfTiles.Height - p.Y), zoom, out ex);
- }
- else // ok
- {
- img = GMaps.Instance.GetImageFrom(type, p, zoom, out ex);
- }
-
- if(img != null)
- {
- img.Dispose();
- img = null;
- }
- else
- {
- return false;
- }
- }
- return true;
- }
-
- void worker_DoWork(object sender, DoWorkEventArgs e)
- {
- if(list != null)
- {
- list.Clear();
- list = null;
- }
- list = provider.Projection.GetAreaTileList(area, zoom, 0);
- maxOfTiles = provider.Projection.GetTileMatrixMaxXY(zoom);
- all = list.Count;
-
- int countOk = 0;
- int retry = 0;
-
- Stuff.Shuffle(list);
-
- for(int i = 0; i < all; i++)
- {
- if(worker.CancellationPending)
- break;
-
- GPoint p = list[i];
- {
- if(CacheTiles(zoom, p))
- {
- countOk++;
- retry = 0;
- }
- else
- {
- if(++retry <= 1) // retry only one
- {
- i--;
- System.Threading.Thread.Sleep(1111);
- continue;
- }
- else
- {
- retry = 0;
- }
- }
- }
-
- worker.ReportProgress((int)((i + 1) * 100 / all), i + 1);
-
- System.Threading.Thread.Sleep(sleep);
- }
-
- e.Result = countOk;
-
- if(!stopped)
- {
- done.WaitOne();
- }
- }
-
- void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
- {
- this.label1.Text = "Fetching tile at zoom (" + zoom + "): " + ((int)e.UserState).ToString() + " of " + all + ", complete: " + e.ProgressPercentage.ToString() + "%";
- this.progressBar1.Value = e.ProgressPercentage;
- }
-
- protected override void OnPreviewKeyDown(KeyEventArgs e)
- {
- if(e.Key == Key.Escape)
- {
- this.Close();
- }
-
- base.OnPreviewKeyDown(e);
- }
-
- protected override void OnClosed(EventArgs e)
- {
- this.Stop();
-
- base.OnClosed(e);
- }
- }
-}
diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/WindowsPresentationImage.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/WindowsPresentationImage.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/WindowsPresentationImage.cs
+++ /dev/null
@@ -1,278 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using GMap.NET.Internals;
-
- internal class TileVisual : FrameworkElement
- {
- public readonly ObservableCollection Source;
- public readonly RawTile Tile;
-
- public TileVisual(IEnumerable src, RawTile tile)
- {
- Opacity = 0;
- Tile = tile;
-
- Source = new ObservableCollection(src);
- Source.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Source_CollectionChanged);
-
- this.Loaded += new RoutedEventHandler(ImageVisual_Loaded);
- this.Unloaded += new RoutedEventHandler(ImageVisual_Unloaded);
- }
-
- void Source_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
- {
- if(IsLoaded)
- {
- switch(e.Action)
- {
- case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
- case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
- case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
- case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
- {
- UpdateVisual();
- }
- break;
-
- case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
- {
- Child = null;
- }
- break;
- }
- }
- }
-
- void ImageVisual_Unloaded(object sender, RoutedEventArgs e)
- {
- Child = null;
- }
-
- void ImageVisual_Loaded(object sender, RoutedEventArgs e)
- {
- UpdateVisual();
- }
-
- Visual _child;
- public virtual Visual Child
- {
- get
- {
- return _child;
- }
- set
- {
- if(_child != value)
- {
- if(_child != null)
- {
- RemoveLogicalChild(_child);
- RemoveVisualChild(_child);
- }
-
- if(value != null)
- {
- AddVisualChild(value);
- AddLogicalChild(value);
- }
-
- // cache the new child
- _child = value;
-
- InvalidateVisual();
- }
- }
- }
-
- public void UpdateVisual()
- {
- Child = Create();
- }
-
- static readonly Pen gridPen = new Pen(Brushes.White, 2.0);
-
- private DrawingVisual Create()
- {
- var dv = new DrawingVisual();
-
- using(DrawingContext dc = dv.RenderOpen())
- {
- foreach(var img in Source)
- {
- var rect = new Rect(0, 0, img.Width + 0.6, img.Height + 0.6);
-
- dc.DrawImage(img, rect);
- dc.DrawRectangle(null, gridPen, rect);
- }
- }
-
- return dv;
- }
-
- #region Necessary Overrides -- Needed by WPF to maintain bookkeeping of our hosted visuals
- protected override int VisualChildrenCount
- {
- get
- {
- return (Child == null ? 0 : 1);
- }
- }
-
- protected override Visual GetVisualChild(int index)
- {
- Debug.Assert(index == 0);
- return Child;
- }
- #endregion
- }
-
- ///
- /// image abstraction
- ///
- public class WindowsPresentationImage : PureImage
- {
- public ImageSource Img;
-
- public override void Dispose()
- {
- if(Img != null)
- {
- Img = null;
- }
-
- if(Data != null)
- {
- Data.Dispose();
- Data = null;
- }
- }
- }
-
- ///
- /// image abstraction proxy
- ///
- public class WindowsPresentationImageProxy : PureImageProxy
- {
- WindowsPresentationImageProxy()
- {
-
- }
-
- public static readonly WindowsPresentationImageProxy Instance = new WindowsPresentationImageProxy();
-
- //static readonly byte[] pngHeader = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
- //static readonly byte[] jpgHeader = { 0xFF, 0xD8, 0xFF };
- //static readonly byte[] gifHeader = { 0x47, 0x49, 0x46 };
- //static readonly byte[] bmpHeader = { 0x42, 0x4D };
-
- public override PureImage FromStream(System.IO.Stream stream)
- {
- WindowsPresentationImage ret = null;
- if(stream != null)
- {
- var type = stream.ReadByte();
- stream.Position = 0;
-
- ImageSource m = null;
-
- switch(type)
- {
- // PNG: 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A
- case 0x89:
- {
- var bitmapDecoder = new PngBitmapDecoder(stream, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnLoad);
- m = bitmapDecoder.Frames[0];
- bitmapDecoder = null;
- }
- break;
-
- // JPG: 0xFF, 0xD8, 0xFF
- case 0xFF:
- {
- var bitmapDecoder = new JpegBitmapDecoder(stream, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnLoad);
- m = bitmapDecoder.Frames[0];
- bitmapDecoder = null;
- }
- break;
-
- // GIF: 0x47, 0x49, 0x46
- case 0x47:
- {
- var bitmapDecoder = new GifBitmapDecoder(stream, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnLoad);
- m = bitmapDecoder.Frames[0];
- bitmapDecoder = null;
- }
- break;
-
- // BMP: 0x42, 0x4D
- case 0x42:
- {
- var bitmapDecoder = new BmpBitmapDecoder(stream, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnLoad);
- m = bitmapDecoder.Frames[0];
- bitmapDecoder = null;
- }
- break;
-
- // TIFF: 0x49, 0x49 || 0x4D, 0x4D
- case 0x49:
- case 0x4D:
- {
- var bitmapDecoder = new TiffBitmapDecoder(stream, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnLoad);
- m = bitmapDecoder.Frames[0];
- bitmapDecoder = null;
- }
- break;
-
- default:
- {
- Debug.WriteLine("WindowsPresentationImageProxy: unknown image format: " + type);
- }
- break;
- }
-
- if(m != null)
- {
- ret = new WindowsPresentationImage();
- ret.Img = m;
- if(ret.Img.CanFreeze)
- {
- ret.Img.Freeze();
- }
- }
- }
- return ret;
- }
-
- public override bool Save(System.IO.Stream stream, PureImage image)
- {
- WindowsPresentationImage ret = (WindowsPresentationImage)image;
- if(ret.Img != null)
- {
- try
- {
- PngBitmapEncoder e = new PngBitmapEncoder();
- e.Frames.Add(BitmapFrame.Create(ret.Img as BitmapSource));
- e.Save(stream);
- e = null;
- }
- catch
- {
- return false;
- }
- }
- else
- {
- return false;
- }
-
- return true;
- }
- }
-}
diff --git a/GMap.NET.WindowsPresentation/Properties/AssemblyInfo.cs b/GMap.NET.WindowsPresentation/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/GMap.NET.WindowsPresentation/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("GMap.NET.WindowsPresentation")]
-[assembly: AssemblyDescription("GMap.NET - Great Maps for Windows Presentation")]
-[assembly: AssemblyProduct("GMap.NET.WindowsPresentation")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(true)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("BB3E880B-18D8-4843-A2C1-47DC7CCC054C")]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-//[assembly: AssemblyVersion("1.0.0.0")]
-//[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/GMap.NET.WindowsPresentation/sn.snk b/GMap.NET.WindowsPresentation/sn.snk
deleted file mode 100644
index 5d3f356338012a684961ee80096fa2174233ecb1..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {A6E9D42C-935B-44D0-9FB0-E2E0319627D1}
- Exe
- Properties
- BigMapMaker
- BigMapMaker
- v3.5
- 512
-
-
- 3.5
-
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\Debug\BigMapMaker.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- false
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\x86\Release\BigMapMaker.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- false
-
-
-
- 3.0
-
-
- 3.0
-
-
-
- 3.5
-
-
-
-
- 3.5
-
-
- 3.5
-
-
- 3.5
-
-
-
-
- 3.0
-
-
-
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {E06DEF77-F933-42FB-AFD7-DB2D0D8D6A98}
- GMap.NET.WindowsForms
-
-
- {644FE7D4-0184-400F-B2D7-99CB41360658}
- GMap.NET.WindowsPresentation
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/BigMapMaker/Program.cs b/Testing/BigMapMaker/Program.cs
deleted file mode 100644
--- a/Testing/BigMapMaker/Program.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Drawing;
-using GMap.NET;
-using GMap.NET.Projections;
-using GMap.NET.WindowsForms;
-using GMap.NET.MapProviders;
-
-namespace BigMapMaker
-{
- class Program
- {
- [STAThread]
- static void Main(string[] args)
- {
- GMaps.Instance.UseMemoryCache = false;
- GMaps.Instance.Mode = AccessMode.ServerAndCache;
-
- GMapProvider.TileImageProxy = WindowsFormsImageProxy.Instance;
-
- GMapProvider provider = GMapProviders.BingMap;
- provider.OnInitialized();
-
- int zoom = 12;
-
- RectLatLng area = RectLatLng.FromLTRB(25.013809204101563, 54.832138557519563, 25.506134033203125, 54.615623046071839);
- if(!area.IsEmpty)
- {
- try
- {
- List tileArea = provider.Projection.GetAreaTileList(area, zoom, 0);
- string bigImage = zoom + "-" + provider + "-vilnius.png";
-
- Console.WriteLine("Preparing: " + bigImage);
- Console.WriteLine("Zoom: " + zoom);
- Console.WriteLine("Type: " + provider.ToString());
- Console.WriteLine("Area: " + area);
-
- // current area
- GPoint topLeftPx = provider.Projection.FromLatLngToPixel(area.LocationTopLeft, zoom);
- GPoint rightButtomPx = provider.Projection.FromLatLngToPixel(area.Bottom, area.Right, zoom);
- GPoint pxDelta = new GPoint(rightButtomPx.X - topLeftPx.X, rightButtomPx.Y - topLeftPx.Y);
-
- int padding = 22;
- {
- using(Bitmap bmpDestination = new Bitmap((int)(pxDelta.X + padding*2), (int)(pxDelta.Y + padding*2)))
- {
- using(Graphics gfx = Graphics.FromImage(bmpDestination))
- {
- gfx.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
-
- // get tiles & combine into one
- foreach(var p in tileArea)
- {
- Console.WriteLine("Downloading[" + p + "]: " + tileArea.IndexOf(p) + " of " + tileArea.Count);
-
- foreach(var tp in provider.Overlays)
- {
- Exception ex;
- WindowsFormsImage tile = GMaps.Instance.GetImageFrom(tp, p, zoom, out ex) as WindowsFormsImage;
- if(tile != null)
- {
- using(tile)
- {
- long x = p.X * provider.Projection.TileSize.Width - topLeftPx.X + padding;
- long y = p.Y * provider.Projection.TileSize.Width - topLeftPx.Y + padding;
- {
- gfx.DrawImage(tile.Img, x, y, provider.Projection.TileSize.Width, provider.Projection.TileSize.Height);
- }
- }
- }
- }
- }
- }
-
- // draw info
- {
- System.Drawing.Rectangle rect = new System.Drawing.Rectangle();
- {
- rect.Location = new System.Drawing.Point(padding, padding);
- rect.Size = new System.Drawing.Size((int)pxDelta.X, (int)pxDelta.Y);
- }
- using(Font f = new Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold))
- using(Graphics gfx = Graphics.FromImage(bmpDestination))
- {
- // draw bounds & coordinates
- using(Pen p = new Pen(Brushes.Red, 3))
- {
- p.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
-
- gfx.DrawRectangle(p, rect);
-
- string topleft = area.LocationTopLeft.ToString();
- SizeF s = gfx.MeasureString(topleft, f);
-
- gfx.DrawString(topleft, f, p.Brush, rect.X + s.Height/2, rect.Y + s.Height/2);
-
- string rightBottom = new PointLatLng(area.Bottom, area.Right).ToString();
- SizeF s2 = gfx.MeasureString(rightBottom, f);
-
- gfx.DrawString(rightBottom, f, p.Brush, rect.Right - s2.Width - s2.Height/2, rect.Bottom - s2.Height - s2.Height/2);
- }
-
- // draw scale
- using(Pen p = new Pen(Brushes.Blue, 1))
- {
- double rez = provider.Projection.GetGroundResolution(zoom, area.Bottom);
- int px100 = (int) (100.0 / rez); // 100 meters
- int px1000 = (int) (1000.0 / rez); // 1km
-
- gfx.DrawRectangle(p, rect.X + 10, rect.Bottom - 20, px1000, 10);
- gfx.DrawRectangle(p, rect.X + 10, rect.Bottom - 20, px100, 10);
-
- string leftBottom = "scale: 100m | 1Km";
- SizeF s = gfx.MeasureString(leftBottom, f);
- gfx.DrawString(leftBottom, f, p.Brush, rect.X+10, rect.Bottom - s.Height - 20);
- }
- }
- }
-
- bmpDestination.Save(bigImage, System.Drawing.Imaging.ImageFormat.Png);
- }
- }
-
- // ok, lets see what we get
- {
- Console.WriteLine("Done! Starting Image: " + bigImage);
-
- Process.Start(bigImage);
- }
- }
- catch(Exception ex)
- {
- Console.WriteLine("Error: " + ex.ToString());
-
- Console.ReadLine();
- }
- }
- }
- }
-}
diff --git a/Testing/BigMapMaker/Properties/AssemblyInfo.cs b/Testing/BigMapMaker/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/BigMapMaker/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("BigMapMaker-ConsoleApplication")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("BigMapMaker-ConsoleApplication")]
-[assembly: AssemblyCopyright("Copyright © 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("24ee2e85-1b31-4f93-89ed-4412fa7097f7")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/ConsoleApplication/ConsoleApplication.csproj b/Testing/ConsoleApplication/ConsoleApplication.csproj
deleted file mode 100644
--- a/Testing/ConsoleApplication/ConsoleApplication.csproj
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {448B761F-C033-447D-93D5-F4380A7DB0E2}
- Exe
- Properties
- ConsoleApplication
- ConsoleApplication
- v4.0
- 512
-
-
- 3.5
-
-
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\x86\Debug\ConsoleApplication.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\x86\Release\ConsoleApplication.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
- true
-
-
- sn.snk
-
-
-
- False
- ..\..\References\Etc\DotSpatial.Projections.dll
-
-
-
- 3.5
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {E06DEF77-F933-42FB-AFD7-DB2D0D8D6A98}
- GMap.NET.WindowsForms
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/ConsoleApplication/Program.cs b/Testing/ConsoleApplication/Program.cs
deleted file mode 100644
--- a/Testing/ConsoleApplication/Program.cs
+++ /dev/null
@@ -1,273 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Security.Cryptography;
-using System.Text;
-using DotSpatial.Projections;
-using GMap.NET;
-using GMap.NET.Internals;
-using GMap.NET.MapProviders;
-using GMap.NET.Projections;
-using System.Threading;
-using GMap.NET.WindowsForms;
-
-namespace ConsoleApplication
-{
- class Program
- {
- static void Main(string[] args)
- {
- //if(false)
- {
- GeoCoderStatusCode status;
- var pp1 = GMapProviders.YahooMap.GetPoint("Lithuania,Vilnius", out status);
-
- //var pl = GMapProviders.OpenStreetMap.GetPlacemark(pp1.Value, out status);
- }
-
- if(false)
- {
- var p = PlateCarreeProjectionDarbAe.Instance;
-
- var l = new PointLatLng(29.4052130085331, 41.522866508209);
-
- Debug.WriteLine("121 * 256: " + 121 * 256 + "px : Y");
- Debug.WriteLine("144 * 256: " + 144 * 256 + "px : X");
-
- Debug.WriteLine("l: " + l);
-
- var px = p.FromLatLngToPixel(l, 0);
-
- Debug.WriteLine("FromLatLngToPixel: " + px);
-
- var ll = p.FromPixelToLatLng(px, 0);
- Debug.WriteLine("FromPixelToLatLng: " + ll);
-
-
- var tl = p.FromPixelToTileXY(px);
-
- Debug.WriteLine("FromPixelToTileXY: " + tl);
- }
-
- /*
- 0/1 = 2
- 1/2 = 1,5
- 2/3 = 2
- 3/4 = 2
- 4/5 = 2,5
- 5/6 = 2
- 6/7 = 2
- 7/8 = 2
- 8/9 = 2,5
- 9/10 = 2
- 10/11 = 2,5
- 11/12 = 2
- */
-
- if(false)
- {
- GMapProvider.TileImageProxy = WindowsFormsImageProxy.Instance;
-
- var p = LKS94Projection.Instance;
- //var p = PlateCarreeProjection.Instance;
-
- var pos = new PointLatLng(54.6961334816182, 25.2985095977783);
-
- {
- var zoom = 4;
- var px = p.FromPixelToTileXY(p.FromLatLngToPixel(pos, zoom));
- Exception ex = null;
- var img = GMaps.Instance.GetImageFrom(GMapProviders.LithuaniaMap, px, zoom, out ex);
- File.WriteAllBytes(zoom + "z-" + px + ".png", img.Data.ToArray());
- }
-
- for(int i = 0; i < 12; i++)
- {
- double scale = p.GetGroundResolution(i, pos.Lat);
- double scale2 = p.GetGroundResolution(i + 1, pos.Lat);
-
- var s = scale / scale2;
-
- Debug.WriteLine(i + "/" + (i + 1) + " = " + s);
- }
- }
-
-#if DEBUG
- if(false)
- {
- GMapProvider.TileImageProxy = WindowsFormsImageProxy.Instance;
-
- //GMaps.Instance.PrimaryCache.DeleteOlderThan(DateTime.Now, GMapProviders.GoogleMap.DbId);
-
- GMaps.Instance.Mode = AccessMode.CacheOnly;
-
- using(Core c = new Core())
- {
- //c.compensationOffset = new GPoint(200, 200);
-
- c.minZoom = 1;
- c.maxZoom = 25;
- c.Zoom = 16;
- c.Provider = GMapProviders.OpenStreetMap;
- c.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
- c.OnMapSizeChanged(400, 400);
-
- c.OnMapOpen();
-
- Debug.WriteLine("Position: " + c.Position);
- Debug.WriteLine("renderOffset: " + c.renderOffset);
- Debug.WriteLine("compensationOffset: " + c.compensationOffset);
-
- var l = c.FromLatLngToLocal(c.Position);
- Debug.WriteLine("local: " + l);
-
- var g = c.FromLocalToLatLng(l.X, l.Y);
- Debug.WriteLine("geo: " + g);
-
- //c.ReloadMap();
-
- Console.ReadLine();
-
- c.OnMapClose();
- }
- }
-
- if(false)
- {
- int i = 0;
-
- //while(true)
- {
- Console.WriteLine(i + " start");
- Debug.WriteLine(i + " start");
-
- //using(Core c = new Core())
- Core c = new Core();
- {
- var f = c.OnMapOpen();
-
- Console.WriteLine("wait");
- Console.ReadLine();
-
- //c.OnMapClose();
- }
- c = null;
-
- Debug.WriteLine("end");
- Console.WriteLine("end");
-
- Console.ReadLine();
-
- GC.Collect();
-
- //if(i++ > 10)
- //{
- // GC.Collect();
- // i = 0;
- //}
- }
- }
-#endif
-
- if(false)
- {
- List plc = null;
- var st = GMapProviders.GoogleMap.GetPlacemarks(new PointLatLng(54.6961334816182, 25.2985095977782), out plc);
- if(st == GeoCoderStatusCode.G_GEO_SUCCESS && plc != null)
- {
- foreach(var pl in plc)
- {
- if(!string.IsNullOrEmpty(pl.PostalCodeNumber))
- {
- Debug.WriteLine("Accuracy: " + pl.Accuracy + ", " + pl.Address + ", PostalCodeNumber: " + pl.PostalCodeNumber);
- }
- }
- }
- }
-
- if(false)
- {
- var p1 = new PointLatLng(54.6961334816182, 25.2985095977782);
- var p2 = new PointLatLng(54.7061334816182, 25.3085095977783);
-
- //GMaps.Instance.ImportFromGMDB(@"C:\Users\m.dambrauskas\AppData\Local\GMap.NET\TileDBv5\en\Data - Copy.gmdb");
-
- //var route = GMapProviders.OpenStreetMap.GetRoute(p1, p2, false, false, 10);
- //var route = GMapProviders.CloudMadeMap.GetRoute(p1, p2, false, false, 10);
-
- //Debug.WriteLine(GMapProviders.BingHybridMap.Name + ":" + GMapProviders.BingHybridMap.DbId);
-
- GDirections ss;
- var xx = GMapProviders.GoogleMap.GetDirections(out ss, p1, p2, false, false, false, false, false);
-
- GeoCoderStatusCode status;
- var pp1 = GMapProviders.GoogleMap.GetPoint("Lithuania,Vilnius", out status);
- var pp2 = GMapProviders.GoogleMap.GetPoint("Lithuania,Kaunas", out status);
- if(pp1.HasValue && pp2.HasValue)
- {
- GDirections s;
- //var x = GMapProviders.GoogleMap.GetDirections(out s, "Lithuania,Vilnius", "Lithuania,Kaunas", false, false, false, true);
- //if(x == DirectionsStatusCode.OK)
- var x = GMapProviders.GoogleMap.GetDirections(out s, pp1.Value, pp2.Value, false, false, false, false, true);
- {
- Debug.WriteLine(s.Summary + ", " + s.Copyrights);
- Debug.WriteLine(s.StartAddress + " -> " + s.EndAddress);
- Debug.WriteLine(s.Distance);
- Debug.WriteLine(s.Duration);
- foreach(var step in s.Steps)
- {
- Debug.WriteLine(step);
- }
- }
- }
- }
-
- if(false)
- {
- //-34,8859309407532, Lng=-58,359375
- PointLatLng p1 = new PointLatLng(-34.608, -58.348);
- PointLatLng p2 = new PointLatLng(-34.608, -58.348);
-
- //Sets up a array to contain the x and y coordinates
- double[] xy = new double[4] { p1.Lng, p1.Lat, p2.Lng, p2.Lat };
-
- //An array for the z coordinate
- double[] z = new double[1];
- z[0] = 1;
-
- ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
-
- //ProjectionInfo pEnd = new ProjectionInfo("+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=4200000 +y_0=-1300000 +ellps=WGS84 +datum=WGS84 +to_meter=0.03125 +no_defs");
- ProjectionInfo pEnd = new ProjectionInfo("+proj=tmerc +lat_0=-34.629269 +lon_0=-58.4633 +k=0.9999980000000001 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs");
-
- Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 2);
-
- Debug.WriteLine(" true1: " + (int)xy[0] + "; " + (int)xy[1]);
-
- //var prj = new MapyCZProjection();
- //{
- // var p2 = prj.WGSToPP(y, x);
-
- // Debug.WriteLine("false1: " + p2[0] + "; " + p2[1]);
-
- // var p3 = prj.PPToWGS(p2[0], p2[1]);
-
- // Reproject.ReprojectPoints(xy, z, pEnd, pStart, 0, 1);
-
- // Debug.WriteLine("");
- // Debug.WriteLine(" true2: " + xy[0] + "; " + xy[1]);
- // Debug.WriteLine("false2: " + p3[1] + "; " + p3[0]);
- //}
- // 134400000],PARAMETER["false_northing",-41600000
- }
-
- // stop caching immediately
- GMaps.Instance.CancelTileCaching();
-
- //Console.ReadLine();
- }
- }
-}
diff --git a/Testing/ConsoleApplication/Properties/AssemblyInfo.cs b/Testing/ConsoleApplication/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/ConsoleApplication/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ConsoleApplication")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("ConsoleApplication")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("67fa56ce-a355-4ce5-99ef-5e1dd3392035")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/ConsoleApplication/app.config b/Testing/ConsoleApplication/app.config
deleted file mode 100644
--- a/Testing/ConsoleApplication/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/Testing/ConsoleApplication/sn.snk b/Testing/ConsoleApplication/sn.snk
deleted file mode 100644
index 5d3f356338012a684961ee80096fa2174233ecb1..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {097FA134-51A5-4801-AADD-A1914EAA32FF}
- WinExe
- Properties
- CloudsDemo
- CloudsDemo
- v2.0
- 512
-
-
- 3.5
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\x86\Debug\CloudsDemo.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\x86\Release\CloudsDemo.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- MainForm.cs
-
-
-
- UserControl
-
-
- MapControl.cs
-
-
-
-
- MainForm.cs
-
-
- MapControl.cs
- Designer
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- true
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {E06DEF77-F933-42FB-AFD7-DB2D0D8D6A98}
- GMap.NET.WindowsForms
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/Demo.Clouds/Images/USOverlay.png b/Testing/Demo.Clouds/Images/USOverlay.png
deleted file mode 100644
index ba9f5cdd7268537327e4cc3478c036097ca24707..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.mapControl = new CloudsDemo.MapControl();
- this.SuspendLayout();
- //
- // mapControl
- //
- this.mapControl.CanDragMap = true;
- this.mapControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.mapControl.GrayScaleMode = false;
- this.mapControl.LevelsKeepInMemmory = 5;
- this.mapControl.Location = new System.Drawing.Point(0, 0);
- this.mapControl.Margin = new System.Windows.Forms.Padding(5);
- this.mapControl.MarkersEnabled = true;
- this.mapControl.MaxZoom = 17;
- this.mapControl.MinZoom = 2;
- this.mapControl.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter;
- this.mapControl.Name = "mapControl";
- this.mapControl.PolygonsEnabled = true;
- this.mapControl.RetryLoadTile = 0;
- this.mapControl.RoutesEnabled = true;
- this.mapControl.ShowTileGridLines = false;
- this.mapControl.Size = new System.Drawing.Size(876, 665);
- this.mapControl.TabIndex = 0;
- this.mapControl.Zoom = 0D;
- //
- // MainForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(876, 665);
- this.Controls.Add(this.mapControl);
- this.Margin = new System.Windows.Forms.Padding(4);
- this.Name = "MainForm";
- this.Text = "Clouds Demo - shows how to render image marker";
- this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private MapControl mapControl;
- }
-}
-
diff --git a/Testing/Demo.Clouds/MainForm.cs b/Testing/Demo.Clouds/MainForm.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/MainForm.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Windows.Forms;
-using GMap.NET;
-using GMap.NET.WindowsForms;
-using GMap.NET.MapProviders;
-
-namespace CloudsDemo
-{
- public partial class MainForm : Form
- {
- // clouds boundaries
- readonly PointLatLng gtl = new PointLatLng(50.4066263673011, -127.620375523875);
- readonly PointLatLng gbr = new PointLatLng(21.652538062803, -66.517937876818);
-
- readonly GMapOverlay mainOverlay;
- readonly GMapImage clouds;
-
- public MainForm()
- {
- InitializeComponent();
-
- if(!DesignMode)
- {
- try
- {
- System.Net.IPHostEntry e = System.Net.Dns.GetHostEntry("www.bing.com");
- }
- catch
- {
- mapControl.Manager.Mode = AccessMode.CacheOnly;
- MessageBox.Show("No internet connection avaible, going to CacheOnly mode.", "GMap.NET - CloudsDemo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
-
- mapControl.MapProvider = GMapProviders.BingSatelliteMap;
- mapControl.OnMapZoomChanged += new MapZoomChanged(mapControl_OnMapZoomChanged);
-
- mainOverlay = new GMapOverlay("top");
- mapControl.Overlays.Add(mainOverlay);
-
- clouds = new GMapImage(gtl);
- clouds.Image = Properties.Resources.USOverlay;
- mainOverlay.Markers.Add(clouds);
- }
- }
-
- void mapControl_OnMapZoomChanged()
- {
- if(clouds != null)
- {
- var tl = mapControl.FromLatLngToLocal(gtl);
- var br = mapControl.FromLatLngToLocal(gbr);
-
- clouds.Position = gtl;
- clouds.Size = new System.Drawing.Size((int)(br.X - tl.X), (int)(br.Y - tl.Y));
- }
- }
-
- protected override void OnShown(EventArgs e)
- {
- base.OnShown(e);
-
- mapControl.SetZoomToFitRect(RectLatLng.FromLTRB(gtl.Lng, gtl.Lat, gbr.Lng, gbr.Lat));
- }
- }
-}
diff --git a/Testing/Demo.Clouds/MainForm.resx b/Testing/Demo.Clouds/MainForm.resx
deleted file mode 100644
--- a/Testing/Demo.Clouds/MainForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Testing/Demo.Clouds/MapControl.cs b/Testing/Demo.Clouds/MapControl.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/MapControl.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-
-namespace CloudsDemo
-{
- using GMap.NET.WindowsForms;
-
- public partial class MapControl : GMapControl
- {
- public MapControl()
- {
- InitializeComponent();
- }
-
- protected override void OnPaintOverlays(System.Drawing.Graphics g)
- {
- base.OnPaintOverlays(g);
- }
- }
-}
diff --git a/Testing/Demo.Clouds/MapControl.designer.cs b/Testing/Demo.Clouds/MapControl.designer.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/MapControl.designer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace CloudsDemo
-{
- partial class MapControl
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // MapControl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Name = "MapControl";
- this.Size = new System.Drawing.Size(286, 245);
- this.ResumeLayout(false);
-
- }
-
- #endregion
- }
-}
diff --git a/Testing/Demo.Clouds/MapControl.resx b/Testing/Demo.Clouds/MapControl.resx
deleted file mode 100644
--- a/Testing/Demo.Clouds/MapControl.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Testing/Demo.Clouds/Markers/GMapImage.cs b/Testing/Demo.Clouds/Markers/GMapImage.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/Markers/GMapImage.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-
-using System.Drawing;
-using GMap.NET.WindowsForms;
-
-namespace CloudsDemo
-{
- public class GMapImage : GMapMarker
- {
- private Image image;
- public Image Image
- {
- get
- {
- return image;
- }
- set
- {
- image = value;
- if(image != null)
- {
- this.Size = new Size(image.Width, image.Height);
- }
- }
- }
-
- public GMapImage(GMap.NET.PointLatLng p)
- : base(p)
- {
- DisableRegionCheck = true;
- IsHitTestVisible = false;
- }
-
- public override void OnRender(Graphics g)
- {
- if(image == null)
- return;
-
- g.DrawImage(image, LocalPosition.X, LocalPosition.Y, Size.Width, Size.Height);
- }
- }
-}
\ No newline at end of file
diff --git a/Testing/Demo.Clouds/Program.cs b/Testing/Demo.Clouds/Program.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/Program.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace CloudsDemo
-{
- static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new MainForm());
- }
- }
-}
diff --git a/Testing/Demo.Clouds/Properties/AssemblyInfo.cs b/Testing/Demo.Clouds/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("CloudsDemo")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("CloudsDemo")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c3f44530-223c-49fa-a61e-4a2f4e9429f8")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/Demo.Clouds/Properties/Resources.Designer.cs b/Testing/Demo.Clouds/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace CloudsDemo.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CloudsDemo.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- internal static System.Drawing.Bitmap USOverlay {
- get {
- object obj = ResourceManager.GetObject("USOverlay", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
- }
-}
diff --git a/Testing/Demo.Clouds/Properties/Resources.resx b/Testing/Demo.Clouds/Properties/Resources.resx
deleted file mode 100644
--- a/Testing/Demo.Clouds/Properties/Resources.resx
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- ..\Images\USOverlay.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
\ No newline at end of file
diff --git a/Testing/Demo.Clouds/Properties/Settings.Designer.cs b/Testing/Demo.Clouds/Properties/Settings.Designer.cs
deleted file mode 100644
--- a/Testing/Demo.Clouds/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace CloudsDemo.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Testing/Demo.Clouds/Properties/Settings.settings b/Testing/Demo.Clouds/Properties/Settings.settings
deleted file mode 100644
--- a/Testing/Demo.Clouds/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Testing/Demo.Docking/App.xaml b/Testing/Demo.Docking/App.xaml
deleted file mode 100644
--- a/Testing/Demo.Docking/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Testing/Demo.Docking/App.xaml.cs b/Testing/Demo.Docking/App.xaml.cs
deleted file mode 100644
--- a/Testing/Demo.Docking/App.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace Sample3
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/Testing/Demo.Docking/Demo.Docking.csproj b/Testing/Demo.Docking/Demo.Docking.csproj
deleted file mode 100644
--- a/Testing/Demo.Docking/Demo.Docking.csproj
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
- Debug
- x86
- 9.0.30729
- 2.0
- {F729FF99-2991-4819-9855-7CD7A1199089}
- WinExe
- Properties
- Sample3
- Demo.Docking
- v3.5
-
-
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\Debug\v35\Demo.Docking.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
- false
-
-
- bin\Release\
- TRACE
- true
- AnyCPU
- bin\Release\Demo.Docking.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
-
- False
- ..\..\References\Etc\AvalonDock.dll
-
-
- False
- ..\..\References\Etc\AvalonDock.Themes.dll
-
-
-
-
-
-
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {644FE7D4-0184-400F-B2D7-99CB41360658}
- GMap.NET.WindowsPresentation
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/Demo.Docking/MainWindow.xaml b/Testing/Demo.Docking/MainWindow.xaml
deleted file mode 100644
--- a/Testing/Demo.Docking/MainWindow.xaml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Testing/Demo.Docking/MainWindow.xaml.cs b/Testing/Demo.Docking/MainWindow.xaml.cs
deleted file mode 100644
--- a/Testing/Demo.Docking/MainWindow.xaml.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-using System;
-using System.Windows;
-using System.Diagnostics;
-using System.Threading;
-using GMap.NET.MapProviders;
-
-namespace Sample3
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
-
- MainMap.MapProvider = GMapProviders.GoogleMap;
- MapArcGISworldTopo.MapProvider = GMapProviders.ArcGIS_World_Topo_Map;
-
- MapBing.MapProvider = GMapProviders.BingMap;
- MapBingHybrid.MapProvider = GMapProviders.BingHybridMap;
- MapBingOld.MapProvider = GMapProviders.BingMap;
-
- MapGoogleHybrid.MapProvider = GMapProviders.GoogleHybridMap;
- MapGoogleTerrain.MapProvider = GMapProviders.GoogleTerrainMap;
-
- MapYahoo.MapProvider = GMapProviders.YahooMap;
- MapYahooHybrid.MapProvider = GMapProviders.YahooHybridMap;
-
- MapYandexMapRuHybrid.MapProvider = GMapProviders.YandexHybridMap;
- MapYandexRu.MapProvider = GMapProviders.YandexMap;
-
- MapLt.MapProvider = GMapProviders.LithuaniaMap;
- MapLtHybrid.MapProvider = GMapProviders.LithuaniaOrtoFotoMap;
-
- MapOpenStreet.MapProvider = GMapProviders.OpenStreetMap;
- MapOpenStreetOsm.MapProvider = GMapProviders.OpenStreetOsm;
- MapOpenStreetSurfer.MapProvider = GMapProviders.OpenStreetMapSurfer;
-
- this.WindowState = System.Windows.WindowState.Minimized;
- }
-
- private void OnMapZoomChanged()
- {
- this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate()
- {
- var amap = dockManager.ActiveContent.Content as GMap.NET.WindowsPresentation.GMapControl;
- if(amap != null)
- {
- foreach(var d in dockManager.Documents)
- {
- var map = d.Content as GMap.NET.WindowsPresentation.GMapControl;
-
- if(map != null && map != amap)
- {
- if(map.MapProvider.Projection.ToString() == amap.MapProvider.Projection.ToString())
- {
- map.Zoom = amap.Zoom;
- }
- else
- {
- map.SetZoomToFitRect(amap.ViewArea);
- }
- }
- }
- }
- }));
- }
-
- private void OnMapDrag()
- {
- this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(delegate()
- {
- var amap = dockManager.ActiveContent.Content as GMap.NET.WindowsPresentation.GMapControl;
- if(amap != null)
- {
- last = amap.Position;
-
- foreach(var d in dockManager.Documents)
- {
- var map = d.Content as GMap.NET.WindowsPresentation.GMapControl;
-
- if(map != null && map != amap)
- {
- map.Position = amap.Position;
- }
- }
- }
- }));
- }
-
- GMap.NET.PointLatLng last = new GMap.NET.PointLatLng();
- GMap.NET.WindowsPresentation.GMapControl lastMap;
-
- private void DocumentPane_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
- {
- if(e.RemovedItems.Count > 0 && e.AddedItems.Count > 0)
- {
- var befCont = (e.RemovedItems[0] as AvalonDock.DocumentContent).Content;
- if(befCont != null)
- {
- var before = befCont as GMap.NET.WindowsPresentation.GMapControl;
- if(before != null)
- {
- var aCont = (e.AddedItems[0] as AvalonDock.DocumentContent).Content;
- if(aCont != null)
- {
- var amap = aCont as GMap.NET.WindowsPresentation.GMapControl;
- if(amap != null)
- {
- //this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate()
- //{
-
- amap.Position = before.Position;
-
- if(amap.MapProvider.Projection.ToString() == before.MapProvider.Projection.ToString())
- {
- amap.Zoom = before.Zoom;
- }
- else
- {
- amap.SetZoomToFitRect(before.ViewArea);
- }
- //}));
- }
-
- lastMap = amap;
- }
- }
- }
- }
- }
-
- private void GMapControl_Loaded(object sender, RoutedEventArgs e)
- {
- var map = sender as GMap.NET.WindowsPresentation.GMapControl;
-
- if(lastMap != null && lastMap != map)
- {
- map.Position = lastMap.Position;
-
- if(map.MapProvider.Projection.ToString() == lastMap.MapProvider.Projection.ToString())
- {
- map.Zoom = lastMap.Zoom;
- }
- else
- {
- map.SetZoomToFitRect(lastMap.ViewArea);
- }
- }
- else
- {
- map.Position = last;
- }
- }
- }
-}
diff --git a/Testing/Demo.Docking/Properties/AssemblyInfo.cs b/Testing/Demo.Docking/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/Demo.Docking/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Demo.Docking")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Demo.Docking")]
-[assembly: AssemblyCopyright("Copyright © 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/Demo.Docking/Properties/Resources.Designer.cs b/Testing/Demo.Docking/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Testing/Demo.Docking/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Sample3.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sample3.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Testing/Demo.Docking/Properties/Resources.resx b/Testing/Demo.Docking/Properties/Resources.resx
deleted file mode 100644
--- a/Testing/Demo.Docking/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Testing/Demo.Docking/Properties/Settings.Designer.cs b/Testing/Demo.Docking/Properties/Settings.Designer.cs
deleted file mode 100644
--- a/Testing/Demo.Docking/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Sample3.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Testing/Demo.Docking/Properties/Settings.settings b/Testing/Demo.Docking/Properties/Settings.settings
deleted file mode 100644
--- a/Testing/Demo.Docking/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/Demo.StreetView/App.xaml b/Testing/Demo.StreetView/App.xaml
deleted file mode 100644
--- a/Testing/Demo.StreetView/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Testing/Demo.StreetView/App.xaml.cs b/Testing/Demo.StreetView/App.xaml.cs
deleted file mode 100644
--- a/Testing/Demo.StreetView/App.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace Demo.StreetView
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/Testing/Demo.StreetView/Demo.StreetView.csproj b/Testing/Demo.StreetView/Demo.StreetView.csproj
deleted file mode 100644
--- a/Testing/Demo.StreetView/Demo.StreetView.csproj
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {B6E411A2-DFD8-461E-8207-BDBA405264CA}
- WinExe
- Properties
- Demo.StreetView
- Demo.StreetView
- v3.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- 3.5
-
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\x86\Debug\Demo.StreetView.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\x86\Release\Demo.StreetView.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
-
-
-
-
- 3.5
-
-
- 3.5
-
-
- 3.5
-
-
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
- 3.0
-
-
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- Window1.xaml
- Code
-
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/Demo.StreetView/PanoramaViewer.cs b/Testing/Demo.StreetView/PanoramaViewer.cs
deleted file mode 100644
--- a/Testing/Demo.StreetView/PanoramaViewer.cs
+++ /dev/null
@@ -1,266 +0,0 @@
-using System;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-using System.Windows.Media.Media3D;
-
-namespace Demo.StreetView
-{
- public class PanoramaViewer : Viewport3D
- {
- public double FieldOfView
- {
- get
- {
- return (double) GetValue(FieldOfViewProperty);
- }
- set
- {
- SetValue(FieldOfViewProperty, value);
- }
- }
-
- // Using a DependencyProperty as the backing store for FieldOfView. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty FieldOfViewProperty =
- DependencyProperty.Register("FieldOfView", typeof(double), typeof(PanoramaViewer), new PropertyMetadata(
- (double) 0, new PropertyChangedCallback(OnFieldOfViewChanged)));
-
- internal static void OnFieldOfViewChanged(Object sender, DependencyPropertyChangedEventArgs e)
- {
- PanoramaViewer Viewer = ((PanoramaViewer) sender);
- PerspectiveCamera Camera = Viewer.Camera as PerspectiveCamera;
- Camera.FieldOfView = Viewer.FieldOfView;
- }
-
- public ImageSource PanoramaImage
- {
- get
- {
- return (ImageSource) GetValue(PanoramaImageProperty);
- }
- set
- {
- SetValue(PanoramaImageProperty, value);
- }
- }
-
- // Using a DependencyProperty as the backing store for PanoramaImage. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty PanoramaImageProperty =
- DependencyProperty.Register("PanoramaImage", typeof(ImageSource), typeof(PanoramaViewer), new PropertyMetadata(
- null, new PropertyChangedCallback(OnPanoramaImageChanged)));
-
- internal static void OnPanoramaImageChanged(Object sender, DependencyPropertyChangedEventArgs e)
- {
- PanoramaViewer Viewer = ((PanoramaViewer) sender);
- ImageBrush PanoramaBrush = new ImageBrush(Viewer.PanoramaImage);
- Viewer.PanoramaGeometry.BackMaterial = new DiffuseMaterial(PanoramaBrush);
- }
-
- #region Rotation
-
- static private readonly Vector3D AxisX = new Vector3D(1, 0, 0);
- static private readonly Vector3D AxisY = new Vector3D(0, 1, 0);
- static private readonly Vector3D AxisZ = new Vector3D(0, 0, 1);
-
- public static readonly DependencyProperty RotationXProperty =
- DependencyProperty.Register("RotationX", typeof(double), typeof(PanoramaViewer), new UIPropertyMetadata(0.0, (d, args) => ((PanoramaViewer) d).UpdateRotation()));
- public static readonly DependencyProperty RotationYProperty =
- DependencyProperty.Register("RotationY", typeof(double), typeof(PanoramaViewer), new UIPropertyMetadata(0.0, (d, args) => ((PanoramaViewer) d).UpdateRotation()));
- public static readonly DependencyProperty RotationZProperty =
- DependencyProperty.Register("RotationZ", typeof(double), typeof(PanoramaViewer), new UIPropertyMetadata(0.0, (d, args) => ((PanoramaViewer) d).UpdateRotation()));
-
-
- public double RotationX
- {
- get
- {
- return (double) GetValue(RotationXProperty);
- }
- set
- {
- SetValue(RotationXProperty, value);
- }
- }
-
- public double RotationY
- {
- get
- {
- return (double) GetValue(RotationYProperty);
- }
- set
- {
- SetValue(RotationYProperty, value);
- }
- }
-
- public double RotationZ
- {
- get
- {
- return (double) GetValue(RotationZProperty);
- }
- set
- {
- SetValue(RotationZProperty, value);
- }
- }
-
- private void UpdateRotation()
- {
- Quaternion qx = new Quaternion(AxisX, RotationX);
- Quaternion qy = new Quaternion(AxisY, RotationY);
- Quaternion qz = new Quaternion(AxisZ, RotationZ);
- PanoramaRotation.Quaternion = qx * qy * qz;
- }
-
- QuaternionRotation3D PanoramaRotation
- {
- get;
- set;
- }
- #endregion
-
- public PanoramaViewer()
- {
- InitializeViewer();
- }
-
- public ModelVisual3D PanoramaObject
- {
- get;
- set;
- }
- public GeometryModel3D PanoramaGeometry
- {
- get;
- set;
- }
-
- public void InitializeViewer()
- {
- ///////////////////////////////////////////
- // Camera Initialize
- ///////////////////////////////////////////
- PerspectiveCamera PanoramaCamera = new PerspectiveCamera();
- PanoramaCamera.Position = new Point3D(0, -0.0, 0);
- PanoramaCamera.UpDirection = new Vector3D(0, 1, 0);
- PanoramaCamera.LookDirection = new Vector3D(0, 0, 1);
- PanoramaCamera.FieldOfView = 80;
- this.Camera = PanoramaCamera;
-
- FieldOfView = 80;
-
- ///////////////////////////////////////////
- // Light Initialize
- ///////////////////////////////////////////
- ModelVisual3D LightModel = new ModelVisual3D();
- LightModel.Content = new DirectionalLight(Colors.White, new Vector3D(0, 0, 1));
- this.Children.Add(LightModel);
-
- ///////////////////////////////////////////
- // Panorama Object Initialize
- ///////////////////////////////////////////
-
- PanoramaObject = new ModelVisual3D();
- PanoramaGeometry = new GeometryModel3D();
- PanoramaGeometry.Geometry = CreateGeometry();
- PanoramaObject.Content = PanoramaGeometry;
-
- RotateTransform3D RotateTransform = new RotateTransform3D();
-
- double x = 1.0;
- ScaleTransform3D ScaleTransform = new ScaleTransform3D()
- {
- ScaleX = x*1,
- ScaleY = x*1.65,
- ScaleZ = x*1
- };
-
- Transform3DGroup Group = new Transform3DGroup();
- PanoramaRotation = new QuaternionRotation3D();
- Group.Children.Add(ScaleTransform);
- Group.Children.Add(RotateTransform);
-
- RotateTransform.Rotation = PanoramaRotation;
- PanoramaObject.Transform = Group;
-
- this.Children.Add(PanoramaObject);
- }
-
- private Geometry3D CreateGeometry()
- {
- int tDiv = 64;
- int yDiv = 64;
- double maxTheta = (360.0 / 180.0) * Math.PI;
- double minY = -1.0;
- double maxY = 1.0;
-
- double dt = maxTheta / tDiv;
- double dy = (maxY - minY) / yDiv;
-
- MeshGeometry3D mesh = new MeshGeometry3D();
-
- for(int yi = 0; yi <= yDiv; yi++)
- {
- double y = minY + yi * dy;
-
- for(int ti = 0; ti <= tDiv; ti++)
- {
- double t = ti * dt;
-
- mesh.Positions.Add(GetPosition(t, y));
- mesh.Normals.Add(GetNormal(t, y));
- mesh.TextureCoordinates.Add(GetTextureCoordinate(t, y));
- }
- }
-
- for(int yi = 0; yi < yDiv; yi++)
- {
- for(int ti = 0; ti < tDiv; ti++)
- {
- int x0 = ti;
- int x1 = (ti + 1);
- int y0 = yi * (tDiv + 1);
- int y1 = (yi + 1) * (tDiv + 1);
-
- mesh.TriangleIndices.Add(x0 + y0);
- mesh.TriangleIndices.Add(x0 + y1);
- mesh.TriangleIndices.Add(x1 + y0);
-
- mesh.TriangleIndices.Add(x1 + y0);
- mesh.TriangleIndices.Add(x0 + y1);
- mesh.TriangleIndices.Add(x1 + y1);
- }
- }
-
- mesh.Freeze();
- return mesh;
- }
-
- internal Point3D GetPosition(double t, double y)
- {
- double r = Math.Sqrt(1 - y * y);
- double x = r * Math.Cos(t);
- double z = r * Math.Sin(t);
-
- return new Point3D(x, y, z);
- }
-
- private Vector3D GetNormal(double t, double y)
- {
- return (Vector3D) GetPosition(t, y);
- }
-
- private Point GetTextureCoordinate(double t, double y)
- {
- Matrix TYtoUV = new Matrix();
- TYtoUV.Scale(1 / (2 * Math.PI), -0.5);
-
- Point p = new Point(t, y);
- p = p * TYtoUV;
-
- return p;
- }
- }
-}
diff --git a/Testing/Demo.StreetView/Properties/AssemblyInfo.cs b/Testing/Demo.StreetView/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/Demo.StreetView/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Street-WpfApplication")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Street-WpfApplication")]
-[assembly: AssemblyCopyright("Copyright © 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/Demo.StreetView/Properties/Resources.Designer.cs b/Testing/Demo.StreetView/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Testing/Demo.StreetView/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Demo.StreetView.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Demo.StreetView.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Testing/Demo.StreetView/Properties/Resources.resx b/Testing/Demo.StreetView/Properties/Resources.resx
deleted file mode 100644
--- a/Testing/Demo.StreetView/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Testing/Demo.StreetView/Properties/Settings.Designer.cs b/Testing/Demo.StreetView/Properties/Settings.Designer.cs
deleted file mode 100644
--- a/Testing/Demo.StreetView/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Demo.StreetView.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Testing/Demo.StreetView/Properties/Settings.settings b/Testing/Demo.StreetView/Properties/Settings.settings
deleted file mode 100644
--- a/Testing/Demo.StreetView/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/Demo.StreetView/Window1.xaml b/Testing/Demo.StreetView/Window1.xaml
deleted file mode 100644
--- a/Testing/Demo.StreetView/Window1.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
diff --git a/Testing/Demo.StreetView/Window1.xaml.cs b/Testing/Demo.StreetView/Window1.xaml.cs
deleted file mode 100644
--- a/Testing/Demo.StreetView/Window1.xaml.cs
+++ /dev/null
@@ -1,282 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.IO;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-
-namespace Demo.StreetView
-{
- ///
- /// Interaction logic for Window1.xaml
- ///
- public partial class Window1 : Window
- {
- BackgroundWorker loader = new BackgroundWorker();
- StackPanel buff = new StackPanel();
-
- public Window1()
- {
- InitializeComponent();
- Viewer.MouseLeftButtonDown += new MouseButtonEventHandler(Viewer_MouseLeftButtonDown);
- Viewer.MouseMove += new MouseEventHandler(Viewer_MouseMove);
-
- buff.Orientation = Orientation.Vertical;
-
- // removes white lines between tiles!
- SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
-
- loader.DoWork += new DoWorkEventHandler(loader_DoWork);
- loader.ProgressChanged += new ProgressChangedEventHandler(loader_ProgressChanged);
- loader.RunWorkerCompleted += new RunWorkerCompletedEventHandler(loader_RunWorkerCompleted);
- loader.WorkerReportsProgress = true;
- }
-
- void loader_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- buff.UpdateLayout();
-
- Canvas canvas = new Canvas();
- canvas.Children.Add(buff);
- canvas.Width = 512 * 13;
- canvas.Height = 512 * 7;
-
- canvas.UpdateLayout();
-
- canvas.Measure(new Size((int)canvas.Width, (int)canvas.Height));
- canvas.Arrange(new Rect(new Size((int)canvas.Width, (int)canvas.Height)));
- int Height = ((int)(canvas.ActualHeight));
- int Width = ((int)(canvas.ActualWidth));
-
- RenderTargetBitmap _RenderTargetBitmap = new RenderTargetBitmap(Width, Height, 96, 96, PixelFormats.Pbgra32);
- _RenderTargetBitmap.Render(buff);
-
- Image img = new Image();
- img.Source = _RenderTargetBitmap;
-
- Viewer.PanoramaImage = _RenderTargetBitmap;
-
- Title = "Demo.StreetView, enjoy! ;}";
- }
-
- Vector RotationVector = new Vector();
- Point DownPoint = new Point();
- void Viewer_MouseMove(object sender, MouseEventArgs e)
- {
- if(e.LeftButton == MouseButtonState.Released)
- return;
- Vector Offset = Point.Subtract(e.GetPosition(Viewer), DownPoint) * 0.25;
-
- Viewer.RotationY = RotationVector.Y + Offset.X;
- Viewer.RotationX = RotationVector.X - Offset.Y;
- }
-
- void Viewer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- DownPoint = e.GetPosition(Viewer);
- RotationVector.X = Viewer.RotationX;
- RotationVector.Y = Viewer.RotationY;
- Cursor = Cursors.SizeAll;
- }
-
- private void Viewer_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- Cursor = Cursors.Arrow;
- }
-
- void loader_ProgressChanged(object sender, ProgressChangedEventArgs e)
- {
- if(e.ProgressPercentage == 100)
- {
- Pass p = e.UserState as Pass;
-
- Title = "Demo.StreetView, please wait on first time loading: " + p.X + "|" + p.Y + " of 13";
- Image i = new Image();
-
- i.Source = p.src;
- (buff.Children[buff.Children.Count - 1] as StackPanel).Children.Add(i);
- }
- else if(e.ProgressPercentage == 0)
- {
- Title = "Demo.StreetView, please wait on first time loading: zooming...";
-
- StackPanel ph = new StackPanel();
- ph.Orientation = Orientation.Horizontal;
- buff.Children.Add(ph);
- }
- }
-
- void loader_DoWork(object sender, DoWorkEventArgs e)
- {
- string panoId = "4fe6hEN9GJC6thoQBcgv0Q";
- int zoom = 4;
-
- //0, 1
- //1, 2
- //2, 4
- //3, 7
- //4, 13
- //5, 26
-
- for(int y = 0; y <= zoom + 1; y++)
- {
- loader.ReportProgress(0);
-
- for(int x = 0; x < 13; x++)
- {
- Pass p = new Pass();
- p.Y = y;
- p.X = x;
-
- string fl = "Tiles\\" + zoom + "\\" + panoId + "\\img_" + x + "_" + y + ".jpg";
- string dr = System.IO.Path.GetDirectoryName(fl);
- if(!Directory.Exists(dr))
- {
- Directory.CreateDirectory(dr);
- }
- if(!File.Exists(fl))
- {
- ImageSource src = Get(string.Format("http://cbk{0}.{5}/cbk?output=tile&panoid={1}&zoom={2}&x={3}&y={4}&cb_client=maps_sv", (x + 2 * y) % 3, panoId, zoom, x, y, GMap.NET.MapProviders.GoogleMapProvider.Instance.Server));
- p.src = src;
- SaveImg(src, fl);
- }
- else
- {
- using(Stream s = File.OpenRead(fl))
- {
- p.src = FromStream(s);
- }
- }
-
- loader.ReportProgress(100, p);
- }
- }
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
- GC.Collect();
- }
-
- void SaveImg(ImageSource src, string file)
- {
- using(Stream s = File.OpenWrite(file))
- {
- JpegBitmapEncoder e = new JpegBitmapEncoder();
- e.Frames.Add(BitmapFrame.Create(src as BitmapSource));
- e.Save(s);
- }
- }
-
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- loader.RunWorkerAsync();
- }
-
- public Stream CopyStream(Stream inputStream)
- {
- const int readSize = 256;
- byte[] buffer = new byte[readSize];
- MemoryStream ms = new MemoryStream();
-
- using(inputStream)
- {
- int count = inputStream.Read(buffer, 0, readSize);
- while(count > 0)
- {
- ms.Write(buffer, 0, count);
- count = inputStream.Read(buffer, 0, readSize);
- }
- }
- buffer = null;
- ms.Seek(0, SeekOrigin.Begin);
- return ms;
- }
-
- ImageSource FromStream(Stream stream)
- {
- ImageSource ret = null;
- if(stream != null)
- {
- {
- // try png decoder
- try
- {
- JpegBitmapDecoder bitmapDecoder = new JpegBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
- ImageSource m = bitmapDecoder.Frames[0];
-
- if(m != null)
- {
- ret = m;
- }
- }
- catch
- {
- ret = null;
- }
-
- // try jpeg decoder
- if(ret == null)
- {
- try
- {
- stream.Seek(0, SeekOrigin.Begin);
-
- PngBitmapDecoder bitmapDecoder = new PngBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
- ImageSource m = bitmapDecoder.Frames[0];
-
- if(m != null)
- {
- ret = m;
- }
- }
- catch
- {
- ret = null;
- }
- }
- }
- }
- return ret;
- }
-
- ImageSource Get(string url)
- {
- ImageSource ret = null;
- try
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
- request.ServicePoint.ConnectionLimit = 50;
- request.Proxy = WebRequest.DefaultWebProxy;
-
- request.UserAgent = "Opera/9.62 (Windows NT 5.1; U; en) Presto/2.1.1";
- request.Timeout = 10 * 1000;
- request.ReadWriteTimeout = request.Timeout * 6;
- request.Referer = string.Format("http://maps.{0}/", GMap.NET.MapProviders.GoogleMapProvider.Instance.Server);
- request.KeepAlive = true;
-
- using(HttpWebResponse response = request.GetResponse() as HttpWebResponse)
- {
- using(Stream responseStream = CopyStream(response.GetResponseStream()))
- {
- ret = FromStream(responseStream);
- }
- }
- }
- catch(Exception)
- {
- ret = null;
- }
- return ret;
- }
- }
-
- class Pass
- {
- public ImageSource src;
- public int Y;
- public int X;
- }
-}
diff --git a/Testing/TemplatedBinding/App.xaml b/Testing/TemplatedBinding/App.xaml
deleted file mode 100644
--- a/Testing/TemplatedBinding/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Testing/TemplatedBinding/App.xaml.cs b/Testing/TemplatedBinding/App.xaml.cs
deleted file mode 100644
--- a/Testing/TemplatedBinding/App.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace TemplatedBinding
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/Testing/TemplatedBinding/Properties/AssemblyInfo.cs b/Testing/TemplatedBinding/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/TemplatedBinding/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("TemplatedBinding")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("TemplatedBinding")]
-[assembly: AssemblyCopyright("Copyright © 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/TemplatedBinding/Properties/Resources.Designer.cs b/Testing/TemplatedBinding/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Testing/TemplatedBinding/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.20506.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace TemplatedBinding.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TemplatedBinding.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Testing/TemplatedBinding/Properties/Resources.resx b/Testing/TemplatedBinding/Properties/Resources.resx
deleted file mode 100644
--- a/Testing/TemplatedBinding/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Testing/TemplatedBinding/Properties/Settings.Designer.cs b/Testing/TemplatedBinding/Properties/Settings.Designer.cs
deleted file mode 100644
--- a/Testing/TemplatedBinding/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.20506.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace TemplatedBinding.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Testing/TemplatedBinding/Properties/Settings.settings b/Testing/TemplatedBinding/Properties/Settings.settings
deleted file mode 100644
--- a/Testing/TemplatedBinding/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/TemplatedBinding/TemplatedBinding.csproj b/Testing/TemplatedBinding/TemplatedBinding.csproj
deleted file mode 100644
--- a/Testing/TemplatedBinding/TemplatedBinding.csproj
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {C7CD6A76-D941-493F-91F8-6222AB87BECA}
- WinExe
- Properties
- TemplatedBinding
- TemplatedBinding
- v3.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- 3.5
-
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\x86\Debug\TemplatedBinding.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- false
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\x86\Release\TemplatedBinding.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
-
-
- 3.5
-
-
- 3.5
-
-
- 3.5
-
-
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- Window1.xaml
- Code
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {644FE7D4-0184-400F-B2D7-99CB41360658}
- GMap.NET.WindowsPresentation
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/TemplatedBinding/Window1.xaml b/Testing/TemplatedBinding/Window1.xaml
deleted file mode 100644
--- a/Testing/TemplatedBinding/Window1.xaml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Testing/TemplatedBinding/Window1.xaml.cs b/Testing/TemplatedBinding/Window1.xaml.cs
deleted file mode 100644
--- a/Testing/TemplatedBinding/Window1.xaml.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Windows;
-using GMap.NET.WindowsPresentation;
-using GMap.NET.MapProviders;
-
-namespace TemplatedBinding
-{
- class MapArr : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- void OnPropertyChanged(string name)
- {
- if(PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(name));
- }
- }
-
- GMapControl map;
- public GMapControl Map
- {
- get
- {
- return map;
- }
- set
- {
- map = value;
- OnPropertyChanged("Map");
- }
- }
-
- string location;
- public string Location
- {
- get
- {
- return location;
- }
- set
- {
- location = value;
- OnPropertyChanged("Location");
- }
- }
-
- public MapArr(GMapControl m, string location)
- {
- Map = m;
- Location = location;
-
- Map.SetCurrentPositionByKeywords(Location);
- }
- }
-
- ///
- /// Interaction logic for Window1.xaml
- ///
- public partial class Window1 : Window
- {
- public Window1()
- {
- InitializeComponent();
-
- ObservableCollection mapCtrl = new ObservableCollection();
-
- // 1
- {
- GMapControl map = new GMapControl();
- map.MapProvider = GMapProviders.OpenStreetMap;
- map.MinZoom = 4;
- map.MaxZoom = map.MinZoom + 3;
- map.Zoom = map.MinZoom;
- mapCtrl.Add(new MapArr(map, "Holand"));
- }
-
- // 2
- {
- GMapControl map = new GMapControl();
- map.MapProvider = GMapProviders.OpenStreetMap;
- map.MinZoom = 4;
- map.MaxZoom = map.MinZoom + 3;
- map.Zoom = map.MinZoom;
- mapCtrl.Add(new MapArr(map, "New York"));
- }
-
- // 3
- {
- GMapControl map = new GMapControl();
- map.MapProvider = GMapProviders.OpenStreetMap;
- map.MinZoom = 4;
- map.MaxZoom = map.MinZoom + 3;
- map.Zoom = map.MinZoom;
- mapCtrl.Add(new MapArr(map, "Lithuania"));
- }
-
- // main
- UserMap.MapProvider = GMapProviders.GoogleMap;
- UserMap.MinZoom = 5;
- UserMap.MaxZoom = 13;
- UserMap.Zoom = 5;
- UserMap.SetCurrentPositionByKeywords("Leuven");
-
- // add all maps
- locations.ItemsSource = mapCtrl;
- }
- }
-}
diff --git a/Testing/WPF-GMapControlNew/App.xaml b/Testing/WPF-GMapControlNew/App.xaml
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Testing/WPF-GMapControlNew/App.xaml.cs b/Testing/WPF-GMapControlNew/App.xaml.cs
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/App.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace WpfApplication1
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/Testing/WPF-GMapControlNew/GMapControlNew.xaml b/Testing/WPF-GMapControlNew/GMapControlNew.xaml
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/GMapControlNew.xaml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
diff --git a/Testing/WPF-GMapControlNew/GMapControlNew.xaml.cs b/Testing/WPF-GMapControlNew/GMapControlNew.xaml.cs
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/GMapControlNew.xaml.cs
+++ /dev/null
@@ -1,1323 +0,0 @@
-
-namespace GMap.NET.WindowsPresentation
-{
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Globalization;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Media.Effects;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- using GMap.NET;
- using GMap.NET.Internals;
-
- ///
- /// GMap.NET control for Windows Presentation
- /// >> for testing purpose only >>
- ///
- [ToolboxItem(false)]
- public partial class GMapControlNew : UserControl, Interface
- {
- readonly Core Core = new Core();
- GRect region = new GRect();
- bool RaiseEmptyTileError = false;
- delegate void MethodInvoker();
- PointLatLng selectionStart;
- PointLatLng selectionEnd;
- Typeface tileTypeface = new Typeface("Arial");
- double zoomReal;
- bool showTileGridLines = false;
-
- FormattedText googleCopyright;
- FormattedText yahooMapCopyright;
- FormattedText virtualEarthCopyright;
- FormattedText openStreetMapCopyright;
- FormattedText arcGisMapCopyright;
-
- ///
- /// pen for empty tile borders
- ///
- public Pen EmptyTileBorders = new Pen(Brushes.White, 1.0);
-
- ///
- /// pen for Selection
- ///
- public Pen SelectionPen = new Pen(Brushes.Blue, 3.0);
-
- ///
- /// ///
- /// pen for empty tile background
- ///
- public Brush EmptytileBrush = Brushes.Navy;
-
- ///
- /// occurs on empty tile displayed
- ///
- public event EmptyTileError OnEmptyTileError;
-
- ///
- /// text on empty tiles
- ///
- public FormattedText EmptyTileText = new FormattedText("We are sorry, but we don't\nhave imagery at this zoom\n level for this region.", System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("Arial"), 16, Brushes.White);
-
- ///
- /// max zoom
- ///
- public int MaxZoom = 2;
-
- ///
- /// min zoom
- ///
- public int MinZoom = 2;
-
- ///
- /// map zooming type for mouse wheel
- ///
- public MouseWheelZoomType MouseWheelZoomType = MouseWheelZoomType.MousePositionAndCenter;
-
- ///
- /// center mouse OnMouseWheel
- ///
- public bool CenterPositionOnMouseWheel = true;
-
- ///
- /// map dragg button
- ///
- public MouseButton DragButton = MouseButton.Right;
-
- ///
- /// zoom increment on mouse wheel
- ///
- public double ZoomIncrement = 1.0;
-
- ///
- /// shows tile gridlines
- ///
- [Category("GMap.NET")]
- public bool ShowTileGridLines
- {
- get
- {
- return showTileGridLines;
- }
- set
- {
- showTileGridLines = value;
- InvalidateVisual();
- }
- }
-
- ///
- /// current selected area in map
- ///
- private RectLatLng selectedArea;
-
- [Browsable(false)]
- public RectLatLng SelectedArea
- {
- get
- {
- return selectedArea;
- }
- set
- {
- selectedArea = value;
- InvalidateVisual();
- }
- }
-
- ///
- /// map boundaries
- ///
- public RectLatLng? BoundsOfMap = null;
-
- ///
- /// list of markers
- ///
- public readonly ObservableCollection Markers = new ObservableCollection();
-
- ///
- /// current map transformation
- ///
- internal Transform MapRenderTransform;
-
- ///
- /// current markers overlay offset
- ///
- internal TranslateTransform MapTranslateTransform = new TranslateTransform();
-
- ///
- /// map zoom
- ///
- [Category("GMap.NET")]
- public double Zoom
- {
- get
- {
- return zoomReal;
- }
- set
- {
- if(zoomReal != value)
- {
- if(value > MaxZoom)
- {
- zoomReal = MaxZoom;
- }
- else
- if(value < MinZoom)
- {
- zoomReal = MinZoom;
- }
- else
- {
- zoomReal = value;
- }
-
- double remainder = (double) System.Decimal.Remainder((Decimal) value, (Decimal) 1);
- if(remainder != 0)
- {
- double scaleValue = remainder + 1;
- {
- MapRenderTransform = new ScaleTransform(scaleValue, scaleValue, ActualWidth / 2, ActualHeight / 2);
- }
-
- if(IsLoaded)
- {
- //DisplayZoomInFadeImage();
- }
-
- ZoomStep = Convert.ToInt32(value - remainder);
-
- Core_OnMapZoomChanged();
-
- InvalidateVisual();
- }
- else
- {
- MapRenderTransform = null;
- ZoomStep = Convert.ToInt32(value);
- InvalidateVisual();
- }
- }
- }
- }
-
- protected bool DesignModeInConstruct
- {
- get
- {
- //Are we in Visual Studio Designer?
- return System.ComponentModel.DesignerProperties.GetIsInDesignMode(this);
- }
- }
-
- Canvas mapCanvas = null;
-
- ///
- /// markers overlay
- ///
- internal Canvas MapCanvas
- {
- get
- {
- if(mapCanvas == null)
- {
- // if(ObjectsLayer.VisualChildrenCount > 0)
- {
- Border border = VisualTreeHelper.GetChild(ObjectsLayer, 0) as Border;
- ItemsPresenter items = border.Child as ItemsPresenter;
- DependencyObject target = VisualTreeHelper.GetChild(items, 0);
- mapCanvas = target as Canvas;
- }
- }
-
- return mapCanvas;
- }
- }
-
- public GMaps Manager
- {
- get
- {
- return GMaps.Instance;
- }
- }
-
- public GMapControlNew()
- {
- InitializeComponent();
-
- if(!DesignModeInConstruct)
- {
- ObjectsLayer.ItemsSource = Markers;
-
- // removes white lines between tiles!
- SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Unspecified);
-
- // set image proxy
- Manager.ImageProxy = new WindowsPresentationImageProxy();
-
- //Core.RenderMode = GMap.NET.RenderMode.WPF;
- //Core.OnNeedInvalidation += new NeedInvalidation(Core_OnNeedInvalidation);
- //Core.OnMapZoomChanged += new MapZoomChanged(Core_OnMapZoomChanged);
-
- Loaded += new RoutedEventHandler(GMapControl_Loaded);
- Unloaded += new RoutedEventHandler(GMapControl_Unloaded);
-
- googleCopyright = new FormattedText(Core.googleCopyright, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("GenericSansSerif"), 9, Brushes.Navy);
- yahooMapCopyright = new FormattedText(Core.yahooMapCopyright, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("GenericSansSerif"), 9, Brushes.Navy);
- virtualEarthCopyright = new FormattedText(Core.virtualEarthCopyright, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("GenericSansSerif"), 9, Brushes.Navy);
- openStreetMapCopyright = new FormattedText(Core.openStreetMapCopyright, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("GenericSansSerif"), 9, Brushes.Navy);
- arcGisMapCopyright = new FormattedText(Core.arcGisCopyright, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("GenericSansSerif"), 9, Brushes.Navy);
-
- MapType = MapType.GoogleMap;
-
- OpacityAnimation = CreateOpacityAnimation(1);
- ZoomAnimation = CreateZoomAnimation(2);
- MoveAnimation = CreateMoveAnimation(2);
- }
- }
-
- DoubleAnimation CreateZoomAnimation(double toValue)
- {
- var da = new DoubleAnimation(toValue, new Duration(TimeSpan.FromMilliseconds(555)));
- da.AccelerationRatio = 0.1;
- da.DecelerationRatio = 0.9;
- da.FillBehavior = FillBehavior.HoldEnd;
- da.Freeze();
- return da;
- }
-
- DoubleAnimation CreateMoveAnimation(double toValue)
- {
- var da = new DoubleAnimation(toValue, new Duration(TimeSpan.FromMilliseconds(555)));
- da.AccelerationRatio = 0.1;
- da.DecelerationRatio = 0.9;
- da.FillBehavior = FillBehavior.HoldEnd;
- da.Freeze();
- return da;
- }
-
- DoubleAnimation CreateOpacityAnimation(double toValue)
- {
- var da = new DoubleAnimation(toValue, new Duration(TimeSpan.FromMilliseconds(555)));
- da.AccelerationRatio = 0.5;
- da.DecelerationRatio = 0.5;
- da.FillBehavior = FillBehavior.HoldEnd;
- da.Freeze();
- return da;
- }
-
- void BeginAnimateOpacity(TileVisual target)
- {
- target.Opacity = 0.4;
- target.BeginAnimation(TileVisual.OpacityProperty, OpacityAnimation, HandoffBehavior.Compose);
- }
-
- void BeginAnimateZoom(TileVisual target)
- {
- //target.TranslateTransform.BeginAnimation(TranslateTransform.XProperty, MoveAnimation, HandoffBehavior.Compose);
- //target.TranslateTransform.BeginAnimation(TranslateTransform.YProperty, MoveAnimation, HandoffBehavior.Compose);
- //target.ScaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, ZoomAnimation, HandoffBehavior.Compose);
- //target.ScaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, ZoomAnimation, HandoffBehavior.Compose);
- }
-
- DoubleAnimation OpacityAnimation;
- DoubleAnimation ZoomAnimation;
- DoubleAnimation MoveAnimation;
-
- QuadTree QuadTree = new QuadTree();
-
- bool update = true;
- Dictionary images = new Dictionary();
- System.Windows.Size TilesSize = new System.Windows.Size();
-
- Stopwatch _stopwatch = new Stopwatch();
- ushort _frameCounter;
- ushort _frameCounterUpdate;
- int count = 0;
-
- protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
- {
- base.OnRenderSizeChanged(sizeInfo);
-
- {
- System.Windows.Size constraint = sizeInfo.NewSize;
- region = new GRect(-50, -50, (int) constraint.Width + 100, (int) constraint.Height + 100);
-
- TilesLayer.Width = sizeInfo.NewSize.Width;
- TilesLayer.Height = sizeInfo.NewSize.Height;
-
- QuadTree.Bounds = new Rect(sizeInfo.NewSize);
- }
-
- //var sizeInPx = Projection.GetTileMatrixSizePixel(ZoomStep);
- //TilesLayer.Width = sizeInPx.Width;
- //TilesLayer.Height = sizeInPx.Height;
-
- if(IsLoaded)
- {
- Refresh();
- }
- }
-
- void CompositionTargetEx_FrameUpdating(object sender, RenderingEventArgs e)
- {
- if(update)
- {
- _frameCounterUpdate++;
- update = false;
-
- #region -- add image --
- for(int x = 0; x < TilesSize.Width; x++)
- {
- for(int y = 0; y < TilesSize.Height; y++)
- {
- var rawTile = new RawTile(MapType.GoogleHybrid, new GPoint(x, y), ZoomStep);
- var rectTilePx = new Rect(x*Projection.TileSize.Width, y*Projection.TileSize.Height, Projection.TileSize.Width, Projection.TileSize.Height);
-
- TileVisual image = null;
- if(!images.TryGetValue(rawTile, out image))
- {
- var layers = GMaps.Instance.GetAllLayersOfType(rawTile.Type);
-
- ImageSource[] imgs = new ImageSource[layers.Length];
-
- // get tiles
- for(int i = 0; i < layers.Length; i++)
- {
- Exception ex;
- var res = GMaps.Instance.GetImageFrom(layers[i], rawTile.Pos, rawTile.Zoom, out ex) as WindowsPresentationImage;
- if(res != null)
- {
- imgs[i] = res.Img;
- }
- }
-
- // combine visual
- image = new TileVisual(imgs, rawTile);
- images.Add(rawTile, image);
-
- Canvas.SetZIndex(image, -1);
- }
-
- bool ri = (region.IntersectsWith(new GRect((int) (rectTilePx.X + renderOffset.X), (int) (rectTilePx.Y + renderOffset.Y), (int) rectTilePx.Width, (int) rectTilePx.Height)));
- if(TilesLayer.Children.Contains(image))
- {
- if(ri)
- {
- image.MoveTo(Math.Round(rectTilePx.X) + 0.6 + renderOffset.X, Math.Round(rectTilePx.Y) + 0.6 + renderOffset.Y);
- }
- else
- {
- TilesLayer.Children.Remove(image);
- }
- }
- else
- {
- if(ri)
- {
- image.MoveTo(Math.Round(rectTilePx.X) + 0.6 + renderOffset.X, Math.Round(rectTilePx.Y) + 0.6 + renderOffset.Y);
- BeginAnimateOpacity(image);
- {
- TilesLayer.Children.Add(image);
- }
- }
- }
- //break;
- }
- //break;
- }
-
- count = TilesLayer.Children.Count;
-
- #endregion
- }
-
- if(_stopwatch.ElapsedMilliseconds >= 1000)
- {
- _stopwatch.Stop();
-
- perfInfo.Text = "FPS: " + (ushort) (_frameCounter/_stopwatch.Elapsed.TotalSeconds) + " | " + (ushort) (_frameCounterUpdate/_stopwatch.Elapsed.TotalSeconds) + " | " + count + " tiles";
-
- _frameCounter = 0;
- _frameCounterUpdate = 0;
- _stopwatch.Reset();
- _stopwatch.Start();
- }
- else
- {
- _frameCounter++;
- }
- }
-
- void GMapControl_Loaded(object sender, RoutedEventArgs e)
- {
- CompositionTargetEx.FrameUpdating += new EventHandler(CompositionTargetEx_FrameUpdating);
- _stopwatch.Start();
-
- Refresh();
-
- //Core.StartSystem();
- //Core_OnMapZoomChanged();
- }
-
- void GMapControl_Unloaded(object sender, RoutedEventArgs e)
- {
- CompositionTargetEx.FrameUpdating -= new EventHandler(CompositionTargetEx_FrameUpdating);
- _stopwatch.Stop();
-
- //Core.OnMapClose();
- }
-
- private void Refresh()
- {
- update = true;
- InvalidateVisual();
- }
-
- //rotected override System.Windows.Size ArrangeOverride(System.Windows.Size finalSize)
- ///
- //MapBase parentMap = this.ParentMap;
- //foreach(UIElement element in base.Children)
- //{
- // Rect finalRect = new Rect(0.0, 0.0, parentMap.ViewportSize.Width, parentMap.ViewportSize.Height);
- // LocationRect positionRectangle = GetPositionRectangle(element);
- // if(positionRectangle != null)
- // {
- // finalRect = parentMap.Mode.LocationToViewportPoint(positionRectangle);
- // }
- // else
- // {
- // Point point;
- // Location position = GetPosition(element);
- // if((position != null) && parentMap.TryLocationToViewportPoint(position, out point))
- // {
- // PositionOrigin positionOrigin = GetPositionOrigin(element);
- // point.X -= positionOrigin.X * element.DesiredSize.Width;
- // point.Y -= positionOrigin.Y * element.DesiredSize.Height;
- // finalRect = new Rect(point.X, point.Y, element.DesiredSize.Width, element.DesiredSize.Height);
- // }
- // }
- // Point positionOffset = GetPositionOffset(element);
- // finalRect.X += positionOffset.X;
- // finalRect.Y += positionOffset.Y;
- // element.Arrange(finalRect);
- //}
- //return parentMap.ViewportSize;
- //
-
- //protected override Size MeasureOverride(Size availableSize)
- //{
- // MapBase parentMap = this.ParentMap;
- // Guid lastProjectPassTag = this.lastProjectPassTag;
- // this.lastProjectPassTag = Guid.NewGuid();
- // foreach(UIElement element in base.Children)
- // {
- // IProjectable projectable = element as IProjectable;
- // if(projectable != null)
- // {
- // ProjectionUpdateLevel pendingUpdate = this.pendingUpdate;
- // if(((Guid) element.GetValue(ProjectionUpdatedTag)) != lastProjectPassTag)
- // {
- // pendingUpdate = ProjectionUpdateLevel.Full;
- // }
- // if(pendingUpdate != ProjectionUpdateLevel.None)
- // {
- // projectable.ProjectionUpdated(pendingUpdate);
- // }
- // element.SetValue(ProjectionUpdatedTag, this.lastProjectPassTag);
- // }
- // }
- // this.pendingUpdate = ProjectionUpdateLevel.None;
- // foreach(UIElement element2 in base.Children)
- // {
- // LocationRect positionRectangle = GetPositionRectangle(element2);
- // if(positionRectangle != null)
- // {
- // Rect rect2 = parentMap.Mode.LocationToViewportPoint(positionRectangle);
- // element2.Measure(new Size(rect2.Width, rect2.Height));
- // }
- // else
- // {
- // if((element2 is ContentPresenter) && (VisualTreeHelper.GetChildrenCount(element2) > 0))
- // {
- // IProjectable child = VisualTreeHelper.GetChild(element2, 0) as IProjectable;
- // if(child != null)
- // {
- // child.ProjectionUpdated(ProjectionUpdateLevel.Full);
- // UIElement element3 = child as UIElement;
- // if(element3 != null)
- // {
- // element3.InvalidateMeasure();
- // }
- // }
- // }
- // element2.Measure(parentMap.ViewportSize);
- // }
- // }
- // return parentMap.ViewportSize;
- //}
-
- #region -- etc --
- void Core_OnMapZoomChanged()
- {
- //UpdateMarkersOffset();
-
- foreach(var i in Markers)
- {
- //i.ForceUpdateLocalPosition(this);
- }
-
- var routes = Markers.Where(p => p != null && p.Route.Count > 1);
- if(routes != null)
- {
- foreach(var i in routes)
- {
- //i.RegenerateRouteShape(this);
- }
- }
- }
-
- ///
- /// on core needs invalidation
- ///
- void Core_OnNeedInvalidation()
- {
- try
- {
- this.Dispatcher.BeginInvoke(DispatcherPriority.Render, new MethodInvoker(Refresh));
- }
- catch
- {
- }
- }
-
- ///
- /// updates markers overlay offset
- ///
- void UpdateMarkersOffset()
- {
- if(MapCanvas != null)
- {
- if(MapRenderTransform != null)
- {
- var tp = MapRenderTransform.Transform(new System.Windows.Point(Core.renderOffset.X, Core.renderOffset.Y));
- MapTranslateTransform.X = tp.X;
- MapTranslateTransform.Y = tp.Y;
- }
- else
- {
- MapTranslateTransform.X = Core.renderOffset.X;
- MapTranslateTransform.Y = Core.renderOffset.Y;
- }
-
- MapCanvas.RenderTransform = MapTranslateTransform;
- }
- }
-
- ///
- /// gets image of the current view
- ///
- ///
- public ImageSource ToImageSource()
- {
- FrameworkElement obj = this;
-
- // Save current canvas transform
- Transform transform = obj.LayoutTransform;
- obj.LayoutTransform = null;
-
- // fix margin offset as well
- Thickness margin = obj.Margin;
- obj.Margin = new Thickness(0, 0,
- margin.Right - margin.Left, margin.Bottom - margin.Top);
-
- // Get the size of canvas
- System.Windows.Size size = new System.Windows.Size(obj.ActualWidth, obj.ActualHeight);
-
- // force control to Update
- obj.Measure(size);
- obj.Arrange(new Rect(size));
-
- RenderTargetBitmap bmp = new RenderTargetBitmap(
- (int) size.Width, (int) size.Height, 96, 96, PixelFormats.Pbgra32);
-
- bmp.Render(obj);
-
- if(bmp.CanFreeze)
- {
- bmp.Freeze();
- }
-
- // return values as they were before
- obj.LayoutTransform = transform;
- obj.Margin = margin;
-
- return bmp;
- }
-
- ///
- /// creates path from list of points
- ///
- ///
- ///
- public Path CreateRoutePath(List localPath)
- {
- // Create a StreamGeometry to use to specify myPath.
- StreamGeometry geometry = new StreamGeometry();
-
- using(StreamGeometryContext ctx = geometry.Open())
- {
- ctx.BeginFigure(localPath[0], false, false);
-
- // Draw a line to the next specified point.
- ctx.PolyLineTo(localPath, true, true);
- }
-
- // Freeze the geometry (make it unmodifiable)
- // for additional performance benefits.
- geometry.Freeze();
-
- // Create a path to draw a geometry with.
- Path myPath = new Path();
- {
- // Specify the shape of the Path using the StreamGeometry.
- myPath.Data = geometry;
-
- BlurEffect ef = new BlurEffect();
- {
- ef.KernelType = KernelType.Gaussian;
- ef.Radius = 3.0;
- ef.RenderingBias = RenderingBias.Quality;
- }
-
- myPath.Effect = ef;
-
- myPath.Stroke = Brushes.Navy;
- myPath.StrokeThickness = 5;
- myPath.StrokeLineJoin = PenLineJoin.Round;
- myPath.StrokeStartLineCap = PenLineCap.Triangle;
- myPath.StrokeEndLineCap = PenLineCap.Square;
- myPath.Opacity = 0.6;
- }
- return myPath;
- }
-
- ///
- /// sets zoom to max to fit rect
- ///
- /// area
- ///
- public bool SetZoomToFitRect(RectLatLng rect)
- {
- int maxZoom = Core.GetMaxZoomToFitRect(rect);
- if(maxZoom > 0)
- {
- PointLatLng center = new PointLatLng(rect.Lat - (rect.HeightLat / 2), rect.Lng + (rect.WidthLng / 2));
- Position = center;
-
- if(maxZoom > MaxZoom)
- {
- maxZoom = MaxZoom;
- }
-
- if(ZoomStep != maxZoom)
- {
- Zoom = maxZoom;
- }
-
- return true;
- }
- return false;
- }
-
- ///
- /// sets to max zoom to fit all markers and centers them in map
- ///
- /// z index or null to check all
- ///
- public bool ZoomAndCenterMarkers(int? ZIndex)
- {
- RectLatLng? rect = GetRectOfAllMarkers(ZIndex);
- if(rect.HasValue)
- {
- return SetZoomToFitRect(rect.Value);
- }
-
- return false;
- }
-
- ///
- /// gets rectangle with all objects inside
- ///
- /// z index or null to check all
- ///
- public RectLatLng? GetRectOfAllMarkers(int? ZIndex)
- {
- RectLatLng? ret = null;
-
- double left = double.MaxValue;
- double top = double.MinValue;
- double right = double.MinValue;
- double bottom = double.MaxValue;
- IEnumerable Overlays;
-
- if(ZIndex.HasValue)
- {
- Overlays = Markers.Where(p => p != null && p.ZIndex == ZIndex);
- }
- else
- {
- Overlays = Markers;
- }
-
- if(Overlays != null)
- {
- foreach(var m in Overlays)
- {
- if(m.Shape != null && m.Shape.IsVisible)
- {
- // left
- if(m.Position.Lng < left)
- {
- left = m.Position.Lng;
- }
-
- // top
- if(m.Position.Lat > top)
- {
- top = m.Position.Lat;
- }
-
- // right
- if(m.Position.Lng > right)
- {
- right = m.Position.Lng;
- }
-
- // bottom
- if(m.Position.Lat < bottom)
- {
- bottom = m.Position.Lat;
- }
- }
- }
- }
-
- if(left != double.MaxValue && right != double.MinValue && top != double.MinValue && bottom != double.MaxValue)
- {
- ret = RectLatLng.FromLTRB(left, top, right, bottom);
- }
-
- return ret;
- }
- #endregion
-
- #region UserControl Events
-
- //double move;
- protected override void OnMouseWheel(MouseWheelEventArgs e)
- {
- base.OnMouseWheel(e);
-
- if(e.Delta > 0)
- {
- ZoomStep++;
-
- //ZoomAnimation = CreateZoomAnimation(ZoomStep);
-
- // move -= Projection.TileSize.Width;
- //MoveAnimation = CreateMoveAnimation(move);
- }
- else
- {
- ZoomStep--;
-
- //ZoomAnimation = CreateZoomAnimation(ZoomStep);
-
- //move += Projection.TileSize.Width;
- //MoveAnimation = CreateMoveAnimation(move);
- }
- //Refresh();
- }
-
- bool isSelected = false;
-
- System.Windows.Point? mouseDown = null;
- static readonly System.Windows.Point Empty = new System.Windows.Point();
-
- protected override void OnMouseDown(MouseButtonEventArgs e)
- {
- if(CanDragMap && e.ChangedButton == DragButton && e.ButtonState == MouseButtonState.Pressed)
- {
- mouseDown = e.GetPosition(TilesLayer);
-
- dragPoint.X = mouseDown.Value.X - renderOffset.X;
- dragPoint.Y = mouseDown.Value.Y - renderOffset.Y;
-
- Mouse.Capture(TilesLayer);
- }
-
- base.OnMouseDown(e);
- }
-
- protected override void OnMouseUp(MouseButtonEventArgs e)
- {
- base.OnMouseUp(e);
-
- mouseDown = null;
- Mouse.Capture(null);
- }
-
- System.Windows.Point renderOffset = new System.Windows.Point();
- System.Windows.Point dragPoint = new System.Windows.Point();
-
- protected override void OnMouseMove(MouseEventArgs e)
- {
- base.OnMouseMove(e);
-
- if(mouseDown.HasValue)
- {
- System.Windows.Point p = e.GetPosition(TilesLayer);
-
- //TileOffset.Y += p.Y - mouseDown.Value.Y;
- //TileOffset.X += p.X - mouseDown.Value.X;
-
- renderOffset.X = p.X - dragPoint.X;
- renderOffset.Y = p.Y - dragPoint.Y;
-
- Refresh();
- }
- }
-
- #endregion
-
- #region IGControl Members
-
- public void ReloadMap()
- {
- Core.ReloadMap();
- }
-
- public GeoCoderStatusCode SetCurrentPositionByKeywords(string keys)
- {
- GeoCoderStatusCode status = GeoCoderStatusCode.Unknow;
- PointLatLng? pos = Manager.GetLatLngFromGeocoder(keys, out status);
- if(pos.HasValue && status == GeoCoderStatusCode.G_GEO_SUCCESS)
- {
- Position = pos.Value;
- }
-
- return status;
- }
-
- public PointLatLng FromLocalToLatLng(int x, int y)
- {
- if(MapRenderTransform != null)
- {
- var tp = MapRenderTransform.Inverse.Transform(new System.Windows.Point(x, y));
- x = (int) tp.X;
- y = (int) tp.Y;
- }
-
- return Core.FromLocalToLatLng(x, y);
- }
-
- public GPoint FromLatLngToLocal(PointLatLng point)
- {
- GPoint ret = Core.FromLatLngToLocal(point);
-
- if(MapRenderTransform != null)
- {
- var tp = MapRenderTransform.Transform(new System.Windows.Point(ret.X, ret.Y));
- ret.X = (int) tp.X;
- ret.Y = (int) tp.Y;
- }
-
- if(MapTranslateTransform != null)
- {
- ret.Offset(-(int) MapTranslateTransform.X, -(int) MapTranslateTransform.Y);
- }
-
- return ret;
- }
-
- public bool ShowExportDialog()
- {
-#if SQLite
- if(Cache.Instance.ImageCache is GMap.NET.CacheProviders.SQLitePureImageCache)
- {
- Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
- {
- dlg.CheckPathExists = true;
- dlg.CheckFileExists = false;
- dlg.AddExtension = true;
- dlg.DefaultExt = "gmdb";
- dlg.ValidateNames = true;
- dlg.Title = "GMap.NET: Export map to db, if file exsist only new data will be added";
- dlg.FileName = "DataExp";
- dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- dlg.Filter = "GMap.NET DB files (*.gmdb)|*.gmdb";
- dlg.FilterIndex = 1;
- dlg.RestoreDirectory = true;
-
- if(dlg.ShowDialog() == true)
- {
- bool ok = GMaps.Instance.ExportToGMDB(dlg.FileName);
- if(ok)
- {
- MessageBox.Show("Complete!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- else
- {
- MessageBox.Show(" Failed!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
- return ok;
- }
- }
- }
- else
- {
- MessageBox.Show("Failed! Only SQLite support ;/", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-#endif
- return false;
- }
-
- public bool ShowImportDialog()
- {
-#if SQLite
- if(Cache.Instance.ImageCache is GMap.NET.CacheProviders.SQLitePureImageCache)
- {
- Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
- {
- dlg.CheckPathExists = true;
- dlg.CheckFileExists = false;
- dlg.AddExtension = true;
- dlg.DefaultExt = "gmdb";
- dlg.ValidateNames = true;
- dlg.Title = "GMap.NET: Import to db, only new data will be added";
- dlg.FileName = "DataImport";
- dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- dlg.Filter = "GMap.NET DB files (*.gmdb)|*.gmdb";
- dlg.FilterIndex = 1;
- dlg.RestoreDirectory = true;
-
- if(dlg.ShowDialog() == true)
- {
- Cursor = Cursors.Wait;
-
- bool ok = GMaps.Instance.ImportFromGMDB(dlg.FileName);
- if(ok)
- {
- MessageBox.Show("Complete!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Information);
- ReloadMap();
- }
- else
- {
- MessageBox.Show(" Failed!", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
- Cursor = Cursors.Arrow;
-
- return ok;
- }
- }
- }
- else
- {
- MessageBox.Show("Failed! Only SQLite support ;/", "GMap.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-#endif
- return false;
- }
-
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- [Browsable(false)]
- internal int ZoomStep
- {
- get
- {
- return Core.Zoom;
- }
- set
- {
- if(value > MaxZoom)
- {
- Core.Zoom = MaxZoom;
- }
- else if(value < MinZoom)
- {
- Core.Zoom = MinZoom;
- }
- else
- {
- bool changed = (Core.Zoom != value);
- Core.Zoom = value;
- if(changed)
- {
- foreach(UIElement u in TilesLayer.Children)
- {
- var m = u as TileVisual;
- if(m != null)
- {
- if(images.ContainsKey(m.Tile))
- {
- images.Remove(m.Tile);
- m.Source.Clear();
- }
- }
- }
-
- TilesLayer.Children.Clear();
-
- var sizeinTiles = Projection.GetTileMatrixSizeXY(ZoomStep);
- TilesSize.Width = sizeinTiles.Width;
- TilesSize.Height = sizeinTiles.Height;
-
- if(IsLoaded)
- {
- Refresh();
- }
- }
- }
- }
- }
-
- [Browsable(false)]
- public PointLatLng Position
- {
- get
- {
- return Core.CurrentPosition;
- }
- set
- {
- Core.CurrentPosition = value;
- UpdateMarkersOffset();
- }
- }
-
- [Browsable(false)]
- public GPoint CurrentPositionGPixel
- {
- get
- {
- return Core.CurrentPositionGPixel;
- }
- }
-
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- [Browsable(false)]
- public string CacheLocation
- {
- get
- {
- return Cache.Instance.CacheLocation;
- }
- set
- {
- Cache.Instance.CacheLocation = value;
- }
- }
-
- [Browsable(false)]
- public bool IsDragging
- {
- get
- {
- return Core.IsDragging;
- }
- }
-
- [Browsable(false)]
- public RectLatLng CurrentViewArea
- {
- get
- {
- return Core.CurrentViewArea;
- }
- }
-
- [Category("GMap.NET")]
- public MapType MapType
- {
- get
- {
- return Core.MapType;
- }
- set
- {
- Core.MapType = value;
- }
- }
-
- [Browsable(false)]
- public PureProjection Projection
- {
- get
- {
- return Core.Projection;
- }
- }
-
- [Category("GMap.NET")]
- public bool CanDragMap
- {
- get
- {
- return Core.CanDragMap;
- }
- set
- {
- Core.CanDragMap = value;
- }
- }
-
- public GMap.NET.RenderMode RenderMode
- {
- get
- {
- return GMap.NET.RenderMode.WPF;
- }
- }
-
- #endregion
-
- #region IGControl event Members
-
- public event PositionChanged OnPositionChanged
- {
- add
- {
- Core.OnCurrentPositionChanged += value;
- }
- remove
- {
- Core.OnCurrentPositionChanged -= value;
- }
- }
-
- public event TileLoadComplete OnTileLoadComplete
- {
- add
- {
- Core.OnTileLoadComplete += value;
- }
- remove
- {
- Core.OnTileLoadComplete -= value;
- }
- }
-
- public event TileLoadStart OnTileLoadStart
- {
- add
- {
- Core.OnTileLoadStart += value;
- }
- remove
- {
- Core.OnTileLoadStart -= value;
- }
- }
-
- public event MapDrag OnMapDrag
- {
- add
- {
- Core.OnMapDrag += value;
- }
- remove
- {
- Core.OnMapDrag -= value;
- }
- }
-
- public event MapZoomChanged OnMapZoomChanged
- {
- add
- {
- Core.OnMapZoomChanged += value;
- }
- remove
- {
- Core.OnMapZoomChanged -= value;
- }
- }
-
- ///
- /// occures on map type changed
- ///
- public event MapTypeChanged OnMapTypeChanged
- {
- add
- {
- Core.OnMapTypeChanged += value;
- }
- remove
- {
- Core.OnMapTypeChanged -= value;
- }
- }
-
- #endregion
- }
-
- static class Extensions
- {
- public static void CenterAt(this FrameworkElement element, System.Windows.Point center)
- {
- CenterAt(element, center.X, center.Y);
- }
-
- public static void CenterAt(this FrameworkElement element, double x, double y)
- {
- MoveTo(element, x - element.Width / 2, y - element.Height / 2);
- }
-
- public static void MoveTo(this UIElement element, double x, double y)
- {
- Canvas.SetLeft(element, x);
- Canvas.SetTop(element, y);
- }
-
- public static void MoveTo(this UIElement element, System.Windows.Point position)
- {
- MoveTo(element, position.X, position.Y);
- }
-
- public static void MoveOffset(this UIElement element, double xOffset, double yOffset)
- {
- if(element == null || double.IsNaN(xOffset) || double.IsNaN(yOffset))
- {
- return;
- }
- var coordinates = element.GetCoordinates();
- Canvas.SetLeft(element, coordinates.X + xOffset);
- Canvas.SetTop(element, coordinates.Y + yOffset);
- }
-
- public static System.Windows.Point GetCoordinates(this UIElement element)
- {
- return new System.Windows.Point(Canvas.GetLeft(element), Canvas.GetTop(element));
- }
-
- public static System.Windows.Rect GetRect(this UIElement element)
- {
- return new System.Windows.Rect(element.GetCoordinates(), element.RenderSize);
- }
- }
-}
\ No newline at end of file
diff --git a/Testing/WPF-GMapControlNew/MainWindow.xaml b/Testing/WPF-GMapControlNew/MainWindow.xaml
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/MainWindow.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
diff --git a/Testing/WPF-GMapControlNew/MainWindow.xaml.cs b/Testing/WPF-GMapControlNew/MainWindow.xaml.cs
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/MainWindow.xaml.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Collections.ObjectModel;
-using GMap.NET.WindowsPresentation;
-
-namespace WpfApplication1
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
-
- {
- GMapMarker m = new GMapMarker();
- {
- var b = new Button();
- b.Click += new RoutedEventHandler(b_Click);
- b.Width = 55;
- b.Content = "test";
-
- m.Shape = b;
- }
- MainMap.Markers.Add(m);
- }
-
- MainMap.MinZoom = 1;
- MainMap.MaxZoom = 4;
- MainMap.Zoom = 2;
- }
-
- void b_Click(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("click");
- }
- }
-}
diff --git a/Testing/WPF-GMapControlNew/Properties/AssemblyInfo.cs b/Testing/WPF-GMapControlNew/Properties/AssemblyInfo.cs
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("WpfApplication1")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("WpfApplication1")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/WPF-GMapControlNew/Properties/Resources.Designer.cs b/Testing/WPF-GMapControlNew/Properties/Resources.Designer.cs
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.21006.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace WpfApplication1.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfApplication1.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Testing/WPF-GMapControlNew/Properties/Resources.resx b/Testing/WPF-GMapControlNew/Properties/Resources.resx
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Testing/WPF-GMapControlNew/Properties/Settings.Designer.cs b/Testing/WPF-GMapControlNew/Properties/Settings.Designer.cs
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.21006.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace WpfApplication1.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Testing/WPF-GMapControlNew/Properties/Settings.settings b/Testing/WPF-GMapControlNew/Properties/Settings.settings
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Testing/WPF-GMapControlNew/WPF-GMapControlNew.csproj b/Testing/WPF-GMapControlNew/WPF-GMapControlNew.csproj
deleted file mode 100644
--- a/Testing/WPF-GMapControlNew/WPF-GMapControlNew.csproj
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
- Debug
- x86
- 8.0.30703
- 2.0
- {B5A673B4-6286-4150-A536-1C16F3B8DC8B}
- WinExe
- Properties
- WpfApplication1
- WpfApplication1
- v3.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- bin\Debug\WpfApplication1.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- true
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- bin\Release\WpfApplication1.exe.CodeAnalysisLog.xml
- true
- GlobalSuppressions.cs
- prompt
- MinimumRecommendedRules.ruleset
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
- ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- GMapControlNew.xaml
-
-
- MainWindow.xaml
- Code
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
- {D0C39D9D-BED0-418B-9A5E-713176CAF40C}
- GMap.NET.Core
-
-
- {644FE7D4-0184-400F-B2D7-99CB41360658}
- GMap.NET.WindowsPresentation
-
-
-
-
-
\ No newline at end of file