/** * Create and configure the Path used to render this graphic. * * @param positions Positions that define the path. * @return New path configured with defaults appropriate for this type of graphic. */ protected Path createPath(List<Position> positions) { Path path = new Path(positions); path.setFollowTerrain(true); path.setPathType(AVKey.GREAT_CIRCLE); path.setAltitudeMode(WorldWind.CLAMP_TO_GROUND); path.setDelegateOwner(this.getActiveDelegateOwner()); path.setAttributes(this.getActiveShapeAttributes()); return path; }
protected void addContourShapes( List<List<Position>> contourList, double value, RenderableLayer layer) { String text = this.textForValue(value); Color color = this.colorForValue(value, 1.0); // color for value at 100% brightness ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setOutlineMaterial(new Material(color)); attrs.setOutlineWidth(2); for (List<Position> positions : contourList) { Path path = new Path(positions); path.setAttributes(attrs); path.setAltitudeMode(WorldWind.CLAMP_TO_GROUND); path.setFollowTerrain(true); path.setValue(AVKey.DISPLAY_NAME, text); layer.addRenderable(path); } }
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); } }
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); } }
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()); }