Package org.gephi.visualization.api.initializer

Examples of org.gephi.visualization.api.initializer.Modeler


        engine.worldUpdated(cacheMarker);
    }

    private void updateNodes(HierarchicalGraph graph) {
        Modeler nodeInit = engine.getModelClasses()[AbstractEngine.CLASS_NODE].getCurrentModeler();

        NodeIterable nodeIterable;
        nodeIterable = graph.getNodes();


        for (Node node : nodeIterable) {

            Model obj = node.getNodeData().getModel();
            if (obj == null) {
                //Model is null, ADD
                obj = nodeInit.initModel(node.getNodeData());
                engine.addObject(AbstractEngine.CLASS_NODE, (ModelImpl) obj);
            } else if (!obj.isValid()) {
                engine.addObject(AbstractEngine.CLASS_NODE, (ModelImpl) obj);
            }
            obj.setCacheMarker(cacheMarker);
View Full Code Here


            }
        }
    }

    private void updateEdges(HierarchicalGraph graph) {
        Modeler edgeInit = engine.getModelClasses()[AbstractEngine.CLASS_EDGE].getCurrentModeler();
        Modeler arrowInit = engine.getModelClasses()[AbstractEngine.CLASS_ARROW].getCurrentModeler();

        EdgeIterable edgeIterable;
        edgeIterable = graph.getEdges();

        float minWeight = Float.POSITIVE_INFINITY;
        float maxWeight = Float.NEGATIVE_INFINITY;

        TimeInterval timeInterval = DynamicUtilities.getVisibleInterval(dynamicModel);

        for (Edge edge : edgeIterable) {
            if (edge.getSource().getNodeData().getModel() == null || edge.getTarget().getNodeData().getModel() == null) {
                continue;
            }
            float weight = 1f;
            if (timeInterval == null) {
                weight = edge.getWeight();
            } else {
                weight = edge.getWeight(timeInterval.getLow(), timeInterval.getHigh());
            }
            minWeight = Math.min(minWeight, weight);
            maxWeight = Math.max(maxWeight, weight);
            Edge2dModel obj = (Edge2dModel) edge.getEdgeData().getModel();
            if (obj == null) {
                //Model is null, ADD
                obj = (Edge2dModel) edgeInit.initModel(edge.getEdgeData());
                engine.addObject(AbstractEngine.CLASS_EDGE, obj);
                if (!undirected && vizConfig.isShowArrows() && !edge.isSelfLoop()) {
                    Arrow2dModel arrowObj = (Arrow2dModel) arrowInit.initModel(edge.getEdgeData());
                    engine.addObject(AbstractEngine.CLASS_ARROW, arrowObj);
                    arrowObj.setCacheMarker(cacheMarker);
                    arrowObj.setWeight(weight);
                    obj.setArrow(arrowObj);
                }
View Full Code Here

        limits.setMinWeight(minWeight);
        limits.setMaxWeight(maxWeight);
    }

    public void updateMetaEdges(HierarchicalGraph graph) {
        Modeler edgeInit = engine.getModelClasses()[AbstractEngine.CLASS_EDGE].getCurrentModeler();
        Modeler arrowInit = engine.getModelClasses()[AbstractEngine.CLASS_ARROW].getCurrentModeler();

        float minWeight = Float.POSITIVE_INFINITY;
        float maxWeight = Float.NEGATIVE_INFINITY;

        TimeInterval timeInterval = DynamicUtilities.getVisibleInterval(dynamicModel);

        for (Edge edge : graph.getMetaEdges()) {
            if (edge.getSource().getNodeData().getModel() == null || edge.getTarget().getNodeData().getModel() == null) {
                continue;
            }
            float weight = 1f;
            if (timeInterval == null) {
                weight = edge.getWeight();
            } else {
                weight = edge.getWeight(timeInterval.getLow(), timeInterval.getHigh());
            }
            minWeight = Math.min(minWeight, weight);
            maxWeight = Math.max(maxWeight, weight);
            Edge2dModel obj = (Edge2dModel) edge.getEdgeData().getModel();
            if (obj == null) {
                //Model is null, ADD
                obj = (Edge2dModel) edgeInit.initModel(edge.getEdgeData());
                engine.addObject(AbstractEngine.CLASS_EDGE, obj);
                if (!undirected && vizConfig.isShowArrows() && !edge.isSelfLoop()) {
                    Arrow2dModel arrowObj = (Arrow2dModel) arrowInit.initModel(edge.getEdgeData());
                    engine.addObject(AbstractEngine.CLASS_ARROW, arrowObj);
                    arrowObj.setCacheMarker(cacheMarker);
                    arrowObj.setWeight(weight);
                    obj.setArrow(arrowObj);
                }
View Full Code Here

    public void updatePotatoes(HierarchicalGraph graph) {

        ModelClass potatoClass = engine.getModelClasses()[AbstractEngine.CLASS_POTATO];
        if (potatoClass.isEnabled()) {
            Modeler potInit = engine.getModelClasses()[AbstractEngine.CLASS_POTATO].getCurrentModeler();

            List<ModelImpl> hulls = new ArrayList<ModelImpl>();
            Node[] nodes = graph.getNodes().toArray();
            for (Node n : nodes) {
                Node parent = graph.getParent(n);
                if (parent != null) {
                    Group group = (Group) parent;
                    Model hullModel = group.getGroupData().getHullModel();
                    if (hullModel != null && hullModel.isCacheMatching(cacheMarker)) {
                        ConvexHull hull = (ConvexHull) hullModel.getObj();
                        hull.addNode(n);
                        hull.setModel(hullModel);
                    } else if (hullModel != null) {
                        //Its not the first time the hull exist
                        ConvexHullModel model = (ConvexHullModel) hullModel;
                        model.setScale(1f);
                        hullModel.setCacheMarker(cacheMarker);
                        hulls.add((ModelImpl) hullModel);
                    } else {
                        ConvexHull ch = new ConvexHull();
                        ch.setMetaNode(parent);
                        ch.addNode(n);
                        ModelImpl obj = potInit.initModel(ch);
                        group.getGroupData().setHullModel(obj);
                        obj.setCacheMarker(cacheMarker);
                        hulls.add(obj);
                    }
                }
View Full Code Here

TOP

Related Classes of org.gephi.visualization.api.initializer.Modeler

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.