Select to view content in your preferred language

How to set z values of a Graphic on 3D Scene?

1189
3
Jump to solution
06-24-2021 06:35 AM
FatmaAkdemir
Frequent Contributor

We have a 3D SceneGraphicsView and several GraphicOverlays on that view. We want to give priority to some certain type of Graphics when user clicks on it. When another Graphic overlaps with that certain type, we want that certain type of Graphic to be selected. How can we achieve this? If we could give Z value to a GraphicOverlay instead of a single Graphic that would be OK too.

0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir. Identify and Selection are two different operations. First you identify and you'll get a list of identified graphics. After that, you can decide which graphic(s) you want to select based on some criteria.

This is where the previous recommendation comes into play. If you organize your graphics into different overlays and only identify the ones from a specific overlay, you can select any/all graphics identified. This is a good strategy to organize "graphics to select" vs "other graphics". If your identified graphics could be in any overlay, then this becomes more difficult. When in 3D the distance to the camera plays a factor in which graphics will appear on top of each other, so that can be inconsistent in determining which graphic to select based on which graphic appeared on top at the moment of the identify operation.

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-graphic.html#setZIndex

 

View solution in original post

0 Kudos
3 Replies
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir. Unfortunately a z value will not help to prioritize which graphics are identified. The z values don't impact identify operations.

What you can do is organize the graphics you want to prioritize into a single graphics overlay and then use

GeoView::identifyGraphicsOverlay

and pass that specific overlay to make sure you only get results from that one. It will be trickier if you want to intersperse graphics in multiple graphics overlays and prioritize identifying certain graphics over others.

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-geoview.html#identifyGraphicsO...

or 

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-geoview.html#identifyGraphicsO... 

0 Kudos
FatmaAkdemir
Frequent Contributor

Thanks @JamesBallard1 , for the reply. What I wanted to ask is : When 2 or more Graphics overlap and user clicks on them, which one would be selected with mouse click? All of them or only the topmost one? And how can I assure that the one I want to be clicked is at the top?

0 Kudos
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir. Identify and Selection are two different operations. First you identify and you'll get a list of identified graphics. After that, you can decide which graphic(s) you want to select based on some criteria.

This is where the previous recommendation comes into play. If you organize your graphics into different overlays and only identify the ones from a specific overlay, you can select any/all graphics identified. This is a good strategy to organize "graphics to select" vs "other graphics". If your identified graphics could be in any overlay, then this becomes more difficult. When in 3D the distance to the camera plays a factor in which graphics will appear on top of each other, so that can be inconsistent in determining which graphic to select based on which graphic appeared on top at the moment of the identify operation.

https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-graphic.html#setZIndex

 

0 Kudos