Examples of mxRectangle


Examples of com.mxgraph.util.mxRectangle

        {
          Object[] children = getChildCells(cells[i]);

          if (children != null && children.length > 0)
          {
            mxRectangle childBounds = getBoundingBoxFromGeometry(children);

            if (childBounds.getWidth() > 0
                && childBounds.getHeight() > 0)
            {
              mxRectangle size = (isSwimlane(cells[i])) ? getStartSize(cells[i])
                  : new mxRectangle();

              geo = (mxGeometry) geo.clone();

              if (moveParent)
              {
                geo.setX(geo.getX() + childBounds.getX()
                    - size.getWidth() - border);
                geo.setY(geo.getY() + childBounds.getY()
                    - size.getHeight() - border);
              }

              geo.setWidth(childBounds.getWidth()
                  + size.getWidth() + 2 * border);
              geo.setHeight(childBounds.getHeight()
                  + size.getHeight() + 2 * border);

              model.setGeometry(cells[i], geo);
              moveCells(children,
                  -childBounds.getX() + size.getWidth()
                      + border, -childBounds.getY()
                      + size.getHeight() + border);
            }
          }
        }
      }
    }
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

  {
    if (cell != null && geo != null)
    {
      if (geo.getAlternateBounds() == null)
      {
        mxRectangle bounds = null;

        if (isCollapseToPreferredSize())
        {
          bounds = getPreferredSizeForCell(cell);

          if (isSwimlane(cell))
          {
            mxRectangle size = getStartSize(cell);

            bounds.setHeight(Math.max(bounds.getHeight(),
                size.getHeight()));
            bounds.setWidth(Math.max(bounds.getWidth(),
                size.getWidth()));
          }
        }

        if (bounds == null)
        {
          bounds = geo;
        }

        geo.setAlternateBounds(new mxRectangle(geo.getX(), geo.getY(),
            bounds.getWidth(), bounds.getHeight()));
      }
      else
      {
        geo.getAlternateBounds().setX(geo.getX());
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

    if (cell != null)
    {
      model.beginUpdate();
      try
      {
        mxRectangle size = getPreferredSizeForCell(cell);
        mxGeometry geo = model.getGeometry(cell);

        if (size != null && geo != null)
        {
          boolean collapsed = isCellCollapsed(cell);
          geo = (mxGeometry) geo.clone();

          if (isSwimlane(cell))
          {
            mxCellState state = view.getState(cell);
            Map<String, Object> style = (state != null) ? state
                .getStyle() : getCellStyle(cell);
            String cellStyle = model.getStyle(cell);

            if (cellStyle == null)
            {
              cellStyle = "";
            }

            if (mxUtils.isTrue(style, mxConstants.STYLE_HORIZONTAL,
                true))
            {
              cellStyle = mxUtils.setStyle(cellStyle,
                  mxConstants.STYLE_STARTSIZE,
                  String.valueOf(size.getHeight() + 8));

              if (collapsed)
              {
                geo.setHeight(size.getHeight() + 8);
              }

              geo.setWidth(size.getWidth());
            }
            else
            {
              cellStyle = mxUtils.setStyle(cellStyle,
                  mxConstants.STYLE_STARTSIZE,
                  String.valueOf(size.getWidth() + 8));

              if (collapsed)
              {
                geo.setWidth(size.getWidth() + 8);
              }

              geo.setHeight(size.getHeight());
            }

            model.setStyle(cell, cellStyle);
          }
          else
          {
            geo.setWidth(size.getWidth());
            geo.setHeight(size.getHeight());
          }

          if (!ignoreChildren && !collapsed)
          {
            mxRectangle bounds = view.getBounds(mxGraphModel
                .getChildren(model, cell));

            if (bounds != null)
            {
              mxPoint tr = view.getTranslate();
              double scale = view.getScale();

              double width = (bounds.getX() + bounds.getWidth())
                  / scale - geo.getX() - tr.getX();
              double height = (bounds.getY() + bounds.getHeight())
                  / scale - geo.getY() - tr.getY();

              geo.setWidth(Math.max(geo.getWidth(), width));
              geo.setHeight(Math.max(geo.getHeight(), height));
            }
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

  public void update(MouseEvent e, mxCellState targetState, double x, double y)
  {
    mxGraph graph = graphComponent.getGraph();
    mxICell cell = (mxICell) previewState.getCell();

    mxRectangle dirty = graphComponent.getGraph().getPaintBounds(
        new Object[] { previewState.getCell() });

    if (cell.getTerminal(false) != null)
    {
      cell.getTerminal(false).removeEdge(cell, false);
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

   */
  protected Rectangle getDirtyRect(mxRectangle dirty)
  {
    if (previewState != null)
    {
      mxRectangle tmp = graphComponent.getGraph().getPaintBounds(
          new Object[] { previewState.getCell() });

      if (dirty != null)
      {
        dirty.add(tmp);
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

  public void mouseDragged(MouseEvent e)
  {
    if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
        && first != null)
    {
      mxRectangle dirty = mxUtils.getBoundingBox(currentState,
          currentAngle * mxConstants.DEG_PER_RAD);
      Point pt = SwingUtilities.convertPoint(e.getComponent(),
          e.getPoint(), graphComponent.getGraphControl());

      double cx = currentState.getCenterX();
      double cy = currentState.getCenterY();
      double dx = pt.getX() - cx;
      double dy = pt.getY() - cy;
      double c = Math.sqrt(dx * dx + dy * dy);

      currentAngle = ((pt.getX() > cx) ? -1 : 1) * Math.acos(dy / c)
          + PI4 + initialAngle;

      dirty.add(mxUtils.getBoundingBox(currentState, currentAngle
          * mxConstants.DEG_PER_RAD));
      dirty.grow(1);

      // TODO: Compute dirty rectangle and repaint
      graphComponent.getGraphControl().repaint(dirty.getRectangle());
      e.consume();
    }
    else if (handle.getParent() != null)
    {
      handle.getParent().remove(handle);
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

    if (handle.getParent() != null)
    {
      handle.getParent().remove(handle);
    }

    mxRectangle dirty = null;

    if (currentState != null && first != null)
    {
      dirty = mxUtils.getBoundingBox(currentState, currentAngle
          * mxConstants.DEG_PER_RAD);
      dirty.grow(1);
    }

    currentState = null;
    currentAngle = 0;
    first = null;

    if (dirty != null)
    {
      graphComponent.getGraphControl().repaint(dirty.getRectangle());
    }
  }
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

   *
   * @return Returns the rectangle that defines the perimeter.
   */
  public mxRectangle getPerimeterBounds(double border)
  {
    mxRectangle bounds = new mxRectangle(getRectangle());

    if (border != 0)
    {
      bounds.grow(border);
    }

    return bounds;
  }
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

    {
      Image img = loadImage(src);

      if (img != null)
      {
        mxRectangle bounds = getImageBounds(img, x, y, w, h, aspect);
        img = scaleImage(img, (int) bounds.getWidth(),
            (int) bounds.getHeight());

        if (img != null)
        {
          createImageGraphics(bounds.getX(), bounds.getY(),
              bounds.getWidth(), bounds.getHeight(), flipH, flipV)
              .drawImage(img, (int) bounds.getX(),
                  (int) bounds.getY(), null);
        }
      }
    }
  }
View Full Code Here

Examples of com.mxgraph.util.mxRectangle

    {
      w = Math.round(w);
      h = Math.round(h);
    }

    return new mxRectangle(x, y, w, h);
  }
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.