Advertisement
Guest User

Untitled

a guest
Jun 13th, 2016
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. ########### C# file
  2. using Esri.ArcGISRuntime;
  3. using Esri.ArcGISRuntime.Data;
  4. using Esri.ArcGISRuntime.Geometry;
  5. using Esri.ArcGISRuntime.Mapping;
  6. using Esri.ArcGISRuntime.Location;
  7. using Esri.ArcGISRuntime.Xamarin.Forms.UI;
  8. using System;
  9. using Xamarin.Forms;
  10.  
  11. namespace FieldEngineerLite.Views
  12. {
  13. public partial class TestGIS : ContentPage
  14. {
  15.  
  16. public TestGIS()
  17. {
  18. InitializeComponent();
  19.  
  20. Title = "Test GPS";
  21. // Create the UI, setup the control references and execute initialization
  22. Initialize();
  23. }
  24.  
  25. private async void Initialize()
  26. {
  27. // Create new Map with basemap
  28. var myMap = new Map(Basemap.CreateTopographic());
  29.  
  30. // Create envelope to be used as a target extent for map's initial viewpoint
  31. Envelope myEnvelope = new Envelope(
  32. -14260091.99687875, 2807349.5830308953,-7352630.624805781,6500786.789769631,
  33. SpatialReferences.WebMercator);
  34.  
  35. // Set the initial viewpoint for map
  36. myMap.InitialViewpoint = new Viewpoint(myEnvelope);
  37.  
  38. // Provide used Map to the MapView
  39. MyMapView.Map = myMap;
  40.  
  41. //get location
  42. MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Default;
  43. MyMapView.LocationDisplay.Start();
  44.  
  45. }
  46. }
  47. }
  48.  
  49.  
  50. #############XAML File
  51. <?xml version="1.0" encoding="utf-8" ?>
  52. <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
  53. xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  54. xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms.UI;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
  55. xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
  56. xmlns:location="clr-namespace:Esri.ArcGISRuntime.Location;assembly=Esri.ArcGISRuntime"
  57. x:Class="FieldEngineerLite.Views.TestGIS">
  58. <Grid>
  59. <esriUI:MapView x:Name="MyMapView">
  60. <location:LocationDisplay
  61. AutoPanMode="Navigation"
  62. DefaultSymbol="{StaticResource NotMovingMarkerSym}" CourseSymbol="{StaticResource MovingMarkerSym}"
  63. IsEnabled="True" IsPingAnimationEnabled="True">
  64. </location:LocationDisplay>
  65. </esriUI:MapView>
  66. </Grid>
  67. </ContentPage>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement