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.
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
// add the graphics overlay to the SceneView
const QUrl pmsUrl("qrc:/Resources/images/navigation.png");
// create a picture marker symbol and set a size
PictureMarkerSymbol* pms = new PictureMarkerSymbol(pmsUrl, this);
// 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
// add the graphic to the graphics overlay
// set a view point to zoom to the graphic
This results in the graphic being draped flat on the ground as shown below:
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!