/// <summary>
 /// Occurs when a mouse button is pressed on the view.
 /// </summary>
 /// <param name="e"></param>
 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
 }
        /// <summary>
        /// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
        /// </summary>
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            //Get the instance of the ViewModel
            var vm = OverlayEmbeddableControl as EmbeddedControlViewModel;

            if (vm == null)
            {
                return(Task.FromResult(0));
            }

            //Get the map coordinates from the click point and set the property on the ViewModel.
            return(QueuedTask.Run(() =>
            {
                var mapPoint = ActiveMapView.ClientToMap(e.ClientPoint);
                var coords = GeometryEngine.Project(mapPoint, SpatialReferences.WGS84) as MapPoint;
                if (coords == null)
                {
                    return;
                }
                var sb = new StringBuilder();
                sb.AppendLine($"X: {coords.X:0.000}");
                sb.Append($"Y: {coords.Y:0.000}");
                if (coords.HasZ)
                {
                    sb.AppendLine();
                    sb.Append($"Z: {coords.Z:0.000}");
                }
                vm.Text = sb.ToString();
            }));
        }
コード例 #3
0
 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
     }
 }
コード例 #4
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            //Get view, determine what type of geometry we're editing (polygon or line)
            var symbolDockPaneViewModel = FrameworkApplication.DockPaneManager.Find("ProSymbolEditor_MilitarySymbolDockpane") as MilitarySymbolDockpaneViewModel;

            if (symbolDockPaneViewModel == null)
            {
                base.OnToolMouseDown(e);
                return;
            }

            if (symbolDockPaneViewModel.GeometryType == GeometryType.Point)
            {
                SketchType = SketchGeometryType.Point;
            }
            else if (symbolDockPaneViewModel.GeometryType == GeometryType.Polyline)
            {
                SketchType = SketchGeometryType.Line;
            }
            else if (symbolDockPaneViewModel.GeometryType == GeometryType.Polygon)
            {
                SketchType = SketchGeometryType.Polygon;
            }

            base.OnToolMouseDown(e);
        }
コード例 #5
0
        /// <summary>
        /// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
        /// </summary>
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            //Get the instance of the ViewModel
            var vm = OverlayEmbeddableControl as EmbeddedControlViewModel;

            if (vm == null)
            {
                return(Task.FromResult(0));
            }

            //Get the map coordinates from the click point and set the property on the ViewModel.
            return(QueuedTask.Run(() =>
            {
                var mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
                var sb = new StringBuilder();
                sb.AppendLine(string.Format("X: {0}", mapPoint.X));
                sb.Append(string.Format("Y: {0}", mapPoint.Y));
                if (mapPoint.HasZ)
                {
                    sb.AppendLine();
                    sb.Append(string.Format("Z: {0}", mapPoint.Z));
                }
                vm.ClickText = sb.ToString();
            }));
        }
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e) {
     if (_graphic != null) {
         _graphic.Dispose();//Clear out the old overlay
         _graphic = null;
     }
     base.OnToolMouseDown(e);
 }
コード例 #7
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            //On mouse down check if the mouse button pressed is the left mouse button. If it is handle the event.
            if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
                e.Handled = true;

        }
コード例 #8
0
        private void MoveWalls(MapViewMouseButtonEventArgs e)
        {
            QueuedTask.Run(() =>
            {
                Dictionary <MapMember, List <long> > selectedItems = GetSelectedItems(e);

                EditOperation editOperation = new EditOperation();
                foreach (KeyValuePair <MapMember, List <long> > item in selectedItems)
                {
                    BasicFeatureLayer layer = item.Key as BasicFeatureLayer;
                    if (layer.ShapeType != ArcGIS.Core.CIM.esriGeometryType.esriGeometryPolygon)
                    {
                        continue;
                    }

                    foreach (long oid in item.Value)
                    {
                        var feature = layer.Inspect(oid);

                        double hoogte  = double.Parse(feature["PandHoogte"].ToString());
                        int verdieping = int.Parse(feature["Verdieping"].ToString());

                        Geometry geom           = feature.Shape.Clone();
                        Geometry removeGeometry = GeometryEngine.Scale(geom, geom.Extent.Center, 1.2, 1.2);
                        Geometry wallGeometry   = GeometryEngine.Scale(geom, geom.Extent.Center, 1.3, 1.3);
                        editOperation.Scale(selectedItems, feature.Shape.Extent.Center, 0.9, 0.9);
                        editOperation.Create(layer, wallGeometry, new Action <long>(x => OnExtractWalls(x, layer, removeGeometry, hoogte, verdieping)));
                    }
                    editOperation.Execute();
                }

                MapView.Active.Map.SetSelection(null);
            });
        }
コード例 #9
0
        /// <summary>
        /// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
        /// </summary>
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            //Get the instance of the ViewModel
            var symbolDockPaneViewModel = FrameworkApplication.DockPaneManager.Find("ProSymbolEditor_MilitarySymbolDockpane") as MilitarySymbolDockpaneViewModel;

            if (symbolDockPaneViewModel == null)
            {
                return(Task.FromResult(0));
            }

            //Get the map coordinates from the click point and set the property on the ViewModel.
            return(QueuedTask.Run(() =>
            {
                var tempMapPoint = MapView.Active.ClientToMap(e.ClientPoint);
                try
                {
                    // for now we will always project to WGS84
                    MapPoint projectedMapPoint = GeometryEngine.Project(tempMapPoint, SpatialReferences.WGS84) as MapPoint;

                    //Create a point with a z value, since the mil spec feature classes have z enabled (TODO: other way to do this?)
                    symbolDockPaneViewModel.MapGeometry = MapPointBuilder.CreateMapPoint(projectedMapPoint.X, projectedMapPoint.Y, 0, projectedMapPoint.SpatialReference);
                    symbolDockPaneViewModel.MapPointCoordinatesString = string.Format("{0:0.0####} {1:0.0####}", tempMapPoint.Y, tempMapPoint.X);
                }
                catch (Exception exception)
                {
                    System.Console.WriteLine(exception.Message);
                }
            }));
        }
コード例 #10
0
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            return(QueuedTask.Run(() =>
            {
                // Get the mouse click point
                MapPoint location = MapView.Active.ClientToMap(e.ClientPoint);

                // Create a symbol based on the mouse button.
                CIMPointSymbol pointSymbol = null;
                if (e.ChangedButton == MouseButton.Left)
                {
                    // Specify a symbol
                    pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.CreateRGBColor(150, 0, 0, 60), 80, SimpleMarkerStyle.Circle);
                }
                else if (e.ChangedButton == MouseButton.Right)
                {
                    // Specify a symbol
                    pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.CreateRGBColor(0, 0, 150, 60), 80, SimpleMarkerStyle.Cross);
                }

                // Create a CIMGraphic to show the symbol on the map in the grapicslayer.
                var graphic = new CIMPointGraphic()
                {
                    Symbol = pointSymbol?.MakeSymbolReference(),
                    Location = location
                };

                // Add the graphic to the grapicslayer.
                FieldOfJoy.AddElement(graphic);

                // By default all items are selected, deselect all items
                FieldOfJoy.UnSelectElements();
            }));
        }
コード例 #11
0
        private void CutBuilding(MapViewMouseButtonEventArgs e)
        {
            QueuedTask.Run(() =>
            {
                Dictionary <MapMember, List <long> > selectedItems = GetSelectedItems(e);
                EditOperation editOperation = new EditOperation();
                foreach (KeyValuePair <MapMember, List <long> > item in selectedItems)
                {
                    BasicFeatureLayer layer = item.Key as BasicFeatureLayer;
                    if (layer.ShapeType != ArcGIS.Core.CIM.esriGeometryType.esriGeometryPolygon)
                    {
                        continue;
                    }

                    foreach (long oid in item.Value)
                    {
                        var feature = layer.Inspect(oid);

                        Geometry geometry = feature.Shape.Clone();
                        Polyline polyLine = GetCutPolyLine(geometry);

                        var splitItems = GeometryEngine.Cut(geometry, polyLine);
                        feature.Shape  = splitItems.First();
                        editOperation.Modify(feature);

                        Layer pointLayer = MapView.Active.Map.Layers[0];
                        editOperation.Create(pointLayer, geometry.Extent.Center);
                    }
                    editOperation.Execute();
                }
                MapView.Active.Map.SetSelection(null);
            });
        }
コード例 #12
0
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     if (e.ChangedButton == System.Windows.Input.MouseButton.Right)
     {
         e.Handled = true;
     }
 }
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Left)
     {
         e.Handled = true;
     }
 }
コード例 #14
0
        /// <summary>
        /// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
        /// </summary>
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            //Get the instance of the ViewModel
            var symbolDockPaneViewModel = FrameworkApplication.DockPaneManager.Find("ProSymbolEditor_MilitarySymbolDockpane") as MilitarySymbolDockpaneViewModel;
            if (symbolDockPaneViewModel == null)
                return Task.FromResult(0);

            //Get the map coordinates from the click point and set the property on the ViewModel.
            return QueuedTask.Run(() =>
            {
                var tempMapPoint = MapView.Active.ClientToMap(e.ClientPoint);
                try
                {
                    // for now we will always project to WGS84
                    MapPoint projectedMapPoint = GeometryEngine.Project(tempMapPoint, SpatialReferences.WGS84) as MapPoint;

                    //Create a point with a z value, since the mil spec feature classes have z enabled (TODO: other way to do this?)
                    symbolDockPaneViewModel.MapGeometry = MapPointBuilder.CreateMapPoint(projectedMapPoint.X, projectedMapPoint.Y, 0, projectedMapPoint.SpatialReference);
                    symbolDockPaneViewModel.MapPointCoordinatesString = string.Format("{0:0.0####} {1:0.0####}", tempMapPoint.Y, tempMapPoint.X);
                }
                catch(Exception exception)
                {
                    System.Console.WriteLine(exception.Message);
                }
            });
        }
 protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e)
 {
     lock (_lock) {
         _trackingMouseMove = TrackingState.NotTracking;
         _lineFeature       = null;
     }
 }
コード例 #16
0
        private static Dictionary <MapMember, List <long> > GetSelectedItems(MapViewMouseButtonEventArgs e)
        {
            var point = MapPointBuilder.CreateMapPoint(e.ClientPoint.X, e.ClientPoint.Y);
            var selectedLayerFeatures = MapView.Active.GetFeatures(point, true);
            var selectedItems         = selectedLayerFeatures.ToDictionary(x => x.Key as MapMember, x => x.Value);

            return(selectedItems);
        }
コード例 #17
0
 /// <summary>
 /// Ascertains that when a left mouse button is clicked, whether this click is to select the control point or not
 /// </summary>
 /// <param name="e"></param>
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     if (e.ChangedButton == System.Windows.Input.MouseButton.Left && SketchType == SketchGeometryType.Point)
     {
         //Handle the event args to get the call to the corresponding async method
         e.Handled = true;
     }
 }
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     //On mouse down check if the mouse button pressed is the left mouse button. If it is handle the event.
     if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
     {
         e.Handled = true;
     }
 }
コード例 #19
0
 /// <summary>
 /// Called when the mouse button is released in the view.
 /// </summary>
 protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e)
 {
     if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
     {
         e.Handled = true;
     }
     base.OnToolMouseUp(e);
 }
コード例 #20
0
 protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
 {
     return(QueuedTask.Run(() =>
     {
         //assign the screen coordinate clicked point to the MapTool base class' OverlayControlLocation property.
         this.OverlayControlPositionRatio = e.ClientPoint;
     }));
 }
コード例 #21
0
 // Event Handler for OnToolMouseDown which returns the clicked point in Map-Coordinates
 protected async override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
 {
     await QueuedTask.Run(() =>
     {
         var mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
         MapCoord     = new Tuple <string, string>(mapPoint.X.ToString(), mapPoint.Y.ToString());
         return(true);
     });
 }
コード例 #22
0
        protected async override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            base.OnToolMouseDown(e);

            await QueuedTask.Run(() =>
            {
                CreateAnimationFromPath.TargetPoint = MapView.Active.ClientToMap(e.ClientPoint);
            });
        }
コード例 #23
0
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     switch (e.ChangedButton)
     {
     case MouseButton.Left:
         e.Handled = true;
         break;
     }
 }
コード例 #24
0
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     if (_graphic != null)
     {
         _graphic.Dispose();//Clear out the old overlay
         _graphic = null;
     }
     base.OnToolMouseDown(e);
 }
コード例 #25
0
        /// <summary>
        /// Sets the control point to the clicked location. This method is only called when e.Handled is set to true
        /// by OnToolMouseDown
        /// </summary>
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            return(QueuedTask.Run(() => {
                // this line must be called from within Run()
                CurrentControlPoint = MapView.Active.ClientToMap(e.ClientPoint);

                // notify the user the control point is selected
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(string.Format("X: {0:0.000} \nY: {1:0.000} \nZ: {2:0.000}", CurrentControlPoint.X, CurrentControlPoint.Y, CurrentControlPoint.Z), "Control Point Picked");
            }));
        }
