public void flipLayoutLeftRight() { LayoutBox box = getExactLayoutBox(); Iterator<NodeLayout> ne = nodes.iterator(); while (ne.hasNext()) { NodeLayout nl = ne.next(); if (nl.processID.equals("null")) { nl.x = box.topleft.x + (box.width - (nl.x - box.topleft.x)) - 60; // minus 60 which is the width of process node's box, since using upperleft // coor } else if (isSecondary(nl)) { nl.x = box.topleft.x + (box.width - (nl.x - box.topleft.x)) - 60; } else { nl.x = box.topleft.x + (box.width - (nl.x - box.topleft.x)) - 20; } } Iterator<EdgeLayout> e2 = edges.iterator(); EdgeLayout el; while (e2.hasNext()) { el = e2.next(); for (LayoutPoint lp : el.bends) { lp.x = box.topleft.x + (box.width - (lp.x - box.topleft.x)); } } }
// convert coordinates to relative coordinates with the top-left one as (0,0) public void convertToRelativePositions() { LayoutBox box = getExactLayoutBox(); // System.out.println("Box // ("+box.topleft.x+","+box.topleft.y+");("+(box.topleft.x+box.width)+","+(box.topleft.y+box.height)); Iterator<NodeLayout> e = nodes.iterator(); NodeLayout nl; while (e.hasNext()) { nl = e.next(); /* Debug code if(nl.x<box.topleft.x || nl.y<box.topleft.y || nl.x>(box.topleft.x+box.width) || nl.y>(box.topleft.y+box.height)){ System.out.println("Invalid node "+nl.x+","+nl.y); } //*/ nl.x = nl.x - box.topleft.x; nl.y = nl.y - box.topleft.y; } Iterator<EdgeLayout> e2 = edges.iterator(); EdgeLayout el; while (e2.hasNext()) { el = e2.next(); for (LayoutPoint lp : el.bends) { lp.x = lp.x - box.topleft.x; lp.y = lp.y - box.topleft.y; } } }
// convert coordinates to shifted coordinates with the top-left one as (xs,ys) public void convertToShiftedPositions(double xs, double ys) { convertToRelativePositions(); Iterator<NodeLayout> e = nodes.iterator(); NodeLayout nl; while (e.hasNext()) { nl = e.next(); nl.x += xs; nl.y += ys; } Iterator<EdgeLayout> e2 = edges.iterator(); EdgeLayout el; while (e2.hasNext()) { el = e2.next(); for (LayoutPoint lp : el.bends) { lp.x += xs; lp.y += ys; } } }
public void flipLayoutUpDown() { LayoutBox box = getExactLayoutBox(); Iterator<NodeLayout> ne = nodes.iterator(); while (ne.hasNext()) { NodeLayout nl = ne.next(); if (isSecondary(nl)) { nl.y = box.topleft.y + (box.height - (nl.y - box.topleft.y)) - 12; } else { nl.y = box.topleft.y + (box.height - (nl.y - box.topleft.y)) - 20; } } Iterator<EdgeLayout> e2 = edges.iterator(); EdgeLayout el; while (e2.hasNext()) { el = e2.next(); for (LayoutPoint lp : el.bends) { lp.y = box.topleft.y + (box.height - (lp.y - box.topleft.y)); } } }
public void filpLayoutUpDown() { LayoutBox box = getExactLayoutBox(); Iterator<NodeLayout> ne = nodes.iterator(); while (ne.hasNext()) { NodeLayout nl = ne.next(); if (nl.cofactor.equalsIgnoreCase("true")) { nl.y = box.topleft.y + (box.height - (nl.y - box.topleft.y)) - 12; } else { nl.y = box.topleft.y + (box.height - (nl.y - box.topleft.y)) - 20; } } Iterator<EdgeLayout> e2 = edges.iterator(); EdgeLayout el; while (e2.hasNext()) { el = e2.next(); for (LayoutPoint lp : el.bends) { lp.y = box.topleft.y + (box.height - (lp.y - box.topleft.y)); } } }