mainstringargs
mainstringargs

Reputation: 14381

WorldWind Image at Elevation

Is there a way to put an image in WorldWind at elevation? I'm able to use a Surface Image to place an image on the globe -- but I'd like to have it instead at a given elevation above the terrain, but I'm not finding it in the API.

Upvotes: 1

Views: 352

Answers (1)

Chris K
Chris K

Reputation: 1723

You can put an image on a Polygon and place it at any elevation you want. Take a look at gov.nasa.worldwind.examples.Polygons. The relevant lines are:

ArrayList<Position> pathLocations = new ArrayList<Position>();
pathLocations.add(Position.fromDegrees(28, -110, 5e4));
pathLocations.add(Position.fromDegrees(35, -108, 5e4));
pathLocations.add(Position.fromDegrees(35, -111, 5e4));
pathLocations.add(Position.fromDegrees(28, -111, 5e4));
pathLocations.add(Position.fromDegrees(28, -110, 5e4));
pgon = new Polygon(pathLocations);
pgon.setValue(AVKey.DISPLAY_NAME, "Has an image");
normalAttributes = new BasicShapeAttributes(normalAttributes);
normalAttributes.setDrawInterior(true);
normalAttributes.setInteriorMaterial(Material.WHITE);
normalAttributes.setInteriorOpacity(1);
pgon.setAttributes(normalAttributes);
pgon.setHighlightAttributes(highlightAttributes);
float[] texCoords = new float[] {0, 0, 1, 0, 1, 1, 0, 1, 0, 0};
pgon.setTextureImageSource("images/32x32-icon-nasa.png", texCoords, 5);

Upvotes: 1

Related Questions