Package org.gephi.visualization.model.edge

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


    protected static final long ONEOVERPHI = 106039;

    private void growEdges(final int index) {
        if (index >= edges.length) {
            final int newLength = (int) Math.min(Math.max((ONEOVERPHI * edges.length) >>> 16, index + 1), Integer.MAX_VALUE);
            final EdgeModel t[] = new EdgeModel[newLength];
            System.arraycopy(edges, 0, t, 0, edges.length);
            edges = t;
        }
    }
View Full Code Here


                    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

    private void growEdges(final int index) {
        if (edges == null) {
            edges = new EdgeModel[10];
        } else if (index >= edges.length) {
            final int newLength = (int) Math.min(Math.max((ONEOVERPHI * edges.length) >>> 16, index + 1), Integer.MAX_VALUE);
            final EdgeModel t[] = new EdgeModel[newLength];
            System.arraycopy(edges, 0, t, 0, edges.length);
            edges = t;
        }
    }
View Full Code Here

        //Edges
        if (edgeClass.isEnabled()) {
            edgeClass.beforeDisplay(gl, glu);

            for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext();) {
                EdgeModel obj = itr.next();

                if (obj.markTime != markTime) {
                    obj.display(gl, glu, vizModel);
                    obj.markTime = markTime;
                }
            }
            edgeClass.afterDisplay(gl, glu);
        }

        markTime++;

        //Arrows
        if (edgeClass.isEnabled() && vizConfig.isShowArrows() && dataBridge.isDirected()) {
            gl.glBegin(GL2.GL_TRIANGLES);
            for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext();) {
                EdgeModel obj = itr.next();
                if (obj.getEdge().isDirected() && obj.markTime != markTime) {
                    obj.displayArrow(gl, glu, vizModel);
                    obj.markTime = markTime;
                }
            }
            gl.glEnd();
        }

        //Nodes
        if (nodeClass.isEnabled()) {
            nodeClass.beforeDisplay(gl, glu);
            for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext();) {
                NodeModel obj = itr.next();
                if (obj.markTime != markTime) {
                    obj.display(gl, glu, vizModel);
                    obj.markTime = markTime;
                }
            }
            nodeClass.afterDisplay(gl, glu);
        }

        //Labels
        if (vizModel.getTextModel().isShowNodeLabels() || vizModel.getTextModel().isShowEdgeLabels()) {
            markTime++;
            if (nodeClass.isEnabled() && vizModel.getTextModel().isShowNodeLabels()) {
                textManager.getNodeRenderer().beginRendering();
                textManager.defaultNodeColor();
                if (textManager.isSelectedOnly()) {
                    for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext();) {
                        NodeModel obj = itr.next();
                        if (obj.markTime != markTime) {
                            if (obj.isSelected() && obj.isTextVisible()) {
                                textManager.getNodeRenderer().drawTextNode(obj);
                            }
                            obj.markTime = markTime;
                        }
                    }
                } else {
                    for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext();) {
                        NodeModel obj = itr.next();
                        if (obj.markTime != markTime) {
                            if (obj.isTextVisible()) {
                                textManager.getNodeRenderer().drawTextNode(obj);
                            }
                            obj.markTime = markTime;
                        }
                    }
View Full Code Here

TOP

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

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.