STK Graphics PrimitivesSend comments on this topic.
IAgStkGraphicsDistanceDisplayCondition Interface

Description

Defines an inclusive distance interval that determines when an object, such as a primitive, is rendered based on the distance from the camera to the object.

Public Properties

Public Property MaximumDistanceGets or sets the maximum distance of the inclusive distance interval. Use Double.MaxValue to ignore checking the maximum distance.
Public Property MaximumDistanceSquaredGets the squared maximum distance of the inclusive distance interval.
Public Property MinimumDistanceGets or sets the minimum distance of the inclusive distance interval.
Public Property MinimumDistanceSquaredGets the squared minimum distance of the inclusive distance interval.

Interfaces

Implemented Interface
IAgStkGraphicsDisplayCondition

CoClasses that Implement IAgStkGraphicsDistanceDisplayCondition

Example

Draw a primitive based on viewer distance
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsModelPrimitive model = manager.Initializers.ModelPrimitive.InitializeWithStringUri(
    modelFile);
Array position = new object[3] { 29.98, -90.25, 8000.0 };
model.SetPositionCartographic("Earth", ref position);
model.Scale = Math.Pow(10, 3);

IAgStkGraphicsDistanceDisplayCondition condition =
    manager.Initializers.DistanceDisplayCondition.InitializeWithDistances(2000, 40000);
((IAgStkGraphicsPrimitive)model).DisplayCondition = condition as IAgStkGraphicsDisplayCondition;

manager.Primitives.Add((IAgStkGraphicsPrimitive)model);
Draw a screen overlay based on viewer distance
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsScreenOverlayCollectionBase overlayManager = (IAgStkGraphicsScreenOverlayCollectionBase)manager.ScreenOverlays.Overlays;

IAgStkGraphicsDistanceToPrimitiveDisplayCondition condition = 
    manager.Initializers.DistanceToPrimitiveDisplayCondition.InitializeWithDistances(
    (IAgStkGraphicsPrimitive)model, 0, 40000);
((IAgStkGraphicsOverlay)overlay).DisplayCondition = (IAgStkGraphicsDisplayCondition)condition;

manager.Primitives.Add((IAgStkGraphicsPrimitive)model);
overlayManager.Add(overlay);
Draw a primitive based on viewer distance
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim model As IAgStkGraphicsModelPrimitive = manager.Initializers.ModelPrimitive.InitializeWithStringUri( _
    modelFile)
Dim position As Array = New Object() {29.98, -90.25, 8000.0}
model.SetPositionCartographic("Earth", position)
model.Scale = Math.Pow(10, 3)

Dim condition As IAgStkGraphicsDistanceDisplayCondition = manager.Initializers.DistanceDisplayCondition.InitializeWithDistances(2000, 40000)
DirectCast(model, IAgStkGraphicsPrimitive).DisplayCondition = TryCast(condition, IAgStkGraphicsDisplayCondition)

manager.Primitives.Add(DirectCast(model, IAgStkGraphicsPrimitive))
Draw a screen overlay based on viewer distance
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim overlayManager As IAgStkGraphicsScreenOverlayCollectionBase = DirectCast(manager.ScreenOverlays.Overlays, IAgStkGraphicsScreenOverlayCollectionBase)

Dim condition As IAgStkGraphicsDistanceToPrimitiveDisplayCondition = manager.Initializers.DistanceToPrimitiveDisplayCondition.InitializeWithDistances(DirectCast(model, IAgStkGraphicsPrimitive), 0, 40000)
DirectCast(overlay, IAgStkGraphicsOverlay).DisplayCondition = DirectCast(condition, IAgStkGraphicsDisplayCondition)

manager.Primitives.Add(DirectCast(model, IAgStkGraphicsPrimitive))
overlayManager.Add(overlay)

See Also

© 2024 Analytical Graphics, Inc. All Rights Reserved.