zoukankan      html  css  js  c++  java
  • ArcGIS Pro 屏幕上一点转换为地图上点

    /*
       Copyright 2018 Esri
       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at
           http://www.apache.org/licenses/LICENSE-2.0
       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.
    */
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using ArcGIS.Desktop.Mapping;
    using ArcGIS.Desktop.Framework.Threading.Tasks;
    
    namespace Examples
    {
      internal class GetMapCoordinates : MapTool
      {
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs  e)
        {
          if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
            e.Handled = true; //Handle the event args to get the call to the corresponding async method
        }
    
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
          return QueuedTask.Run(() =>
          {
            //Convert the clicked point in client coordinates to the corresponding map coordinates.
            var mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
            ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(string.Format("X: {0} Y: {1} Z: {2}",
                           mapPoint.X, mapPoint.Y, mapPoint.Z), "Map Coordinates");
          });
        }
      }
    }

    来自:https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/MapExploration/GetMapCoordinates.cs

  • 相关阅读:
    终端时钟与时钟源偏差40秒异常处理
    (原创)odoo one2many字段以子列表形式显示
    (原创)odoo动态设置树形视图中的字段,每个用户可定制自己要显示的字段
    (原创)odoo14下qweb模板的前端与后端语法区别
    nginx安装前奏
    MySQL破解root用户密码
    Docker创建运行多个mysql容器
    判断pcie卡插在哪个cpu上
    虚拟化之Hypervisor
    HCIA-Cloud Computer笔记
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12517370.html
Copyright © 2011-2022 走看看