Package org.gephi.visualization.api.objects

Examples of org.gephi.visualization.api.objects.CompatibilityModelClass


    public CompatibilityModelClass[] createModelClassesCompatibility(AbstractEngine engine) {
        compatibilityModelClasses = new CompatibilityModelClass[4];
        int classIds = 0;

        //NODE
        compatibilityModelClasses[0] = new CompatibilityModelClass("NODE", true, true, true, false, false);
        compatibilityModelClasses[0].setClassId(classIds++);
        CompatibilityNodeSphereModeler modeler3d = new CompatibilityNodeSphereModeler(engine);
        CompatibilityNodeDiskModeler modeler2d = new CompatibilityNodeDiskModeler(engine);
        CompatibilityNodeRectangleModeler modelerRect = new CompatibilityNodeRectangleModeler(engine);
        compatibilityModelClasses[0].addModeler(modeler3d);
        compatibilityModelClasses[0].addModeler(modeler2d);
        compatibilityModelClasses[0].addModeler(modelerRect);
        if (VizController.getInstance().getVizModel().isUse3d()) {
            compatibilityModelClasses[0].setCurrentModeler(modeler3d);
        } else {
            compatibilityModelClasses[0].setCurrentModeler(modeler2d);
        }

        //EDGE
        compatibilityModelClasses[1] = new CompatibilityModelClass("EDGE", false, true, false, false, false);
        compatibilityModelClasses[1].setClassId(classIds++);
        CompatibilityEdgeModeler edgeModeler = new CompatibilityEdgeModeler();
        compatibilityModelClasses[1].addModeler(edgeModeler);
        compatibilityModelClasses[1].setCurrentModeler(edgeModeler);

        //ARROW
        compatibilityModelClasses[2] = new CompatibilityModelClass("ARROW", true, false, false, false, false);
        compatibilityModelClasses[2].setClassId(classIds++);
        CompatibilityArrowModeler arrowModeler = new CompatibilityArrowModeler(engine);
        compatibilityModelClasses[2].addModeler(arrowModeler);
        compatibilityModelClasses[2].setCurrentModeler(arrowModeler);

        //POTATO
        compatibilityModelClasses[3] = new CompatibilityModelClass("POTATO", false, true, true, true, true);
        compatibilityModelClasses[3].setClassId(classIds++);
        CompatibilityHullModeler hullModeler = new CompatibilityHullModeler();
        compatibilityModelClasses[3].addModeler(hullModeler);
        compatibilityModelClasses[3].setCurrentModeler(hullModeler);
        //modelClasses[3] = new CompatibilityModelClass("POTATO", false, true, true);
View Full Code Here


                mp[1] += cent[1];
            }
            octree.updateSelectedOctant(gl, glu, mp, currentSelectionArea.getSelectionAreaRectancle());

            for (int i = 0; i < selectableClasses.length; i++) {
                CompatibilityModelClass modelClass = selectableClasses[i];

                if (modelClass.isEnabled() && modelClass.isGlSelection()) {
                    int objectCount = octree.countSelectedObjects(modelClass.getClassId());

                    float[] mousePosition = Arrays.copyOf(graphIO.getMousePosition(), 2);
                    float[] pickRectangle = currentSelectionArea.getSelectionAreaRectancle();
                    float[] center = currentSelectionArea.getSelectionAreaCenter();
                    if (center != null) {
                        mousePosition[0] += center[0];
                        mousePosition[1] += center[1];
                    }
                    int capacity = 1 * 4 * objectCount;      //Each object take in maximium : 4 * name stack depth
                    IntBuffer hitsBuffer = BufferUtil.newIntBuffer(capacity);

                    gl.glSelectBuffer(hitsBuffer.capacity(), hitsBuffer);
                    gl.glRenderMode(GL.GL_SELECT);

                    gl.glInitNames();
                    gl.glPushName(0);

                    gl.glMatrixMode(GL.GL_PROJECTION);
                    gl.glPushMatrix();
                    gl.glLoadIdentity();

                    glu.gluPickMatrix(mousePosition[0], mousePosition[1], pickRectangle[0], pickRectangle[1], graphDrawable.getViewport());
                    gl.glMultMatrixd(graphDrawable.getProjectionMatrix());

                    gl.glMatrixMode(GL.GL_MODELVIEW);

                    int hitName = 1;
                    ModelImpl[] array = new ModelImpl[objectCount];
                    for (Iterator<ModelImpl> itr = octree.getSelectedObjectIterator(modelClass.getClassId()); itr.hasNext();) {
                        ModelImpl obj = itr.next();
                        obj.setAutoSelect(false);

                        array[hitName - 1] = obj;
                        gl.glLoadName(hitName);
View Full Code Here

            setViewportPosition(obj);
        }

        markTime++;

        CompatibilityModelClass edgeClass = modelClasses[AbstractEngine.CLASS_EDGE];
        CompatibilityModelClass nodeClass = modelClasses[AbstractEngine.CLASS_NODE];
        CompatibilityModelClass arrowClass = modelClasses[AbstractEngine.CLASS_ARROW];
        CompatibilityModelClass potatoClass = modelClasses[AbstractEngine.CLASS_POTATO];

        VizModel vizModel = VizController.getInstance().getVizModel();

        //Potato
        if (potatoClass.isEnabled()) {
            potatoClass.beforeDisplay(gl, glu);
            for (Iterator<ModelImpl> itr = octree.getObjectIterator(AbstractEngine.CLASS_POTATO); itr.hasNext();) {
                ModelImpl obj = itr.next();

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

            }
            potatoClass.afterDisplay(gl, glu);
        }

        //Edges
        if (edgeClass.isEnabled()) {
            edgeClass.beforeDisplay(gl, glu);
View Full Code Here

TOP

Related Classes of org.gephi.visualization.api.objects.CompatibilityModelClass

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.