Package org.eclipse.zest.layouts.dataStructures

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


        double minX = Double.MAX_VALUE;
        double maxX = Double.MIN_VALUE;
        double minY = Double.MAX_VALUE;
        double maxY = Double.MIN_VALUE;
        for (int i = 0; i < entitiesToLayout.length; i++) {
            InternalNode layoutEntity = entitiesToLayout[i];
            minX = Math.min(minX, layoutEntity.getInternalX());
            minY = Math.min(minY, layoutEntity.getInternalY());
            maxX = Math.max(maxX, layoutEntity.getInternalX());
            maxY = Math.max(maxY, layoutEntity.getInternalY());
        }

        double spanX = maxX - minX;
        double spanY = maxY - minY;
        double maxSpan = Math.max(spanX, spanY);

        if (maxSpan > EPSILON) {
            for (int i = 0; i < entitiesToLayout.length; i++) {
                InternalNode layoutEntity = entitiesToLayout[i];
                double x = (layoutEntity.getInternalX() - minX) / spanX;
                double y = (layoutEntity.getInternalY() - minY) / spanY;
                tempLocationsX[i] = x;
                tempLocationsY[i] = y;
            }
        } else {
            placeRandomly(entitiesToLayout);
View Full Code Here


      int i = 0;
      int width = (int) ((boundsWidth / 2) - currentRow.size() * 75);
     
      heightSoFar += ((InternalNode)currentRow.get(0)).getLayoutEntity().getHeightInLayout() + VSPACING*8 ;
      while(iterator2.hasNext()) {
        InternalNode currentNode = (InternalNode) iterator2.next();
       
        double location = width + 10*++i;
        currentNode.setLocation(location , heightSoFar);
        width += currentNode.getLayoutEntity().getWidthInLayout();
      }
    }
  }
View Full Code Here

  private void addToRowList( InternalNode node, ArrayList list) {
    double  layoutY = node.getLayoutEntity().getYInLayout();
   
    for ( int i = 0; i < list.size(); i++ ) {
      List currentRow = (List) list.get(i);
      InternalNode currentRowNode = (InternalNode) currentRow.get(0);
      double currentRowY = currentRowNode.getLayoutEntity().getYInLayout();
      //double currentRowHeight = currentRowNode.getLayoutEntity().getHeightInLayout();
      if ( layoutY >= (currentRowY-DELTA) && layoutY <= currentRowY + DELTA ) {
        currentRow.add(node);
        //list.add(i, currentRow);
        return;
View Full Code Here

      for( int j = 0; j < cols; j++ ) {
        if( (i*cols + j) < numChildren ) {
          // find new position for child
          double xmove = boundsX + j * colWidth + offsetX;
          double ymove = boundsY + i * rowHeight + offsetY;
          InternalNode sn = entitiesToLayout[index++];
          sn.setInternalLocation( xmove, ymove );
          sn.setInternalSize( Math.max(w, MIN_ENTITY_SIZE), Math.max(h, MIN_ENTITY_SIZE) );
        }
      }
      fireProgressEvent (2 + i, totalProgress);
   
    updateLayoutLocations(entitiesToLayout);
View Full Code Here

        // weight between them
        srcDestToNumRels = new int[entitiesToLayout.length][entitiesToLayout.length];
        srcDestToRelsAvgWeight = new double[entitiesToLayout.length][entitiesToLayout.length];

        for (int i = 0; i < entitiesToLayout.length - 1; i++) {
            InternalNode layoutEntity1 = entitiesToLayout[i];
            for (int j = i + 1; j < entitiesToLayout.length; j++) {
                InternalNode layoutEntity2 = entitiesToLayout[j];
                srcDestToNumRels[i][j] = numRelations(layoutEntity1, layoutEntity2);
                srcDestToNumRels[i][j] += numRelations(layoutEntity2, layoutEntity1);
                srcDestToRelsAvgWeight[i][j] = avgWeight(layoutEntity1, layoutEntity2);
            }
        }
View Full Code Here

        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

        computeForces(entitiesToLayout);
        largestMovement = Double.MAX_VALUE;
        computePositions(entitiesToLayout);
       
        for (int i = 0; i < entitiesToLayout.length; i++) {
            InternalNode layoutEntity = entitiesToLayout[i];
            layoutEntity.setInternalLocation(tempLocationsX[i], tempLocationsY[i]);
        }       
       
        defaultFitWithinBounds(entitiesToLayout, bounds);

        iteration++;
View Full Code Here

        }

        // TODO: Again really really slow!

        for (int i = 0; i < entitiesToLayout.length - 1; i++) {
            InternalNode sourceEntity = entitiesToLayout[i];
           
            double srcLocationX = tempLocationsX[i];
            double srcLocationY = tempLocationsY[i];
            double fx = forcesX[i]; // force in x direction
            double fy = forcesY[i]; // force in y direction
           

            for (int j = i + 1; j < entitiesToLayout.length; j++) {
                InternalNode destinationEntity = entitiesToLayout[j];

                if (!destinationEntity.equals(sourceEntity)) {
                    double destLocationX = tempLocationsX[j];
                    double destLocationY = tempLocationsY[j];
                    double dx = srcLocationX - destLocationX;
                    double dy = srcLocationY- destLocationY;
                    double distance = Math.sqrt(dx * dx + dy * dy);
 
View Full Code Here

   
    return new DisplayIndependentPoint( x, y );
  }
 
  private DisplayIndependentRectangle calculateBounds() {   
    InternalNode n1 = (InternalNode) XCoords.first();
    InternalNode n2 = (InternalNode) XCoords.last();
    InternalNode n3 = (InternalNode) YCoords.first();
    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

    maxY = 0.0;
  }
 
  class XComparator implements Comparator {
    public int compare(Object arg0, Object arg1) {
      InternalNode n1 = (InternalNode)arg0;
      InternalNode n2 = (InternalNode)arg1;
      if ( n1.getInternalX() > n2.getInternalX() ) return +1;
      else if ( n1.getInternalX() < n2.getInternalX() ) return -1;
      else {
        return n1.toString().compareTo( n2.toString() );
      }
     
    }   
View Full Code Here

TOP

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

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.