Examples of PreciseRectangle


Examples of com.sencha.gxt.core.client.util.PreciseRectangle

   * Returns the rectangle values of the sprite as a {@link PreciseRectangle}.
   *
   * @return the rectangle values of the sprite as a precise rectangle
   */
  public PreciseRectangle toRectangle() {
    return new PreciseRectangle(x, y, width, height);
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

    double minY = Double.POSITIVE_INFINITY;
    double maxHeight = Double.NEGATIVE_INFINITY;
    double maxWidth = Double.NEGATIVE_INFINITY;
    for (int i = 0; i < size(); i++) {
      S sprite = get(i);
      PreciseRectangle box = sprite.getBBox();
      minX = Math.min(minX, box.getX());
      minY = Math.min(minY, box.getY());
      maxHeight = Math.max(maxHeight, box.getHeight() + box.getY());
      maxWidth = Math.max(maxWidth, box.getWidth() + box.getX());
    }

    return new PreciseRectangle(minX, minY, maxWidth - minX, maxHeight - minY);
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

        new StringBuilder().append(x).append(", ").append(y).append(", ").append(width).append(", ").append(height).toString());
  }

  @Override
  protected PreciseRectangle getBBoxText(TextSprite sprite) {
    PreciseRectangle bbox = new PreciseRectangle();
    XElement element = getElement(sprite);

    if (element != null && element.isVisible(true)) {
      TextBBox box = getTextBBox(element);
      bbox.setX(box.getX());
      bbox.setY(box.getY());
      bbox.setWidth(box.getWidth());
      bbox.setHeight(box.getHeight());
    }

    return bbox;
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

    labelConfig.setTextAnchor(TextAnchor.MIDDLE);
  }

  @Override
  public void drawAxis(boolean init) {
    PreciseRectangle chartBBox = chart.getBBox();
    center.setX(chartBBox.getX() + (chartBBox.getWidth() / 2.0));
    center.setY(chartBBox.getY() + chartBBox.getHeight());
    double rho = Math.min(chartBBox.getWidth(), 2.0 * chartBBox.getHeight()) / 2.0 + margin;

    if (this.margin >= 0 && displayGrid) {
      final PathSprite line;
      if (lines.size() == 0) {
        line = axisConfig.copy();
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

   * Applies the clipping rectangle of the given sprite
   *
   * @param sprite the sprite to apply its clipping rectangle
   */
  private void applyClip(Sprite sprite) {
    PreciseRectangle rect = sprite.getClipRectangle();
    XElement clipPath = getClipElement(sprite);

    if (clipPath != null) {
      Element clipParent = clipPath.getParentElement();
      clipParent.getParentElement().removeChild(clipParent);
    }

    Element clipElement = createSVGElement("clipPath");
    clipPath = createSVGElement("rect");
    clipElement.setId("ext-clip-" + ++clipId);
    clipPath.setAttribute("x", String.valueOf(rect.getX()));
    clipPath.setAttribute("y", String.valueOf(rect.getY()));
    clipPath.setAttribute("width", String.valueOf(rect.getWidth()));
    clipPath.setAttribute("height", String.valueOf(rect.getHeight()));
    clipElement.appendChild(clipPath);
    getDefinitions().appendChild(clipElement);
    getElement(sprite).setAttribute("clip-path", "url(#" + clipElement.getId() + ")");
    setClipElement(sprite, clipPath);
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

    }
  }

  @Override
  public void drawLabels() {
    PreciseRectangle chartBBox = chart.getBBox();
    center.setX(chartBBox.getX() + (chartBBox.getWidth() / 2.0));
    center.setY(chartBBox.getY() + chartBBox.getHeight());
    double rho = Math.min(chartBBox.getWidth(), chartBBox.getHeight()) + 2.0 * margin;

    // draw scale
    for (double i = 0; i <= gaugeSteps; i++) {
      final TextSprite label;
      if (i >= labels.size()) {
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

  /**
   * Renders the title of the axis.
   */
  private void drawTitle() {
    PreciseRectangle bbox = chart.getBBox();
    if (titleSprite == null && titleConfig != null) {
      titleSprite = titleConfig.copy();
      chart.addSprite(titleSprite);
    }
    titleSprite.setText(title);

    PreciseRectangle titleBBox = titleSprite.getBBox();
    titleSprite.setX(bbox.getX() + (bbox.getWidth() / 2.0) - (titleBBox.getWidth() / 2.0));
    titleSprite.setY(bbox.getY() + bbox.getHeight() - (titleBBox.getHeight() / 2.0) - 4);

    titleSprite.redraw();
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

   * @param sprite the rectangle sprite
   * @param rectangle the target rectangle attributes
   * @return the animator used to run the animation
   */
  public static Animator createRectangleAnimator(final RectangleSprite sprite, PreciseRectangle rectangle) {
    final PreciseRectangle origin = new PreciseRectangle(sprite.getX(), sprite.getY(), sprite.getWidth(),
        sprite.getHeight());
    final PreciseRectangle delta = new PreciseRectangle(rectangle.getX() - sprite.getX(), rectangle.getY()
        - sprite.getY(), rectangle.getWidth() - sprite.getWidth(), rectangle.getHeight() - sprite.getHeight());
    return new Animator() {
      @Override
      protected void onUpdate(double progress) {
        sprite.setX(origin.getX() + delta.getX() * progress);
        sprite.setY(origin.getY() + delta.getY() * progress);
        sprite.setWidth(origin.getWidth() + delta.getWidth() * progress);
        sprite.setHeight(origin.getHeight() + delta.getHeight() * progress);
        sprite.redraw();
      }
    };
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

  @Override
  public void setPixelSize(int width, int height) {
    super.setPixelSize(width, height);
    if (currentWidth != width && currentHeight != height) {
      bbox = new PreciseRectangle(0, 0, width, height);
    }
    currentWidth = width;
    currentHeight = height;
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.PreciseRectangle

      double inset = defaultInsets;

      // Add legend size if it's on this edge
      if (legend != null) {
        if (legend.getPosition() == edges[i]) {
          PreciseRectangle bbox = legend.getBBox();
          if (isVertical) {
            inset += bbox.getWidth() + inset;
          } else {
            inset += bbox.getHeight() + inset;
          }
        }
      }

      // Add axis size if there's one on this edge
      if (axis != null) {
        PreciseRectangle bbox = axis.getBBox();
        if (isVertical) {
          inset += bbox.getWidth();
        } else {
          inset += bbox.getHeight();
        }
      }

      insets.put(edges[i], inset);
    }
    // Build the chart bbox based on the collected inset values
    bbox.setX(insets.get(Position.LEFT));
    bbox.setY(insets.get(Position.TOP));
    bbox.setWidth(currentWidth - insets.get(Position.LEFT) - insets.get(Position.RIGHT));
    bbox.setHeight(currentHeight - insets.get(Position.TOP) - insets.get(Position.BOTTOM));

    // Go back through each axis and set its length and position based on the
    // corresponding edge of the chartBBox
    for (Axis<M, ?> ax : this.axes.values()) {
      if (ax instanceof CartesianAxis) {
        CartesianAxis<M, ?> axis = (CartesianAxis<M, ?>) ax;
        Position pos = axis.getPosition();
        boolean isVertical = (pos == Position.LEFT || pos == Position.RIGHT);
        axis.setX((pos == Position.RIGHT) ? (bbox.getX() + bbox.getWidth()) : (bbox.getX()));
        axis.setY((pos == Position.TOP) ? (bbox.getY()) : (bbox.getY() + bbox.getHeight()));
        axis.setDepth(isVertical ? bbox.getWidth() : bbox.getHeight());
        axis.setLength(isVertical ? bbox.getHeight() : bbox.getWidth());
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.