예제 #1
0
 private async void SetCameraInEarth(MapViewCameraChangedEventArgs args)
 {
     try
     {
         // Get current camera of ArcGIS Pro.
         MapView mapView = args.MapView;
         if (null != mapView && null != mapView.Camera && mapView.ViewingMode == MapViewingMode.SceneGlobal)
         {
             JObject cameraJObject = new JObject()
             {
                 // Get position.
                 ["position"] = new JObject
                 {
                     ["x"] = mapView.Camera.X,
                     ["y"] = mapView.Camera.Y,
                     ["z"] = mapView.Camera.Z,
                     ["spatialReference"] = new JObject
                     {
                         ["wkid"] = mapView.Camera.SpatialReference?.Wkid
                     }
                 },
                 // Get heading.
                 ["heading"] = mapView.Camera.Heading > 0 ? 360 - mapView.Camera.Heading : -mapView.Camera.Heading,
                 // Get tilt.
                 ["tilt"] = mapView.Camera.Pitch + 90,
                 // Get roll.
                 ["roll"] = mapView.Camera.Roll
             };
             // Set camera in ArcGIS Earth.
             await AutomationAPIHelper.SetCamera(cameraJObject.ToString());
         }
     }
     catch
     {
     }
 }
예제 #2
0
        private async Task <string> SendMessage(FunctionType sendType, string inputStr)
        {
            string outputStr = null;

            switch (sendType)
            {
            case FunctionType.GetCamera:
                outputStr = await AutomationAPIHelper.GetCamera();

                break;

            case FunctionType.SetCamera:
                outputStr = await AutomationAPIHelper.SetCamera(inputStr);

                break;

            case FunctionType.SetFlight:
                outputStr = await AutomationAPIHelper.SetFlight(inputStr);

                break;

            case FunctionType.AddLayer:
                outputStr = await AutomationAPIHelper.AddLayer(inputStr);

                break;

            case FunctionType.GetLayer:
                outputStr = await AutomationAPIHelper.GetLayer(inputStr);

                break;

            case FunctionType.RemoveLayer:
                outputStr = await AutomationAPIHelper.RemoveLayer(inputStr);

                break;

            case FunctionType.ClearLayers:
                outputStr = await AutomationAPIHelper.ClearLayers(inputStr);

                break;

            case FunctionType.AddGraphic:
                outputStr = await AutomationAPIHelper.AddGraphic(inputStr);

                break;

            case FunctionType.GetGraphic:
                outputStr = await AutomationAPIHelper.GetGraphic(inputStr);

                break;

            case FunctionType.UpdateGraphic:
                outputStr = await AutomationAPIHelper.UpdateGraphic(inputStr);

                break;

            case FunctionType.RemoveGraphic:
                outputStr = await AutomationAPIHelper.RemoveGraphic(inputStr);

                break;

            case FunctionType.GetWorkspace:
                outputStr = await AutomationAPIHelper.GetWorkspace();

                break;

            case FunctionType.ImportWorkspace:
                outputStr = await AutomationAPIHelper.ImportWorkspace(inputStr);

                break;

            case FunctionType.ClearWorkspace:
                outputStr = await AutomationAPIHelper.ClearWorkspace();

                break;
            }

            return(outputStr);
        }