Examples of mxGraphHierarchyRank


Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

        // positioning is used
        if (currentXDelta < bestXDelta)
        {
          for (int j = 0; j < model.ranks.size(); j++)
          {
            mxGraphHierarchyRank rank = model.ranks
                .get(new Integer(j));
            Iterator<mxGraphAbstractHierarchyCell> iter = rank
                .iterator();

            while (iter.hasNext())
            {
              mxGraphAbstractHierarchyCell cell = iter.next();
              cell.setX(j, cell.getGeneralPurposeVariable(j));
            }
          }

          bestXDelta = currentXDelta;
        }
        else
        {
          // Restore the best positions
          for (int j = 0; j < model.ranks.size(); j++)
          {
            mxGraphHierarchyRank rank = model.ranks
                .get(new Integer(j));
            Iterator<mxGraphAbstractHierarchyCell> iter = rank
                .iterator();

            while (iter.hasNext())
            {
              mxGraphAbstractHierarchyCell cell = iter.next();
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

    Map<mxGraphAbstractHierarchyCell, WeightedCellSorter> map = new Hashtable<mxGraphAbstractHierarchyCell, WeightedCellSorter>();
    mxGraphAbstractHierarchyCell[][] rank = new mxGraphAbstractHierarchyCell[model.maxRank + 1][];

    for (int i = 0; i <= model.maxRank; i++)
    {
      mxGraphHierarchyRank rankSet = model.ranks.get(new Integer(i));
      rank[i] = rankSet.toArray(new mxGraphAbstractHierarchyCell[rankSet
          .size()]);

      for (int j = 0; j < rank[i].length; j++)
      {
        // Use the weight to store the rank and visited to store whether
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

   *            relative to
   */
  protected void rankMedianPosition(int rankValue,
      mxGraphHierarchyModel model, int nextRankValue)
  {
    mxGraphHierarchyRank rankSet = model.ranks.get(new Integer(rankValue));
    Object[] rank = rankSet.toArray();
    // Form an array of the order in which the cells are to be processed
    // , the order is given by the weighted sum of the in or out edges,
    // depending on whether we're travelling up or down the hierarchy.
    WeightedCellSorter[] weightedValues = new WeightedCellSorter[rank.length];
    Map<mxGraphAbstractHierarchyCell, WeightedCellSorter> cellMap = new Hashtable<mxGraphAbstractHierarchyCell, WeightedCellSorter>(
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

   *            an internal model of the hierarchical layout
   */
  protected void rankCoordinates(int rankValue, mxGraph graph,
      mxGraphHierarchyModel model)
  {
    mxGraphHierarchyRank rank = model.ranks.get(new Integer(rankValue));
    double maxY = 0.0;
    double localX = initialX + (widestRankValue - rankWidths[rankValue])
        / 2;

    // Store whether or not any of the cells' bounds were unavailable so
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

    for (int rankValue = model.maxRank; rankValue >= 0; rankValue--)
    {
      // Keep track of the widest cell on this rank
      double maxCellHeight = 0.0;
      mxGraphHierarchyRank rank = model.ranks.get(new Integer(rankValue));
      double localX = initialX;

      // Store whether or not any of the cells' bounds were unavailable so
      // to only issue the warning once for all cells
      boolean boundsWarning = false;
      Iterator<mxGraphAbstractHierarchyCell> iter = rank.iterator();

      while (iter.hasNext())
      {
        mxGraphAbstractHierarchyCell cell = iter.next();

        if (cell.isVertex())
        {
          mxGraphHierarchyNode node = (mxGraphHierarchyNode) cell;
          mxRectangle bounds = layout.getVertexBounds(node.cell);

          if (bounds != null)
          {
            if (orientation == SwingConstants.NORTH
                || orientation == SwingConstants.SOUTH)
            {
              cell.width = bounds.getWidth();
              cell.height = bounds.getHeight();
            }
            else
            {
              cell.width = bounds.getHeight();
              cell.height = bounds.getWidth();
            }
          }
          else
          {
            boundsWarning = true;
          }

          maxCellHeight = Math.max(maxCellHeight, cell.height);
        }
        else if (cell.isEdge())
        {
          mxGraphHierarchyEdge edge = (mxGraphHierarchyEdge) cell;
          // The width is the number of additional parallel edges
          // time the parallel edge spacing
          int numEdges = 1;

          if (edge.edges != null)
          {
            numEdges = edge.edges.size();
          }
          else
          {
            logger.info("edge.edges is null");
          }

          cell.width = (numEdges - 1) * parallelEdgeSpacing;
        }

        // Set the initial x-value as being the best result so far
        localX += cell.width / 2.0;
        cell.setX(rankValue, localX);
        cell.setGeneralPurposeVariable(rankValue, (int) localX);
        localX += cell.width / 2.0;
        localX += intraCellSpacing;

        if (localX > widestRankValue)
        {
          widestRankValue = localX;
          widestRank = rankValue;
        }

        rankWidths[rankValue] = localX;
      }

      if (boundsWarning == true)
      {
        logger.info("At least one cell has no bounds");
      }

      rankY[rankValue] = y;
      double distanceToNextRank = maxCellHeight / 2.0
          + lastRankMaxCellHeight / 2.0 + interRankCellSpacing;
      lastRankMaxCellHeight = maxCellHeight;

      if (orientation == SwingConstants.NORTH
          || orientation == SwingConstants.WEST)
      {
        y += distanceToNextRank;
      }
      else
      {
        y -= distanceToNextRank;
      }

      iter = rank.iterator();

      while (iter.hasNext())
      {
        mxGraphAbstractHierarchyCell cell = iter.next();
        cell.setY(rankValue, y);
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

   * @return whether or not the virtual node can be moved to this position
   */
  protected boolean repositionValid(mxGraphHierarchyModel model,
      mxGraphAbstractHierarchyCell cell, int rank, double position)
  {
    mxGraphHierarchyRank rankSet = model.ranks.get(new Integer(rank));
    mxGraphAbstractHierarchyCell[] rankArray = rankSet
        .toArray(new mxGraphAbstractHierarchyCell[rankSet.size()]);
    int rankIndex = -1;

    for (int i = 0; i < rankArray.length; i++)
    {
      if (cell == rankArray[i])
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

    System.out.println("======Coord assignment debug=======");

    for (int j = 0; j < model.ranks.size(); j++)
    {
      System.out.print("Rank " + j + " : " );
      mxGraphHierarchyRank rank = model.ranks
          .get(new Integer(j));
      Iterator<mxGraphAbstractHierarchyCell> iter = rank
          .iterator();

      while (iter.hasNext())
      {
        mxGraphAbstractHierarchyCell cell = iter.next();
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

        // positioning is used
        if (currentXDelta < bestXDelta)
        {
          for (int j = 0; j < model.ranks.size(); j++)
          {
            mxGraphHierarchyRank rank = model.ranks
                .get(new Integer(j));
            Iterator<mxGraphAbstractHierarchyCell> iter = rank
                .iterator();

            while (iter.hasNext())
            {
              mxGraphAbstractHierarchyCell cell = iter.next();
              cell.setX(j, cell.getGeneralPurposeVariable(j));
            }
          }

          bestXDelta = currentXDelta;
        }
        else
        {
          // Restore the best positions
          for (int j = 0; j < model.ranks.size(); j++)
          {
            mxGraphHierarchyRank rank = model.ranks
                .get(new Integer(j));
            Iterator<mxGraphAbstractHierarchyCell> iter = rank
                .iterator();

            while (iter.hasNext())
            {
              mxGraphAbstractHierarchyCell cell = iter.next();
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

    Map<mxGraphAbstractHierarchyCell, WeightedCellSorter> map = new Hashtable<mxGraphAbstractHierarchyCell, WeightedCellSorter>();
    mxGraphAbstractHierarchyCell[][] rank = new mxGraphAbstractHierarchyCell[model.maxRank + 1][];

    for (int i = 0; i <= model.maxRank; i++)
    {
      mxGraphHierarchyRank rankSet = model.ranks.get(new Integer(i));
      rank[i] = rankSet.toArray(new mxGraphAbstractHierarchyCell[rankSet
          .size()]);

      for (int j = 0; j < rank[i].length; j++)
      {
        // Use the weight to store the rank and visited to store whether
View Full Code Here

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyRank

   *            relative to
   */
  protected void rankMedianPosition(int rankValue,
      mxGraphHierarchyModel model, int nextRankValue)
  {
    mxGraphHierarchyRank rankSet = model.ranks.get(new Integer(rankValue));
    Object[] rank = rankSet.toArray();
    // Form an array of the order in which the cells are to be processed
    // , the order is given by the weighted sum of the in or out edges,
    // depending on whether we're travelling up or down the hierarchy.
    WeightedCellSorter[] weightedValues = new WeightedCellSorter[rank.length];
    Map<mxGraphAbstractHierarchyCell, WeightedCellSorter> cellMap = new Hashtable<mxGraphAbstractHierarchyCell, WeightedCellSorter>(
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.