• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MapView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnCreate

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

            /*
             * For Information on how to add you own keystore to the project read the README from the
             * old GoogleMaps sample: https://github.com/xamarin/monodroid-samples/tree/master/GoogleMaps
             * 
             * */

            // Remember to generate your own API key
            mapView = new MapView(this, "0Nd7w_yOI1NbUsBP_Mg2IosWa0Ns2j22r4meJnA");
            mapView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);

            SetContentView(mapView);

            mapView.SetBuiltInZoomControls(true);
            mapView.Enabled = true;
            mapView.Clickable = true; //This has to be set to true to be able to navigate the map

            myLocationOverlay = new MyLocationOverlay(this, mapView); //this shows your current position on the map
            mapView.Overlays.Add(myLocationOverlay);

            Drawable marker = Resources.GetDrawable(Resource.Drawable.Icon); //these are the markers put on the map
            myItemizedOverlay = new MyItemizedOverlay(this, marker);
            mapView.Overlays.Add(myItemizedOverlay);

            myItemizedOverlay.AddItem(new GeoPoint((int)(55.816149 * 1E6),(int)(12.532868 * 1E6)), "BKSV", "Brüel & Kjær Sound & Vision");
            mapView.PostInvalidate();
        }
开发者ID:Cheesebaron,项目名称:MonoDroid.GoogleMapsDemo,代码行数:30,代码来源:MapActivity.cs


示例17: MyVectorCanvas

        /// <summary>  </summary>
        /// <param name="mapControl"></param>
        public MyVectorCanvas(MapView mapView)
            : base(mapView)
        {
            var myPolygon = new MapPolygon()
            {
                Points = new PointCollection{ new Point(20,40), new Point(20, 50), new Point(30,50), new Point(30,40) }
            };
            myPolygon.Fill = new SolidColorBrush(Colors.Blue);
            myPolygon.Stroke = new SolidColorBrush(Colors.Black);
            myPolygon.InvariantStrokeThickness = 3;
            Children.Add(myPolygon);

            //// http://msdn.microsoft.com/en-us/library/system.windows.media.animation.coloranimation.aspx
            SolidColorBrush myAnimatedBrush = new SolidColorBrush();
            myAnimatedBrush.Color = Colors.Blue;
            myPolygon.Fill = myAnimatedBrush;
            MapView.RegisterName("MyAnimatedBrush", myAnimatedBrush);
            ColorAnimation mouseEnterColorAnimation = new ColorAnimation();
            mouseEnterColorAnimation.From = Colors.Blue;
            mouseEnterColorAnimation.To = Colors.Red;
            mouseEnterColorAnimation.Duration = TimeSpan.FromMilliseconds(250);
            mouseEnterColorAnimation.AutoReverse = true;
            Storyboard.SetTargetName(mouseEnterColorAnimation, "MyAnimatedBrush");
            Storyboard.SetTargetProperty(mouseEnterColorAnimation, new PropertyPath(SolidColorBrush.ColorProperty));
            Storyboard mouseEnterStoryboard = new Storyboard();
            mouseEnterStoryboard.Children.Add(mouseEnterColorAnimation);
            myPolygon.MouseEnter += delegate(object msender, MouseEventArgs args)
            {
                mouseEnterStoryboard.Begin(MapView);
            };
        }
开发者ID:MuffPotter,项目名称:xservernet-bin,代码行数:33,代码来源:MyVectorLayer.cs


示例18: OnCreate

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

            SetContentView (Resource.Layout.MapFragmentLayout);

            mapView = FindViewById<MapView> (Resource.Id.fragmentMapView);
            myLocation = new MyLocationOverlay (this, mapView);
            myLocation.RunOnFirstFix (() => {
                //mapView.Controller.AnimateTo (myLocation.MyLocation);

                var maxLat = Math.Max (myLocation.MyLocation.LatitudeE6, assignment.Latitude.ToIntE6 ());
                var minLat = Math.Min (myLocation.MyLocation.LatitudeE6, assignment.Latitude.ToIntE6 ());
                var maxLong = Math.Max (myLocation.MyLocation.LongitudeE6, assignment.Longitude.ToIntE6 ());
                var minLong = Math.Min (myLocation.MyLocation.LongitudeE6, assignment.Longitude.ToIntE6 ());

                mapView.Controller.ZoomToSpan (Math.Abs (maxLat - minLat), Math.Abs (maxLong - minLong));

                mapView.Controller.AnimateTo (new GeoPoint ((maxLat + minLat) / 2, (maxLong + minLong) / 2));
            });

            mapView.Overlays.Add (myLocation);
            mapView.Controller.SetZoom (5);
            mapView.Clickable = true;
            mapView.Enabled = true;
            mapView.SetBuiltInZoomControls (true);
        }
开发者ID:harouny,项目名称:prebuilt-apps,代码行数:27,代码来源:MapFragmentActivity.cs


示例19: Initialize

        /// <inheritdoc/>
        protected override void Initialize()
        {
            base.Initialize();

            IsActive = true;
            this.mapView = MapView;
            Setup();
        }
开发者ID:MuffPotter,项目名称:xservernet-bin,代码行数:9,代码来源:CustomPanAndZoom.cs


示例20: CoordinateDisplayViewModel

 /// <summary>
 /// Initializes a new instance of the CoordinateDisplayViewModel class.
 /// </summary>
 public CoordinateDisplayViewModel()
 {
     Messenger.Default.Register<Esri.ArcGISRuntime.Controls.MapView>(this, (mapView) =>
     {
         this.mapView = mapView;
         this.mapView.MouseMove += mapView_MouseMove;
     });
 }
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:11,代码来源:CoordinateDisplayViewModel.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MapViewInputEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# MapType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap