AJAX-STYLE MAPPING USING THE VIRTUAL EARTH SDK in C#

Encoder QR in C# AJAX-STYLE MAPPING USING THE VIRTUAL EARTH SDK

CHAPTER 9 AJAX-STYLE MAPPING USING THE VIRTUAL EARTH SDK
Encoding QR Code In C#
Using Barcode generator for .NET framework Control to generate, create Denso QR Bar Code image in Visual Studio .NET applications.
www.OnBarcode.com
QR-Code Decoder In Visual C#.NET
Using Barcode reader for VS .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Property Name
Creating DataMatrix In Visual C#.NET
Using Barcode maker for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in .NET framework applications.
www.OnBarcode.com
Encode UPC Code In Visual C#
Using Barcode creation for Visual Studio .NET Control to generate, create UPC Symbol image in Visual Studio .NET applications.
www.OnBarcode.com
mode showSwitch
EAN128 Encoder In C#
Using Barcode printer for Visual Studio .NET Control to generate, create USS-128 image in VS .NET applications.
www.OnBarcode.com
Linear Encoder In Visual C#
Using Barcode encoder for .NET Control to generate, create Linear image in .NET framework applications.
www.OnBarcode.com
Description
Creating Barcode In C#.NET
Using Barcode printer for .NET framework Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
Delivery Point Barcode (DPBC) Creation In Visual C#
Using Barcode creator for .NET Control to generate, create USPS POSTal Numeric Encoding Technique Barcode image in VS .NET applications.
www.OnBarcode.com
A VEMapMode enumeration value that indicates whether to load the map in 2D or 3D mode. The default mode is 2D. (Optional) A boolean value indicating whether or not to show the map mode switch on the dashboard control. By default, the map mode switch is displayed.
Print QR-Code In None
Using Barcode generation for Online Control to generate, create QR Code ISO/IEC18004 image in Online applications.
www.OnBarcode.com
Denso QR Bar Code Creation In .NET Framework
Using Barcode maker for ASP.NET Control to generate, create QR Code image in ASP.NET applications.
www.OnBarcode.com
The only thing left to do is to call the DisplayMap function somewhere on the page. You could set this to an event handler for a button or some other control on the page. In this case, you could simply set it to the onload event of the <body> tag:
Generating Code 128C In Java
Using Barcode generator for BIRT reports Control to generate, create Code 128 Code Set A image in BIRT applications.
www.OnBarcode.com
Encode Barcode In Java
Using Barcode creator for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
<body onload='DisplayMap();'>
Making Code-39 In None
Using Barcode creator for Microsoft Word Control to generate, create Code 39 Extended image in Word applications.
www.OnBarcode.com
Barcode Drawer In None
Using Barcode generator for Online Control to generate, create Barcode image in Online applications.
www.OnBarcode.com
And when the page loads, the map is displayed as depicted in Figure 9-2.
Quick Response Code Generator In None
Using Barcode creation for Microsoft Excel Control to generate, create QR Code ISO/IEC18004 image in Office Excel applications.
www.OnBarcode.com
Making Code-39 In VS .NET
Using Barcode creator for VS .NET Control to generate, create Code-39 image in VS .NET applications.
www.OnBarcode.com
Figure 9-2. Map of the Seattle, Washington area hosted in an ASP .NET page
Generate Code 3 Of 9 In None
Using Barcode creator for Software Control to generate, create Code-39 image in Software applications.
www.OnBarcode.com
GS1 128 Recognizer In C#.NET
Using Barcode scanner for .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
CHAPTER 9 AJAX-STYLE MAPPING USING THE VIRTUAL EARTH SDK
Barcode Maker In Visual Studio .NET
Using Barcode maker for ASP.NET Control to generate, create Barcode image in ASP.NET applications.
www.OnBarcode.com
Print Data Matrix In Java
Using Barcode creation for Android Control to generate, create ECC200 image in Android applications.
www.OnBarcode.com
The VEMap control contains all the code necessary to handle mouse interaction. If you hold the mouse button down on the map, you can drag the map in any direction with the map being updated in a completely AJAX manner. This is an excellent showcase of AJAX and its importance in web applications, namely that asynchronous updates can significantly improve the user experience. In this case, the map you are viewing consists of a number of tiles. As you are viewing the map surface, the tiles for the surrounding areas are downloaded and cached. If you drag the map around, another download for these tiles isn t necessary. However, if you drag really fast to see areas that are far away, you ll see that VE is working to catch up, caching the tiles as it goes. During this time, you often notice blank tiles or sometimes tiles with an icon. See Figure 9-3 for an example of this.
Figure 9-3. Caching map tiles asynchronously
CHAPTER 9 AJAX-STYLE MAPPING USING THE VIRTUAL EARTH SDK
If you look at an HTTP trace (using any HTTP tracing utility) of what is happening as you run this application, you ll see the following. (Much of this has been removed for brevity.) Take note that the VE service implements the mapping functionality, returning the correct map tiles upon requests from this client library. First the browser issues the initial request to a page:
#1 10:34:27.328 127.0.0.1:4611 GET /chapter9/Default.aspx HTTP/1.1 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Then the server responds with this:
#2 10:34:27.390 127.0.0.1:4611 HTTP/1.1 200 OK Server: ASP.NET Development Server/8.0.0.0 Date: Mon, 21 May 2007 18:34:27 GMT X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 1624 Connection: Close <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ...
After the initial download of the page, the map control kicks in and starts making the asynchronous requests for the map tiles using XMLHttpRequest. You can see the request, issued by the map control:
#11 10:34:28.656 65.55.241.30:80 GET /tiles/r021230000.png g=15 HTTP/1.1 Accept: */* Referer: http://localhost:4611/chapter9/Default.aspx Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; . NET CLR 2.0.50727; WinFX RunTime 3.0.50727) Host: r0.ortho.tiles.virtualearth.net Connection: Keep-Alive
CHAPTER 9 AJAX-STYLE MAPPING USING THE VIRTUAL EARTH SDK
This is the response from the VE map server:
#12 10:34:28.859 65.55.241.30:80 HTTP/1.1 200 OK Content-Length: 17055 Content-Type: image/png Expires: Sat, 24 May 2008 01:39:58 GMT Server: Microsoft-IIS/6.0 Srv: 31300 Date: Mon, 21 May 2007 18:34:28 GMT
As you pan around the map, you see the same functionality the images being requested, downloaded, and cached asynchronously. In addition to panning around the map, you can zoom in and out because VE also caches images when you zoom, providing what is effectively a smart multilevel cache of the current map context. In other words, the VEMap control looks at the current context of the map and caches the area outside the current view in the current zoom context as well as a zoom-in context and a zoom-out context. If you have a mouse with a wheel, you can roll the wheel to zoom in and out. You can see this for the current application in Figure 9-4. Now that you ve gotten a feel for the functionality of the map, you ll see some more of the programmatic features for further controlling the map that are available to application developers.
Copyright © OnBarcode.com . All rights reserved.