我想用高程表示在地球上画一条线,如下所示:
我知道我可以使用折线来表示一条线,但是如何填充线下方的空间?
您可以使用路径来绘制线条。setOutlineMaterial 将绘制类似于您想要的“窗帘”。
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);
查看Path
海拔模式,您希望它如何跟随地面。
您可以使用多边形,只需为其指定经纬度相同但海拔不同的点:
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);