public static void main(String[] args) {
    // zoom to San Francisco downtown
    Configuration.setValue(AVKey.INITIAL_ALTITUDE, 34e3);
    Configuration.setValue(AVKey.INITIAL_LATITUDE, 37.9521d);
    Configuration.setValue(AVKey.INITIAL_LONGITUDE, -119.7761d);

    // Adjust configuration values before instantiation
    ApplicationTemplate.start("World Wind Terrain Intersections", AppFrame.class);
  }
示例#2
0
    public AppFrame() {
      // Create the WorldWindow.
      this.wwjPanel = new ApplicationTemplate.AppPanel(this.canvasSize, true);
      this.wwjPanel.setPreferredSize(canvasSize);

      ApplicationTemplate.insertBeforePlacenames(this.wwjPanel.getWwd(), layer);

      JPanel shapesPanel = makeShapeSelectionPanel();
      shapesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      JPanel attrsPanel = makeAttributesPanel();
      attrsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      // Put the pieces together.
      JPanel controlPanel = new JPanel(new BorderLayout());
      controlPanel.add(shapesPanel, BorderLayout.CENTER);
      JPanel p = new JPanel(new BorderLayout(6, 6));
      p.add(attrsPanel, BorderLayout.CENTER);
      controlPanel.add(p, BorderLayout.SOUTH);

      this.getContentPane().add(wwjPanel, BorderLayout.CENTER);
      this.getContentPane().add(controlPanel, BorderLayout.WEST);
      this.pack();

      // Center the application on the screen.
      Dimension prefSize = this.getPreferredSize();
      Dimension parentSize;
      java.awt.Point parentLocation = new java.awt.Point(0, 0);
      parentSize = Toolkit.getDefaultToolkit().getScreenSize();
      int x = parentLocation.x + (parentSize.width - prefSize.width) / 2;
      int y = parentLocation.y + (parentSize.height - prefSize.height) / 2;
      this.setLocation(x, y);
      this.setResizable(true);

      wwjPanel
          .getWwd()
          .addRenderingListener(
              new RenderingListener() {
                public void stageChanged(RenderingEvent event) {
                  if (!event.getStage().equals(RenderingEvent.BEFORE_BUFFER_SWAP)) return;

                  if (currentShape instanceof Polyline) {
                    Polyline p = (Polyline) currentShape;
                    String length = Double.toString(p.getLength());
                    textRenderer.beginRendering(wwjPanel.getWidth(), wwjPanel.getHeight());
                    textRenderer.draw(length, 100, 100);
                    textRenderer.endRendering();
                  }
                }
              });

      // Enable dragging and other selection responses
      this.setupSelection();
    }
示例#3
0
 public static void main(String[] args) {
   ApplicationTemplate.start("World Wind Wedges", AppFrame.class);
 }
 /**
  * Marked as deprecated to keep it out of the javadoc.
  *
  * @param args the arguments passed to the program.
  * @deprecated
  */
 public static void main(String[] args) {
   //noinspection deprecation
   ApplicationTemplate.start("World Wind Line Builder", LineBuilder.AppFrame.class);
 }