Worldwind public release 0.2.1
[worldwind-tracker.git] / gov / nasa / worldwind / DrawContext.java
blobfae9d69f6f37c2ccd1159c5b70e2182031654f82
1 /*
2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
5 All Rights Reserved.
6 */
7 package gov.nasa.worldwind;
9 import com.sun.opengl.util.texture.*;
10 import gov.nasa.worldwind.geom.*;
12 /**
13 * @author Tom Gaskins
14 * @version $Id: DrawContext.java 1994 2007-06-11 16:33:33Z dcollins $
16 public interface DrawContext extends WWObject
18 /**
19 * Assigns this <code>DrawContext</code> a new </code>javax.media.opengl.GLContext</code>. May throw a
20 * <code>NullPointerException</code> if <code>glContext</code> is null.
22 * @param glContext the new <code>javax.media.opengl.GLContext</code>
23 * @throws NullPointerException if glContext is null
24 * @since 1.5
26 void setGLContext(javax.media.opengl.GLContext glContext);
28 /**
29 * Retrieves this <code>DrawContext</code>s </code>javax.media.opengl.GLContext</code>. If this method returns null,
30 * then there are potentially no active <code>GLContext</code>s and rendering should be aborted.
32 * @return this <code>DrawContext</code>s </code>javax.media.opengl.GLContext</code>.
33 * @since 1.5
35 javax.media.opengl.GLContext getGLContext();
37 /**
38 * Retrieves the current <code>javax.media.opengl.GL</code>. A <code>GL</code> or <code>GLU</code> is required for
39 * all graphical rendering in World Wind Raptor.
41 * @return the current <code>GL</code> if available, null otherwise
42 * @since 1.5
44 javax.media.opengl.GL getGL();
46 /**
47 * Retrieves the current <code>javax.media.opengl.glu.GLU</code>. A <code>GLU</code> or <code>GL</code> is required
48 * for all graphical rendering in World Wind Raptor.
50 * @return the current <code>GLU</code> if available, null otherwise
51 * @since 1.5
53 javax.media.opengl.glu.GLU getGLU();
55 /**
56 * Retrieves the current<code>javax.media.opengl.GLDrawable</code>. A <code>GLDrawable</code> can be used to create
57 * a <code>GLContext</code>, which can then be used for rendering.
59 * @return the current <code>GLDrawable</code>, null if none available
60 * @since 1.5
62 javax.media.opengl.GLDrawable getGLDrawable();
64 /**
65 * Retrieves the drawable width of this <code>DrawContext</code>.
67 * @return the drawable width of this <code>DrawCOntext</code>
68 * @since 1.5
70 int getDrawableWidth();
72 /**
73 * Retrieves the drawable height of this <code>DrawContext</code>.
75 * @return the drawable height of this <code>DrawCOntext</code>
76 * @since 1.5
78 int getDrawableHeight();
80 /**
81 * Initializes this <code>DrawContext</code>. This method should be called at the beginning of each frame to prepare
82 * the <code>DrawContext</code> for the coming render pass.
84 * @param glContext the <code>javax.media.opengl.GLContext</code> to use for this render pass
85 * @since 1.5
87 void initialize(javax.media.opengl.GLContext glContext);
89 /**
90 * Assigns a new <code>View</code>. Some layers cannot function properly with a null <code>View</code>. It is
91 * recommended that the <code>View</code> is never set to null during a normal render pass.
93 * @param view the enw <code>View</code>
94 * @since 1.5
96 void setView(View view);
98 /**
99 * Retrieves the current <code>View</code>, which may be null.
101 * @return the current <code>View</code>, which may be null
102 * @since 1.5
104 View getView();
107 * Assign a new <code>Model</code>. Some layers cannot function properly with a null <code>Model</code>. It is
108 * recommended that the <code>Model</code> is never set to null during a normal render pass.
110 * @param model the new <code>Model</code>
111 * @since 1.5
113 void setModel(Model model);
116 * Retrieves the current <code>Model</code>, which may be null.
118 * @return the current <code>Model</code>, which may be null
119 * @since 1.5
121 Model getModel();
124 * Retrieves the current <code>Globe</code>, which may be null.
126 * @return the current <code>Globe</code>, which may be null
127 * @since 1.5
129 Globe getGlobe();
132 * Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.
134 * @return a <code>LayerList</code> containing all the current layers
135 * @since 1.5
137 LayerList getLayers();
140 * Retrieves a <code>Sector</code> which is at least as large as the current visible sector. The value returned is
141 * the value passed to <code>SetVisibleSector</code>. This method may return null.
143 * @return a <code>Sector</code> at least the size of the curernt visible sector, null if unavailable
144 * @since 1.5
146 gov.nasa.worldwind.geom.Sector getVisibleSector();
149 * Sets the visible <code>Sector</code>. The new visible sector must completely encompass the Sector which is
150 * visible on the display.
152 * @param s the new visible <code>Sector</code>
153 * @since 1.5
155 void setVisibleSector(gov.nasa.worldwind.geom.Sector s);
158 * Sets the vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A
159 * vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying
160 * <code>Globe</code>. A vertical exaggeration of 3 will create mountains and valleys which are three times as
161 * high/deep as they really are.
163 * @param verticalExaggeration the new vertical exaggeration.
164 * @since 1.5
166 void setVerticalExaggeration(double verticalExaggeration);
169 * Retrieves the current vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied
170 * elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying
171 * <code>Globe</code>. A vertical exaggeration of 3 will create mountains and valleys which are three times as
172 * high/deep as they really are.
174 * @return the current vertical exaggeration
175 * @since 1.5
177 double getVerticalExaggeration();
179 // not used (12th January 2007)
180 final static String HIGH_PRIORITY = "gov.nasa.worldwind.DrawContext.HighPriority";
181 final static String LOW_PRIORITY = "gov.nasa.worldwind.DrawContext.LowPriority";
184 * Retrieves a list of all the sectors rendered so far this frame.
186 * @return a <code>SectorGeometryList</code> containing every <code>SectorGeometry</code> rendered so far this
187 * render pass.
188 * @since 1.5
190 SectorGeometryList getSurfaceGeometry();
193 // /**
194 // * Sets the average render time per frame in milliseconds.
195 // *
196 // * @param timeMillis the new average time in milliseconds
197 // * @since 1.5
198 // */
199 // void setAverageRenderTimeMillis(double timeMillis);
201 // /**
202 // * Retrieves the current average render time for a frame. The average render time can be used to calculate the
203 // * framerate.
204 // *
205 // * @return the current average render time for a frame
206 // * @since 1.5
207 // */
208 // double getAverageRenderTimeMillis();
211 * Returns the list of objects picked during the most recent pick traversal.
213 * @return the list of picked objects
215 gov.nasa.worldwind.PickedObjectList getPickedObjects();
218 * Adds a collection of picked objects to the current picked-object list
220 * @param pickedObjects the objects to add
222 void addPickedObjects(PickedObjectList pickedObjects);
225 * Adds a single insatnce of the picked object to the current picked-object list
227 * @param pickedObject the object to add
229 void addPickedObject(PickedObject pickedObject);
232 * Returns a unique color to serve as a pick identifier during picking.
234 * @return a unique pick color
236 java.awt.Color getUniquePickColor();
238 java.awt.Color getClearColor();
241 * Enables color picking mode
243 void enablePickingMode();
246 * Returns true if the Picking mode is active, otherwise return false
248 * @return true for Picking mode, otherwise false
250 boolean isPickingMode();
253 * Disables color picking mode
255 void disablePickingMode();
257 void addOrderedRenderable(OrderedRenderable orderedRenderable);
259 java.util.Queue<OrderedRenderable> getOrderedRenderables();
261 void drawUnitQuad();
263 void drawUnitQuad(TextureCoords texCoords);
265 int getNumTextureUnits();
267 void setNumTextureUnits(int numTextureUnits);
269 void setSurfaceGeometry(SectorGeometryList surfaceGeometry);
271 Vec4 getPointOnGlobe(Angle latitude, Angle longitude);
273 SurfaceTileRenderer getSurfaceTileRenderer();