CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

File Line
org/deegree/rendering/r3d/multiresolution/SelectiveRefinement.java 98
org/deegree/rendering/r3d/multiresolution/SpatialSelection.java 105
    public List<MeshFragment> determineLOD() {

        List<MeshFragment> fragments = new ArrayList<MeshFragment>();

        adaptTopDown();

        for ( Arc arc : lod ) {
            for ( int fragmentId = arc.lowestPatch; fragmentId <= arc.highestPatch; fragmentId++ ) {
                MeshFragment fragment = mt.fragments[fragmentId];
                fragments.add( fragment );
            }
        }

        return fragments;
    }

    private void adaptTopDown() {

        long begin = System.currentTimeMillis();

        initializeCut();

        // initialize toDo with all arc ids in the current lod
        List<Arc> toDo = new ArrayList<Arc>( lod );

        while ( !toDo.isEmpty() ) {
            Arc region = toDo.remove( toDo.size() - 1 );
            Node modification = mt.nodes[region.destinationNode];

            // do not move the cut below the drain
            if ( modification.lowestOutgoingArc == -1 ) {
                continue;
            }

            // only process arc if it points to a node below the cut
            if ( !applied[modification.id] ) {
                if ( crit.needsRefinement( region ) ) {
                    int incomingArc = modification.lowestIncomingArc;
                    while ( incomingArc != -1 ) {
                        if ( applied[mt.arcs[incomingArc].sourceNode] ) {
                            lod.remove( mt.arcs[incomingArc] );
                        } else {
                            forceRefinement( mt.arcs[incomingArc], toDo );
                        }
                        incomingArc = mt.arcs[incomingArc].nextArcWithSameDestination;
                    }

                    if ( modification.lowestOutgoingArc > 0 ) {
                        for ( int arcId = modification.lowestOutgoingArc; arcId <= modification.highestOutgoingArc; arcId++ ) {
                            Arc arc = mt.arcs[arcId];
File Line
org/deegree/rendering/r3d/model/WorldObject.java 121
org/deegree/rendering/r3d/model/WorldObject.java 262
        if ( bbox == null ) {
            throw new NullPointerException( "Bbox may not be null" );
        }
        this.bbox = bbox;
        Point p = bbox.getCentroid();
        double[] min = bbox.getMin().getAsArray();
        double[] max = bbox.getMax().getAsArray();
        position = new float[] { (float) p.get0(), (float) p.get1(),
                                (float) ( ( p.getCoordinateDimension() == 3 ) ? p.get2() : 0 ) };
        if ( bbox.getMin().getCoordinateDimension() == 2 ) {
            min = new double[] { min[0], min[1], 0 };
        }
        if ( bbox.getMax().getCoordinateDimension() == 2 ) {
            max = new double[] { max[0], max[1], 0 };
        }
File Line
org/deegree/rendering/r3d/opengl/display/OpenGLEventHandler.java 301
org/deegree/rendering/r3d/opengl/rendering/model/prototype/BOXGeometry.java 125
        gl.glMaterialfv( GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, color, 0 );
        gl.glBegin( GL.GL_QUADS );
        // Top face
        gl.glNormal3f( 0, 1, 0 );
        gl.glVertex3fv( cubeData[3], 0 );
        gl.glVertex3fv( cubeData[2], 0 );
        gl.glVertex3fv( cubeData[6], 0 );
        gl.glVertex3fv( cubeData[7], 0 );
        // Bottom face
        gl.glNormal3f( 0, -1, 0 );
        gl.glVertex3fv( cubeData[4], 0 );
        gl.glVertex3fv( cubeData[5], 0 );
        gl.glVertex3fv( cubeData[1], 0 );
        gl.glVertex3fv( cubeData[0], 0 );
        gl.glEnd();
        gl.glEnable( GL.GL_BLEND );
File Line
org/deegree/rendering/r3d/opengl/display/OpenGLEventHandler.java 283
org/deegree/rendering/r3d/opengl/rendering/model/prototype/BOXGeometry.java 108
        gl.glMaterialfv( GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, color, 0 );

        gl.glBegin( GL.GL_QUADS );
        // Left face
        gl.glNormal3f( -1, 0, 0 );
        gl.glVertex3fv( cubeData[4], 0 );
        gl.glVertex3fv( cubeData[0], 0 );
        gl.glVertex3fv( cubeData[3], 0 );
        gl.glVertex3fv( cubeData[7], 0 );
        // Right face
        gl.glNormal3f( 1, 0, 0 );
        gl.glVertex3fv( cubeData[1], 0 );
        gl.glVertex3fv( cubeData[5], 0 );
        gl.glVertex3fv( cubeData[6], 0 );
        gl.glVertex3fv( cubeData[2], 0 );
        gl.glEnd();
File Line
org/deegree/rendering/r3d/opengl/rendering/dem/texturing/TextureTile.java 408
org/deegree/rendering/r3d/opengl/rendering/dem/texturing/TextureTileRequest.java 193
    }

    /**
     * Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even
     * distribution and is relatively fast. It is created from field <b>f</b> as follows:
     * <ul>
     * <li>boolean -- code = (f ? 0 : 1)</li>
     * <li>byte, char, short, int -- code = (int)f</li>
     * <li>long -- code = (int)(f ^ (f &gt;&gt;&gt;32))</li>
     * <li>float -- code = Float.floatToIntBits(f);</li>
     * <li>double -- long l = Double.doubleToLongBits(f); code = (int)(l ^ (l &gt;&gt;&gt; 32))</li>
     * <li>all Objects, (where equals(&nbsp;) calls equals(&nbsp;) for this field) -- code = f.hashCode(&nbsp;)</li>
     * <li>Array -- Apply above rules to each element</li>
     * </ul>
     * <p>
     * Combining the hash code(s) computed above: result = 37 * result + code;
     * </p>
     * 
     * @return (int) ( result >>> 32 ) ^ (int) result;
     * 
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        // the 2nd millionth prime, :-)
        long code = 32452843;
        long tmp = doubleToLongBits( this.minX );
        code = code * 37 + (int) ( tmp ^ ( tmp >>> 32 ) );
        tmp = doubleToLongBits( this.minY );
        code = code * 37 + (int) ( tmp ^ ( tmp >>> 32 ) );
        tmp = Double.doubleToLongBits( this.maxX );
        code = code * 37 + (int) ( tmp ^ ( tmp >>> 32 ) );
        tmp = Double.doubleToLongBits( this.maxY );
        code = code * 37 + (int) ( tmp ^ ( tmp >>> 32 ) );
        tmp = Double.doubleToLongBits( this.metersPerPixel );
File Line
org/deegree/rendering/r3d/multiresolution/SelectiveRefinement.java 173
org/deegree/rendering/r3d/multiresolution/SpatialSelection.java 184
        }
        applied[0] = true;
    }

    private void forceRefinement( Arc region, List<Arc> toDo ) {

        Node modification = mt.nodes[region.sourceNode];

        int incomingArc = modification.lowestIncomingArc;
        while ( incomingArc != -1 ) {
            if ( applied[mt.arcs[incomingArc].sourceNode] ) {
                lod.remove( mt.arcs[incomingArc] );
            } else {
                forceRefinement( mt.arcs[incomingArc], toDo );
            }
            incomingArc = mt.arcs[incomingArc].nextArcWithSameDestination;
        }

        for ( int arcId = modification.lowestOutgoingArc; arcId <= modification.highestOutgoingArc; arcId++ ) {
            if ( arcId != region.id ) {
                Arc arc2 = mt.arcs[arcId];
File Line
org/deegree/rendering/r3d/opengl/display/LODAnalyzer.java 207
org/deegree/rendering/r3d/opengl/display/TextureTileAnalyzer.java 177
            gl.glColor3f( 1.0f, 0.0f, 0.0f );
        }
    }

    @Override
    public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) {
        LOG.trace( "reshape( GLAutoDrawable, " + x + ", " + y + ", " + width + ", " + height + " ) called" );

        GL gl = drawable.getGL();
        gl.glViewport( x, y, width, height );

        gl.glMatrixMode( GL.GL_PROJECTION );
        gl.glLoadIdentity();
        glu.gluOrtho2D( 0, width, 0, height );

        gl.glMatrixMode( GL.GL_MODELVIEW );
        gl.glLoadIdentity();
File Line
org/deegree/rendering/r3d/ViewFrustum.java 668
org/deegree/rendering/r3d/ViewFrustum.java 682
        final Point3d getPositiveVertex( double[][] box ) {
            Point3d p = new Point3d( box[0][0], box[0][1], box[0][2] );
            if ( n.x >= 0.0 ) {
                p.x = box[1][0];
            }
            if ( n.y >= 0.0 ) {
                p.y = box[1][1];
            }
            if ( n.z >= 0.0 ) {
                p.z = box[1][2];
            }
            return p;
        }

        final Point3d getPositiveVertex( float[][] box ) {
File Line
org/deegree/rendering/r3d/ViewFrustum.java 709
org/deegree/rendering/r3d/ViewFrustum.java 723
        final Point3d getNegativeVertex( double[][] box ) {
            Point3d p = new Point3d( box[1][0], box[1][1], box[1][2] );
            if ( n.x >= 0.0 ) {
                p.x = box[0][0];
            }
            if ( n.y >= 0.0 ) {
                p.y = box[0][1];
            }
            if ( n.z >= 0.0 ) {
                p.z = box[0][2];
            }
            return p;
        }

        final Point3d getNegativeVertex( float[][] box ) {