当前位置: 首页>>代码示例>>Java>>正文


Java UniversalGraph.getNodes方法代码示例

本文整理汇总了Java中org.netbeans.api.visual.graph.layout.UniversalGraph.getNodes方法的典型用法代码示例。如果您正苦于以下问题:Java UniversalGraph.getNodes方法的具体用法?Java UniversalGraph.getNodes怎么用?Java UniversalGraph.getNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.visual.graph.layout.UniversalGraph的用法示例。


在下文中一共展示了UniversalGraph.getNodes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performGraphLayout

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
protected void performGraphLayout(UniversalGraph<N, E> graph) {

        Set<LinkWrapper> links = new LinkedHashSet<LinkWrapper>();
        Set<VertexWrapper> vertices = new LinkedHashSet<VertexWrapper>();
        Map<N, VertexWrapper> vertexMap = new HashMap<N, VertexWrapper>();

        for (N node : graph.getNodes()) {
            VertexWrapper v = new VertexWrapper(node, graph);
            vertexMap.put(node, v);
            vertices.add(v);
        }

        for (E edge : graph.getEdges()) {
            N source = graph.getEdgeSource(edge);
            N target = graph.getEdgeTarget(edge);
            LinkWrapper l = new LinkWrapper(vertexMap.get(source), vertexMap.get(target));
            links.add(l);
        }

        HierarchicalLayoutManager m = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.NONE);

        LayoutGraph layoutGraph = new LayoutGraph(links, vertices);
        m.doLayout(layoutGraph);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:HierarchicalGraphLayout.java

示例2: performGraphLayout

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
protected void performGraphLayout(UniversalGraph<N, E> graph) {

        Set<LinkWrapper> links = new HashSet<LinkWrapper>();
        Set<VertexWrapper> vertices = new HashSet<VertexWrapper>();
        Map<N, VertexWrapper> vertexMap = new HashMap<N, VertexWrapper>();

        for (N node : graph.getNodes()) {
            VertexWrapper v = new VertexWrapper(node, graph);
            vertexMap.put(node, v);
            vertices.add(v);
        }

        for (E edge : graph.getEdges()) {
            N source = graph.getEdgeSource(edge);
            N target = graph.getEdgeTarget(edge);
            LinkWrapper l = new LinkWrapper(vertexMap.get(source), vertexMap.get(target));
            links.add(l);
        }

        HierarchicalLayoutManager m = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.NONE);

        LayoutGraph layoutGraph = new LayoutGraph(links, vertices);
        m.doLayout(layoutGraph);
    }
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:25,代码来源:HierarchicalGraphLayout.java

示例3: performGraphLayout

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
/**
 * Performs the grid graph layout on an universal graph.
 *
 * @param graph the universal graph
 */
@Override
protected void performGraphLayout(UniversalGraph<GraphNode, EdgeNode> graph) {
    ObjectScene scene = graph.getScene();
    List<GraphNode> leftNodes = new ArrayList<GraphNode>();
    List<GraphNode> rightNodes = new ArrayList<GraphNode>();
    for (GraphNode node : graph.getNodes()) {
        Integer rightAlign = (Integer) node.getValue(LAYOUT_NODE_LOCATION);
        if (rightAlign != null && rightAlign == LOCATION_RIGHT) {
            rightNodes.add(node);
        } else {
            leftNodes.add(node);
        }
    }
    List<GraphLocation> leftWidgets = createRelativeLocations(scene, leftNodes, Align.LEFT);
    List<GraphLocation> rightWidgets = createRelativeLocations(scene, rightNodes, Align.LEFT);
    Rectangle leftBoundMax = findMaxBound(leftWidgets);
    Point leftStart = new Point(LEFT_SPACING, TOP_SPACING);
    Point rightStart = new Point(RIGHT_START_X, TOP_SPACING);
    if (RIGHT_START_X < (LEFT_SPACING + leftBoundMax.width + horizontalGap)) {
        rightStart = new Point(LEFT_SPACING + leftBoundMax.width + horizontalGap, TOP_SPACING);
    }
    resolveNodeLocations(graph, leftWidgets, leftStart);
    resolveNodeLocations(graph, rightWidgets, rightStart);
}
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:30,代码来源:GraphBiLayout.java

示例4: DirectedGraph

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
/**
 * Creates a new instance of DirectedGraph
 */
protected DirectedGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
    this.uGraph = uGraph;
    this.scene = scene;
    this.nodes = uGraph.getNodes();
    this.edges = uGraph.getEdges();

    vertexMap = new HashMap<N, Vertex>();
    edgeMap = new LinkedHashMap<E, Edge>();
    rootVertices = new ArrayList<Vertex>();
    vertices = new ArrayList<Vertex>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DirectedGraph.java

示例5: MixedGraph

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
/** Creates a new instance of UndirectedGraph */
private MixedGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
    this.uGraph = uGraph;
    this.scene = scene;
    this.nodes = uGraph.getNodes();
    this.edges = uGraph.getEdges() ;

    vertexMap = new HashMap<N, Vertex>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MixedGraph.java

示例6: MGraph

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
/**
 * 
 * @param uGraph
 * @param scene
 */
protected MGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
    this.uGraph = uGraph;
    this.scene = scene;
    this.nodes = uGraph.getNodes();

    vertexMap = new HashMap<N, Vertex>();
    edgeMap = new LinkedHashMap<E, Edge>();
    vertices = new ArrayList<Vertex>();

    DummyVertex.resetCounter();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:MGraph.java

示例7: performGraphLayout

import org.netbeans.api.visual.graph.layout.UniversalGraph; //导入方法依赖的package包/类
@Override
protected void performGraphLayout (UniversalGraph<N, E> graph) {
    if (rootNode == null)
        return;
    Collection<N> allNodes = graph.getNodes ();
    if (! allNodes.contains (rootNode))
        return;
    ArrayList<N> nodesToResolve = new ArrayList<N> (allNodes);

    HashSet<N> loadedSet = new HashSet<N> ();
    Node root = new Node (graph, rootNode, loadedSet);
    nodesToResolve.removeAll (loadedSet);

    Map<Integer, Integer> map = root.getMaxSpaceForEveryLevel(graph);

    List<Node.LeftRight> envelope = root.layout(originX, originY, map, 0);

    // correction of originX, if needed
    int moveDistance = Integer.MIN_VALUE;
    // get the most left position and determine the distance to move
    for (Node.LeftRight leftRight : envelope) {
        if (leftRight.getLeft() < originX && originX - leftRight.getLeft() > moveDistance) {
            moveDistance = originX - leftRight.getLeft();
        }
    }

    if (moveDistance == Integer.MIN_VALUE) {
        moveDistance = 0;
    }

    if (!vertical) {
        root.invert(moveDistance);
    } else {
        root.relativeBoundsCorrectionX(moveDistance);
    }

    final HashMap<N, Point> resultPosition = new HashMap<N, Point> ();
    root.upload (resultPosition);

    for (N node : nodesToResolve) {
        Point position = new Point ();
        // TODO - resolve others
        resultPosition.put (node, position);
    }

    for (Map.Entry<N, Point> entry : resultPosition.entrySet ())
        setResolvedNodeLocation (graph, entry.getKey (), entry.getValue ());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:TreeGraphLayout.java


注:本文中的org.netbeans.api.visual.graph.layout.UniversalGraph.getNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。