AGI STK Graphics 11 Send comments on this topic.
SetWithColors Method (IAgStkGraphicsPolylinePrimitive)
See Also  Example
Positions
An array containing new positions (in the order x, y, z) for the polyline.
Colors
An array containing the numeric representation of colors for the polyline. There must be one color for each position in positions. The first color is ignored, each additional color defines the color of the line segment ending at that position. In .NET a Color should be translated to a number by calling its ToArgb method and casting the result as an unsigned integer.





Description

Defines the positions and colors of a polyline. The polyline is rendered in it's Reference Frame.

Syntax

[Visual Basic .NET]
Public Sub SetWithColors( _
   ByRef Positions As System.Array, _
   ByRef Colors As System.Array _
) 

[C#]
public void SetWithColors(
ref System.Array Positions,
ref System.Array Colors
);

[Managed C++]
public: void SetWithColors(
System::Array ^^ Positions,
System::Array ^^ Colors
);

[Java]
public  setWithColors(
Object[] Positions,
Object[] Colors
);

[Unmanaged C++]
public: HRESULT SetWithColors(
SAFEARRAY ** Positions,
SAFEARRAY ** Colors
);

Parameters

Positions
An array containing new positions (in the order x, y, z) for the polyline.
Colors
An array containing the numeric representation of colors for the polyline. There must be one color for each position in positions. The first color is ignored, each additional color defines the color of the line segment ending at that position. In .NET a Color should be translated to a number by calling its ToArgb method and casting the result as an unsigned integer.

Remarks

This call overwrites the primitive's previous positions and per-position colors. To update a subset of positions and colors, use SetPartial.

If the polyline's Position Interpolator is not null, positions are interpolated before they are rendered. If the polyline's Polyline Type is LineStrip, for each position after the first position, a line segment is rendered that connects the position to the previous position. Otherwise, if Lines is used, a line segment is rendered for every two positions.

Each color in colors corresponds to a position in positions with the same location. For example, the first color in colors is applied to the first position in positions. These colors override the primitive's Color and Translucency properties. Accessing these properties will result in an Invalid Operation Exception.

To create translucent line segments, use the Color's alpha component. An alpha of 0 is completely transparent and an alpha of 255 is completely opaque.

Example

Shows the format of the Positions, Colors and Indices parameters when updating a polyline primitive.
[C#] Copy Code
Array positions = new object[] 

    1247.87, -4739.744067.77
    1115.48, -4847.093979.36
    -24.12, -5529.313168.45
    -2683.42, -4307.743850.11 
}; 
 
Array colors = new object[] 

    Color.Red.ToArgb(), 
    Color.Green.ToArgb(), 
    Color.Blue.ToArgb(), 
    Color.White.ToArgb() 
}; 
 
Array indices = new object[] 

    0
    1
    2
    3 
}; 
 
polyline.SetPartialWithColorsIndicesOrderAndRenderPassHint( 
    ref positions, 
    ref colors, 
    ref indices, 
    AgEStkGraphicsIndicesOrderHint.eStkGraphicsIndicesOrderHintSortedAscending, 
    AgEStkGraphicsRenderPassHint.eStkGraphicsRenderPassHintOpaque); 
 

Shows the format of the Positions, Colors and Indices parameters when updating a polyline primitive.
[Visual Basic .NET] Copy Code
Dim positions As Array = New Object() {1247.87, -4739.74, 4067.77, 1115.48, -4847.09, 3979.36, _
    -24.12, -5529.31, 3168.45, -2683.42, -4307.74, 3850.11}

Dim colors As Array = New Object() {Color.Red.ToArgb(), Color.Green.ToArgb(), Color.Blue.ToArgb(), Color.White.ToArgb()}

Dim indices As Array = New Object() {0, 1, 2, 3}

polyline.SetPartialWithColorsIndicesOrderAndRenderPassHint(positions, colors, indices, AgEStkGraphicsIndicesOrderHint.eStkGraphicsIndicesOrderHintSortedAscending, AgEStkGraphicsRenderPassHint.eStkGraphicsRenderPassHintOpaque)

See Also

© 2016 All Rights Reserved.

STK Programming Interface 11.0.1