Exemplo n.º 1
0
  protected void drawToolTip(
      DrawContext dc,
      java.awt.Rectangle viewport,
      String text,
      int x,
      int y,
      ToolTipAttributes attributes) {
    java.awt.geom.Rectangle2D textBounds = this.computeTextBounds(dc, text, attributes.getFont());
    java.awt.geom.Rectangle2D bgBounds =
        this.computeBackgroundBounds(
            dc, textBounds.getWidth(), textBounds.getHeight(), attributes.getInsets());

    java.awt.Point screenPoint = this.adjustDrawPointToViewport(x, y, bgBounds, viewport);
    java.awt.geom.Point2D textTranslation =
        this.computeTextTranslation(dc, textBounds, attributes.getInsets());

    GL2 gl = dc.getGL();
    OGLStackHandler stackHandler = new OGLStackHandler();

    stackHandler.pushModelview(gl);
    try {
      gl.glTranslated(
          screenPoint.getX() + bgBounds.getX(), screenPoint.getY() + bgBounds.getY(), 0);
      this.drawToolTipInterior(dc, bgBounds.getWidth(), bgBounds.getHeight(), attributes);
      this.drawToolTipOutline(dc, bgBounds.getWidth(), bgBounds.getHeight(), attributes);

      gl.glTranslated(textTranslation.getX(), textTranslation.getY(), 0);
      this.drawToolTipText(dc, text, 0, 0, attributes);
    } finally {
      stackHandler.pop(gl);
    }
  }
  private static MeshCoords transformSector(AffineTransform transform, Sector sector) {
    java.awt.geom.Point2D p = new java.awt.geom.Point2D.Double();
    java.awt.geom.Point2D ll = new java.awt.geom.Point2D.Double();
    java.awt.geom.Point2D ur = new java.awt.geom.Point2D.Double();

    p.setLocation(sector.getMinLongitude().degrees, sector.getMinLatitude().degrees);
    transform.transform(p, ll);

    p.setLocation(sector.getMaxLongitude().degrees, sector.getMaxLatitude().degrees);
    transform.transform(p, ur);

    return new MeshCoords(
        (float) ur.getY(), // Top
        (float) ll.getX(), // Left
        (float) ll.getY(), // Bottom
        (float) ur.getX()); // Right
  }