Display Conditions

Display conditions are used to limit when a primitive, globe overlay, or screen overlay is rendered. This can be based on the distance from the camera to an object, such as a primitive or globe overlay, the distance from the camera to a position, the camera's altitude, pixel size, the current time, or other conditions. These fine grain conditions can be combined using Boolean logic with a composite - that is, a condition of conditions. For example, several time intervals can be or-ed together.

For efficient evaluation, primitives that share the same condition can be combined using a composite primitive. For example, 1,000 models with the same condition can be combined in a composite primitive so that they are quickly rejected. See the composite primitive overview.

Several fine grain conditions are available, including:

A display condition is applied to an object as shown in the following code example:

[C#] Copy Code
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsAltitudeDisplayCondition condition = manager.Initializers.AltitudeDisplayCondition.InitializeWithAltitudes(0, 1000); // Minimum Altitude, Maximum Altitude
primitive.DisplayCondition = condition as IAgStkGraphicsDisplayCondition;

When an object's DisplayCondition property is not null, the condition is evaluated before the object is rendered. The object is rendered only if the condition is met. In this case, the primitive will only be rendered if the camera's altitude is within [0, 1000] meters from the Earth's surface.

The same display condition instance can be assigned to multiple objects.

Display Condition: Composite

Display conditions can be combined with Boolean logic using composites, CompositeDisplayCondition. Hierarchies of composites can represent expressions with parentheses, but 9 times out of 10, simple and / or combinations of conditions will do the trick.

The following example creates a composite of conditions that allows the primitive to be rendered during two time intervals.

[C#] Copy Code
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgDate start1 = root.ConversionUtility.NewDate("UTCG", "30 May 2008 14:00:00.000");
IAgDate end1 = root.ConversionUtility.NewDate("UTCG", "30 May 2008 14:30:00.000");
IAgDate start2 = root.ConversionUtility.NewDate("UTCG", "30 May 2008 15:00:00.000");
IAgDate end2 = root.ConversionUtility.NewDate("UTCG", "30 May 2008 15:30:00.000");

IAgStkGraphicsTimeIntervalDisplayCondition time1 = manager.Initializers.TimeIntervalDisplayCondition.InitializeWithTimes(start1, end1);
IAgStkGraphicsTimeIntervalDisplayCondition time2 = manager.Initializers.TimeIntervalDisplayCondition.InitializeWithTimes(start2, end2);
IAgStkGraphicsCompositeDisplayCondition composite = manager.Initializers.CompositeDisplayCondition.Initialize();

composite.LogicOperation = AgEStkGraphicsBinaryLogicOperation.eStkGraphicsBinaryLogicOperationOr;

primitive.DisplayCondition = composite as IAgStkGraphicsDisplayCondition;

If a large number of conditions are added to a composite, the composite can become expensive to compute, especially if a large number of primitives have a reference to the same composite. In this case, it is recommended to put the primitives into a composite of primitives and assign the composite condition to the composite primitive.

STK 11.2.1 Programming Interface