Package com.mxgraph.layout.hierarchical.model

Examples of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyModel$CellVisitor


    while (iter.hasNext())
    {
      Set<Object> vertexSet = iter.next();

      model = new mxGraphHierarchyModel(this, vertexSet.toArray(), roots,
          parent, false, deterministic, layoutFromSinks);

      cycleStage(parent);
      layeringStage();
      crossingStage(parent);
View Full Code Here


  /**
   * A basic horizontal coordinate assignment algorithm
   */
  public void execute(Object parent)
  {
    mxGraphHierarchyModel model = layout.getModel();
    currentXDelta = 0.0;

    initialCoords(layout.getGraph(), model);

    if (fineTuning)
View Full Code Here

  /**
   * Produces the layer assignmment using the graph information specified
   */
  public void execute(Object parent)
  {
    mxGraphHierarchyModel model = layout.getModel();
    final Set<mxGraphHierarchyNode> seenNodes = new HashSet<mxGraphHierarchyNode>();
    final Set<mxGraphHierarchyNode> unseenNodes = new HashSet<mxGraphHierarchyNode>(
        model.getVertexMapper().values());

    // Perform a dfs through the internal model. If a cycle is found,
    // reverse it.
    mxGraphHierarchyNode[] rootsArray = null;

    if (model.roots != null)
    {
      Object[] modelRoots = model.roots.toArray();
      rootsArray = new mxGraphHierarchyNode[modelRoots.length];

      for (int i = 0; i < modelRoots.length; i++)
      {
        Object node = modelRoots[i];
        mxGraphHierarchyNode internalNode = model
            .getVertexMapper().get(node);
        rootsArray[i] = internalNode;
      }
    }

    model.visit(new mxGraphHierarchyModel.CellVisitor()
    {
      public void visit(mxGraphHierarchyNode parent,
          mxGraphHierarchyNode cell,
          mxGraphHierarchyEdge connectingEdge, int layer, int seen)
      {
        // Check if the cell is in it's own ancestor list, if so
        // invert the connecting edge and reverse the target/source
        // relationship to that edge in the parent and the cell
        if ((cell)
            .isAncestor(parent))
        {
          connectingEdge.invert();
          parent.connectsAsSource.remove(connectingEdge);
          parent.connectsAsTarget.add(connectingEdge);
          cell.connectsAsTarget.remove(connectingEdge);
          cell.connectsAsSource.add(connectingEdge);
        }
        seenNodes.add(cell);
        unseenNodes.remove(cell);
      }
    }, rootsArray, true, null);

    Set<Object> possibleNewRoots = null;

    if (unseenNodes.size() > 0)
    {
      possibleNewRoots = new HashSet<Object>(unseenNodes);
    }

    // If there are any nodes that should be nodes that the dfs can miss
    // these need to be processed with the dfs and the roots assigned
    // correctly to form a correct internal model
    Set<mxGraphHierarchyNode> seenNodesCopy = new HashSet<mxGraphHierarchyNode>(
        seenNodes);

    // Pick a random cell and dfs from it
    mxGraphHierarchyNode[] unseenNodesArray = new mxGraphHierarchyNode[1];
    unseenNodes.toArray(unseenNodesArray);
   
    model.visit(new mxGraphHierarchyModel.CellVisitor()
    {
      public void visit(mxGraphHierarchyNode parent,
          mxGraphHierarchyNode cell,
          mxGraphHierarchyEdge connectingEdge, int layer, int seen)
      {
View Full Code Here

    while (iter.hasNext())
    {
      Set<Object> vertexSet = iter.next();

      this.model = new mxGraphHierarchyModel(this, vertexSet.toArray(),
          roots, parent);

      cycleStage(parent);
      layeringStage();
      crossingStage(parent);
View Full Code Here

  /**
   * Utility method to display the x co-ords
   */
  public void printStatus()
  {
    mxGraphHierarchyModel model = layout.getModel();

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

    for (int j = 0; j < model.ranks.size(); j++)
    {
View Full Code Here

  /**
   * A basic horizontal coordinate assignment algorithm
   */
  public void execute(Object parent)
  {
    mxGraphHierarchyModel model = layout.getModel();
    currentXDelta = 0.0;

    initialCoords(layout.getGraph(), model);

    if (fineTuning)
View Full Code Here

   * Performs a vertex ordering within ranks as described by Gansner et al
   * 1993
   */
  public void execute(Object parent)
  {
    mxGraphHierarchyModel model = layout.getModel();

    // Stores initial ordering as being the best one found so far
    nestedBestRanks = new mxGraphAbstractHierarchyCell[model.ranks.size()][];

    for (int i = 0; i < nestedBestRanks.length; i++)
View Full Code Here

  /**
   * A basic horizontal coordinate assignment algorithm
   */
  public void execute(Object parent)
  {
    mxGraphHierarchyModel model = layout.getModel();
    currentXDelta = 0.0;

    initialCoords(layout.getGraph(), model);

    if (fineTuning)
View Full Code Here

   * Performs a vertex ordering within ranks as described by Gansner et al
   * 1993
   */
  public void execute(Object parent)
  {
    mxGraphHierarchyModel model = layout.getModel();

    // Stores initial ordering as being the best one found so far
    nestedBestRanks = new mxGraphAbstractHierarchyCell[model.ranks.size()][];

    for (int i = 0; i < nestedBestRanks.length; i++)
View Full Code Here

    while (iter.hasNext())
    {
      Set<Object> vertexSet = iter.next();

      model = new mxGraphHierarchyModel(this, vertexSet.toArray(), Arrays
          .asList(roots), parent, false, deterministic,
          layoutFromSinks);

      cycleStage(parent);
      layeringStage();
View Full Code Here

TOP

Related Classes of com.mxgraph.layout.hierarchical.model.mxGraphHierarchyModel$CellVisitor

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.