Package org.gephi.visualization.apiimpl

Examples of org.gephi.visualization.apiimpl.ModelImpl


    }

    public void cleanDeletedObjects(int classID) {
        for (Octant o : leaves) {
            for (cleanObjectsIterator.setNode(o.getTree(classID)); cleanObjectsIterator.hasNext();) {
                ModelImpl obj = cleanObjectsIterator.next();
                if (!obj.isCacheMatching(cacheMarker)) {
                    removeObject(classID, obj);
                    obj.resetOctant();
                    if (vizController.getVizConfig().isCleanDeletedModels()) {
                        obj.cleanModel();
                    }
                }
            }
        }
    }
View Full Code Here


        for (Octant o : leaves) {
            ParamAVLTree<ModelImpl> tree = o.getTree(classID);

            //Reset octants in objects
            for (cleanObjectsIterator.setNode(tree); cleanObjectsIterator.hasNext();) {
                ModelImpl obj = cleanObjectsIterator.next();
                obj.resetOctant();
                obj.cleanModel();
                obj.destroy();
            }

            //Empty the tree
            o.clear(classID);
        }
View Full Code Here

    public void updateObjectsPosition(int classID) {
        for (Octant o : leaves) {
            if (o.isRequiringUpdatePosition()) {
                for (updatePositionIterator.setNode(o.getTree(classID)); updatePositionIterator.hasNext();) {
                    ModelImpl obj = updatePositionIterator.next();
                    if (!obj.isInOctreeLeaf(o)) {
                        o.removeObject(classID, obj);
                        obj.resetOctant();
                        addObject(classID, obj);
                        //TODO break the loop somehow
                    }
                }
            }
View Full Code Here

            }
            return true;
        }

        public ModelImpl next() {
            ModelImpl obj = octantIterator.next();
            return obj;
        }
View Full Code Here

        modelers = new ArrayList<CompatibilityModeler>();
    }

    public void lod(Iterator<ModelImpl> iterator) {
        for (; iterator.hasNext();) {
            ModelImpl obj = iterator.next();
            currentModeler.chooseModel(obj);
        }
    }
View Full Code Here

        ModelImpl[] nodes = obj.getNodes();
        if (nodes.length != octants.length) {
            return false;
        }
        for (int i = 0; i < nodes.length; i++) {
            ModelImpl model = nodes[i];
            if (model.getOctants()[0] != octants[i]) {
                return false;
            }
        }
        return true;
    }
