コード例 #1
0
        /**
         * Causes this SurfaceObject to draw a representation of itself suitable for use during picking.
         *
         * @param dc the current DrawContext.
         */
        protected void drawPickRepresentation(DrawContext dc)
        {
            // The pick representation is stored as a list of surface tiles. If the list is empty, then this surface object
            // was not picked. This method might be called when the list is null or empty because of an upstream
            // exception that prevented creation of the list.
            if (this.pickTileBuilder == null || this.pickTileBuilder.getTileCount(dc) == 0)
            {
                return;
            }

            // Draw the pickable representation of this surface object created during preRendering.
            GL2             gl   = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
            OGLStackHandler ogsh = new OGLStackHandler();

            ogsh.pushAttrib(gl, GL2.GL_POLYGON_BIT); // For cull face enable, cull face, polygon mode.
            try
            {
                gl.glEnable(GL.GL_CULL_FACE);
                gl.glCullFace(GL.GL_BACK);
                gl.glPolygonMode(GL2.GL_FRONT, GL2.GL_FILL);

                dc.getGeographicSurfaceTileRenderer().renderTiles(dc, this.pickTileBuilder.getTiles(dc));
            }
            finally
            {
                ogsh.pop(gl);
                // Clear the list of pick tiles to avoid retaining references to them in case we're never picked again.
                this.pickTileBuilder.clearTiles(dc);
            }
        }