Point Batch Primitive
The point batch renders a group of points with the same pixel
size but potentially different colors. The point batch is commonly
used to visualize waypoints or locations, such as cities, when the
camera is at a distance. Using the point batch is similar to using
the polyline but only the points are rendered, not the line
segments between them. This is demonstrated in the following
example from the GraphicsHowTo:
[C#] |
Copy Code
|
IAgStkGraphicsSceneManager
manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array positions = new object[]
{
39.88, -75.25, 0, // Philadelphia
38.85, -77.04, 0, // Washington,
D.C.
29.98, -90.25, 0, // New Orleans
37.37, -121.92, 0 // San Jose
};
IAgStkGraphicsPointBatchPrimitive pointBatch =
manager.Initializers.PointBatchPrimitive.Initialize();
pointBatch.SetCartographic("Earth", ref positions);
pointBatch.PixelSize = 5;
((IAgStkGraphicsPrimitive)pointBatch).Color = Color.White;
pointBatch.DisplayOutline = true;
pointBatch.OutlineWidth = 2;
pointBatch.OutlineColor = Color.Red;
manager.Primitives.Add((IAgStkGraphicsPrimitive)pointBatch);
manager.Render();
|
|
A collection of positions is used to define the Point Batch. The
pixel size is set to 10 pixels. As the camera zooms in and out, the
size of a point on the screen stays the same.
Color,
DisplayOutline, and
OutlineColor are used to give each point a red interior with a
white outline.
In the above example, each position in the batch is the same
color. The point batch also supports a per position color using a
parallel collection similar to the polyline
primitive. In addition to a collection of positions, a
corresponding collection of colors is used to initialize the point
batch as demonstrated in the following example from the GraphicsHowTo:
[C#] |
Copy Code
|
IAgStkGraphicsSceneManager
manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array positions = new object[]
{
37.62, -122.38, 0.0, // San
Francisco
38.52, -121.50, 0.0, //
Sacramento
33.93, -118.40, 0.0, // Los
Angeles
32.82, -117.13, 0.0 // San Diego
};
Array colors = new object[]
{
(uint)Color.Red.ToArgb(),
(uint)Color.Orange.ToArgb(),
(uint)Color.Blue.ToArgb(),
(uint)Color.White.ToArgb()
};
IAgStkGraphicsPointBatchPrimitive pointBatch =
manager.Initializers.PointBatchPrimitive.Initialize();
pointBatch.SetCartographicWithColors("Earth", ref positions, ref
colors);
pointBatch.PixelSize = 8;
manager.Primitives.Add((IAgStkGraphicsPrimitive)pointBatch);
manager.Render();
|
|
STK Programming Interface 11.0.1