コード例 #26
0
 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");
     }));
 }
コード例 #27
0
ファイル: MapTool1.cs プロジェクト: bgeers/Geog-5223-final
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     // On mouse down, check if the mouse button pressed is:
     // the left mouse button to handle zoom in
     // or the right mouse button to handle zoom out.
     // If it is handle the event.
     if (e.ChangedButton == MouseButton.Right)
     {
         e.Handled = true;
     }
 }
コード例 #28
0
ファイル: MapTool1.cs プロジェクト: bgeers/Buckeyes
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            MapPoint map_point = null;
            Task     t         = QueuedTask.Run(() =>
            {
                map_point = MapView.Active.ClientToMap(e.ClientPoint);
            });

            t.Wait();

            pane.PositionLabel = string.Format("Clicked @ ({0:0.###}, {1:0.###})!", map_point.X, map_point.Y);
        }
コード例 #29
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            if (e.ChangedButton != System.Windows.Input.MouseButton.Left)
                return;

            var vm = FrameworkApplication.DockPaneManager.Find("ProAppCoordConversionModule_CoordinateConversionDockpane") as CoordinateConversionDockpaneViewModel;
            if (vm != null)
            {
                vm.IsToolGenerated = true;
                vm.IsToolActive = false;
            }
            UpdateInputWithMapPoint(e.ClientPoint);
        }
コード例 #30
0
 protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e)
 {
     switch (e.ChangedButton)
     {
     case System.Windows.Input.MouseButton.Right:
         e.Handled = true;
         var menu = FrameworkApplication.CreateContextMenu(
             "esri_layouts_mapGraphicContextMenu");
         menu.DataContext = this;
         menu.IsOpen      = true;
         break;
     }
 }
コード例 #31
0
        protected async override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            MapPoint clickedPoint = await QueuedTask.Run(() =>
            {
                this.ClientPoint = e.ClientPoint;
                return(MapView.Active.ClientToMap(this.ClientPoint));
            });

            //There is always a sketch if the tool is active though it can be
            //empty...
            var sketch = await MapView.Active.GetCurrentSketchAsync();

            ShowContextMenu(sketch, clickedPoint);
        }
コード例 #32
0
ファイル: MapTool1.cs プロジェクト: bgeers/Geog-5223-final
 protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
 {
     // Get the map coordinates from the click point and change the Camera to zoom in or out.
     return(QueuedTask.Run(() =>
     {
         if (e.ChangedButton == MouseButton.Right)
         {
             if (MapView.Active.Map != null)
             {
                 MapView.Active.Map.SetSelection(null);
             }
             pane2.SelectedHouses = "";
         }
     }));
 }
コード例 #33
0
    /// <summary>
    /// Asynchronous callback if the OnTooMouseUp event is handled.
    /// </summary>
    /// <param name="e"></param>
    protected override Task HandleMouseUpAsync(MapViewMouseButtonEventArgs e)
    {
      return QueuedTask.Run(() =>
      {
        var mapView = MapView.Active;
        if (mapView == null)
          return;

        //Get the point clicked, zoom to it and call the module method to construct keyframes around it.
        var mapPoint = mapView.ClientToMap(e.ClientPoint);
        mapView.LookAt(mapPoint, TimeSpan.Zero);
        Animation.Current.CreateKeyframesAroundPoint(mapPoint);
        _pointClicked = true;
      });
    }
コード例 #34
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            if (e.ChangedButton != System.Windows.Input.MouseButton.Left)
            {
                return;
            }

            var vm = FrameworkApplication.DockPaneManager.Find("ProAppCoordConversionModule_CoordinateConversionDockpane") as CoordinateConversionDockpaneViewModel;

            if (vm != null)
            {
                vm.IsToolGenerated = true;
                vm.IsToolActive    = false;
            }
            UpdateInputWithMapPoint(e.ClientPoint);
        }
コード例 #35
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            switch (e.ChangedButton)
            {
            case MouseButton.Left: BlowUpBuilding(e);
                break;

            case MouseButton.Right: MoveWalls(e);
                break;

            case MouseButton.Middle: CutBuilding(e);
                break;
            }

            e.Handled = true;
        }
