STK Graphics PrimitivesSend comments on this topic.
IAgStkGraphicsPolylinePrimitive Interface

Description

Renders a polyline in the 3D scene. Each line segment may have a different color. A polyline can be constructed with a Position Interpolator to render great arcs or rhumb lines.

Public Methods

Public Method SetDefines the positions for a polyline primitive. The polyline is rendered in its Reference Frame.
Public Method SetCartographicFor convenience. Defines the positions of a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling Set.
Public Method SetCartographicWithColorsFor convenience. Defines the positions and colors of a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling Set.
Public Method SetCartographicWithColorsAndHintFor convenience. Defines the positions and colors of a polyline using Cartographic positions. renderPassHint is provided for efficiency. This is equivalent to converting each position in positions to Cartesian and calling Set.
Public Method SetCartographicWithColorsAndOptionalParametersFor convenience. Defines the positions, colors, and/or optional point properties of a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling Set.
Public Method SetPartialUpdates a subset of positions in a polyline.
Public Method SetPartialCartographicFor convenience. Updates a subset of positions in a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling SetPartial.
Public Method SetPartialCartographicWithColorsFor convenience. Updates a subset of positions and/or colors in a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling SetPartial.
Public Method SetPartialCartographicWithColorsIndicesOrderAndRenderPassFor convenience. Updates a subset of positions and/or colors in a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling SetPartial.
Public Method SetPartialCartographicWithIndicesOrderFor convenience. Updates a subset of positions in a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling SetPartial.
Public Method SetPartialCartographicWithOptionalParametersFor convenience. Updates a subset of positions, colors, and/or optional point properties in a polyline using Cartographic positions. This is equivalent to converting each position in positions to Cartesian and calling SetPartial.
Public Method SetPartialWithColorsUpdates a subset of positions and/or colors in a polyline.
Public Method SetPartialWithColorsAndOptionalParametersUpdates a subset of positions, colors, and/or optional point properties in a polyline.
Public Method SetPartialWithColorsIndicesOrderAndRenderPassHintUpdates a subset of positions and/or colors in a polyline.
Public Method SetPartialWithIndicesOrderUpdates a subset of positions in a polyline.
Public Method SetSubsetDefines the positions of a polyline using a subset of input positions.
Public Method SetSubsetCartographicFor convenience. Defines the positions of a polyline using a subset of input Cartographic positions. This is equivalent to converting the subset of positions to Cartesian and calling SetSubset.
Public Method SetWithColorsDefines the positions and colors of a polyline. The polyline is rendered in its Reference Frame.
Public Method SetWithColorsAndHintDefines the positions and colors of a polyline. The polyline is rendered in its Reference Frame. renderPassHint is provided for efficiency.
Public Method SetWithColorsAndOptionalParametersDefines the positions, colors, and/or optional point properties of a polyline. The polyline is rendered in its Reference Frame.
Public Method SetWithSolidTriangulatorResultDefines the positions of a polyline using the outline positions of the specified solidTriangulatorResult.
Public Method SetWithSurfaceShapesResultDefines the positions of a polyline using the positions of the specified surfaceShapesResult.
Public Method SetWithSurfaceTriangulatorResultDefines the positions of a polyline using the boundary positions of the specified surfaceTriangulatorResult.

Public Properties

Public Property CentralBodyClippedGets or sets whether the polyline will be clipped by the central body.
Public Property DisplayOutlineGets or sets whether an outline is rendered around the polyline.
Public Property MaximumWidthSupportedGets the maximum width, in pixels, supported by the video card.
Public Property MinimumWidthSupportedGets the minimum width, in pixels, supported by the video card.
Public Property OutlineColorGets or sets the outline's color.
Public Property OutlineTranslucencyGets or sets the translucency of the outline. Translucency is between 0 and 1, where 0 is opaque and 1 is transparent.
Public Property OutlineWidthGets or sets the width, in pixels, of the outline around the polyline.
Public Property PerItemPickingEnabledGets or sets whether individual line indices will be included in the PickResults returned from the Scene's Pick method. Each line index that is picked will be returned as a BatchPrimitiveIndex.
Public Property PolylineTypeGets how the polyline interprets the positions passed to Set methods.
Public Property PositionInterpolatorGets the Position Interpolator applied to positions passed to Set, SetCartographic, SetSubset, and SetSubsetCartographic methods. When this property is null, linear interpolation is used.
Public Property SetHintGets the primitive's Set Hint. See the Set Hint Performance Overview for selecting an appropriate value to construct the primitive with.
Public Property WidthGets or sets the line width, in pixels.

Interfaces

Implemented Interface
IAgStkGraphicsPrimitive

CoClasses that Implement IAgStkGraphicsPolylinePrimitive