View Full Code Here


        gl.glBegin(GL.GL_POLYGON);
        ModelImpl[] nodes = obj.getNodes();
        for (int i = 0; i < nodes.length; i++) {
            ModelImpl node = nodes[i];
            gl.glVertex3f(node.getObj().x() - centroidX, node.getObj().y() - centroidY, node.getObj().z());
        }
        gl.glEnd();

        //Line
        gl.glColor4f(r, g, b, 0.8f);
        gl.glBegin(GL.GL_LINE_LOOP);
        for (int i = 0; i < nodes.length; i++) {
            ModelImpl node = nodes[i];
            gl.glVertex3f(node.getObj().x() - centroidX, node.getObj().y() - centroidY, node.getObj().z());
        }
        gl.glEnd();

        if (scale < 1f && scale > 0f) {
            scale += scaleQuantum;
View Full Code Here

        }
        if (!selected && vizModel.isHideNonSelectedEdges()) {
            return;
        }
        if (selected && vizModel.isAutoSelectNeighbor()) {
            ModelImpl m1 = (ModelImpl) obj.getSource().getModel();
            ModelImpl m2 = (ModelImpl) obj.getTarget().getModel();
            m1.mark = true;
            m2.mark = true;
        }

        //Edge weight
        GraphLimits limits = vizModel.getLimits();
        float w;
        if (obj.getEdge() instanceof MetaEdge) {
            float weightRatio;
            if (limits.getMinMetaWeight() == limits.getMaxMetaWeight()) {
                weightRatio = WEIGHT_MINIMUM / limits.getMinMetaWeight();
            } else {
                weightRatio = Math.abs((WEIGHT_MAXIMUM - WEIGHT_MINIMUM) / (limits.getMaxMetaWeight() - limits.getMinMetaWeight()));
            }
            float edgeScale = vizModel.getEdgeScale() * vizModel.getMetaEdgeScale();
            w = weight;
            w = ((w - limits.getMinMetaWeight()) * weightRatio + WEIGHT_MINIMUM) * edgeScale;
        } else {
            float weightRatio;
            if (limits.getMinWeight() == limits.getMaxWeight()) {
                weightRatio = WEIGHT_MINIMUM / limits.getMinWeight();
            } else {
                weightRatio = Math.abs((WEIGHT_MAXIMUM - WEIGHT_MINIMUM) / (limits.getMaxWeight() - limits.getMinWeight()));
            }
            float edgeScale = vizModel.getEdgeScale();
            w = weight;
            w = ((w - limits.getMinWeight()) * weightRatio + WEIGHT_MINIMUM) * edgeScale;
        }
        //

        float x1 = obj.getSource().x();
        float x2 = obj.getTarget().x();
        float y1 = obj.getSource().y();
        float y2 = obj.getTarget().y();
        float t1 = w;
        float t2 = w;

        float sideVectorX = y1 - y2;
        float sideVectorY = x2 - x1;
        float norm = (float) Math.sqrt(sideVectorX * sideVectorX + sideVectorY * sideVectorY);
        sideVectorX /= norm;
        sideVectorY /= norm;

        float x1Thick = sideVectorX / 2f * t1;
        float x2Thick = sideVectorX / 2f * t2;
        float y1Thick = sideVectorY / 2f * t1;
        float y2Thick = sideVectorY / 2f * t2;

        if (!selected) {
            float r;
            float g;
            float b;
            float a;
            r = obj.r();
            if (r == -1f) {
                if (vizModel.isEdgeHasUniColor()) {
                    float[] uni = vizModel.getEdgeUniColor();
                    r = uni[0];
                    g = uni[1];
                    b = uni[2];
                    a = uni[3];
                } else {
                    NodeData source = obj.getSource();
                    r = 0.498f * source.r();
                    g = 0.498f * source.g();
                    b = 0.498f * source.b();
                    a = obj.alpha();
                }
            } else {
                g = 0.498f * obj.g();
                b = 0.498f * obj.b();
                r *= 0.498f;
                a = obj.alpha();
            }
            if (vizModel.getConfig().isLightenNonSelected()) {
                float lightColorFactor = vizModel.getConfig().getLightenNonSelectedFactor();
                a = a - (a - 0.01f) * lightColorFactor;
                gl.glColor4f(r, g, b, a);
            } else {
                gl.glColor4f(r, g, b, a);
            }
        } else {
            float r = 0f;
            float g = 0f;
            float b = 0f;
            if (vizModel.isEdgeSelectionColor()) {
                ModelImpl m1 = (ModelImpl) obj.getSource().getModel();
                ModelImpl m2 = (ModelImpl) obj.getTarget().getModel();
                if (m1.isSelected() && m2.isSelected()) {
                    float[] both = vizModel.getEdgeBothSelectionColor();
                    r = both[0];
                    g = both[1];
                    b = both[2];
                } else if (m1.isSelected()) {
                    float[] out = vizModel.getEdgeOutSelectionColor();
                    r = out[0];
                    g = out[1];
                    b = out[2];
                } else if (m2.isSelected()) {
                    float[] in = vizModel.getEdgeInSelectionColor();
                    r = in[0];
                    g = in[1];
                    b = in[2];
                }
View Full Code Here

    }

    public void unload() {

         for (Iterator<ModelImpl> itr = octree.getObjectIterator(AbstractEngine.CLASS_NODE); itr.hasNext();) {
                ModelImpl obj = itr.next();
                ColorLayer.restituteColor(obj);
         }
    }
View Full Code Here

                    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);
                        obj.display(gl, glu, vizModel);
                        hitName++;

                    }

                    //Restoring the original projection matrix
                    gl.glMatrixMode(GL.GL_PROJECTION);
                    gl.glPopMatrix();
                    gl.glMatrixMode(GL.GL_MODELVIEW);
                    gl.glFlush();

                    //Returning to normal rendering mode
                    int nbRecords = gl.glRenderMode(GL.GL_RENDER);

                    //Get the hits and put the node under selection in the selectionArray
                    for (int j = 0; j < nbRecords; j++) {
                        int hit = hitsBuffer.get(j * 4 + 3) - 1;     //-1 Because of the glPushName(0)
                        ModelImpl obj = array[hit];
                        obj.setAutoSelect(true);
                    }
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.gephi.visualization.apiimpl.ModelImpl

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.