Click or drag to resize

Point Batch Primitive

PointBatchPrimitive 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 HowTo:

C#
List<Cartographic> positions = new List<Cartographic>
{
    new Cartographic(Trig.DegreesToRadians(-75.25), Trig.DegreesToRadians(39.88), 0.0), //Philadelphia
    new Cartographic(Trig.DegreesToRadians(-77.04), Trig.DegreesToRadians(38.85), 0.0), //Washington, D.C.
    new Cartographic(Trig.DegreesToRadians(-90.25), Trig.DegreesToRadians(29.98), 0.0), //New Orleans
    new Cartographic(Trig.DegreesToRadians(-121.92), Trig.DegreesToRadians(37.37), 0.0), //San Jose
};

PointBatchPrimitive pointBatch = new PointBatchPrimitive
{
    PixelSize = 5.0f,
    Color = Color.White,
    DisplayOutline = true,
    OutlineWidth = 2.0f,
    OutlineColor = Color.Red
};
pointBatch.SetCartographic(CentralBodiesFacet.GetFromContext().Earth, positions);

SceneManager.Primitives.Add(pointBatch);
Point Batch Example
Per-position Colors

In the above example, each position in the batch is the same color. The point batch also supports per-position colors, 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 HowTo:

C#
List<Cartographic> positions = new List<Cartographic>
{
    new Cartographic(Trig.DegreesToRadians(-122.38), Trig.DegreesToRadians(37.62), 0.0), // San Francisco
    new Cartographic(Trig.DegreesToRadians(-121.50), Trig.DegreesToRadians(38.52), 0.0), // Sacramento
    new Cartographic(Trig.DegreesToRadians(-118.40), Trig.DegreesToRadians(33.93), 0.0), // Los Angeles
    new Cartographic(Trig.DegreesToRadians(-117.13), Trig.DegreesToRadians(32.82), 0.0), // San Diego
};

List<Color> colors = new List<Color>
{
    Color.Red,
    Color.Orange,
    Color.Blue,
    Color.White
};

PointBatchPrimitive pointBatch = new PointBatchPrimitive
{
    PixelSize = 8.0f
};
pointBatch.SetCartographic(CentralBodiesFacet.GetFromContext().Earth, positions, colors);

SceneManager.Primitives.Add(pointBatch);
Point Batch Per-Position Color Example