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:

Java
ArrayList<Cartographic> positions = new ArrayList<Cartographic>();
positions.add(new Cartographic(Trig.degreesToRadians(-75.25), Trig.degreesToRadians(39.88), 0.0)); // Philadelphia
positions.add(new Cartographic(Trig.degreesToRadians(-77.04), Trig.degreesToRadians(38.85), 0.0)); // Washington, D.C.
positions.add(new Cartographic(Trig.degreesToRadians(-90.25), Trig.degreesToRadians(29.98), 0.0)); // New Orleans
positions.add(new Cartographic(Trig.degreesToRadians(-121.92), Trig.degreesToRadians(37.37), 0.0)); // San Jose

PointBatchPrimitive pointBatch = new PointBatchPrimitive();
pointBatch.setPixelSize(5.0f);
pointBatch.setColor(Color.WHITE);
pointBatch.setDisplayOutline(true);
pointBatch.setOutlineWidth(2.0f);
pointBatch.setOutlineColor(Color.RED);
pointBatch.setCartographic(CentralBodiesFacet.getFromContext().getEarth(), positions);

SceneManager.getPrimitives().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:

Java
ArrayList<Cartographic> positions = new ArrayList<Cartographic>();
positions.add(new Cartographic(Trig.degreesToRadians(-122.38), Trig.degreesToRadians(37.62), 0.0)); // San Francisco
positions.add(new Cartographic(Trig.degreesToRadians(-121.50), Trig.degreesToRadians(38.52), 0.0)); // Sacramento
positions.add(new Cartographic(Trig.degreesToRadians(-118.40), Trig.degreesToRadians(33.93), 0.0)); // Los Angeles
positions.add(new Cartographic(Trig.degreesToRadians(-117.13), Trig.degreesToRadians(32.82), 0.0)); // San Diego

ArrayList<Color> colors = new ArrayList<Color>();
colors.add(Color.RED);
Color orange = new Color(0xFFA500);
colors.add(orange);
colors.add(Color.BLUE);
colors.add(Color.WHITE);

PointBatchPrimitive pointBatch = new PointBatchPrimitive();
pointBatch.setPixelSize(8.0f);
pointBatch.setCartographic(CentralBodiesFacet.getFromContext().getEarth(), positions, colors);

SceneManager.getPrimitives().add(pointBatch);
Point Batch Per-Position Color Example