Download presentation
Presentation is loading. Please wait.
Published byShanon Knight Modified over 9 years ago
18
<UserControl x:Class="VirtualEarthSilverlight.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentat ion" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr- namespace:Microsoft.VirtualEarth.MapControl;assembly=Micro soft.VirtualEarth.MapControl">
21
<UserControl x:Class="VirtualEarthSilverlight.Page“ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presen tation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr- namespace:Microsoft.VirtualEarth.MapControl;assembly=Micro soft.VirtualEarth.MapControl">
25
LocationCollection 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);
26
double 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;
32
private void ChangeMapView(object sender, RoutedEventArgs e) { myMap.View (MapViewSpecification)mapSpecConverter.ConvertFrom(((Butto n)sender).Tag); pushpin = CreateUIElement(); Location pinLocation = myMap.TargetView.Center; PositionMethod position = PositionMethod.Center; myMapLayer.AddChild(pushpin, pinLocation, position); }
33
//Image Brush ImageBrush 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;
34
Ellipse 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;
37
private 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/Geoc odeService.svc"); //Create the Service Client geocodeClient = new PlatformServices.GeocodeServiceClient(binding, new EndpointAddress(serviceUri.Uri)); geocodeClient.GeocodeCompleted += new EventHandler (client_GeocodeCom pleted); } return geocodeClient; }
38
private 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.ConfidenceFilter filter = new PlatformServices.ConfidenceFilter(); filter.MinimumConfidence = PlatformServices.Confidence.High; request.Options.Filters.Add(filter); Output.Text = " "; geocodesInProgress++; // Make asynchronous call to fetch the data... pass state object. GeocodeClient.GeocodeAsync(request, address); }
39
/* Demonstrate Microsoft Virtual Earth Silverlight Interactive SDK */ //demo
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.