Example

Draw a STK area target outline on the globe
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;

IAgStkGraphicsPolylinePrimitive line = manager.Initializers.PolylinePrimitive.Initialize();
line.Set(ref positions);
line.Width = 2;
((IAgStkGraphicsPrimitive)line).Color = Color.Yellow;
line.DisplayOutline = true;
line.OutlineWidth = 2;
line.OutlineColor = Color.Black;

manager.Primitives.Add((IAgStkGraphicsPrimitive)line);
Draw the outline of a circle on the globe
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array center = new object[] { 39.88, -75.25, 0.0 }; // Philadelphia

IAgStkGraphicsSurfaceShapesResult shape = manager.Initializers.SurfaceShapes.ComputeCircleCartographic("Earth", ref center, 10000);
Array positions = shape.Positions;

IAgStkGraphicsPolylinePrimitive line = manager.Initializers.PolylinePrimitive.InitializeWithType(shape.PolylineType);
line.Set(ref positions);
line.Width = 2;
((IAgStkGraphicsPrimitive)line).Color = Color.White;

manager.Primitives.Add((IAgStkGraphicsPrimitive)line);
Draw a line between two points
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array philadelphia = new object[]
{
    39.88,
    -75.25,
    3000.0
};
Array washingtonDC = new object[]
{
    38.85,
    -77.04,
    3000.0
};

Array positions = new object[6];
philadelphia.CopyTo(positions, 0);
washingtonDC.CopyTo(positions, 3);

IAgStkGraphicsPolylinePrimitive line = manager.Initializers.PolylinePrimitive.Initialize();
line.SetCartographic("Earth", ref positions);
manager.Primitives.Add((IAgStkGraphicsPrimitive)line);
Draw the outline of an ellipse on the globe
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array center = new object[] { 38.85, -77.04, 3000.0 }; // Washington, DC

IAgStkGraphicsSurfaceShapesResult shape = manager.Initializers.SurfaceShapes.ComputeEllipseCartographic(
    "Earth", ref center, 45000, 30000, 45);
Array positions = shape.Positions;

IAgStkGraphicsPolylinePrimitive line = manager.Initializers.PolylinePrimitive.InitializeWithType(shape.PolylineType);
line.Set(ref positions);
((IAgStkGraphicsPrimitive)line).Color = Color.Cyan;

manager.Primitives.Add((IAgStkGraphicsPrimitive)line);
Draw a great arc on the globe
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array washingtonDC = new object[] 
{
    38.85,
    -77.04,
    0.0
};
Array newOrleans = new object[] 
{
    29.98, 
    -90.25,
    0.0
};

Array positions = new object[6];
washingtonDC.CopyTo(positions, 0);
newOrleans.CopyTo(positions, 3);

IAgStkGraphicsPositionInterpolator interpolator = manager.Initializers.GreatArcInterpolator.Initialize() as IAgStkGraphicsPositionInterpolator;
IAgStkGraphicsPolylinePrimitive line = manager.Initializers.PolylinePrimitive.InitializeWithInterpolator(interpolator);
line.SetCartographic("Earth", ref positions);

manager.Primitives.Add((IAgStkGraphicsPrimitive)line);
Draw a rhumb line on the globe
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array newOrleans = new object[] 
{
    29.98, 
    -90.25, 
    0.0
};
Array sanJose = new object[] 
{
    37.37, 
    -121.92, 
    0.0
};

Array positions = new object[6];
newOrleans.CopyTo(positions, 0);
sanJose.CopyTo(positions, 3);

IAgStkGraphicsPositionInterpolator interpolator = manager.Initializers.RhumbLineInterpolator.Initialize() as IAgStkGraphicsPositionInterpolator;
IAgStkGraphicsPolylinePrimitive line = manager.Initializers.PolylinePrimitive.InitializeWithInterpolator(interpolator);
line.SetCartographic("Earth", ref positions);
manager.Primitives.Add((IAgStkGraphicsPrimitive)line);
Draw a STK area target outline on the globe
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager

Dim line As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.Initialize()

line.Set(positions)
line.Width = 2
DirectCast(line, IAgStkGraphicsPrimitive).Color = Color.Yellow
line.DisplayOutline = True
line.OutlineWidth = 2
line.OutlineColor = Color.Black

manager.Primitives.Add(DirectCast(line, IAgStkGraphicsPrimitive))
Draw the outline of a circle on the globe
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim philadelphia As Array = New Object() {39.88, -75.25, 0.0}

Dim shape As IAgStkGraphicsSurfaceShapesResult = manager.Initializers.SurfaceShapes.ComputeCircleCartographic("Earth", philadelphia, 10000)
Dim positions As Array = shape.Positions

