Package org.gephi.visualization.model.edge

Examples of org.gephi.visualization.model.edge.EdgeModeler


    }

    public synchronized boolean updateWorld() {
        if (observer != null && observer.hasGraphChanged()) {
            NodeModeler nodeModeler = (NodeModeler) engine.getNodeClass().getCurrentModeler();
            EdgeModeler edgeModeler = (EdgeModeler) engine.getEdgeClass().getCurrentModeler();
            Octree octree = engine.getOctree();

            //Stats
            int removedNodes = 0;
            int addedNodes = 0;
            int removedEdges = 0;
            int addedEdges = 0;

            for (int i = 0; i < nodes.length; i++) {
                NodeModel node = nodes[i];
                if (node != null && node.getNode().getStoreId() == -1) {
                    //Removed
                    octree.removeNode(node);
                    nodes[i] = null;
                    removedNodes++;
                }
            }
            for (Node node : graph.getNodes()) {
                int id = node.getStoreId();
                if (id >= nodes.length || nodes[id] == null) {
                    growNodes(id);
                    NodeModel model = nodeModeler.initModel(node);
                    octree.addNode(model);
                    nodes[id] = model;
                    addedNodes++;
                }
            }
            for (int i = 0; i < edges.length; i++) {
                EdgeModel edge = edges[i];
                if (edge != null && edge.getEdge().getStoreId() == -1) {
                    //Removed
                    NodeModel sourceModel = nodes[edge.getEdge().getSource().getStoreId()];
                    NodeModel targetModel = nodes[edge.getEdge().getTarget().getStoreId()];
                    if (sourceModel != null) {
                        sourceModel.removeEdge(edge);
                    }
                    if (targetModel != null) {
                        targetModel.removeEdge(edge);
                    }
                    edges[i] = null;
                    removedEdges++;
                }
            }
            float minWeight = Float.MAX_VALUE;
            float maxWeight = Float.MIN_VALUE;
            for (Edge edge : graph.getEdges()) {
                int id = edge.getStoreId();
                if (id >= edges.length || edges[id] == null) {
                    growEdges(id);
                    NodeModel sourceModel = nodes[edge.getSource().getStoreId()];
                    NodeModel targetModel = nodes[edge.getTarget().getStoreId()];
                    EdgeModel model = edgeModeler.initModel(edge, sourceModel, targetModel);
                    sourceModel.addEdge(model);
                    targetModel.addEdge(model);
                    edges[id] = model;
                    addedEdges++;
                }
View Full Code Here


            nodeClass.setCurrentModeler(modeler2d);
        }

        //EDGE
        edgeClass = new ModelClass(1, "EDGE", false, true, false, true);
        EdgeModeler edgeModeler = new EdgeModeler(engine);
        edgeClass.addModeler(edgeModeler);
        edgeClass.setCurrentModeler(edgeModeler);
    }
View Full Code Here

TOP

Related Classes of org.gephi.visualization.model.edge.EdgeModeler

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.