Exemplo n.º 1
0
  /**
   * Create an screen image.
   *
   * @param tc the current {@link KMLTraversalContext}.
   * @param overlay the <i>Overlay</i> element containing.
   * @throws NullPointerException if the traversal context is null.
   * @throws IllegalArgumentException if the parent overlay or the traversal context is null.
   */
  public KMLSurfaceImageImpl(KMLTraversalContext tc, KMLGroundOverlay overlay) {
    this.parent = overlay;

    if (tc == null) {
      String msg = Logging.getMessage("nullValue.TraversalContextIsNull");
      Logging.logger().severe(msg);
      throw new IllegalArgumentException(msg);
    }

    if (overlay == null) {
      String msg = Logging.getMessage("nullValue.ParentIsNull");
      Logging.logger().severe(msg);
      throw new IllegalArgumentException(msg);
    }

    // Positions are specified either as a kml:LatLonBox or a gx:LatLonQuad
    KMLLatLonBox box = overlay.getLatLonBox();
    if (box != null) {
      Sector sector = KMLUtil.createSectorFromLatLonBox(box);
      this.initializeGeometry(sector);

      // TODO: rotation
    } else {
      GXLatLongQuad latLonQuad = overlay.getLatLonQuad();
      if (latLonQuad != null && latLonQuad.getCoordinates() != null) {
        this.initializeGeometry(latLonQuad.getCoordinates().list);
      }
    }

    this.setPickEnabled(false);
  }