How to draw a line with elevation representation in WorldWind
Asked Answered
E

2

6

I want to draw a line on the globe with elevation representation, something like this :

Elevation representation sketch

I know I can use polyline to represent a line, but how can fill the space below the line ?

Ethics answered 28/5, 2015 at 8:15 Comment(4)
Does the globe make a difference here, I mean can it be a plain as well? Should be the filled area be segmented?Barhorst
Absolutly no need of segmentation, the goal is just to represent the elevation of the lineEthics
Is this really related to javafx ?Prayerful
Well I use a worldwind panel in a javafx applicationEthics
E
3

You can use a path to draw the line. The setOutlineMaterial will draw a "curtain" similar to what you want.

Path path = new Path(pathPositions); //Arraylist of positions
final BasicShapeAttributes attrs = new BasicShapeAttributes();
attrs.setInteriorOpacity(0.25);
attrs.setInteriorMaterial(Material.BLACK);
attrs.setOutlineMaterial(new Material(color));
attrs.setOutlineWidth(width);
path.setAttributes(attrs);
path.setDrawVerticals(true);
path.setAltitudeMode(WorldWind.ABSOLUTE);

look at Path altitude mode how you want it follow the ground.

Easton answered 4/2, 2016 at 17:45 Comment(0)
G
1

You can use a polygon, just give it points with the same latitude and longitude but different elevations:

ArrayList<Position> pathPositions = new ArrayList<Position>();
pathPositions.add(Position.fromDegrees(28, -106, 3e4));
pathPositions.add(Position.fromDegrees(28, -106, 3e0));
pathPositions.add(Position.fromDegrees(35, -107, 9e0));
pathPositions.add(Position.fromDegrees(35, -107, 9e4));
pathPositions.add(Position.fromDegrees(28, -106, 3e4));
Polygon pgon = new Polygon(pathPositions);
Grison answered 15/7, 2015 at 21:18 Comment(1)
And use setExtrude also to draw the elevation.Ethics

© 2022 - 2024 — McMap. All rights reserved.