コード例 #36
0
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     // On mouse down check if the mouse button pressed is:
     // the left mouse button to handle zoom in
     // or the right mouse button to handle zoom out
     // If it is handle the event.
     switch (e.ChangedButton)
     {
         case MouseButton.Right:
             e.Handled = true;
             break;
         case MouseButton.Left:
             e.Handled = true;
             break;
     }
 }
コード例 #37
0
        protected override async void OnToolDoubleClick(MapViewMouseButtonEventArgs e)
        {
            try
            {
                var mp = await QueuedTask.Run(() =>
                {
                    return(MapView.Active.ClientToMap(e.ClientPoint));
                });

                Mediator.NotifyColleagues(DistanceAndDirectionLibrary.Constants.MOUSE_DOUBLE_CLICK, mp);
            }
            catch (Exception ex)
            {
            }
            base.OnToolDoubleClick(e);
        }
コード例 #38
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            if (e.ChangedButton != System.Windows.Input.MouseButton.Left)
                return;

            try
            {
                QueuedTask.Run(() =>
                {
                    var mp = MapView.Active.ClientToMap(e.ClientPoint);
                    Mediator.NotifyColleagues(DistanceAndDirectionLibrary.Constants.NEW_MAP_POINT, mp);
                });
            }
            catch(Exception ex)
            {

            }
            base.OnToolMouseDown(e);
        }
コード例 #39
0
 protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
 {
     // Get the map coordinates from the click point and change the Camera to zoom in or out.
     return QueuedTask.Run(() =>
     {
         var mapClickPnt = MapView.Active.ClientToMap(e.ClientPoint);                
         ActiveMapView.LookAt(mapClickPnt, TimeSpan.FromSeconds(1));
         // zoom out
         if (e.ChangedButton == MouseButton.Right)
         {
             ActiveMapView.ZoomOutFixed(TimeSpan.FromSeconds(1));
         }
         // zoom in
         else if (e.ChangedButton == MouseButton.Left)
         {
             ActiveMapView.ZoomInFixed(TimeSpan.FromSeconds(1));
         }
     });
 }
コード例 #40
0
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            //Get view, determine what type of geometry we're editing (polygon or line)
            var symbolDockPaneViewModel = FrameworkApplication.DockPaneManager.Find("ProSymbolEditor_MilitarySymbolDockpane") as MilitarySymbolDockpaneViewModel;
            if (symbolDockPaneViewModel.GeometryType == GeometryType.Point)
            {
                SketchType = SketchGeometryType.Point;
            }
            else if (symbolDockPaneViewModel.GeometryType == GeometryType.Polyline)
            {
                SketchType = SketchGeometryType.Line;
            }
            else if (symbolDockPaneViewModel.GeometryType == GeometryType.Polygon)
            {
                SketchType = SketchGeometryType.Polygon;
            }

            base.OnToolMouseDown(e);
        }
コード例 #41
0
    /// <summary>
    /// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
    /// </summary>
    protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
    {
      //Get the instance of the ViewModel
      var vm = OverlayEmbeddableControl as EmbeddedControlViewModel;
      if (vm == null)
        return Task.FromResult(0);

      //Get the map coordinates from the click point and set the property on the ViewModel.
      return QueuedTask.Run(() =>
      {
        var mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
        var sb = new StringBuilder();
        sb.AppendLine(string.Format("X: {0}", mapPoint.X));
        sb.Append(string.Format("Y: {0}", mapPoint.Y));
        if (mapPoint.HasZ)
        {
          sb.AppendLine();
          sb.Append(string.Format("Z: {0}", mapPoint.Z));
        }         
        vm.ClickText = sb.ToString();
      });
    }
コード例 #42
0
    /// <summary>
    /// Called when the OnToolMouseDown event is handled. Allows the opportunity to perform asynchronous operations corresponding to the event.
    /// </summary>
    protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
    {
      //Get the instance of the ViewModel
      var vm = OverlayEmbeddableControl as EmbeddedControlViewModel;
      if (vm == null)
        return Task.FromResult(0);

      //Get the map coordinates from the click point and set the property on the ViewModel.
      return QueuedTask.Run(() =>
      {
        var mapPoint = ActiveMapView.ClientToMap(e.ClientPoint);
        var coords = GeometryEngine.Project(mapPoint, SpatialReferences.WGS84) as MapPoint;
        if (coords == null) return;
        var sb = new StringBuilder();
        sb.AppendLine($"X: {coords.X:0.000}");
        sb.Append($"Y: {coords.Y:0.000}");
        if (coords.HasZ)
        {
          sb.AppendLine();
          sb.Append($"Z: {coords.Z:0.000}");
        }         
        vm.Text = sb.ToString();
      });
    }
 protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e) {
     lock (_lock) {
         _trackingMouseMove = TrackingState.NotTracking;
         _lineFeature = null;
     }
 }