Dim line As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.InitializeWithType(shape.PolylineType)
line.Set(positions)
line.Width = 2
DirectCast(line, IAgStkGraphicsPrimitive).Color = Color.White

manager.Primitives.Add(DirectCast(line, IAgStkGraphicsPrimitive))
Draw a line between two points
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim philadelphia As Array = New Object() {39.88, -75.25, 3000.0}
Dim washingtonDC As Array = New Object() {38.85, -77.04, 3000.0}

Dim positions As Array = New Object(5) {}
philadelphia.CopyTo(positions, 0)
washingtonDC.CopyTo(positions, 3)

Dim line As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.Initialize()
'$planetName$Name of the planet to place primitive$
line.SetCartographic("Earth", positions)
manager.Primitives.Add(DirectCast(line, IAgStkGraphicsPrimitive))
Draw the outline of an ellipse on the globe
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim washingtonDC As Array = New Object() {38.85, -77.04, 3000.0}

Dim shape As IAgStkGraphicsSurfaceShapesResult = manager.Initializers.SurfaceShapes.ComputeEllipseCartographic("Earth", washingtonDC, 45000, 30000, 45)
Dim positions As Array = shape.Positions

Dim line As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.InitializeWithType(shape.PolylineType)
line.Set(positions)
DirectCast(line, IAgStkGraphicsPrimitive).Color = Color.Cyan

manager.Primitives.Add(DirectCast(line, IAgStkGraphicsPrimitive))
Draw a great arc on the globe
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim washingtonDC As Array = New Object() {38.85, -77.04, 0.0}
Dim newOrleans As Array = New Object() {29.98, -90.25, 0.0}

Dim positions As Array = New Object(5) {}
washingtonDC.CopyTo(positions, 0)
newOrleans.CopyTo(positions, 3)

Dim interpolator As IAgStkGraphicsPositionInterpolator = TryCast(manager.Initializers.GreatArcInterpolator.Initialize(), IAgStkGraphicsPositionInterpolator)
Dim line As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.InitializeWithInterpolator(interpolator)
line.SetCartographic("Earth", positions)

manager.Primitives.Add(DirectCast(line, IAgStkGraphicsPrimitive))
Draw a rhumb line on the globe
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim newOrleans As Array = New Object() {29.98, -90.25, 0.0}
Dim sanJose As Array = New Object() {37.37, -121.92, 0.0}

Dim positions As Array = New Object(5) {}
newOrleans.CopyTo(positions, 0)
sanJose.CopyTo(positions, 3)

Dim interpolator As IAgStkGraphicsPositionInterpolator = TryCast(manager.Initializers.RhumbLineInterpolator.Initialize(), IAgStkGraphicsPositionInterpolator)
Dim line As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.InitializeWithInterpolator(interpolator)
line.SetCartographic("Earth", positions)
manager.Primitives.Add(DirectCast(line, IAgStkGraphicsPrimitive))
Draw a new Polyline Primitive
[MATLAB]
% IAgScenario scenario: Scenario object
% 3(n) x 1 cell result: cell of LLA values
% Create a polyline primitive and sets properties
manager = scenario.SceneManager;
polyline = manager.Initializers.PolylinePrimitive.InitializeWithType('eStkGraphicsPolylineTypeLineStrip');
polyline.SetCartographic('Earth', {43.6364; -106.364; 1.0;
                                   43.6364; -85.2273; 2.0,
                                   34.7727; -81.1363; 1.0});
polyline.Color = 255; % Red
polyline.Width = 3;
polyline.Translucency = 0;
polyline.Display = true;
polyline.DisplayOutline = false;
manager.Primitives.Add(polyline);
manager.Render();

%%
path = manager.Initializers.PathPrimitive.Initialize();
path.Width = 2;

interpolator = manager.Initializers.GreatArcInterpolator.InitializeWithCentralBody('Earth');
interpolator.Granularity = 1;
interpolator.PolylineType(1);

result = interpolator.Interpolate({2.383;13.049;10;0.054;35.919;10});
% path.AddRangeToFront(reshape(result, length(result)/3, 3));

counter = 1;
for i=counter:3:length(result)
    cartesian = root.ConversionUtility.ConvertPositionArray('eGeodetic', {result{i}, result{i+1}, result{i+2}}, 'eCartesian');
    pt = manager.Initializers.PathPoint.Initialize;
    pt.Position = cartesian';
    pt.Translucency = .25;

    counter = counter + 1;
    if (rem(counter, 2) == 0)
        pt.Color = 255;
    else
        pt.Color = 65280;
    end
    path.AddBack(pt);
end

manager.Primitives.Add(path);
manager.Render();


        

See Also

© 2024 Analytical Graphics, Inc. All Rights Reserved.