当前位置: 首页>>代码示例>>C#>>正文


C# MapView类代码示例

本文整理汇总了C#中MapView的典型用法代码示例。如果您正苦于以下问题:C# MapView类的具体用法?C# MapView怎么用?C# MapView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapView类属于命名空间,在下文中一共展示了MapView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnClick

        protected override async void OnClick()
        {
            activeMapView = ProSDKSampleModule.ActiveMapView;
            Camera camera = await activeMapView.GetCameraAsync() ;

            bool is2D = false ;
            try {
              is2D = activeMapView.ViewMode == ViewMode.Map;
            }
            catch(System.ApplicationException) {
                return ;
            }

            if (is2D)
            {
                // in 2D we are changing the scale
                double scaleStep = camera.Scale / _zoomSteps;
                camera.Scale = camera.Scale + scaleStep;
            }
            else
            {
                // in 3D we are changing the Z-value and the pitch (for drama)
                double heightZStep = camera.Z / _zoomSteps;
                double pitchStep = 90.0 / _zoomSteps;

                camera.Pitch = camera.Pitch + pitchStep;
                camera.Z = camera.Z + heightZStep;
            }

            // the heading changes the same in 2D and 3D
            camera.Heading = HollywoodZoomUtils.StepHeading(camera.Heading, -30);

            // assign the changed camera back to the view
            activeMapView.ZoomToAsync(camera);
        }
开发者ID:marmarih,项目名称:arcgis-pro-samples-beta,代码行数:35,代码来源:HollywoodZoomOut.cs

示例2: BoundedImage

        public BoundedImage(MapView map, Uri imageUri, BasicGeoposition northWest, BasicGeoposition southEast)
        {
            _map = map;
            _northWest = northWest;
            _southEast = southEast;

            _img = new Image();
            _img.Stretch = Stretch.Fill;
            _img.Source = new BitmapImage(imageUri);
            this.Children.Add(_img);

            _map.ViewChanged += (center, zoom, heading) =>
            {
                UpdatePosition();
            };

            _map.SizeChanged += (s, a) =>
            {
                this.Width = _map.ActualWidth;
                this.Height = _map.ActualHeight;

                UpdatePosition();
            };

            UpdatePosition();
        }
开发者ID:ponnuswa,项目名称:Flickr_TestApp,代码行数:26,代码来源:BoundedImage.cs

示例3: mapView1_Tap

        // On tap, either get related records for the tapped well or find nearby wells if no well was tapped
        private async void mapView1_Tap(object sender, MapViewInputEventArgs e)
        {
            // Show busy UI
            BusyVisibility = Visibility.Visible;

            // Get the map
            if (m_mapView == null)
                m_mapView = (MapView)sender;
                      

            // Create graphic and add to tap points
            var g = new Graphic() { Geometry = e.Location };
            TapPoints.Add(g);

            // Buffer graphic by 100 meters, create graphic with buffer, add to buffers
            var buffer = GeometryEngine.Buffer(g.Geometry, 100);
            Buffers.Add(new Graphic() { Geometry = buffer });

            // Find intersecting parcels and show them on the map
            var result = await doQuery(buffer);
            if (result != null && result.FeatureSet != null && result.FeatureSet.Features.Count > 0)
            {
                // Instead of adding parcels one-by-one, update the Parcels collection all at once to
                // allow the map to render the new features in one rendering pass.
                Parcels = new ObservableCollection<Graphic>(Parcels.Union(result.FeatureSet.Features));
            }

            // Hide busy UI
            BusyVisibility = Visibility.Collapsed;
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:31,代码来源:BufferAndQuery.xaml.cs

示例4: OnClick

        protected override void OnClick()
        {
            activeMapView = ProSDKSampleModule.ActiveMapView;
            Camera activeCamera = activeMapView.Camera;

            if (activeMapView.Is2D)
            {
                // in 2D we are changing the scale
                double scaleStep = activeCamera.Scale / _zoomSteps;
                activeCamera.Scale = activeCamera.Scale - scaleStep;
            }
            else
            {
                // in 3D we are changing the Z-value and the pitch (for drama)
                double heightZStep = activeCamera.EyeXYZ.Z / _zoomSteps;
                double pitchStep = 90.0 / _zoomSteps;

                activeCamera.Pitch = activeCamera.Pitch - pitchStep;
                activeCamera.EyeXYZ.Z = activeCamera.EyeXYZ.Z - heightZStep;
            }

            // the heading changes the same in 2D and 3D
            activeCamera.Heading = HollywoodZoomUtils.StepHeading(activeCamera.Heading, 30);

            // assign the changed camera back to the view
            activeMapView.Camera = activeCamera;

        }
开发者ID:Esri,项目名称:arcgis-pro-samples-beta,代码行数:28,代码来源:HollywoodZoomIn.cs

示例5: MainViewModel

            /// <summary>
            /// Initializes a new instance of the MainViewModel class.
            /// </summary>
            public MainViewModel()
            {
                if (IsInDesignMode)
                {
                    // Code runs in Blend --> create design time data.
                }
                else
                {
                    // Code runs "for real"
                    ConfigService config = new ConfigService();
                    this.myModel = config.LoadJSON();

                    Messenger.Default.Register<Esri.ArcGISRuntime.Controls.MapView>(this, (mapView) =>
                    {
                        this.mapView = mapView;
                        this.mapView.MaxScale = 500;

                        ArcGISLocalTiledLayer localTiledLayer = new ArcGISLocalTiledLayer(this.TilePackage);
                        localTiledLayer.ID = "SF Basemap";
                        localTiledLayer.InitializeAsync();

                        this.mapView.Map.Layers.Add(localTiledLayer);

                        this.CreateLocalServiceAndDynamicLayer();
                        this.CreateFeatureLayers();                      

                    });
                }
            }
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:32,代码来源:MainViewModel.cs

示例6: SimplifierHandler

 public SimplifierHandler(MapView mapView, Looper looper, IList<Point> points, IList<GeoPoint> data , int epsilon )
 {
     this.mapView = mapView;
     _points = points;
     _data = data;
     _epsilon = epsilon;
 }
开发者ID:knji,项目名称:mvvmcross.plugins,代码行数:7,代码来源:SimplifierHandler.cs

示例7: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Register license
            MapView.RegisterLicense(LICENSE, ApplicationContext);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            MapView = (MapView)FindViewById(Resource.Id.mapView);

            // Add base map
            CartoOnlineVectorTileLayer baseLayer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleDefault);
            MapView.Layers.Add(baseLayer);

            // Set projection
            Projection projection = MapView.Options.BaseProjection;

            // Set default position and zoom
            // Change projection of map so coordinates would fit on a mercator map
            MapPos berlin = MapView.Options.BaseProjection.FromWgs84(new MapPos(13.38933, 52.51704));
            MapView.SetFocusPos(berlin, 0);
            MapView.SetZoom(10, 0);

            Marker marker = MapView.AddMarkerToPosition(berlin);

            // Add simple event listener that changes size and/or color on map click
            MapView.MapEventListener = new HelloMapEventListener(marker);
        }
