Пример #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 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());
    }
    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());
    }
Пример #6
0
 public void setBorderWidth(double width) {
   ShapeAttributes attr = this.getBorder().getAttributes();
   attr.setOutlineWidth(width);
   this.getBorder().setAttributes(attr);
 }
Пример #7
0
 public void setBorderOpacity(double opacity) {
   ShapeAttributes attr = this.getBorder().getAttributes();
   attr.setOutlineOpacity(opacity);
   this.getBorder().setAttributes(attr);
 }
Пример #8
0
 public void setInteriorOpacity(double opacity) {
   ShapeAttributes attr = this.getAttributes();
   attr.setInteriorOpacity(opacity);
   this.setAttributes(attr);
 }
Пример #9
0
 public void setBorderColor(Color color) {
   ShapeAttributes attr = this.getBorder().getAttributes();
   attr.setOutlineMaterial(new Material(color));
   this.getBorder().setAttributes(attr);
 }
Пример #10
0
 public void setInteriorColor(Color color) {
   ShapeAttributes attr = this.getAttributes();
   attr.setInteriorMaterial(new Material(color));
   this.setAttributes(attr);
 }