コード例 #44
0
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
 {
     base.OnToolMouseDown(e);
 }
コード例 #45
0
        protected override async void OnToolDoubleClick(MapViewMouseButtonEventArgs e)
        {
            try
            {
                var mp = await QueuedTask.Run(() =>
                {
                    return MapView.Active.ClientToMap(e.ClientPoint);
                });
                Mediator.NotifyColleagues(DistanceAndDirectionLibrary.Constants.MOUSE_DOUBLE_CLICK, mp);
            }
            catch(Exception ex)
            {

            }
            base.OnToolDoubleClick(e);
        }
        /// <summary>
        /// Occurs when the OnToolMouseDown event is handled.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected async override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            lock (LockSelection)
            {
                Selection.Clear();
            }
            POINT pt;
            GetCursorPos(out pt);
            _clickedPoint = new Point(pt.X, pt.Y); //Point on screen to show the context menu

            await QueuedTask.Run(async () =>
            {
                //Convert the clicked point in client coordinates to the corresponding map coordinates.
                _toolClickedPoint = e.ClientPoint;

                var allLyrs = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>(); //get all the layers in teh TOC for that map

                if (allLyrs == null)
                    return;

                List<long> oidList = new List<long>();                

                foreach (var lyr in allLyrs)
                {
                    oidList = await GetFeaturesWithinGeometryAsync(lyr); //gets the oids of all the features within 3 pixels of the point clicked
                    if (oidList != null && oidList.Count > 0)
                    {
                        lock (LockSelection)
                        {
                            Selection.Add(lyr, oidList);
                        }
                    }
                }                
            });

           // if (Selection.Count > 0)
           ShowContextMenu();
        }
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e) {
            //Select a line feature and place the initial graphic. Clear out any
            //previously placed graphic
            return QueuedTask.Run(() => {
                var mapPoint = this.ActiveMapView.ClientToMap(e.ClientPoint);
                var lineFeature = Module1.SelectLineFeature(mapPoint);

                if (lineFeature != null) {
                    var nearest = GeometryEngine.NearestPoint(lineFeature, mapPoint);
                    lock (_lock) {
                        _workingLocation = null;
                        _lineFeature = lineFeature;
                        if (_graphic != null)
                            _graphic.Dispose();
                        _graphic = this.AddOverlay(nearest.Point, _pointSymbol.MakeSymbolReference());
                        _trackingMouseMove = TrackingState.CanTrack;
                    }
                }
                else {
                    lock (_lock) {
                        _workingLocation = null;
                        _lineFeature = null;
                        if (_graphic != null)
                            _graphic.Dispose();
                        _graphic = null;
                        _trackingMouseMove = TrackingState.NotTracking;
                    }
                }
            });
        }
コード例 #48
0
 /// <summary>
 /// Called when the mouse button is released in the view.
 /// </summary>
 protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e)
 {
   if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
     e.Handled = true;
   base.OnToolMouseUp(e);
 }
 protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e) {
     if (e.ChangedButton == MouseButton.Left)
         e.Handled = true;
 }
コード例 #50
-1
        protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
        {
            var mp = QueuedTask.Run(() =>
            {
                MapPoint temp = null;

                if (MapView.Active != null)
                {
                    temp = MapView.Active.ClientToMap(e.ClientPoint);
                    try
                    {
                        // for now we will always project to WGS84
                        var result = GeometryEngine.Project(temp, SpatialReferences.WGS84);
                        return result;
                    }
                    catch { }
                }

                return temp;
            }).Result as MapPoint;

            if (mp != null)
            {
                var vm = FrameworkApplication.DockPaneManager.Find("ProAppCoordToolModule_CoordinateToolDockpane") as CoordinateToolDockpaneViewModel;
                if (vm != null)
                {
                    vm.InputCoordinate = string.Format("{0:0.0####} {1:0.0####}", mp.Y, mp.X);
                }
            }
        }