Пример #1
0
    public AppFrame() {
      super(true, true, false);

      // Add detail hint slider panel
      this.getLayerPanel().add(makeDetailHintControlPanel(), BorderLayout.SOUTH);

      RenderableLayer layer = new RenderableLayer();

      // Create and set an attribute bundle.
      ShapeAttributes attrs = new BasicShapeAttributes();
      attrs.setInteriorMaterial(Material.YELLOW);
      attrs.setInteriorOpacity(0.7);
      attrs.setEnableLighting(true);
      attrs.setOutlineMaterial(Material.RED);
      attrs.setOutlineWidth(2d);
      attrs.setDrawInterior(true);
      attrs.setDrawOutline(false);

      // Create and set an attribute bundle.
      ShapeAttributes attrs2 = new BasicShapeAttributes();
      attrs2.setInteriorMaterial(Material.PINK);
      attrs2.setInteriorOpacity(1);
      attrs2.setEnableLighting(true);
      attrs2.setOutlineMaterial(Material.WHITE);
      attrs2.setOutlineWidth(2d);
      attrs2.setDrawOutline(false);

      // ********* sample  Wedges  *******************

      // Wedge with equal axes, ABSOLUTE altitude mode
      Wedge wedge3 =
          new Wedge(Position.fromDegrees(40, -120, 80000), Angle.POS90, 50000, 50000, 50000);
      wedge3.setAltitudeMode(WorldWind.ABSOLUTE);
      wedge3.setAttributes(attrs);
      wedge3.setVisible(true);
      wedge3.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, ABSOLUTE altitude mode");
      layer.addRenderable(wedge3);

      // Wedge with equal axes, RELATIVE_TO_GROUND
      Wedge wedge4 =
          new Wedge(Position.fromDegrees(37.5, -115, 50000), Angle.POS90, 50000, 50000, 50000);
      wedge4.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      wedge4.setAttributes(attrs);
      wedge4.setVisible(true);
      wedge4.setValue(
          AVKey.DISPLAY_NAME, "Wedge with equal axes, RELATIVE_TO_GROUND altitude mode");
      layer.addRenderable(wedge4);

      // Wedge with equal axes, CLAMP_TO_GROUND
      Wedge wedge5 =
          new Wedge(Position.fromDegrees(35, -110, 50000), Angle.POS90, 50000, 50000, 50000);
      wedge5.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
      wedge5.setAttributes(attrs);
      wedge5.setVisible(true);
      wedge5.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, CLAMP_TO_GROUND altitude mode");
      layer.addRenderable(wedge5);

      // Wedge with a texture, using Wedge(position, angle, height, radius) constructor
      Wedge wedge9 =
          new Wedge(Position.fromDegrees(0, -90, 600000), Angle.fromDegrees(225), 1200000, 600000);
      wedge9.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      wedge9.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      wedge9.setAttributes(attrs);
      wedge9.setVisible(true);
      wedge9.setValue(AVKey.DISPLAY_NAME, "Wedge with a texture");
      layer.addRenderable(wedge9);

      // Scaled Wedge with default orientation
      Wedge wedge = new Wedge(Position.ZERO, Angle.fromDegrees(125), 500000, 500000, 500000);
      wedge.setAltitudeMode(WorldWind.ABSOLUTE);
      wedge.setAttributes(attrs);
      wedge.setVisible(true);
      wedge.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with default orientation");
      layer.addRenderable(wedge);

      // Scaled Wedge with a pre-set orientation
      Wedge wedge2 =
          new Wedge(
              Position.fromDegrees(0, 30, 750000),
              Angle.POS90,
              500000,
              500000,
              500000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      wedge2.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      wedge2.setAttributes(attrs2);
      wedge2.setVisible(true);
      wedge2.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with a pre-set orientation");
      layer.addRenderable(wedge2);

      // Scaled Wedge with a pre-set orientation
      Wedge wedge6 =
          new Wedge(
              Position.fromDegrees(30, 30, 750000),
              Angle.POS90,
              500000,
              500000,
              500000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      wedge6.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      wedge6.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      wedge6.setAttributes(attrs2);
      wedge6.setVisible(true);
      wedge6.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with a pre-set orientation");
      layer.addRenderable(wedge6);

      // Scaled Wedge with a pre-set orientation
      Wedge wedge7 =
          new Wedge(
              Position.fromDegrees(60, 30, 750000),
              Angle.POS90,
              500000,
              500000,
              500000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      wedge7.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      wedge7.setAttributes(attrs2);
      wedge7.setVisible(true);
      wedge7.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with a pre-set orientation");
      layer.addRenderable(wedge7);

      // Scaled, oriented Wedge in 3rd "quadrant" (-X, -Y, -Z)
      Wedge wedge8 =
          new Wedge(
              Position.fromDegrees(-45, -180, 750000),
              Angle.POS90,
              500000,
              1000000,
              500000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      wedge8.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      wedge8.setAttributes(attrs2);
      wedge8.setVisible(true);
      wedge8.setValue(
          AVKey.DISPLAY_NAME, "Scaled, oriented Wedge with in the 3rd 'quadrant' (-X, -Y, -Z)");
      layer.addRenderable(wedge8);

      // Add the layer to the model.
      insertBeforeCompass(getWwd(), layer);

      // Update layer panel
      this.getLayerPanel().update(this.getWwd());
    }
Пример #2
0
    protected void makeShapes() {
      RenderableLayer layer = new RenderableLayer();
      layer.setName("Rigid Shapes");

      // Create and set an attribute bundle.
      ShapeAttributes attrs = new BasicShapeAttributes();
      attrs.setInteriorMaterial(Material.YELLOW);
      attrs.setInteriorOpacity(0.7);
      attrs.setEnableLighting(true);
      attrs.setOutlineMaterial(Material.RED);
      attrs.setOutlineWidth(2d);
      attrs.setDrawInterior(true);
      attrs.setDrawOutline(false);

      // Create and set a second attribute bundle.
      ShapeAttributes attrs2 = new BasicShapeAttributes();
      attrs2.setInteriorMaterial(Material.PINK);
      attrs2.setInteriorOpacity(1);
      attrs2.setEnableLighting(true);
      attrs2.setOutlineMaterial(Material.WHITE);
      attrs2.setOutlineWidth(2d);
      attrs2.setDrawOutline(false);

      // Pyramid with equal axes, ABSOLUTE altitude mode.
      Pyramid pyramid = new Pyramid(Position.fromDegrees(40, -120, 220000), 200000, 200000, 200000);
      pyramid.setAltitudeMode(WorldWind.ABSOLUTE);
      pyramid.setAttributes(attrs);
      pyramid.setValue(AVKey.DISPLAY_NAME, "Pyramid with equal axes, ABSOLUTE altitude mode");
      layer.addRenderable(pyramid);

      // Cone with equal axes, RELATIVE_TO_GROUND.
      Cone cone = new Cone(Position.fromDegrees(37.5, -115, 200000), 200000, 200000, 200000);
      cone.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone.setAttributes(attrs);
      cone.setValue(AVKey.DISPLAY_NAME, "Cone with equal axes, RELATIVE_TO_GROUND altitude mode");
      layer.addRenderable(cone);

      // Wedge with equal axes, CLAMP_TO_GROUND.
      Wedge wedge =
          new Wedge(
              Position.fromDegrees(35, -110, 200000),
              Angle.fromDegrees(225),
              200000,
              200000,
              200000);
      wedge.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
      wedge.setAttributes(attrs);
      wedge.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, CLAMP_TO_GROUND altitude mode");
      layer.addRenderable(wedge);

      // Box with a texture.
      Box box = new Box(Position.fromDegrees(0, -90, 600000), 600000, 600000, 600000);
      box.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ArrayList<Object> imageSources = new ArrayList<Object>();
      imageSources.add("images/32x32-icon-nasa.png");
      imageSources.add(null);
      imageSources.add("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      imageSources.add(null);
      imageSources.add("images/64x64-crosshair.png");
      imageSources.add(null);
      box.setImageSources(imageSources);
      box.setAttributes(attrs);
      box.setValue(AVKey.DISPLAY_NAME, "Box with a texture");
      layer.addRenderable(box);

      // Sphere with a texture.
      Ellipsoid sphere =
          new Ellipsoid(Position.fromDegrees(0, -110, 600000), 600000, 600000, 600000);
      sphere.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      sphere.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      sphere.setAttributes(attrs);
      sphere.setValue(AVKey.DISPLAY_NAME, "Sphere with a texture");
      layer.addRenderable(sphere);

      // Cylinder with a texture.
      Cylinder cylinder =
          new Cylinder(Position.fromDegrees(0, -130, 600000), 600000, 600000, 600000);
      cylinder.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cylinder.setImageSources(
          "gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      cylinder.setAttributes(attrs);
      cylinder.setValue(AVKey.DISPLAY_NAME, "Cylinder with a texture");
      layer.addRenderable(cylinder);

      // Cylinder with default orientation.
      cylinder = new Cylinder(Position.ZERO, 600000, 500000, 300000);
      cylinder.setAltitudeMode(WorldWind.ABSOLUTE);
      cylinder.setAttributes(attrs);
      cylinder.setValue(AVKey.DISPLAY_NAME, "Cylinder with default orientation");
      layer.addRenderable(cylinder);

      // Ellipsoid with a pre-set orientation.
      Ellipsoid ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(0, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation");
      layer.addRenderable(ellipsoid);

      // Ellipsoid with a pre-set orientation.
      ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(30, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setImageSources(
          "gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation");
      layer.addRenderable(ellipsoid);

      // Ellipsoid with a pre-set orientation.
      ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(60, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation");
      layer.addRenderable(ellipsoid);

      // Ellipsoid oriented in 3rd "quadrant" (-X, -Y, -Z).
      ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(-45, -180, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid oriented in 3rd \"quadrant\" (-X, -Y, -Z)");
      layer.addRenderable(ellipsoid);

      // Add the layer to the model and update the layer panel.
      insertBeforePlacenames(getWwd(), layer);
    }