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 viewer is at a distance. Using the point batch is similar to using the polyline but only the points are rendered and not the line segments between them as the following example from the HowTo demonstrates.
double[] points = new double[] { Trig.DegreesToRadians(39.88), Trig.DegreesToRadians(-75.25), 3000.0, // Philadelphia Trig.DegreesToRadians(38.85), Trig.DegreesToRadians(-77.04), 3000.0, // Washington, D.C. Trig.DegreesToRadians(38.85), Trig.DegreesToRadians(-77.04), 0.0, // Washington, D.C. Trig.DegreesToRadians(29.98), Trig.DegreesToRadians(-90.25), 0.0, // New Orleans Trig.DegreesToRadians(37.37), Trig.DegreesToRadians(-121.92), 0.0 // San Jose }; Array pointsAry = points; IAgGxCentralBody earth = sceneManager.CentralBodies("Earth"); IAgGxPrimitivePointBatch pointBatch = new AgGxPrimitivePointBatch(); pointBatch.InitializeCartographic(earth, AgGxVertexUpdate.VertexUpdateNone, ref pointsAry); pointBatch.PixelSize = 10; pointBatch.SetRGBA(255, 0, 0, 255); // Red sceneManager.Primitives.Add(pointBatch);
An array of doubles, where every 3 doubles is a cartographic position (latitude, longitude, altitude) is created and used to initialize the Point Batch. The pixel size is set to 10 pixels. This is similar to the marker primitive's pixel size; as the viewer zooms in and out the size of a point stays the same.
In the above example, each vertex in the batch is the same color. The point batch also supports a per vertex color using a parallel array similar to the polyline primitive. In addition to an array of vertices, a corresponding array of colors is used to initialize the point batch as demonstrated in the following example from the HowTo.
double[] points = new double[] { Trig.DegreesToRadians(37.62), Trig.DegreesToRadians(-122.38), 0.0, // San Francisco Trig.DegreesToRadians(38.52), Trig.DegreesToRadians(-121.50), 0.0, // Sacramento Trig.DegreesToRadians(33.93), Trig.DegreesToRadians(-118.40), 0.0, // Los Angeles Trig.DegreesToRadians(32.82), Trig.DegreesToRadians(-117.13), 0.0 // San Diego }; Array pointsAry = points; byte[] colors = new byte[] { 255, 0, 0, 255, // Red 0, 255, 0, 255, // Green 0, 0, 255, 255, // Blue 255, 255, 255, 255, // White }; Array colorsAry = colors; IAgGxCentralBody earth = sceneManager.CentralBodies("Earth"); IAgGxPrimitivePointBatch pointBatch = new AgGxPrimitivePointBatch(); pointBatch.InitializeCartographicWithColors(earth, AgGxVertexUpdate.VertexUpdateNone, ref pointsAry, ref colorsAry, AgGxRenderPassHint.RenderPassHintOpaque); pointBatch.PixelSize = 6; sceneManager.Primitives.Add(pointBatch);