コード例 #1
0
    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);
    }
コード例 #2
0
    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);
      }
    }
コード例 #3
0
    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);
      }
    }
コード例 #4
0
 public void setBorderOpacity(double opacity) {
   ShapeAttributes attr = this.getBorder().getAttributes();
   attr.setOutlineOpacity(opacity);
   this.getBorder().setAttributes(attr);
 }