public AppFrame() {
      super(true, true, false);

      try {
        // Create the Quad from a Sector
        Globe globe = this.getWwd().getModel().getGlobe();
        double radius = globe.getRadiusAt(sector.getCentroid());
        double quadWidth = sector.getDeltaLonRadians() * radius;
        double quadHeight = sector.getDeltaLatRadians() * radius;
        final SurfaceQuad quad =
            new SurfaceQuad(sector.getCentroid(), quadWidth, quadHeight, Angle.ZERO);

        // Create the layer to hold it
        final RenderableLayer layer = new RenderableLayer();
        layer.setName("Rotating Sector");
        layer.addRenderable(quad);

        // Add the layer to the model and update the ApplicationTemplate's layer manager
        insertBeforeCompass(this.getWwd(), layer);
        this.getLayerPanel().update(this.getWwd());

        // Rotate the quad continuously
        Timer timer =
            new Timer(
                50,
                new ActionListener() {
                  public void actionPerformed(ActionEvent actionEvent) {
                    // Increment the current heading if the layer is visible
                    if (layer.isEnabled()) {
                      quad.setHeading(
                          Angle.fromDegrees((quad.getHeading().getDegrees() + 1) % 360));
                      getWwd().redraw();
                    }
                  }
                });
        timer.start();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  private boolean needToSplit(DrawContext dc, Sector sector) {
    Vec4[] corners = sector.computeCornerPoints(dc.getGlobe(), dc.getVerticalExaggeration());
    Vec4 centerPoint = sector.computeCenterPoint(dc.getGlobe(), dc.getVerticalExaggeration());

    View view = dc.getView();
    double d1 = view.getEyePoint().distanceTo3(corners[0]);
    double d2 = view.getEyePoint().distanceTo3(corners[1]);
    double d3 = view.getEyePoint().distanceTo3(corners[2]);
    double d4 = view.getEyePoint().distanceTo3(corners[3]);
    double d5 = view.getEyePoint().distanceTo3(centerPoint);

    double minDistance = d1;
    if (d2 < minDistance) minDistance = d2;
    if (d3 < minDistance) minDistance = d3;
    if (d4 < minDistance) minDistance = d4;
    if (d5 < minDistance) minDistance = d5;

    double cellSize =
        (Math.PI * sector.getDeltaLatRadians() * dc.getGlobe().getRadius()) / 20; // TODO

    return !(Math.log10(cellSize) <= (Math.log10(minDistance) - this.splitScale));
  }
Exemplo n.º 3
0
 protected Angle computeSectorRadius(Sector sector) {
   double dLat = sector.getDeltaLatRadians();
   double dLon = sector.getDeltaLonRadians();
   return Angle.fromRadians(Math.sqrt(dLat * dLat + dLon * dLon) / 2);
 }