protected RegionShape(Sector sector) { super(sector); // Create the default border shape. this.setBorder(new SurfaceSector(sector)); // The edges of the region shape should be constant lines of latitude and longitude. this.setPathType(AVKey.LINEAR); this.getBorder().setPathType(AVKey.LINEAR); // Setup default interior rendering attributes. Note that the interior rendering attributes // are // configured so only the SurfaceSector's interior is rendered. ShapeAttributes interiorAttrs = new BasicShapeAttributes(); interiorAttrs.setDrawOutline(false); interiorAttrs.setInteriorMaterial(new Material(Color.WHITE)); interiorAttrs.setInteriorOpacity(0.1); this.setAttributes(interiorAttrs); // Setup default border rendering attributes. Note that the border rendering attributes are // configured // so that only the SurfaceSector's outline is rendered. ShapeAttributes borderAttrs = new BasicShapeAttributes(); borderAttrs.setDrawInterior(false); borderAttrs.setOutlineMaterial(new Material(Color.RED)); borderAttrs.setOutlineOpacity(0.7); borderAttrs.setOutlineWidth(3); this.getBorder().setAttributes(borderAttrs); }
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); } }
private void update() { for (JComponent c : onTerrainOnlyItems) { c.setEnabled(currentFollowTerrain); } for (JComponent c : offTerrainOnlyItems) { c.setEnabled(!currentFollowTerrain); } if (this.currentShape instanceof SurfaceShape) { SurfaceShape shape = (SurfaceShape) currentShape; ShapeAttributes attr = shape.getAttributes(); if (attr == null) attr = new BasicShapeAttributes(); if (!currentBorderStyle.equals("None")) { float alpha = currentBorderOpacity >= 10 ? 1f : currentBorderOpacity <= 0 ? 0f : currentBorderOpacity / 10f; Color color = null; if (currentBorderColor.equals("Yellow")) color = new Color(1f, 1f, 0f); else if (currentBorderColor.equals("Red")) color = new Color(1f, 0f, 0f); else if (currentBorderColor.equals("Green")) color = new Color(0f, 1f, 0f); else if (currentBorderColor.equals("Blue")) color = new Color(0f, 0f, 1f); attr.setDrawOutline(true); attr.setOutlineMaterial(new Material(color)); attr.setOutlineOpacity(alpha); attr.setOutlineWidth(currentBorderWidth); } else { attr.setDrawOutline(false); } if (!currentInteriorStyle.equals("None")) { float alpha = currentInteriorOpacity >= 10 ? 1f : currentInteriorOpacity <= 0 ? 0f : currentInteriorOpacity / 10f; Color color = null; if (currentInteriorColor.equals("Yellow")) color = new Color(1f, 1f, 0f); else if (currentInteriorColor.equals("Red")) color = new Color(1f, 0f, 0f); else if (currentInteriorColor.equals("Green")) color = new Color(0f, 1f, 0f); else if (currentInteriorColor.equals("Blue")) color = new Color(0f, 0f, 1f); attr.setInteriorMaterial(new Material(color)); attr.setInteriorOpacity(alpha); attr.setDrawInterior(true); } else { attr.setDrawInterior(false); } shape.setAttributes(attr); } else { float alpha = currentPathOpacity >= 10 ? 1f : currentPathOpacity <= 0 ? 0f : currentPathOpacity / 10f; Color color = null; if (currentPathColor.equals("Yellow")) color = new Color(1f, 1f, 0f, alpha); else if (currentPathColor.equals("Red")) color = new Color(1f, 0f, 0f, alpha); else if (currentPathColor.equals("Green")) color = new Color(0f, 1f, 0f, alpha); else if (currentPathColor.equals("Blue")) color = new Color(0f, 0f, 1f, alpha); if (currentShape instanceof Polyline) { Polyline pl = (Polyline) currentShape; pl.setColor(color); pl.setLineWidth(currentPathWidth); pl.setFollowTerrain(currentFollowTerrain); pl.setTerrainConformance(currentTerrainConformance); pl.setNumSubsegments(currentNumSubsegments); if (currentPathType.equalsIgnoreCase("linear")) pl.setPathType(Polyline.LINEAR); else if (currentPathType.equalsIgnoreCase("rhumb line")) pl.setPathType(Polyline.RHUMB_LINE); else pl.setPathType(Polyline.GREAT_CIRCLE); pl.setOffset(currentOffset); if (currentPathStyle.equals("Dash")) { pl.setStippleFactor(5); pl.setStipplePattern((short) 0xAAAA); } else { pl.setStippleFactor(0); // solid } } } this.layer.removeAllRenderables(); if (this.currentShape != null) this.layer.addRenderable(this.currentShape); this.wwjPanel.getWwd().redraw(); }
public void setBorderOpacity(double opacity) { ShapeAttributes attr = this.getBorder().getAttributes(); attr.setOutlineOpacity(opacity); this.getBorder().setAttributes(attr); }