Examples of InternalNode


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

   
    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

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

    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

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

     
    }   
  }
  class YComparator implements Comparator {
    public int compare(Object arg0, Object arg1) {
      InternalNode n1 = (InternalNode)arg0;
      InternalNode n2 = (InternalNode)arg1;
      if ( n1.getInternalY() > n2.getInternalY() ) return +1;
      else if ( n1.getInternalY() < n2.getInternalY() ) return -1;
      else {
        return n1.toString().compareTo( n2.toString() );
      }

    }   
View Full Code Here

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

      }

      // Also remove from _internalNodes
      ArrayList updatedEntities = new ArrayList(internalNodes.length - entitiesToRemove.size() + entitiesToAdd.size());
      for (int i = 0; i < internalNodes.length; i++) {
        InternalNode node = internalNodes[i];
        if (entitiesToRemove.contains(node.getLayoutEntity())) {
          entitiesToRemove.remove(node.getLayoutEntity());
        } else {
          updatedEntities.add(node);
        }
      }
      entitiesToRemove.clear();
View Full Code Here

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

      InternalRelationship relationship = relationshipsToConsider[i];
      List bendPoints = relationship.getBendPoints();
      if (bendPoints.size() > 0) {
        // We will assume that source/dest coordinates are for center of node
        BendPoint[] externalBendPoints = new BendPoint[bendPoints.size() + 2];
        InternalNode sourceNode = relationship.getSource();
        externalBendPoints[0] = new BendPoint(sourceNode.getInternalX(), sourceNode.getInternalY());
        InternalNode destNode = relationship.getDestination();
        externalBendPoints[externalBendPoints.length - 1] = new BendPoint(destNode.getInternalX(), destNode.getInternalY());

        for (int j = 0; j < bendPoints.size(); j++) {
          BendPoint bp = (BendPoint) bendPoints.get(j);
          externalBendPoints[j + 1] = new BendPoint(bp.x, bp.y, bp.getIsControlPoint());
        }
View Full Code Here

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

    InternalNode[] internalNodes = new InternalNode[nodes.length];
    BasicEntityConstraint basicEntityConstraint = new BasicEntityConstraint();
    for (int i = 0; i < nodes.length; i++) {
      basicEntityConstraint.clear();
      LayoutEntity externalNode = nodes[i];
      InternalNode internalNode = new InternalNode(externalNode);
      externalNode.populateLayoutConstraint(basicEntityConstraint);
      internalNode.setInternalLocation(externalNode.getXInLayout(), externalNode.getYInLayout());
      internalNodes[i] = internalNode;
    } // end of for
    return internalNodes;
  }
View Full Code Here

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

   */
  private InternalRelationship[] createInternalRelationships(LayoutRelationship[] rels) {
    ArrayList listOfInternalRelationships = new ArrayList(rels.length);
    for (int i = 0; i < rels.length; i++) {
      LayoutRelationship relation = rels[i];
      InternalNode src = (InternalNode) relation.getSourceInLayout().getLayoutInformation();
      InternalNode dest = (InternalNode) relation.getDestinationInLayout().getLayoutInformation();
      if ((src != null) && (dest != null)) {
        InternalRelationship internalRelationship = new InternalRelationship(relation, src, dest);
        listOfInternalRelationships.add(internalRelationship);
      } else {
        throw new RuntimeException("Error creating internal relationship, one of the nodes is null: src=" + src + ", dest=" + dest);
View Full Code Here

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

    double nodeSize = getNodeSize(entitiesToLayout);
    double halfNodeSize = nodeSize / 2;

    // Resize and shift nodes
    for (int i = 0; i < entitiesToLayout.length; i++) {
      InternalNode node = entitiesToLayout[i];
      node.setInternalSize(nodeSize, nodeSize);
      node.setInternalLocation(node.getInternalX() + halfNodeSize, node.getInternalY() + halfNodeSize);
    }
  }
View Full Code Here

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

   */
  private void convertPositionsToPercentage(InternalNode[] entitiesToLayout, InternalRelationship[] relationships, DisplayIndependentRectangle layoutBounds, boolean includeNodeSize) {

    // Adjust node positions and sizes
    for (int i = 0; i < entitiesToLayout.length; i++) {
      InternalNode node = entitiesToLayout[i];
      DisplayIndependentPoint location = node.getInternalLocation().convertToPercent(layoutBounds);
      node.setInternalLocation(location.x, location.y);
      if (includeNodeSize) { // adjust node sizes
        double width = node.getInternalWidth() / layoutBounds.width;
        double height = node.getInternalHeight() / layoutBounds.height;
        node.setInternalSize(width, height);
      }
    }

    // Adjust bendpoint positions
    for (int i = 0; i < relationships.length; i++) {
View Full Code Here

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

   */
  private void convertPositionsToCoords(InternalNode[] entitiesToLayout, InternalRelationship[] relationships, DisplayIndependentRectangle screenBounds) {

    // Adjust node positions and sizes
    for (int i = 0; i < entitiesToLayout.length; i++) {
      InternalNode node = entitiesToLayout[i];
      double width = node.getInternalWidth() * screenBounds.width;
      double height = node.getInternalHeight() * screenBounds.height;
      DisplayIndependentPoint location = node.getInternalLocation().convertFromPercent(screenBounds);
      node.setInternalLocation(location.x - width / 2, location.y - height / 2);
      if (resizeEntitiesAfterLayout) {
        adjustNodeSizeAndPos(node, height, width);
      } else {
        node.setInternalSize(width, height);
      }
    }

    // Adjust bendpoint positions and shift based on source node size
    for (int i = 0; i < relationships.length; i++) {
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.