Exemplo n.º 1
0
  public void setOutlineWidth(double width) {
    if (width < 0) {
      String message = Logging.getMessage("generic.ArgumentOutOfRange", "width < 0");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    this.outlineWidth = width;
  }
Exemplo n.º 2
0
  public void setFont(java.awt.Font font) {
    if (font == null) {
      String message = Logging.getMessage("nullValue.FontIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    this.font = font;
  }
Exemplo n.º 3
0
  public void setTextColor(Color color) {
    if (color == null) {
      String message = Logging.getMessage("nullValue.ColorIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    this.textColor = color;
  }
Exemplo n.º 4
0
  public void setInsets(java.awt.Insets insets) {
    if (insets == null) {
      String message = Logging.getMessage("nullValue.InsetsIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    // Class java.awt.Insets is known to override the method Object.clone().
    this.insets = (java.awt.Insets) insets.clone();
  }
Exemplo n.º 5
0
  public void setOpacity(double opacity) {
    if (opacity < 0 || opacity > 1) {
      String message =
          Logging.getMessage("generic.ArgumentOutOfRange", "opacity < 0 or opacity > 1");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    this.opacity = opacity;
  }
Exemplo n.º 6
0
  protected void endRendering(DrawContext dc, OGLStackHandler stackHandler) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    GL2 gl = dc.getGL();

    stackHandler.pop(gl);
  }
Exemplo n.º 7
0
  public void render(DrawContext dc, String text, int x, int y) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    if (text == null) {
      String message = Logging.getMessage("nullValue.StringIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    this.doRender(dc, text, x, y);
  }
    public void doActionOnButton3() {
      //            Sector sector = Sector.fromDegrees( 44d, 46d, -123.3d, -123.2d );

      ArrayList<LatLon> latlons = new ArrayList<LatLon>();

      latlons.add(LatLon.fromDegrees(45.50d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.51d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.52d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.53d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.54d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.55d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.56d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.57d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.58d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.59d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.60d, -123.3d));

      ElevationModel model = this.wwd.getModel().getGlobe().getElevationModel();

      StringBuffer sb = new StringBuffer();
      for (LatLon ll : latlons) {
        double e = model.getElevation(ll.getLatitude(), ll.getLongitude());
        sb.append("\n").append(e);
      }

      Logging.logger().info(sb.toString());
    }
Exemplo n.º 9
0
  public ToolTipRenderer(java.awt.Font font) {
    if (font == null) {
      String message = Logging.getMessage("nullValue.FontIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    this.useSystemLookAndFeel = false;
    this.font = font;
    this.textColor = java.awt.Color.WHITE;
    this.interiorColor = java.awt.Color.BLACK;
    this.outlineColor = java.awt.Color.WHITE;
    this.outlineWidth = 1;
    this.opacity = 1;
    this.insets = new java.awt.Insets(1, 1, 1, 1);
  }
    public void doActionOnButton4() {
      ArrayList<LatLon> locations = new ArrayList<LatLon>();

      locations.add(LatLon.fromDegrees(45.50d, -123.3d));
      locations.add(LatLon.fromDegrees(45.52d, -123.3d));
      locations.add(LatLon.fromDegrees(45.54d, -123.3d));
      locations.add(LatLon.fromDegrees(45.56d, -123.3d));
      locations.add(LatLon.fromDegrees(45.58d, -123.3d));
      locations.add(LatLon.fromDegrees(45.60d, -123.3d));

      locations.add(LatLon.fromDegrees(40.50d, -120.1d));
      locations.add(LatLon.fromDegrees(40.52d, -120.2d));
      locations.add(LatLon.fromDegrees(40.54d, -120.3d));
      locations.add(LatLon.fromDegrees(40.56d, -120.4d));
      locations.add(LatLon.fromDegrees(40.58d, -120.5d));
      locations.add(LatLon.fromDegrees(40.60d, -120.6d));

      // Now, let's find WMSBasicElevationModel
      WMSBasicElevationModel wmsbem = null;

      ElevationModel model = this.wwd.getModel().getGlobe().getElevationModel();
      if (model instanceof CompoundElevationModel) {
        CompoundElevationModel cbem = (CompoundElevationModel) model;
        for (ElevationModel em : cbem.getElevationModels()) {
          // you can have additional checks if you know specific model name, etc.
          if (em instanceof WMSBasicElevationModel) {
            wmsbem = (WMSBasicElevationModel) em;
            break;
          }
        }
      } else if (model instanceof WMSBasicElevationModel) {
        wmsbem = (WMSBasicElevationModel) model;
      }

      if (null != wmsbem) {
        ElevationsRetriever retriever =
            new ElevationsRetriever(wmsbem, locations, 10000, 30000, new NotifyWhenReady());
        retriever.start();
      } else {
        String message =
            Logging.getMessage(
                "ElevationModel.ExceptionRequestingElevations",
                "No instance of WMSBasicElevationModel was found");
        Logging.logger().severe(message);
      }
    }
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     String message = "ExceptionWhileSettingSystemLookAndFeel";
     Logging.logger().log(java.util.logging.Level.WARNING, message, e);
   }
   start("World Wind - elevations demo", AppFrame.class);
 }
 public void onSuccess(Position[] positions) {
   for (Position p : positions) {
     Logging.logger()
         .info(
             p.getLatitude().degrees
                 + ","
                 + p.getLongitude().degrees
                 + " --> "
                 + p.getElevation());
   }
 }
Exemplo n.º 13
0
  protected void beginRendering(DrawContext dc, OGLStackHandler stackHandler) {
    if (dc == null) {
      String message = Logging.getMessage("nullValue.DrawContextIsNull");
      Logging.logger().fine(message);
      throw new IllegalArgumentException(message);
    }

    GL2 gl = dc.getGL();

    int attribMask =
        GL2.GL_COLOR_BUFFER_BIT // for alpha test func and ref, blend func
            | GL2.GL_CURRENT_BIT // for current color
            | GL2.GL_ENABLE_BIT // for enable/disable
            | GL2.GL_LINE_BIT // for line width
            | GL2.GL_TRANSFORM_BIT; // for matrix mode
    stackHandler.pushAttrib(gl, attribMask);

    stackHandler.pushTextureIdentity(gl);
    stackHandler.pushProjectionIdentity(gl);
    java.awt.Rectangle viewport = dc.getView().getViewport();
    gl.glOrtho(
        viewport.x, viewport.x + viewport.width, viewport.y, viewport.y + viewport.height, -1, 1);
    stackHandler.pushModelviewIdentity(gl);

    // Enable the alpha test.
    gl.glEnable(GL2.GL_ALPHA_TEST);
    gl.glAlphaFunc(GL2.GL_GREATER, 0.0f);

    // Enable blending in premultiplied color mode.
    gl.glEnable(GL2.GL_BLEND);
    OGLUtil.applyBlending(gl, true);

    gl.glDisable(GL2.GL_CULL_FACE);
    gl.glDisable(GL2.GL_DEPTH_TEST);
    gl.glDisable(GL2.GL_LIGHTING);
    gl.glDisable(GL2.GL_TEXTURE_2D);
  }
    public void doActionOnButton1() {
      Logging.logger().info("Zooming to Matterhorn");

      View view = this.wwd.getView();

      Position matterhorn =
          new Position(LatLon.fromDegrees(45.9763888888889d, 7.65833333333333d), 0d);

      //            Position eyePos = new Position( LatLon.fromDegrees( 46.01066860997058d,
      // 7.633097536001656d ), 3363d );
      //
      //            view.setEyePosition( eyePos );
      //            view.setHeading( Angle.fromDegrees( 156d ));
      //            view.setPitch( Angle.fromDegrees( 89.9d ));

      view.goTo(matterhorn, 5000d);
    }
    public void doActionOnButton2() {
      ArrayList<LatLon> latlons = new ArrayList<LatLon>();

      latlons.add(LatLon.fromDegrees(45.50d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.51d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.52d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.53d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.54d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.55d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.56d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.57d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.58d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.59d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.60d, -123.3d));

      Sector sector = Sector.fromDegrees(44d, 46d, -123d, -121d);
      //            Sector sector = Sector.boundingSector( latlons );

      double[] elevations = new double[latlons.size()];

      // request resolution of DTED2 (1degree / 3600 )
      double targetResolution = Angle.fromDegrees(1d).radians / 3600;

      double resolutionAchieved =
          this.wwd
              .getModel()
              .getGlobe()
              .getElevationModel()
              .getElevations(sector, latlons, targetResolution, elevations);

      StringBuffer sb = new StringBuffer();
      for (double e : elevations) {
        sb.append("\n").append(e);
      }
      sb.append("\nresolutionAchieved = ").append(resolutionAchieved);
      sb.append(", requested resolution = ").append(targetResolution);

      Logging.logger().info(sb.toString());
    }
 public void doActionOnButton5() {
   Logging.logger().info("You have pressed button 5");
 }
 public void onError(String error) {
   String message = Logging.getMessage("ElevationModel.ExceptionRequestingElevations", error);
   Logging.logger().severe(message);
 }