├── .gitattributes ├── .gitignore ├── DemosWPF ├── 3DBuildingsWindow.xaml ├── 3DBuildingsWindow.xaml.cs ├── App.config ├── App.xaml ├── App.xaml.cs ├── BingStyleWindow.xaml ├── BingStyleWindow.xaml.cs ├── DataBindingViewModel.cs ├── DataBindingWindow.xaml ├── DataBindingWindow.xaml.cs ├── DemosWPF.csproj ├── GeoJsonWindow.xaml ├── GeoJsonWindow.xaml.cs ├── HelloWorldWindow.xaml ├── HelloWorldWindow.xaml.cs ├── LocalRasterWindow.xaml ├── LocalRasterWindow.xaml.cs ├── LocalVectorWindow.xaml ├── LocalVectorWindow.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── OfflineWindow.xaml ├── OfflineWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── StyleSwitchWindow.xaml ├── StyleSwitchWindow.xaml.cs ├── VideoOverlayWindow.xaml ├── VideoOverlayWindow.xaml.cs ├── XamlProjectionWindow.xaml ├── XamlProjectionWindow.xaml.cs ├── aliflux-style.json ├── images │ ├── pikachu-hd.png │ └── pikachu.png └── packages.config ├── HelloWorldWinForms ├── App.config ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── HelloWorldWinForms.csproj ├── Program.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── LICENSE ├── MapboxNet.sln ├── MapboxNetCore ├── Core.cs ├── DynamicExpression.cs ├── EnhancedExpandoObeject.cs ├── ExpressionBuilder.cs ├── GeoExtent.cs ├── GeoLocation.cs ├── IMap.cs ├── MapServer.cs ├── MapboxNetCore.csproj ├── Point2D.cs └── web │ ├── frame.js │ ├── mapbox-gl.css │ └── mapbox-gl.js ├── MapboxNetWPF ├── Map.xaml ├── Map.xaml.cs ├── MapboxNetWPF.csproj ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Relay.cs └── packages.config ├── MapboxNetWinForms ├── Map.Designer.cs ├── Map.cs ├── Map.resx ├── MapboxNetWinForms.csproj ├── Properties │ └── AssemblyInfo.cs ├── Relay.cs └── packages.config ├── README.md ├── Raw ├── pikachu-hd.png └── pikachu.png └── images ├── 3d.png ├── bing.png ├── dark.png ├── geojson.png ├── local-raster.png ├── local-vector.png └── oslo.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | 244 | # SQL Server files 245 | *.mdf 246 | *.ldf 247 | *.ndf 248 | 249 | # Business Intelligence projects 250 | *.rdl.data 251 | *.bim.layout 252 | *.bim_*.settings 253 | *.rptproj.rsuser 254 | 255 | # Microsoft Fakes 256 | FakesAssemblies/ 257 | 258 | # GhostDoc plugin setting file 259 | *.GhostDoc.xml 260 | 261 | # Node.js Tools for Visual Studio 262 | .ntvs_analysis.dat 263 | node_modules/ 264 | 265 | # Visual Studio 6 build log 266 | *.plg 267 | 268 | # Visual Studio 6 workspace options file 269 | *.opt 270 | 271 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 272 | *.vbw 273 | 274 | # Visual Studio LightSwitch build output 275 | **/*.HTMLClient/GeneratedArtifacts 276 | **/*.DesktopClient/GeneratedArtifacts 277 | **/*.DesktopClient/ModelManifest.xml 278 | **/*.Server/GeneratedArtifacts 279 | **/*.Server/ModelManifest.xml 280 | _Pvt_Extensions 281 | 282 | # Paket dependency manager 283 | .paket/paket.exe 284 | paket-files/ 285 | 286 | # FAKE - F# Make 287 | .fake/ 288 | 289 | # JetBrains Rider 290 | .idea/ 291 | *.sln.iml 292 | 293 | # CodeRush 294 | .cr/ 295 | 296 | # Python Tools for Visual Studio (PTVS) 297 | __pycache__/ 298 | *.pyc 299 | 300 | # Cake - Uncomment if you are using it 301 | # tools/** 302 | # !tools/packages.config 303 | 304 | # Tabs Studio 305 | *.tss 306 | 307 | # Telerik's JustMock configuration file 308 | *.jmconfig 309 | 310 | # BizTalk build output 311 | *.btp.cs 312 | *.btm.cs 313 | *.odx.cs 314 | *.xsd.cs 315 | 316 | # OpenCover UI analysis results 317 | OpenCover/ 318 | 319 | # Azure Stream Analytics local run output 320 | ASALocalRun/ 321 | 322 | # MSBuild Binary and Structured Log 323 | *.binlog 324 | 325 | # NVidia Nsight GPU debugger configuration file 326 | *.nvuser 327 | 328 | # MFractors (Xamarin productivity tool) working folder 329 | .mfractor/ 330 | /packages 331 | /tile-cache 332 | 333 | *.psd -------------------------------------------------------------------------------- /DemosWPF/3DBuildingsWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /DemosWPF/3DBuildingsWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace DemosWPF 16 | { 17 | /// 18 | /// Interaction logic for _3DBuildingsWindow.xaml 19 | /// 20 | public partial class _3DBuildingsWindow : Window 21 | { 22 | public _3DBuildingsWindow(string accessToken) 23 | { 24 | InitializeComponent(); 25 | Map.AccessToken = accessToken; 26 | } 27 | 28 | private void Map_Styled(object sender, EventArgs e) 29 | { 30 | 31 | // Extruding the building polygons to create a 3D map view 32 | 33 | // Converted using the JSON to C# anonymous type converter 34 | // source: https://docs.mapbox.com/mapbox-gl-js/example/3d-buildings/ 35 | // converter: https://jsfiddle.net/aliashrafx/c7pxomjb/39/ 36 | 37 | var layers = Map.Invoke.getStyle().layers; 38 | var labelLayerId = ""; 39 | 40 | // firstly, we get the text layer 41 | 42 | foreach (var layer in layers) 43 | if (layer.type == "" || (layer.ContainsKey("layout") && layer.layout.ContainsKey("text-field"))) 44 | { 45 | labelLayerId = layer.id; 46 | break; 47 | } 48 | 49 | // then we create a new extrusion layer 50 | 51 | var obj = new Dictionary 52 | { 53 | ["id"] = "3d-buildings", 54 | ["source"] = "composite", 55 | ["source-layer"] = "building", 56 | ["filter"] = new [] { "==", "extrude", "true" }, 57 | ["type"] = "fill-extrusion", 58 | ["minzoom"] = 15, 59 | ["paint"] = new Dictionary 60 | { 61 | ["fill-extrusion-color"] = "#dfe4ea", 62 | ["fill-extrusion-height"] = new object[] { 63 | "interpolate" , 64 | new [] { "linear" }, 65 | new [] { "zoom" }, 66 | 14, 0, 15.05, 67 | new [] { "get", "height" } 68 | }, 69 | ["fill-extrusion-base"] = new object[] { 70 | "interpolate", 71 | new [] { "linear" }, 72 | new [] { "zoom" }, 73 | 14, 0, 15.05, 74 | new [] { "get", "min_height" } 75 | }, 76 | ["fill-extrusion-opacity"] = .6 77 | } 78 | }; 79 | 80 | // now we add the new layer after text layer 81 | 82 | Map.Invoke.AddLayer(obj, labelLayerId); 83 | 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /DemosWPF/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /DemosWPF/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /DemosWPF/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace DemosWPF 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DemosWPF/BingStyleWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /DemosWPF/BingStyleWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace DemosWPF 16 | { 17 | /// 18 | /// Interaction logic for BingStyleWindow.xaml 19 | /// 20 | public partial class BingStyleWindow : Window 21 | { 22 | public BingStyleWindow() 23 | { 24 | InitializeComponent(); 25 | 26 | // Creating a custom style that takes bing satellite tile source as the raster layer 27 | 28 | var style = new Dictionary 29 | { 30 | ["version"] = 8, 31 | ["name"] = "Custom style", 32 | ["sources"] = new Dictionary 33 | { 34 | ["satellite"] = new Dictionary 35 | { 36 | ["type"] = "raster", 37 | ["tileSize"] = 256, 38 | ["tiles"] = new object[] { 39 | "http://ecn.t0.tiles.virtualearth.net/tiles/h{quadkey}.jpeg?g=129&mkt=en&stl=H", 40 | }, 41 | }, 42 | }, 43 | ["layers"] = new object[] { 44 | new Dictionary { 45 | ["id"] = "satellite", 46 | ["type"] = "raster", 47 | ["source"] = "satellite", 48 | ["minzoom"] = 0, 49 | ["maxzoom"] = 22, 50 | ["layout"] = new Dictionary { 51 | }, 52 | ["paint"] = new Dictionary { 53 | }, 54 | }, 55 | }, 56 | ["glyphs"] = "http://glfonts.lukasmartinelli.ch/fonts/{fontstack}/{range}.pbf", 57 | ["id"] = "44004506-1129-4d81-9889-800854993041", 58 | }; 59 | 60 | Map.MapStyle = style; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /DemosWPF/DataBindingViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace DemosWPF 9 | { 10 | // A simple view-model that has the basic Map properties 11 | 12 | class DataBindingViewModel : INotifyPropertyChanged 13 | { 14 | MapboxNetCore.GeoLocation _location = new MapboxNetCore.GeoLocation(47.3769, 8.5417); 15 | public MapboxNetCore.GeoLocation Location 16 | { 17 | get => _location; 18 | set 19 | { 20 | if (value == _location) 21 | return; 22 | 23 | _location = value; 24 | OnPropertyRaised(nameof(Location)); 25 | } 26 | } 27 | 28 | double _zoom = 13; 29 | public double Zoom 30 | { 31 | get => _zoom; 32 | set 33 | { 34 | if (value == _zoom) 35 | return; 36 | 37 | _zoom = value; 38 | OnPropertyRaised(nameof(Zoom)); 39 | } 40 | } 41 | 42 | double _pitch; 43 | public double Pitch 44 | { 45 | get => _pitch; 46 | set 47 | { 48 | if (value == _pitch) 49 | return; 50 | 51 | _pitch = value; 52 | OnPropertyRaised(nameof(Pitch)); 53 | } 54 | } 55 | 56 | double _bearing; 57 | public double Bearing 58 | { 59 | get => _bearing; 60 | set 61 | { 62 | if (value == _bearing) 63 | return; 64 | 65 | _bearing = value; 66 | OnPropertyRaised(nameof(Bearing)); 67 | } 68 | } 69 | 70 | public event PropertyChangedEventHandler PropertyChanged; 71 | private void OnPropertyRaised(string propertyname) 72 | { 73 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname)); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /DemosWPF/DataBindingWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /DemosWPF/DataBindingWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace DemosWPF 16 | { 17 | /// 18 | /// Interaction logic for DataBindingWindow.xaml 19 | /// 20 | public partial class DataBindingWindow : Window 21 | { 22 | public DataBindingWindow(string accessToken) 23 | { 24 | InitializeComponent(); 25 | Map.AccessToken = accessToken; 26 | 27 | // Check the XAML for binding 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /DemosWPF/DemosWPF.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F073EBC1-F2C2-4965-B07B-20647EDB5A69} 8 | WinExe 9 | DemosWPF 10 | DemosWPF 11 | v4.6.2 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | true 16 | true 17 | 18 | 19 | 20 | 21 | x86 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | AnyCPU 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | true 41 | bin\x86\Debug\ 42 | DEBUG;TRACE 43 | full 44 | x86 45 | prompt 46 | MinimumRecommendedRules.ruleset 47 | true 48 | 49 | 50 | bin\x86\Release\ 51 | TRACE 52 | true 53 | pdbonly 54 | x86 55 | prompt 56 | MinimumRecommendedRules.ruleset 57 | true 58 | 59 | 60 | 61 | ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll 62 | 63 | 64 | 65 | 66 | ..\packages\System.Data.SQLite.Core.1.0.110.0\lib\net46\System.Data.SQLite.dll 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 4.0 76 | 77 | 78 | ..\packages\uHttpSharp.0.1.6.22\lib\net40\uhttpsharp.dll 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | MSBuild:Compile 87 | Designer 88 | 89 | 90 | BingStyleWindow.xaml 91 | 92 | 93 | 94 | DataBindingWindow.xaml 95 | 96 | 97 | LocalRasterWindow.xaml 98 | 99 | 100 | LocalVectorWindow.xaml 101 | 102 | 103 | OfflineWindow.xaml 104 | 105 | 106 | StyleSwitchWindow.xaml 107 | 108 | 109 | VideoOverlayWindow.xaml 110 | 111 | 112 | XamlProjectionWindow.xaml 113 | 114 | 115 | Designer 116 | MSBuild:Compile 117 | 118 | 119 | Designer 120 | MSBuild:Compile 121 | 122 | 123 | Designer 124 | MSBuild:Compile 125 | 126 | 127 | Designer 128 | MSBuild:Compile 129 | 130 | 131 | Designer 132 | MSBuild:Compile 133 | 134 | 135 | Designer 136 | MSBuild:Compile 137 | 138 | 139 | Designer 140 | MSBuild:Compile 141 | 142 | 143 | MSBuild:Compile 144 | Designer 145 | 146 | 147 | 3DBuildingsWindow.xaml 148 | 149 | 150 | App.xaml 151 | Code 152 | 153 | 154 | GeoJsonWindow.xaml 155 | 156 | 157 | HelloWorldWindow.xaml 158 | 159 | 160 | MainWindow.xaml 161 | Code 162 | 163 | 164 | Designer 165 | MSBuild:Compile 166 | 167 | 168 | Designer 169 | MSBuild:Compile 170 | 171 | 172 | Designer 173 | MSBuild:Compile 174 | 175 | 176 | Designer 177 | MSBuild:Compile 178 | 179 | 180 | 181 | 182 | Code 183 | 184 | 185 | True 186 | True 187 | Resources.resx 188 | 189 | 190 | True 191 | Settings.settings 192 | True 193 | 194 | 195 | ResXFileCodeGenerator 196 | Resources.Designer.cs 197 | 198 | 199 | 200 | SettingsSingleFileGenerator 201 | Settings.Designer.cs 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | {657821b4-5c50-4d72-9898-81352a6130dc} 210 | MapboxNetCore 211 | 212 | 213 | {f23272d5-b532-48f6-a178-25cdf0320484} 214 | MapboxNetWPF 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 229 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /DemosWPF/GeoJsonWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /DemosWPF/GeoJsonWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace DemosWPF 16 | { 17 | /// 18 | /// Interaction logic for GeoJsonWindow.xaml 19 | /// 20 | public partial class GeoJsonWindow : Window 21 | { 22 | public GeoJsonWindow(string accessToken) 23 | { 24 | InitializeComponent(); 25 | Map.AccessToken = accessToken; 26 | } 27 | 28 | private void Map_Styled(object sender, EventArgs e) 29 | { 30 | // Making two layers, one is a geojson polygon, other is a set of pikachu markers/images 31 | 32 | // Converted using the JSON to C# anonymous type converter 33 | // source: https://docs.mapbox.com/mapbox-gl-js/example/geojson-polygon/ 34 | // converter: https://jsfiddle.net/aliashrafx/c7pxomjb/39/ 35 | 36 | var polygonLayer = new Dictionary 37 | { 38 | ["id"] = "maine", 39 | ["type"] = "fill", 40 | ["source"] = new Dictionary 41 | { 42 | ["type"] = "geojson", 43 | ["data"] = new Dictionary 44 | { 45 | ["type"] = "Feature", 46 | ["geometry"] = new Dictionary 47 | { 48 | ["type"] = "Polygon", 49 | ["coordinates"] = new object[] { 50 | new object[] { 51 | new object[] { 52 | -67.13734351262877, 45.137451890638886, 53 | }, 54 | new object[] { 55 | -66.96466, 44.8097, 56 | }, 57 | new object[] { 58 | -68.03252, 44.3252, 59 | }, 60 | new object[] { 61 | -69.06, 43.98, 62 | }, 63 | new object[] { 64 | -70.11617, 43.68405, 65 | }, 66 | new object[] { 67 | -70.64573401557249, 43.090083319667144, 68 | }, 69 | new object[] { 70 | -70.75102474636725, 43.08003225358635, 71 | }, 72 | new object[] { 73 | -70.79761105007827, 43.21973948828747, 74 | }, 75 | new object[] { 76 | -70.98176001655037, 43.36789581966826, 77 | }, 78 | new object[] { 79 | -70.94416541205806, 43.46633942318431, 80 | }, 81 | new object[] { 82 | -71.08482, 45.3052400000002, 83 | }, 84 | new object[] { 85 | -70.6600225491012, 45.46022288673396, 86 | }, 87 | new object[] { 88 | -70.30495378282376, 45.914794623389355, 89 | }, 90 | new object[] { 91 | -70.00014034695016, 46.69317088478567, 92 | }, 93 | new object[] { 94 | -69.23708614772835, 47.44777598732787, 95 | }, 96 | new object[] { 97 | -68.90478084987546, 47.184794623394396, 98 | }, 99 | new object[] { 100 | -68.23430497910454, 47.35462921812177, 101 | }, 102 | new object[] { 103 | -67.79035274928509, 47.066248887716995, 104 | }, 105 | new object[] { 106 | -67.79141211614706, 45.702585354182816, 107 | }, 108 | new object[] { 109 | -67.13734351262877, 45.137451890638886, 110 | }, 111 | }, 112 | }, 113 | }, 114 | }, 115 | }, 116 | ["paint"] = new Dictionary 117 | { 118 | ["fill-color"] = "#9b59b6", 119 | ["fill-opacity"] = 0.4, 120 | ["fill-outline-color"] = "#e74c3c", 121 | }, 122 | }; 123 | 124 | // inspired by: https://docs.mapbox.com/mapbox-gl-js/example/add-image/ 125 | // converter: https://jsfiddle.net/aliashrafx/c7pxomjb/39/ 126 | 127 | var pikachuLayer = new Dictionary 128 | { 129 | ["id"] = "points", 130 | ["type"] = "symbol", 131 | ["source"] = new Dictionary 132 | { 133 | ["type"] = "geojson", 134 | ["data"] = new Dictionary 135 | { 136 | ["type"] = "FeatureCollection", 137 | ["features"] = new object[] { 138 | new Dictionary { 139 | ["type"] = "Feature", 140 | ["properties"] = new Dictionary { 141 | ["label"] = "Pika pika", 142 | }, 143 | ["geometry"] = new Dictionary { 144 | ["type"] = "Point", 145 | ["coordinates"] = new object[] { 146 | -74.0124907170679, 40.7052768300975 147 | }, 148 | }, 149 | }, 150 | new Dictionary { 151 | ["type"] = "Feature", 152 | ["properties"] = new Dictionary { 153 | ["label"] = "Pika chuuuu", 154 | }, 155 | ["geometry"] = new Dictionary { 156 | ["type"] = "Point", 157 | ["coordinates"] = new object[] { 158 | -78.6569, 37.4316 159 | }, 160 | }, 161 | }, 162 | new Dictionary { 163 | ["type"] = "Feature", 164 | ["properties"] = new Dictionary { 165 | ["label"] = "Pikaaa", 166 | }, 167 | ["geometry"] = new Dictionary { 168 | ["type"] = "Point", 169 | ["coordinates"] = new object[] { 170 | -79.3832, 43.6532 171 | }, 172 | }, 173 | }, 174 | }, 175 | }, 176 | }, 177 | ["layout"] = new Dictionary 178 | { 179 | ["text-field"] = "{label}", 180 | ["text-anchor"] = "bottom", 181 | ["icon-anchor"] = "top", 182 | ["icon-image"] = "pikachu", 183 | ["icon-size"] = 0.75, 184 | }, 185 | }; 186 | 187 | // You can add images to the map using bitmap, stream, or base64 188 | Map.AddImage("pikachu", pikachuImage.Source as BitmapSource); 189 | 190 | Map.Invoke.AddLayer(polygonLayer); 191 | Map.Invoke.AddLayer(pikachuLayer); 192 | 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /DemosWPF/HelloWorldWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /DemosWPF/HelloWorldWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace DemosWPF 4 | { 5 | /// 6 | /// Interaction logic for HelloWorldWindow.xaml 7 | /// 8 | public partial class HelloWorldWindow : Window 9 | { 10 | public HelloWorldWindow(string accessToken) 11 | { 12 | InitializeComponent(); 13 | Map.AccessToken = accessToken; 14 | 15 | // Check the XAML 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DemosWPF/LocalRasterWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /DemosWPF/LocalRasterWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using MapboxNetCore; 15 | 16 | namespace DemosWPF 17 | { 18 | /// 19 | /// Interaction logic for LocalRasterWindow.xaml 20 | /// 21 | public partial class LocalRasterWindow : Window 22 | { 23 | public LocalRasterWindow() 24 | { 25 | InitializeComponent(); 26 | 27 | // Starting a tile server on a random port 28 | 29 | var server = new MapboxNetCore.MapServer(@"tiles\zurich-raster.mbtiles"); 30 | server.GlyphsPath = @"fonts\"; 31 | server.Start(); 32 | 33 | // Creating a custom style that takes our MapServer tiles as a raster source 34 | 35 | var style = new Dictionary 36 | { 37 | ["version"] = 8, 38 | ["name"] = "Custom style", 39 | ["sources"] = new Dictionary 40 | { 41 | ["satellite"] = new Dictionary 42 | { 43 | ["type"] = "raster", 44 | ["tileSize"] = 256, 45 | ["tiles"] = new object[] { 46 | server.TilesURL, // using tile URL here 47 | }, 48 | }, 49 | }, 50 | ["layers"] = new object[] { 51 | new Dictionary { 52 | ["id"] = "satellite", 53 | ["type"] = "raster", 54 | ["source"] = "satellite", 55 | ["minzoom"] = 0, 56 | ["maxzoom"] = 22, 57 | ["layout"] = new Dictionary { 58 | }, 59 | ["paint"] = new Dictionary { 60 | }, 61 | }, 62 | }, 63 | ["glyphs"] = server.GlyphsURL, 64 | ["id"] = "14004506-1129-4d81-9889-800854993041", 65 | }; 66 | 67 | // You can create a hybrid satellite view as well by using a style that takes both Vector Tiles as Raster Tiles 68 | 69 | Map.MapStyle = style; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /DemosWPF/LocalVectorWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DemosWPF/LocalVectorWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace DemosWPF 16 | { 17 | /// 18 | /// Interaction logic for LocalVectorWindow.xaml 19 | /// 20 | public partial class LocalVectorWindow : Window 21 | { 22 | public LocalVectorWindow() 23 | { 24 | InitializeComponent(); 25 | 26 | // Starting the MapServer on a random port, that serves the vector tiles stored in .mbtiles format 27 | 28 | var server = new MapboxNetCore.MapServer(@"tiles\zurich.mbtiles"); 29 | server.GlyphsPath = @"fonts\"; 30 | server.Start(); 31 | 32 | // pulling the style json stored as an embedded resource in this project, and decoding it into C# dynamic object 33 | 34 | var json = MapboxNetCore.Core.GetEmbeddedResource(this.GetType(), "DemosWPF.aliflux-style.json"); 35 | dynamic style = MapboxNetCore.Core.DecodeJsonPlain(json); 36 | 37 | // modifying the style a bit so that it uses our tile server 38 | 39 | style.sources.openmaptiles.tiles.Add(server.TilesURL); 40 | style.glyphs = server.GlyphsURL; 41 | 42 | // NOTE: this style (aliflux-style.json) is using the openmaptiles spec, not the mapbox spec 43 | // It is specifically compatable with the zurich.mbtiles vector tiles 44 | 45 | Map.MapStyle = style; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /DemosWPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 |