开发者ID:CartoDB,项目名称:mobile-dotnet-samples,代码行数:29,代码来源:MainActivity.cs

示例8: Tab

 /// <summary>
 /// 
 /// </summary>
 /// <param name="mapView">Must not be null</param>
 /// <param name="tree"></param>
 public Tab(MapView mapView, PersistentTree tree)
     : base(mapView.Canvas)
 {
     Tree = tree;
     MapView = mapView;
     tree.DirtyChanged += Tree_DirtyChanged;
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例9: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            // Get a reference to the sensor manager
            sensor_manager = (SensorManager) GetSystemService (Context.SensorService);

            // Create our view
            var map_view = new MapView (this, "MapViewCompassDemo_DummyAPIKey");

            rotate_view = new RotateView (this);
            rotate_view.AddView (map_view);

            SetContentView (rotate_view);

            // Create the location overlay
            location_overlay = new MyLocationOverlay (this, map_view);
            location_overlay.RunOnFirstFix (delegate {
                map_view.Controller.AnimateTo (location_overlay.MyLocation);
            });
            map_view.Overlays.Add (location_overlay);

            map_view.Controller.SetZoom(18);
            map_view.Clickable = true;
            map_view.Enabled = true;
        }
开发者ID:ogborstad,项目名称:monodroid-samples,代码行数:26,代码来源:MapViewCompassDemo.cs

