Click or drag to resize

Ordered Composite Primitive

OrderedCompositePrimitive is similar to CompositePrimitive, in that it is a primitive that contains other primitives. The key difference is that OrderedCompositePrimitive has a well defined order for rendering overlapping primitives.

Using an Ordered Composite

An ordered composite is intended to contain overlapping primitives rendered on the globe's surface. It is compatible with the following primitives:

It is not intended for use with ModelPrimitive, SolidPrimitive, or CompositePrimitive.

Primitives added to an ordered composite first are drawn below those added later. For example, the following image shows a polyline for the Schuylkill River drawn on top of two triangle meshes for the 215 and 610 area codes, which are drawn on top of a triangle mesh for Pennsylvania.

Ordered Composite All

To create this ordering, first, the triangle mesh for Pennsylvania is added to an ordered composite:

C#
OrderedCompositePrimitive composite = new OrderedCompositePrimitive();
composite.Add(pennsylvania);
Ordered Composite State Only

Next, the triangle meshes for the 215 and 610 area codes are added, since they should be rendered on top of the Pennsylvania triangle mesh:

C#
composite.Add(areaCode610);
composite.Add(areaCode215);
Ordered Composite State And Zips

Finally, the polyline for the Schuylkill River is added, since it should be rendered on top of the zip code and Pennsylvania triangle meshes:

C#
composite.Add(schuylkillRiver);
SceneManager.Primitives.Add(composite);
Ordered Composite All

The ordered composite provides methods to change the render order of primitives after they are added. See BringToFront, BringForward, SendBackward, and SendToBack. Primitives at the back are rendered below those at the front, just as if they were added first. For example, the Schuylkill River polyline could be rendered below the zip code and Pennsylvania triangle meshes by moving it to the back:

C#
composite.SendToBack(schuylkillRiver);
Note Note

Regardless of order in the ordered composite, all SurfaceMeshPrimitives in an ordered composite are rendered before all other primitives in that composite.

The ordered composite can be used with display conditions in the same manner as the normal composite, as described in the Composite Primitive topic.