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.
An ordered composite is intended to contain overlapping primitives rendered on the globe's surface. It is compatible with the following primitives:
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.
To create this ordering, first, the triangle mesh for Pennsylvania is added to an ordered composite:
OrderedCompositePrimitive composite = new OrderedCompositePrimitive(); composite.add(pennsylvania);
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:
Finally, the polyline for the Schuylkill River is added, since it should be rendered on top of the zip code and Pennsylvania triangle meshes:
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:
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.