protected void showGridSightLines(List<Position> grid, Position cPos) { this.sightLinesLayer.removeAllRenderables(); // Display lines from the center to each grid point. ShapeAttributes lineAttributes; lineAttributes = new BasicShapeAttributes(); lineAttributes.setDrawOutline(true); lineAttributes.setDrawInterior(false); lineAttributes.setOutlineMaterial(Material.GREEN); lineAttributes.setOutlineOpacity(0.6); for (Position p : grid) { List<Position> endPoints = new ArrayList<Position>(); endPoints.add(cPos); endPoints.add(new Position(p.getLatitude(), p.getLongitude(), 0)); Path path = new Path(endPoints); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setAttributes(lineAttributes); this.sightLinesLayer.addRenderable(path); } }
public AppFrame() { super(true, true, false); RenderableLayer layer = new RenderableLayer(); // Create and set an attribute bundle. ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setOutlineMaterial(Material.RED); attrs.setOutlineWidth(2d); // Create a path, set some of its properties and set its attributes. ArrayList<Position> pathPositions = new ArrayList<Position>(); pathPositions.add(Position.fromDegrees(49.01653274909177, -122.7349081128505, 1)); pathPositions.add(Position.fromDegrees(49.01715024535254, -122.7596194200486, 10)); pathPositions.add(Position.fromDegrees(49.02781845803761, -122.7651733463364, 100)); pathPositions.add(Position.fromDegrees(49.05312411976134, -122.7926787136435, 1000)); pathPositions.add(Position.fromDegrees(49.0747697644625, -122.8224152286015, 1000)); pathPositions.add(Position.fromDegrees(49.09727187849899, -122.8187118695457, 1000)); pathPositions.add(Position.fromDegrees(49.1002974270654, -122.7348314826556, 100)); pathPositions.add(Position.fromDegrees(49.11190305133165, -122.7345541413842, 100)); pathPositions.add(Position.fromDegrees(49.11101764617014, -122.7455553490629, 10)); pathPositions.add(Position.fromDegrees(49.11509767012883, -122.7459193678911, 10)); pathPositions.add(Position.fromDegrees(49.11467371318521, -122.7563706291131, 10)); Path path = new DirectedPath(pathPositions); // To ensure that the arrowheads resize smoothly, refresh each time the path is drawn. path.setAttributes(attrs); path.setVisible(true); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setPathType(AVKey.GREAT_CIRCLE); layer.addRenderable(path); // Add the layer to the model. insertBeforeCompass(getWwd(), layer); // Update layer panel this.getLayerPanel().update(this.getWwd()); }
protected void showSightLines(List<Position[]> sightLines) { this.sightLinesLayer.removeAllRenderables(); // Display the sight lines as green lines. ShapeAttributes lineAttributes; lineAttributes = new BasicShapeAttributes(); lineAttributes.setDrawOutline(true); lineAttributes.setDrawInterior(false); lineAttributes.setOutlineMaterial(Material.GREEN); lineAttributes.setOutlineOpacity(0.6); for (Position[] pp : sightLines) { List<Position> endPoints = new ArrayList<Position>(); endPoints.add(pp[0]); endPoints.add(pp[1]); Path path = new Path(endPoints); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setAttributes(lineAttributes); this.sightLinesLayer.addRenderable(path); } }
protected void addPath(RenderableLayer layer, List<Position> positions, String displayName) { ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setOutlineWidth(5); Path path = new Path(positions); path.setPathType(AVKey.LINEAR); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setAttributes(attrs); path.setValue(AVKey.DISPLAY_NAME, displayName); layer.addRenderable(path); // Show how to make the colors vary along the paths. path.setPositionColors(new ExamplePositionColors()); }