Ejemplo n.º 1
0
  public Point getLocationOf(int idx) {
    ConfigElement vp_elt = (ConfigElement) getElement(idx);
    double x = ((Number) vp_elt.getProperty("origin", 0)).doubleValue() * mDesktopSize.getWidth();
    double y = ((Number) vp_elt.getProperty("origin", 1)).doubleValue() * mDesktopSize.getHeight();

    // Convert y from Juggler coords (bottom left is origin)
    double height =
        ((Number) vp_elt.getProperty("size", 1)).doubleValue() * mDesktopSize.getHeight();
    y = mDesktopSize.getHeight() - y - height;
    return new Point((int) x, (int) y);
  }
Ejemplo n.º 2
0
  public Dimension getSizeOf(int idx) {
    ConfigElement vp_elt = (ConfigElement) getElement(idx);

    double vp_width = ((Number) vp_elt.getProperty("size", 0)).doubleValue();
    double vp_height = ((Number) vp_elt.getProperty("size", 1)).doubleValue();

    if (vp_width > 1.0) {
      vp_width = 1.0;
    }

    if (vp_height > 1.0) {
      vp_height = 1.0;
    }

    double width = vp_width * mDesktopSize.getWidth();
    double height = vp_height * mDesktopSize.getHeight();

    return new Dimension((int) width, (int) height);
  }
Ejemplo n.º 3
0
  public void setLocationOf(int idx, Point pt) {
    ConfigElement vp_elt = (ConfigElement) getElement(idx);

    // Convert y to Juggler coords (bottom left is origin)
    double height =
        ((Number) vp_elt.getProperty("size", 1)).doubleValue() * mDesktopSize.getHeight();
    double y = mDesktopSize.height - pt.y - height;

    double vp_origin_x = (double) pt.x / mDesktopSize.getWidth();
    double vp_origin_y = y / mDesktopSize.getHeight();

    if (vp_origin_x < 0.0) {
      vp_origin_x = 0.0;
    }

    if (vp_origin_y < 0.0) {
      vp_origin_y = 0.0;
    }

    vp_elt.setProperty("origin", 0, new Double(vp_origin_x), mContext);
    vp_elt.setProperty("origin", 1, new Double(vp_origin_y), mContext);
  }