//**************************************************************//
        //********************  Diagnostic Support  ********************//
        //**************************************************************//

        /**
         * Causes this SurfaceObject to render its bounding sectors to the specified region in geographic coordinates. The
         * specified viewport denotes the geographic region and its corresponding screen viewport.
         * <p/>
         * The bounding sectors are rendered as a 1 pixel wide green outline.
         *
         * @param dc  the current DrawContext.
         * @param sdc the context containing a geographic region and screen viewport corresponding to a surface tile.
         *
         * @see #getSectors(DrawContext)
         */
        protected void drawBoundingSectors(DrawContext dc, SurfaceTileDrawContext sdc)
        {
            List <Sector> sectors = this.getSectors(dc);

            if (sectors == null)
            {
                return;
            }

            GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

            int attributeMask =
                GL2.GL_COLOR_BUFFER_BIT // For alpha test enable, blend enable, alpha func, blend func.
                | GL2.GL_CURRENT_BIT    // For current color.
                | GL2.GL_LINE_BIT;      // For line smooth, line width.

            OGLStackHandler ogsh = new OGLStackHandler();

            ogsh.pushAttrib(gl, attributeMask);
            ogsh.pushModelview(gl);
            try
            {
                gl.glEnable(GL.GL_BLEND);
                OGLUtil.applyBlending(gl, false);

                gl.glDisable(GL.GL_LINE_SMOOTH);
                gl.glLineWidth(1f);

                gl.glColor4f(1f, 1f, 1f, 0.5f);

                // Set the model-view matrix to transform from geographic coordinates to viewport coordinates.
                Matrix matrix = sdc.getModelviewMatrix();
                gl.glMultMatrixd(matrix.toArray(new double[16], 0, false), 0);

                foreach (Sector s in sectors)
                {
                    LatLon[] corners = s.getCorners();
                    gl.glBegin(GL2.GL_LINE_LOOP);
                    gl.glVertex2f((float)corners[0].getLongitude().degrees, (float)corners[0].getLatitude().degrees);
                    gl.glVertex2f((float)corners[1].getLongitude().degrees, (float)corners[1].getLatitude().degrees);
                    gl.glVertex2f((float)corners[2].getLongitude().degrees, (float)corners[2].getLatitude().degrees);
                    gl.glVertex2f((float)corners[3].getLongitude().degrees, (float)corners[3].getLatitude().degrees);
                    gl.glEnd();
                }
            }
            finally
            {
                ogsh.pop(gl);
            }
        }
        /**
         * Causes the SurfaceObject to render itself. SurfaceObjects are drawn in geographic coordinates into offscreen
         * surface tiles. This attempts to get a {@link SharpEarth.util.SurfaceTileDrawContext} from the
         * DrawContext's AVList by querying the key {@link SharpEarth.avlist.AVKey#SURFACE_TILE_DRAW_CONTEXT}. If
         * the DrawContext has a SurfaceTileDrawContext attached under that key, this calls {@link
         * #drawGeographic(DrawContext, SharpEarth.util.SurfaceTileDrawContext)} with the SurfaceTileDrawContext.
         * Otherwise this logs a warning and returns.
         *
         * @param dc the current DrawContext.
         */
        protected void drawOrderedRenderable(DrawContext dc)
        {
            // This method is invoked by the SceneController during ordered rendering mode while building a composite
            // representation of the SurfaceObjects during ordered preRendering. Since we use this method to draw a
            // composite representation during preRendering, we prevent this method from being invoked during ordered
            // rendering. Note that this method is not invoked during ordered picking; pickOrderedRenderable is called
            // instead.

            SurfaceTileDrawContext sdc = (SurfaceTileDrawContext)dc.getValue(AVKey.SURFACE_TILE_DRAW_CONTEXT);

            if (sdc == null)
            {
                Logging.logger().warning(Logging.getMessage("nullValue.SurfaceTileDrawContextIsNull"));
                return;
            }

            this.drawGeographic(dc, sdc);

            // Draw the diagnostic bounding sectors during ordered rendering mode.
            if (this.isDrawBoundingSectors() && !dc.isPickingMode())
            {
                this.drawBoundingSectors(dc, sdc);
            }
        }
 /**
  * Causes the SurfaceObject to render itself to the specified region in geographic coordinates. The specified
  * viewport denotes the geographic region and its corresponding screen viewport.
  *
  * @param dc  the current draw context.
  * @param sdc the context containing a geographic region and screen viewport corresponding to a surface tile.
  */
 protected abstract void drawGeographic(DrawContext dc, SurfaceTileDrawContext sdc);