Developers

The whats, whys, and hows of DrapedFlat mode for SurfacePlacement in ArcGIS Runtime

What is SurfacePlacement?

SurfacePlacement is used in 3D applications to determine the position of a graphic or feature in the scene. In this article, I will describe a new mode that was added in ArcGIS Runtime with version 100.7, for defining the placement of elements in a scene. You may wish to place a graphic or feature (point, line, or polygon) on the ground (a vehicle on a road), or at a certain elevation from the ground (an aircraft in flight). In this topic, I will focus on placing point graphics or features on the ground.

Note, the capabilities presented in this blog post are available in all ArcGIS Runtime SDKs.   However I will focus on use of the ArcGIS Runtime SDK for Qt to discuss and demonstrate these capabilities.

Adding a Draped feature in Dynamic rendering mode

For elements you want to display on the surface, there are some additional considerations. GeoElements, that is graphics or features, can be displayed billboarded (always facing the camera) or draped (flat on the ground). The most important factor when working with billboarded or draped elements is the rendering mode: dynamic and static.

By default, point features are rendered in dynamic rendering mode, resulting in a billboarded display. However, there are times when you need elements to lay flat on the ground (draped). Displaying a moving object on the surface, for example, such as a navigation symbol, or the ground location of a flying aircraft. Prior to 100.7, the only way to accomplish this was to use static rendering mode for the element. However, static rendering mode is not intended to be used with rapidly changing data and is therefore not well suited to solve this problem. Hence, we added a new surface placement mode called SurfacePlacement::DrapedFlat to better support this use case. This mode enables features to be rendered flat on the ground while using dynamic rendering mode. It also allows symbols to be draped flat on the base surface combined with the ability to rapidly update them as supported by all other surface placement options in dynamic mode.

For a graphics overlay or a feature layer, you can set the surface placement mode using the sceneProperties property on either class.

Prior to 100.7, the default surface placement mode was SurfacePlacement::Draped. However, to add more clarity, we deprecated that value and replaced it with SurfacePlacement::Billboarded. Any existing code you have will continue to work, but it is encouraged that you update the enumeration to the new Billboarded  value.

Code example

Here is some code demonstrating both the Draped mode:


// create a graphics overlay
GraphicsOverlay* graphics_Overlay = new GraphicsOverlay(this);

// set the surface placement on the graphics overlay
graphics_Overlay->setSceneProperties(LayerSceneProperties(SurfacePlacement::DrapedFlat));

// add the graphics overlay to the SceneView
m_sceneView->graphicsOverlays()->append(graphics_Overlay);

const QUrl pmsUrl("qrc:/Resources/images/navigation.png");
// create a picture marker symbol and set a size
PictureMarkerSymbol* pms = new PictureMarkerSymbol(pmsUrl, this);
pms->setWidth(50.0f);
pms->setHeight(50.0f);

// create a geometry for the graphic
Point pnt(134, 34, 40, SpatialReference::wgs84());

// create a new graphic using the point above
Graphic* pmsGraphic = new Graphic(pnt, pms, this);
// give it an attribute for heading
pmsGraphic->attributes()->insertAttribute("HEADING", 360);

// add the graphic to the graphics overlay
graphics_Overlay->graphics()->append(pmsGraphic);

// set a view point to zoom to the graphic
m_sceneView->setViewpoint(Viewpoint(graphics_Overlay->extent()));

This results in the graphic being draped flat on the ground as shown below:

Conclusion

As you can see, these two modes give you the ability to render GeoElements based on your use case without changing the rendering mode. You’ll notice, in the code example above, that the graphics overlay rendering mode was not changed and thus the graphic was rendered in (the default) dynamic rendering mode.

However, if the surface placement is changed to DrapedBillboarded (graphics_Overlay->setSceneProperties(LayerSceneProperties(SurfacePlacement::DrapedBillboarded));) instead of DrapedFlat, you will see the graphic render billboarded as shown below.

I hope you found this description of the new SurfacePlacement mode useful. Please share your feedback with us, we would love to hear from you!

About the authors

Koushik is a Principal Product Engineer with the ArcGIS Runtime team. He primarily works on the 3D layers specializing in Qt SDK. He is passionate about building high quality functional APIs for our users. Koushik presents at Esri conferences like Developers Summit or the Users Conference where he talks about using the different parts of the Maps SDK.

Connect:

Rex Hansen is a Product Manager for the ArcGIS Maps SDKs for Native Apps and ArcGIS Maps SDKs for Game Engines. He has over 25 years of experience in GIS, spatial analytics, and computer mapping. Currently, he guides the development of native technologies in the GIS industry to use authoritative geospatial content and analysis in offline workflows, photorealistic experiences, and immersive, extended reality solutions.

Connect:
0 Comments
Inline Feedbacks
View all comments

Next Article

What’s new in ArcGIS StoryMaps (April 2024)

Read this article