示例10: CreateLayout

        private void CreateLayout()
        {
            // Create a label for showing the load status for the public service
            var label1ViewFrame = new CoreGraphics.CGRect(10, 30, View.Bounds.Width-10, 20);
            _publicLayerLabel = new UILabel(label1ViewFrame);
            _publicLayerLabel.TextColor = UIColor.Gray;
            _publicLayerLabel.Font = _publicLayerLabel.Font.WithSize(12);
            _publicLayerLabel.Text = PublicLayerName;

            // Create a label to show the load status of the secured layer
            var label2ViewFrame = new CoreGraphics.CGRect(10, 55, View.Bounds.Width-10, 20);
            _secureLayerLabel = new UILabel(label2ViewFrame);
            _secureLayerLabel.TextColor = UIColor.Gray;
            _secureLayerLabel.Font = _secureLayerLabel.Font.WithSize(12);
            _secureLayerLabel.Text = SecureLayerName;

            // Setup the visual frame for the MapView
            var mapViewRect = new CoreGraphics.CGRect(0, 80, View.Bounds.Width, View.Bounds.Height - 80);

            // Create a map view with a basemap
            _myMapView = new MapView();
            _myMapView.Frame = mapViewRect;

            // Add the map view and button to the page
            View.AddSubviews(_publicLayerLabel, _secureLayerLabel, _myMapView);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:26,代码来源:TokenSecuredChallenge.cs

示例11: AttachToMapView

		internal void AttachToMapView(MapView mv)
		{
			if (m_mapView != null && m_mapView != mv)
				throw new InvalidOperationException("RestoreAutoPanMode can only be assigned to one mapview");
			m_mapView = mv;
			m_mapView.PropertyChanged += m_mapView_PropertyChanged;
		}
开发者ID:Gue2014,项目名称:DS2014-GettingStarted,代码行数:7,代码来源:RestoreAutoPanMode.cs

示例12: GetSearchCount_CountFeatures_NineFeatureFound

        public  async Task GetSearchCount_CountFeatures_NineFeatureFound()
        {

            // instantiate the locator so that our view model is created
            locator = new ViewModelLocator();
            // get the MainViewModel
            MainViewModel mainViewModel = locator.MainViewModel;
            // create a MapView
            MapView mapView = new MapView();
            // send the MapView to the MainViewModel
            Messenger.Default.Send<MapView>(mapView);

            // UNCOMMENT THE FOLLOWING LINES 

            //// Arrange
            //// search string
            //mainViewModel.SearchText = "Lancaster";
            //// run the search async
            //var task = mainViewModel.SearchRelayCommand.ExecuteAsync(4326);
            //task.Wait(); // wait

            //// Assert
            //Assert.IsNotNull(mainViewModel, "Null mainViewModel");
            //Assert.IsNotNull(mainViewModel.GridDataResults, "Null GridDataResults");
            //Assert.AreEqual(9, mainViewModel.GridDataResults.Count);
            
        }
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:27,代码来源:UnitTest1.cs

示例13: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _MapView = new MapView(new RectangleF(0, 0, View.Frame.Width, View.Frame.Height));
            _MapView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            View.AddSubview(_MapView);

            var home = new Place()
            {
                Name = "Home",
                Description = "Boring Home Town",
                Latitude = 32.725410,
                Longitude = -97.320840,
            };

            var office = new Place()
            {
                Name = "Austin",
                Description = "Super Awesome Town",
                Latitude = 30.26710,
                Longitude = -97.744546,
            };

            _MapView.ShowRouteFrom(office, home);
        }
开发者ID:anujb,项目名称:MapWithRoutes,代码行数:27,代码来源:MapWithRouteViewController.cs

示例14: mapView1_Tap

        // Perform identify when the map is tapped
        private async void mapView1_Tap(object sender, MapViewInputEventArgs e)
        {
            if (m_mapView == null)
                m_mapView = (MapView)sender;
            // Clear any previously displayed results
            clearResults();

            // Get the point that was tapped and show it on the map
            
            GraphicsLayer identifyPointLayer = m_mapView.Map.Layers["IdentifyPointLayer"] as GraphicsLayer;
            identifyPointLayer.Graphics.Add(new Graphic() { Geometry = e.Location });

            // Show activity
            progress.Visibility = Visibility.Visible;

            // Perform the identify operation
            List<DataItem> results = await doIdentifyAsync(e.Location);

            // Hide the activity indicator
            progress.Visibility = Visibility.Collapsed;

            // Show the results
            ResultsListPicker.ItemsSource = results;
            if (results.Count > 0)
            {
                ResultsListPicker.Visibility = Visibility.Visible;
                ShowAttributesButton.Visibility = Visibility.Visible;
            }
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:Identify.xaml.cs

示例15: OnLaunched

        // Invoked when the application is launched normally by the end user.
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Register CARTO license
            bool registered = MapView.RegisterLicense(License);

            if (registered)
            {
                Carto.Utils.Log.ShowDebug = true;
            }

            MapView = new MapView();

            // Add base map

            // TODO: Crashes here for some reason
            CartoOnlineVectorTileLayer baseLayer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleDark);
            MapView.Layers.Add(baseLayer);

            // Set default location and zoom
            Projection projection = MapView.Options.BaseProjection;

            MapPos tallinn = projection.FromWgs84(new MapPos(24.646469, 59.426939));
            MapView.AddMarkerToPosition(tallinn);

            MapView.SetFocusPos(tallinn, 0);
            MapView.SetZoom(3, 0);

            Window.Current.Content = MapView;
            Window.Current.Activate();
        }
开发者ID:CartoDB,项目名称:mobile-dotnet-samples,代码行数:31,代码来源:App.xaml.cs


注:本文中的MapView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。