Пример #1
0
  public void prepareForEye(boolean left) {
    float anchorPointX = WorldWindVRConstants.RenderHorizontalResolution / 4.0f;
    float anchorPointY = WorldWindVRConstants.RenderVerticalResolution / 2.0f;
    float messageWidth =
        messageAnnotation
            .getGraphicsContext()
            .getFontMetrics()
            .stringWidth(messageAnnotation.getOutlinedText());
    float messageHeight = messageAnnotation.getGraphicsContext().getFontMetrics().getHeight();
    anchorPointX -= (messageWidth / 2.0f);
    anchorPointY += messageHeight / 2.0f;

    // not sure why we need this
    anchorPointX += 100;
    //		anchorPointY += 110 ;

    int pixelSeparation = 40;
    if (left) {
      messageAnnotation.setScreenPoint(
          new Point((int) (anchorPointX + pixelSeparation), (int) anchorPointY));
    } else {
      messageAnnotation.setScreenPoint(new Point((int) (anchorPointX), (int) anchorPointY));
    }
  }