Package CH.ifa.draw.framework

Examples of CH.ifa.draw.framework.Figure


    StringBuffer sb = new StringBuffer();

    // Add dependent objects from the drawing
    for (Enumeration en = figures(); en.hasMoreElements();)
    {
      Figure f = (Figure) en.nextElement();

      if (f instanceof LineFigure)
      {
        if (sb.length() > 0)
          sb.append("|");
View Full Code Here


  {
    willChange();

    for (FigureEnumeration fe = figures(); fe.hasMoreElements();)
    {
      Figure f = fe.nextFigure();

      if (f instanceof UpdatableFigure)
      {
        ((UpdatableFigure) f).updateFigure();
      }
View Full Code Here

  {
    p = SwingUtil.convertFromGlassCoords(p, getDrawing().getView());

    try
    {
      Figure addedFigure = null;

      if ("addNode".equals(regionId))
      {
        NodeProvider np = (NodeProvider) data.getTransferData(StandardFlavors.OBJECT);
View Full Code Here

  private static class ZComparator
    implements Comparator
  {
    public int compare(Object o1, Object o2)
    {
      Figure f1 = (Figure) o1;
      Figure f2 = (Figure) o2;

      int fo1 = getFigureTypeZOrder(f1);
      int fo2 = getFigureTypeZOrder(f2);

      if (fo1 == fo2)
      {
        // Identical figures, let the current z-order decide
        return f1.getZValue() - f2.getZValue();
      }

      return fo1 - fo2;
    }
View Full Code Here

    Orientation startOrientation = startConnector.getOrientation();
    Orientation endOrientation = endConnector.getOrientation();

    SocketFigure startSocketFigure = (SocketFigure) ((ParamFigure) startFigure()).getParent();
    SocketFigure endSocketFigure = (SocketFigure) ((ParamFigure) endFigure()).getParent();
    Figure startNodeFigure = startSocketFigure.getParent();
    Figure endNodeFigure = endSocketFigure.getParent();

    Point startCenter = startSocketFigure.center();
    Point endCenter = endSocketFigure.center();
    Orientation startSocketOrientation = CircleConstants.determineOrientation(startSocketFigure.getAngle(), startNodeFigure.displayBox());
    Orientation endSocketOrientation = CircleConstants.determineOrientation(endSocketFigure.getAngle(), endNodeFigure.displayBox());
    boolean startSocketIsVertical = startSocketOrientation == Orientation.TOP || startSocketOrientation == Orientation.BOTTOM;
    boolean endSocketIsVertical = endSocketOrientation == Orientation.TOP || endSocketOrientation == Orientation.BOTTOM;
    boolean socketsInSync = startSocketIsVertical == endSocketIsVertical;

    // TODO Fix 4: Param autoconnector orientation doesn't work optimal, test...
View Full Code Here

    int height = 0;
    int width = 0;

    for (FigureEnumeration en = tagFigure.figures(); en.hasMoreElements();)
    {
      Figure subFigure = en.nextFigure();
      Rectangle r;

      if (subFigure instanceof Expandable)
      {
        r = ((Expandable) subFigure).compactDisplayBox();
      }
      else if (subFigure instanceof LayoutableTag)
      {
        r = ((LayoutableTag) subFigure).getLayouter().calculateSize();
      }
      else
      {
        r = subFigure.displayBox();
      }

      height = Math.max(r.height, height);

      // Add sub figure width and horizontal insets
View Full Code Here

    // Add sub left horizontal inset
    int xPos = insets.left + box.x;

    for (FigureEnumeration en = (hAlign == Orientation.RIGHT ? tagFigure.figures() : tagFigure.figuresReverse()); en.hasMoreElements();)
    {
      Figure subFigure = en.nextFigure();
      Rectangle r;

      // Calculate the sub figure size
      if (subFigure instanceof Expandable)
      {
        r = ((Expandable) subFigure).compactDisplayBox();
      }
      else if (subFigure instanceof LayoutableTag)
      {
        r = ((LayoutableTag) subFigure).getLayouter().calculateSize();
      }
      else
      {
        r = subFigure.displayBox();
      }

      // Set the sub figure position and size
      int y = yBaseLine + CommonUtil.rnd(yFactor * r.height);
      r.setLocation(xPos, y);
      subFigure.displayBox(r);

      // Add sub figure width and horizontal insets
      xPos += insets.left + insets.right + r.width;
    }
  }
View Full Code Here

      // Draw the children of this composite figure
      super.draw(g2);

      // Finally the overlay if the tag is decorated
      Figure overlay = (Figure) DecorationMgr.decorate(this, BasicFigure.DECO_OVERLAY, null);
      if (overlay != null)
      {
        // Make the overlay the same size as the presentation figure
        overlay.draw(g);
      }
    }
  }
View Full Code Here

  /**
   * Gets the figure that forms the center of the rotation (usually the parent).
   */
  public Figure getCenterFigure()
  {
    Figure centerFigure = parent;
    while (centerFigure != null)
    {
      if (! (centerFigure instanceof ChildFigure))
        break;
      ChildFigure cf = (ChildFigure) centerFigure;
View Full Code Here

   * @return The box or null if there is no center figure
   */
  public Rectangle getCenterFigureBox()
  {
    Rectangle centerBox = null;
    Figure centerFigure = getCenterFigure();
    if (centerFigure != null)
    {
      if (centerFigure instanceof Expandable)
      {
        // The orientation change may affect the overall figure display box,
        // which may lead to 'flicker' of the orientation as the angle changes.
        // So we use the compact display box, which should be constant, if possible.
        centerBox = ((Expandable) centerFigure).compactDisplayBox();
      }
      else
      {
        centerBox = centerFigure.displayBox();
      }
    }
    return centerBox;
  }
View Full Code Here

TOP

Related Classes of CH.ifa.draw.framework.Figure

Copyright © 2018 www.massapicom. 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.