Package org.eclipse.zest.layouts.dataStructures

Examples of org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle


    public SpringLayoutAlgorithm() {
      this( LayoutStyles.NONE );
  }
   
    public void setLayoutArea(double x, double y, double width, double height) {
        bounds = new DisplayIndependentRectangle(x,y,width,height);
    }
View Full Code Here


    protected void preLayoutAlgorithm(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider, double x, double y, double width, double height) {
        // TODO: Filter out any non-wanted entities and relationships
        // super.applyLayout(entitiesToLayout, relationshipsToConsider, x, y,
        // width, height);
        //InternalNode[] a_entitiesToLayout = (InternalNode[]) entitiesToLayout.toArray(new InternalNode[entitiesToLayout.size()]);
      bounds = new DisplayIndependentRectangle(x,y,width,height);
        tempLocationsX = new double[entitiesToLayout.length];
        tempLocationsY = new double[entitiesToLayout.length];
        forcesX = new double[entitiesToLayout.length];
        forcesY = new double[entitiesToLayout.length];
        anchors = new boolean[entitiesToLayout.length];
View Full Code Here

            topSide = Math.min(y, topSide);
            rightSide = Math.max(x, rightSide);
            bottomSide = Math.max(y, bottomSide);

        }
        return new DisplayIndependentRectangle(leftSide, topSide, rightSide - leftSide, bottomSide - topSide);
    }
View Full Code Here

    }

    private void checkPreferredLocation(InternalNode [] entitiesToLayout, DisplayIndependentRectangle realBounds) {
        // use 10% for the border - 5% on each side
        double borderWidth = Math.min(realBounds.width, realBounds.height) / 10.0;
        DisplayIndependentRectangle screenBounds = new DisplayIndependentRectangle(realBounds.x + borderWidth / 2.0, realBounds.y + borderWidth / 2.0, realBounds.width - borderWidth, realBounds.height - borderWidth);

        DisplayIndependentRectangle layoutBounds = getLayoutBoundsTemp(entitiesToLayout, false);
        for (int i = 0; i < entitiesToLayout.length; i++) {
            InternalNode layoutEntity = entitiesToLayout[i];
            if (layoutEntity.hasPreferredLocation()) {
                convertNodePositionsBack(i, layoutEntity, layoutEntity.getPreferredX(), layoutEntity.getPreferredY(), screenBounds.width, screenBounds.height, layoutBounds);
            }
View Full Code Here

        return sprIterations;
    }
   
    protected void computeOneIteration(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider, double x, double y, double width, double height) {
      if ( bounds == null )
        bounds = new DisplayIndependentRectangle(x,y,width,height);
        checkPreferredLocation(entitiesToLayout, bounds );
        computeForces(entitiesToLayout);
        largestMovement = Double.MAX_VALUE;
        computePositions(entitiesToLayout);
       
View Full Code Here

   */
  protected DisplayIndependentPoint getLocalLocation(InternalNode[] entitiesToLayout, double x, double y, DisplayIndependentRectangle realBounds) {

    double screenWidth = realBounds.width;
    double screenHeight = realBounds.height;
    DisplayIndependentRectangle layoutBounds = getLayoutBounds(entitiesToLayout, false);
    double localX = (x / screenWidth) * layoutBounds.width + layoutBounds.x;
    double localY = (y / screenHeight) * layoutBounds.height + layoutBounds.y;
    return new DisplayIndependentPoint(localX, localY);
  }
View Full Code Here

    XCoords = new TreeSet(new XComparator());
    YCoords = new TreeSet(new YComparator());
   
   
   
    this.screenBounds = new DisplayIndependentRectangle(x,y,width,height);
  }
View Full Code Here

    YCoords.add( node );
  }
 
  public DisplayIndependentPoint getScreenLocation( InternalNode node ) {
   
    DisplayIndependentRectangle layoutBounds = calculateBounds();
   
    double x = (layoutBounds.width == 0) ? 0 : (node.getInternalX() - layoutBounds.x) / layoutBounds.width;
    double y = (layoutBounds.height == 0) ? 0 : (node.getInternalY() - layoutBounds.y) / layoutBounds.height;   
   
    x = screenBounds.x + x * screenBounds.width;
 
View Full Code Here

    return new DisplayIndependentPoint( x, y );
  }
  
  public DisplayIndependentPoint getVirtualLocation( DisplayIndependentPoint point ) {
   
    DisplayIndependentRectangle layoutBounds = calculateBounds();
   
   
    double x = (point.x/screenBounds.width) * layoutBounds.width + layoutBounds.x;
    double y = (point.y/screenBounds.height* layoutBounds.height + layoutBounds.y;
   
View Full Code Here

    InternalNode n4 = (InternalNode) YCoords.last();
    double x = n1.getInternalX();
    double width = n2.getInternalX();
    double y = n3.getInternalY();
    double height = n4.getInternalY();
    return new DisplayIndependentRectangle(x, y, width - x, height - y);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle

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.