Java 类org.eclipse.draw2d.graph.EdgeList 实例源码

项目:d-case_editor    文件:NodeEx.java   
/**
 * Returns the children those should be locate to the south.
 * 
 * @return the children those should be locate to the south.
 */
@SuppressWarnings("unchecked")
public NodeList getSouthNodes() {
    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    for (Object obj : node.outgoing) {
        if (!DcaseDirectedGraph.isEast((Node) ((Edge) obj).target)) {
            edgeList.add(obj);
        }
    }
    // sorts by the sibling order.
    if (edgeList.size() > 1) {
        Collections.sort(edgeList, new DcaseEditPartLayoutComparator());
    }
    for (int i = 0; i < edgeList.size(); i++) {
        nodeList.add(((Edge) edgeList.get(i)).target);
    }
    return nodeList;
}
项目:d-case_editor    文件:NodeEx.java   
/**
 * Returns the children those should be locate to the east.
 * 
 * @return the children those should be locate to the east.
 */
@SuppressWarnings("unchecked")
public NodeList getEastNodes() {
    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    for (Object obj : node.outgoing) {
        if (DcaseDirectedGraph.isEast((Node) ((Edge) obj).target)) {
            edgeList.add(obj);
        }
    }
    // sorts by the sibling order.
    if (edgeList.size() > 1) {
        Collections.sort(edgeList, new DcaseEditPartLayoutComparator());
    }
    for (int i = 0; i < edgeList.size(); i++) {
        nodeList.add(((Edge) edgeList.get(i)).target);
    }
    return nodeList;
}
项目:d-case_editor    文件:CollectNodeGraphVisitor.java   
/**
 * Returns the root of the specified node.
 * 
 * @param node the node.
 */
private void getRootParent(Node node) {
    if (getNodeEx(node) != null) {
        return;
    }
    if (workStack.contains(node)) {
        return;
    }
    workStack.push(node);
    EdgeList edgeList = node.incoming;
    if (edgeList.size() > 0) {
        for (int i = 0; i < edgeList.size(); i++) {
            Node parent = ((Edge) edgeList.get(i)).source;
            getRootParent(parent);
        }
    } else {
        addBaseNodeList(node);
        collectBaseNode(node);
    }
    workStack.pop();
    return;
}
项目:d-case_editor    文件:LocateEdgeGraphVisitor.java   
/**
 * Locates the edges.
 */
private void locateEdge() {
    EdgeList list = getGraph().getEdgeList();
    for (int i = 0; i < list.size(); i++) {
        Edge edge = list.getEdge(i);
        Node source = edge.source;
        Node target = edge.target;
        Point start = new Point();
        Point end = new Point();
        PointList mid = new PointList();
        int direction = getDirection(source, target);
        switch (direction) {
        case LEFT_TO_RIGHT:
            start.x = source.x + source.width;
            start.y = source.y + source.height / 2;
            end.x = target.x;
            end.y = target.y + target.height / 2;
            break;
        case RIGHT_TO_LEFT:
            start.x = source.x;
            start.y = source.y + source.height / 2;
            end.x = target.x + target.width;
            end.y = target.y + target.height / 2;
            break;
        case BOTTOM_TO_TOP:
            start.x = source.x + source.width / 2;
            start.y = source.y;
            end.x = target.x + target.width / 2;
            end.y = target.y + target.height;
            break;
        default:
            start.x = source.x + source.width / 2;
            start.y = source.y + source.height;
            end.x = target.x + target.width / 2;
            end.y = target.y;
        }

        if (getNodeEx(target).getLooped()) {
            if (direction == BOTTOM_TO_TOP || direction == RIGHT_TO_LEFT) {
                if (Math.abs(start.x - end.x) < GAP) {
                    end.x = target.x + target.width / 2;
                    end.y = target.y + target.height;

                    int xPoint = start.x - source.width / 2 - VERTICAL_SPACING;
                    mid.addPoint(xPoint, start.y - HORIZONTAL_SPACING / 2);
                    mid.addPoint(xPoint, end.y + (start.y - end.y) / 2);
                    mid.addPoint(xPoint, end.y + HORIZONTAL_SPACING / 2);
                } else if (Math.abs(start.y - end.y) < GAP) {
                    end.x = target.x + target.width;
                    end.y = target.y + target.height / 2;

                    int yPoint = start.y - source.height / 2
                            - HORIZONTAL_SPACING;
                    mid.addPoint(start.x - VERTICAL_SPACING / 2, yPoint);
                    mid.addPoint(end.x + (start.x - end.x) / 2, yPoint);
                    mid.addPoint(end.x + VERTICAL_SPACING / 2, yPoint);
                }
            }
        }
        edge.getPoints().removeAllPoints();
        edge.getPoints().addPoint(start);
        for (int j = 0; j < mid.size(); j++) {
            edge.getPoints().addPoint(mid.getPoint(j));
        }
        edge.getPoints().addPoint(end);
        edge.getPoints();
    }
}
项目:d-case_editor    文件:DcaseDirectedGraph.java   
/**
 * Returns the all of the edges in the graph.
 * 
 * @return the all of the edges in the graph.
 */
public EdgeList getEdgeList() {
    return graph.edges;
}