Introducing the Microsoft Virtual Earth Silverlight Map Control CTP
-
Upload
goodfriday -
Category
Business
-
view
1.979 -
download
1
description
Transcript of Introducing the Microsoft Virtual Earth Silverlight Map Control CTP
![Page 1: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/1.jpg)
Introducing the Microsoft Virtual Earth Silverlight Map ControlChris PendletonMicrosoft Virtual Earth Technical Evangelist
![Page 2: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/2.jpg)
Agenda
The World As We Know ItDiving Into the VESL Control
How it worksNavigating the mapLeveraging XAML
Getting a mapConfigure the mapplication
Leveraging C#Adding data to the mapAdding media to the mapAccessing Virtual Earth Web Services
How To Get ItQ&A
![Page 3: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/3.jpg)
The World As We Know ItPaper Maps
Not Digital
![Page 4: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/4.jpg)
The World As We Know ItDigital Maps
Not Scaled
![Page 5: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/5.jpg)
The World As We Know ItDigital Static Maps
Not Scrollable
![Page 6: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/6.jpg)
The World As We Know ItAJAX Maps
Not Performant (enough)
![Page 7: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/7.jpg)
The World As We Know ItFlash Maps
Learn Flex/Flash/ActionScript
![Page 8: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/8.jpg)
The World As We Know ItSilverlight Maps
[FIND AND INSERT DOWNSIDE…]
![Page 9: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/9.jpg)
Diving Into the VESL Map ControlNavigating the Map
![Page 10: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/10.jpg)
Silverlight vs. Ajax Map?
Rich, interactive mapping experience – zooming, panningOpens up ability to do things that are not possible with Ajax map such as scaling images and video in a seamless mannerDevelopment environment working with Managed Code and Visual Studio development, debugging tools, unit tests for our developers and our customer developersMicrosoft’s next generation web platformPerformance improvements regarding number of items to render on the map – pushpins (UIElements), polylines, polygons
![Page 11: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/11.jpg)
What is Virtual Earth?How data flows
![Page 12: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/12.jpg)
What is Virtual Earth?How data flows
![Page 13: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/13.jpg)
Virtual Earth Silverlight Map Control"Core" Features
Get / Set Map Mode Road, Aerial, AerialWithLabelsMap Mode is a set of default content layers and projection
Get / Set Map View Zoom level, center, etc.
User Control of Map via Input Devices Mouse, Keyboard / panning, zooming
EventsMap-specific, keyboard, mouse
Viewport Projection Calculations LatLong to Viewport Point, Viewport Point to LatLong, etc.
Layer Support (Position Silverlight UIElements in the LatLong space)Render Fixed-Size UIElements at LatLong (with optional pixel offset) (basic pushpin support)Render Scalable UIElements at a LatLongRectangle (scalable in the X and Y directions) (for video/image overlays, etc.)Render basic Shapes with multiple LatLong geometries (Polylines, Polygons)
Communication with VE Platform Services through WCFImageryRouteSearchGeocoding
![Page 14: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/14.jpg)
Some Key Silverlight ClassesUIElement
The base class for UI objects in Silverlight
PanelThe base class in Silverlight which manages a collection of Children UIElements and their presentation layoutProvides an implementation of 2 Key Silverlight Layout passes: Measure and Arrange
Measure: Compute and return Desired Size of child elements to SilverlightArrange: Arrange your child elements in the specified size
CanvasSilverlight class which is a specialized Panel where elements are never resized Has attached properties Canvas.Left and Canvas.Top to position content relative to Canvas
UserControlSilverlight class designed so you can build your own custom control
![Page 15: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/15.jpg)
Silverlight Map Control Key Classes
Map A Silverlight User Control which represents the map and is the main entry point to using the Silverlight Map Control.Contains properties to set the View and Mode of the map.Contains Children container of UIElements to hold contentContains built in foreground layer including default controls such as Copyright control, Virtual Earth logo, and Scale controlContains Events to register for to subscribe to Map notifications – ViewChangeStart, ViewChangeEnd, ViewChangeOnFrame, ModeChanged, Mouse, Keyboard
MapViewSpecificationDescribes the map view – Center Location (Latitude, Longitude), Heading, Zoom Level
MapModeBase class for all Map ModesMap Mode defines a set of content UIElements (layers) and a Location mathematical projection to position content on the MapLocationToViewportPoint / ViewportPointToLocation – coordinates on screen <-> to LatLong coordinatesWell known map modes include RoadMode, AerialMode, AerialWithLabelsMode
![Page 16: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/16.jpg)
Silverlight Map Control Key Classes (continued…)
MapLayerA Specialized Panel which can position UIElements in the Latitude / Longitude spaceDefines attached properties to position content such as:
MapLayer.MapPosition -- Latitude / Longitude Location to position the UIElement atMapLayer. MapPositionMethod -- What part of the UIElement to position at MapPosition: Center, Top, TopLeft, etc.MapLayer. MapPositionOffset – Screen Pixel offset for MapPositionMapLayer.MapRectangle – Latitude / Longitude rectangle for position scalable content
MapPolygonDerives from MapShapeBase and defines a polygon in the Latitude/Longitude space.Contains a Silverlight Polygon element
MapPolylineDerives from MapShapeBase and defines a polyline in the Latitude/Longitude space.Contains a Silverlight Polyline element
![Page 17: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/17.jpg)
Diving Into the VESL Map ControlLeveraging XAML – Get A Map
Public VirtualEarthSilverlightMap Demo(Awesome){
return multi-imagescalingsickness;}
//demo
![Page 18: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/18.jpg)
Diving Into the VESL Map ControlLeveraging XAML – Get A Map<UserControl x:Class="VirtualEarthSilverlight.Page"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/
presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-
namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
<Grid x:Name="LayoutRoot" Background="White"> <m:Map/> </Grid></UserControl>
![Page 19: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/19.jpg)
Diving Into the VESL Map ControlLeveraging XAML – Get A Map<UserControl x:Class="VirtualEarthSilverlight.Page"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/
presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-
namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
<Grid x:Name="LayoutRoot" Background="White"> <m:Map/> </Grid></UserControl>
![Page 20: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/20.jpg)
Diving Into the VESL Map ControlLeveraging XAML – Configuring the Mapplication
Public VirtualEarthSilverlightMap Demo(Awesome){
return multi-imagescalingsickness;}
//demo
![Page 21: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/21.jpg)
Diving Into the VESL Map ControlLeveraging XAML – Configuring the Mapplication<UserControl x:Class="VirtualEarthSilverlight.Page“
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-
namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl"><Grid x:Name="LayoutRoot" Background="White">
<m:Map Center="36.12154022795178, -115.16997814178468" Mode="AerialWithLabels"
NavigationVisibility="Visible" ZoomLevel="17" /> </Grid></UserControl>
![Page 22: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/22.jpg)
Diving Into the VESL Map ControlLeveraging XAML – Configuring the Mapplication<UserControl x:Class="VirtualEarthSilverlight.Page“
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-
namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl"><Grid x:Name="LayoutRoot" Background="White">
<m:Map Center="36.12154022795178, -115.16997814178468" Mode="AerialWithLabels"
NavigationVisibility="Visible" ZoomLevel="17" /> </Grid></UserControl>
![Page 23: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/23.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Data to the Map
public VirtualEarthSilverlightMap DataDemo(){
return businessintelligencemaps;}
//demo
![Page 24: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/24.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Data to the Map <m:Map HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" x:Name="MyMap" Grid.Column="1" Grid.Row="0"> <m:Map.Children> <m:MapLayer x:Name="MyLayer"> <m:MapPolygon Fill="Blue" Stroke="Green" StrokeThickness="5" Locations="20,-20 20,20 -20,20 -20,-20" Opacity="0.7" /> </m:MapLayer> </m:Map.Children>
</m:Map>
![Page 25: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/25.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Data to the MapLocationCollection points = GetPoints(pointsCount, centerX,
centerY); MapPolygon shape = new MapPolygon(); shape.Locations = points; shape.StrokeThickness = thickness; shape.Stroke = new SolidColorBrush(color); shape.Fill = new SolidColorBrush(fillColor); MyLayer.Children.Add(shape);
![Page 26: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/26.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Data to the Mapdouble width = MyMap.ViewportSize.Width * 0.1; LocationCollection points = new LocationCollection();
for (int i = 0; i < count; i++)
{ double j = (double)i / (double)count; points.Add(MyMap.ViewportPointToLocation(
new Point(centerX + Math.Cos(j * 2.0 * Math.PI) * width, centerY + Math.Sin(j * 2.0 * Math.PI) * width))); }
return points;
![Page 27: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/27.jpg)
DEMOLeveraging C# – Adding Data to the Map
![Page 30: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/30.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Media to the Map
public VirtualEarthSilverlightMap MediaDemo(){
return richmediaonthemap;}
//demo
![Page 31: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/31.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Media to the Map<m:Map x:Name="myMap" Grid.Column="0" Grid.Row="0"
Mode="AerialWithLabels"><m:Map.Children>
<m:MapLayer x:Name="myMapLayer"></m:MapLayer>
</m:Map.Children></m:Map>
![Page 32: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/32.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Media to the Mapprivate void ChangeMapView(object sender, RoutedEventArgs e){
myMap.View (MapViewSpecification)mapSpecConverter.ConvertFrom(((Button)sender).Tag);pushpin = CreateUIElement();Location pinLocation = myMap.TargetView.Center;PositionMethod position = PositionMethod.Center;myMapLayer.AddChild(pushpin, pinLocation, position);
}
![Page 33: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/33.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Media to the Map //Image BrushImageBrush imagebrush = new ImageBrush();imagebrush.AlignmentX = AlignmentX.Center;imagebrush.AlignmentY = AlignmentY.Center;imagebrush.ImageSource = new BitmapImage(new Uri(@"Chris
Pendleton.jpg", UriKind.Relative));imagebrush.Opacity = 1;
![Page 34: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/34.jpg)
Diving Into the VESL Map ControlLeveraging C# – Adding Media to the MapEllipse ellipse = new Ellipse();ellipse.Fill = new SolidColorBrush(Colors.Cyan);ellipse.Opacity = .9;ellipse.Stroke = new SolidColorBrush(Colors.Black);ellipse.Height = 100.00;ellipse.Width = 100.00;
Border border = new Border();border.BorderBrush = new SolidColorBrush(Colors.Black);border.BorderThickness = new Thickness(0);border.Child = ellipse;
return border;
![Page 36: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/36.jpg)
Diving Into the VESL Map ControlLeveraging C# – Accessing Virtual Earth WS
public VirtualEarthSilverlightMap WCFDemo(){
if(map != clean){
return SOAPonthemap;}
}
![Page 37: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/37.jpg)
Diving Into the VESL Map ControlLeveraging C# – Accessing Virtual Earth WSprivate int geocodesInProgress; private PlatformServices.GeocodeServiceClient geocodeClient; private PlatformServices.GeocodeServiceClient GeocodeClient{ get{ if (null == geocodeClient){ //Handle http/https bool httpsUriScheme =
HtmlPage.Document.DocumentUri.Scheme.Equals(Uri.UriSchemeHttps);
BasicHttpBinding binding = httpsUriScheme ? new BasicHttpBinding(BasicHttpSecurityMode.Transport) : new BasicHttpBinding(BasicHttpSecurityMode.None);
UriBuilder serviceUri = new UriBuilder("http://dev.virtualearth.net/webservices/v1/GeocodeService/GeocodeService.svc");
//Create the Service Client geocodeClient = new PlatformServices.GeocodeServiceClient(binding, new
EndpointAddress(serviceUri.Uri)); geocodeClient.GeocodeCompleted += new
EventHandler<PlatformServices.GeocodeCompletedEventArgs>(client_GeocodeCompleted);
} return geocodeClient; } }
![Page 38: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/38.jpg)
Diving Into the VESL Map ControlLeveraging C# – Accessing Virtual Earth WSprivate void GeocodeAddress(string address){ PlatformServices.GeocodeRequest request = new
PlatformServices.GeocodeRequest(); request.Culture = MyMap.Culture; request.Query = address; request.ExecutionOptions = new PlatformServices.ExecutionOptions(); request.ExecutionOptions.SuppressFaults = true; request.Credentials = PlatformServicesHelper.GetCredentials(); request.Options = new PlatformServices.GeocodeOptions(); // Using ObservableCollection since this is the default for Silverlight proxy
generation. request.Options.Filters = new
ObservableCollection<PlatformServices.FilterBase>(); PlatformServices.ConfidenceFilter filter = new
PlatformServices.ConfidenceFilter(); filter.MinimumConfidence = PlatformServices.Confidence.High;
request.Options.Filters.Add(filter); Output.Text = "< geocoding " + address + " >";geocodesInProgress++; // Make asynchronous call to fetch the data ... pass state object. GeocodeClient.GeocodeAsync(request, address); }
![Page 39: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/39.jpg)
DEMOLeveraging C# – Accessing Virtual Earth WS
/* Demonstrate Microsoft Virtual Earth Silverlight Interactive SDK */
//demo
![Page 40: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/40.jpg)
How To Get It
Library posted on Microsoft Connect(http://connect.microsoft.com)
/VirtualEarthMapControlCTP
Login with Windows Live IDInstall MSI
Includes .DLLIncludes .CHM
Interactive SDK on Connect PortalNo Virtual Earth credentials needed for CTP
![Page 41: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/41.jpg)
Questions?
More Information: www.microsoft.com/virtualearth
Developersdev.live.com/virtualearth
CP’s Blogblogs.msdn.com/virtualearth
![Page 42: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/42.jpg)
Complete MIX Survey
Session ID: T34F
![Page 43: Introducing the Microsoft Virtual Earth Silverlight Map Control CTP](https://reader033.fdocuments.net/reader033/viewer/2022061213/5496fd0bb47959c06d8b459d/html5/thumbnails/43.jpg)
Please Complete an Evaluation FormYour feedback is important!
Evaluation forms can be found on each chairTemp Staff at the back of the room have additional evaluation form copies