Select to view content in your preferred language

How to catch event when z changes

778
4
Jump to solution
10-18-2023 06:36 AM
BarbaraSchneider2
Frequent Contributor

I want to catch the event when z changes (when I scroll the mouse wheel) in the Stereo Map. In ArcMap, I used the following code in a ToolControl:

((IEditEvents2_Event)_editor).OnCurrentZChanged += OnCurrentZChanged

How can I achieve this in ArcGIS Pro? I tried the following method in a MapTool, but this only reacts when x and/or y change:

protected override async void OnToolMouseMove(MapViewMouseEventArgs e)

Any help is appreciated!

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
BarbaraSchneider2
Frequent Contributor

I tried the OnToolMouseMoveEvent in a MapTool again (see above), and now (in ArcGIS Pro 3.4), it catches the event when the z-value of the cursor changes!

View solution in original post

0 Kudos
4 Replies
SelimDissem
Esri Contributor

@BarbaraSchneider2 

the MapViewCameraChangedEvent Class—ArcGIS Pro event provides the before and after status of the camera (PreviousCamera and CurrentCamera) and the Camera object has x, y and z properties (amongst others) so you can quickly test if PreviousCamera.z != CurrentCamera.z (or the opposite) and implement whatever logic you need if the test is successful (the z value has changed).

0 Kudos
BarbaraSchneider2
Frequent Contributor

Hi Selim,

thanks for your reply! I want to display the current object height (height above sea level minus DTM height) in a text box inside a dockpane, when the user moves the mouse (x,y and z) on the stereo map. This could be achieved in ArcObjects using the event OnCurrentZChanged (see above).

Unfortunately, MapViewCameraChangedEvent does not catch the event when the mouse (x,y,z) moves on the map (or stereo map) , it only catches the event when the map is moved.

0 Kudos
BarbaraSchneider2
Frequent Contributor

The MapViewCameraChangedEvent  catches the event when the map is moved. This can be used when in Fixed Cursor Mode on the Stereo Map. Unfortunately, the camera only returns the x and y, not the z. 

0 Kudos
BarbaraSchneider2
Frequent Contributor

I tried the OnToolMouseMoveEvent in a MapTool again (see above), and now (in ArcGIS Pro 3.4), it catches the event when the z-value of the cursor changes!

0 Kudos