Select to view content in your preferred language

Graphics overlay renderer

3159
17
02-23-2017 10:53 AM
KirstenStrandjord
Emerging Contributor

I am interested in drawing several lines using the SimpleLineSymbol. I have run into two problems. First, in the graphics scene (3D) the lines appear and disappear behind the 3D terrain when viewed from different camera angles. Even though there is no terrain obstructing the line (no terrain between camera and graphic) the lines still appear to render in incorrect order (behind terrain). Is there a setting I need to set for this to work (e.g. a depth test). My second problem is that I want each one the lines to be a different color. Does that mean I will need a new GraphicsOverlay for each line? For example, this is how I am currently setting my renderer.

SimpleLineSymbol* sls = new SimpleLineSymbol(SimpleLineSymbolStyle::Solid, lineColor, 3, thisF);

lineGraphicOverlay->setRenderer(new mn::SimpleRenderer(sls, thisF));

This makes each line the same color. Is there a way to set each line as a different color while only having one GraphicsOverlay?
Thanks for the help! 

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
17 Replies
LucasDanzinger
Esri Frequent Contributor

Have you set the layer scene properties? GraphicsOverlay Class | ArcGIS for Developers 

As for the renderer, you should use a UniqueValueRenderer.  Each graphic needs to have some identifier in it, and then the renderer will have a specific symbol for each identifier. This will make it so that any graphic with that identifier will automatically get that symbol from the renderer. This sample shows this workflow, only it uses a FeatureLayer - UniqueValueRenderer—ArcGIS Runtime SDK for Qt | ArcGIS for Developers

0 Kudos
KirstenStrandjord
Emerging Contributor

Thanks Lucas for the response. I will give the UniqueValueRenderer a try. 

I have set the layer scene properties to absolute. I am attempting to draw the lines from a location near the surface of the terrain to a point in the sky. At no point is the line obstructed by terrain, but portions of the line render behind the terrain image and the portion that renders incorrectly changes as I change the camera angle. Here is the way in which I set the scene properties:

lineGraphicOverlay->sceneProperties().setSurfacePlacement(SurfacePlacement::Absolute);
0 Kudos
LucasDanzinger
Esri Frequent Contributor

Not positive this will fix your issues, but we had a bug in our sample before, and it looks similar to what you have in the above code. The issue is that the sceneProperties getter returns a value object, so you are just setting the surface placement on a copy, and it never makes its way back to the graphics overlay. Instead, try it like this - arcgis-runtime-samples-qt/Surface_Placement.cpp at v.next · Esri/arcgis-runtime-samples-qt · GitHub 

Again, not sure it will fix the issue, but it is the way to do it, so it shouldn't hurt at least.

0 Kudos
KirstenStrandjord
Emerging Contributor

Thanks for the response. I have changed the scene properties to set in the way mentioned in that line. However, it does not fix the rendering order problem.

0 Kudos
KirstenStrandjord
Emerging Contributor

Hey Lucas, do you have any updates on the rendering order problem I have been having? Have you ever encountered this before with drawing lines in a scene?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hi Kristen, I'm not sure what the issue is off hand. Do you have Esri technical support access through your organization? If so, they should be able to help troubleshoot more. Otherwise, maybe posting a video will help display the issue?

0 Kudos
NorbertThoden
Frequent Contributor

Hi Kristian!

I have encountered a similar problem.
As i can remember the behaviour depends also on the RenderingMode (static vs. dynamic).
I am out of office now.
I will try to give you more information tomorrow..

Norbert

Edit:

I would like to give additional information:

My goal was to create a line on the ground (draped!?) using a GraphicalOverlay.
Depending on the RenderingMode the result is:

RenderingMode::Static: The line is on the ground and i can move the viewpoint without any negative effects top the line.

RenderingMode::Dynamic: The line is on the ground and if i move the viewpoint the line move a little bit to left or right.

(Hopefully you can understand my description!?)

 

The SurfacePlacement::Draped seems to be default, but if you like to configure it manually pay attention:

d->m_graphicsLayer->sceneProperties() return a copy.

Try this:

Esri::ArcGISRuntime::LayerSceneProperties lsp = d->m_graphicsLayer->sceneProperties();
lsp.setSurfacePlacement(Esri::ArcGISRuntime::SurfacePlacement::Draped);
d->m_graphicsLayer->setSceneProperties(lsp);

or maybe simply:

d->m_graphicsLayer->setSceneProperties(Esri::ArcGISRuntime::LayerSceneProperties(Esri::ArcGISRuntime::SurfacePlacement::Draped));

Good luck

0 Kudos
KirstenStrandjord
Emerging Contributor

Hi Norbert,

Thanks for the additional info and the response. I set the RenderingMode to Dynamic and I am having the same issues. When I set the mode to Static, the lines do not appear point to the sky, but are draped over the terrain. I have attached a picture of the rendering issue. The left picture shows that (more often than not) segments of the lines do not render (green circles added to show where lines are not being draw correctly). Could this possibly by a clipping plane issue?line of sight rendering incorrectly

0 Kudos
NorbertThoden
Frequent Contributor

Oh, the lines look ugly

Can you provide a small example or code snippet?

Btw, does your basemap has an elevation?

Thx

0 Kudos