Updated to worldwind release 20070817
[worldwind-tracker.git] / gov / nasa / worldwind / render / DrawContext.java
blobba792ca0f602ea2721d9751289c3da438c507d60
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.render;
9 import com.sun.opengl.util.texture.TextureCoords;
10 import gov.nasa.worldwind.*;
11 import gov.nasa.worldwind.cache.TextureCache;
12 import gov.nasa.worldwind.geom.*;
13 import gov.nasa.worldwind.globes.*;
14 import gov.nasa.worldwind.layers.LayerList;
15 import gov.nasa.worldwind.pick.*;
16 import gov.nasa.worldwind.util.PerformanceStatistic;
17 import gov.nasa.worldwind.view.View;
19 import javax.media.opengl.*;
20 import javax.media.opengl.glu.GLU;
21 import java.awt.*;
22 import java.util.*;
24 /**
25 * @author Tom Gaskins
26 * @version $Id: DrawContext.java 2533 2007-08-13 05:59:08Z tgaskins $
28 public interface DrawContext extends WWObject
30 /**
31 * Assigns this <code>DrawContext</code> a new </code>javax.media.opengl.GLContext</code>. May throw a
32 * <code>NullPointerException</code> if <code>glContext</code> is null.
34 * @param glContext the new <code>javax.media.opengl.GLContext</code>
35 * @throws NullPointerException if glContext is null
36 * @since 1.5
38 void setGLContext(GLContext glContext);
40 /**
41 * Retrieves this <code>DrawContext</code>s </code>javax.media.opengl.GLContext</code>. If this method returns null,
42 * then there are potentially no active <code>GLContext</code>s and rendering should be aborted.
44 * @return this <code>DrawContext</code>s </code>javax.media.opengl.GLContext</code>.
45 * @since 1.5
47 GLContext getGLContext();
49 /**
50 * Retrieves the current <code>javax.media.opengl.GL</code>. A <code>GL</code> or <code>GLU</code> is required for
51 * all graphical rendering in World Wind Raptor.
53 * @return the current <code>GL</code> if available, null otherwise
54 * @since 1.5
56 GL getGL();
58 /**
59 * Retrieves the current <code>javax.media.opengl.glu.GLU</code>. A <code>GLU</code> or <code>GL</code> is required
60 * for all graphical rendering in World Wind Raptor.
62 * @return the current <code>GLU</code> if available, null otherwise
63 * @since 1.5
65 GLU getGLU();
67 /**
68 * Retrieves the current<code>javax.media.opengl.GLDrawable</code>. A <code>GLDrawable</code> can be used to create
69 * a <code>GLContext</code>, which can then be used for rendering.
71 * @return the current <code>GLDrawable</code>, null if none available
72 * @since 1.5
74 GLDrawable getGLDrawable();
76 /**
77 * Retrieves the drawable width of this <code>DrawContext</code>.
79 * @return the drawable width of this <code>DrawCOntext</code>
80 * @since 1.5
82 int getDrawableWidth();
84 /**
85 * Retrieves the drawable height of this <code>DrawContext</code>.
87 * @return the drawable height of this <code>DrawCOntext</code>
88 * @since 1.5
90 int getDrawableHeight();
92 /**
93 * Initializes this <code>DrawContext</code>. This method should be called at the beginning of each frame to prepare
94 * the <code>DrawContext</code> for the coming render pass.
96 * @param glContext the <code>javax.media.opengl.GLContext</code> to use for this render pass
97 * @since 1.5
99 void initialize(GLContext glContext);
102 * Assigns a new <code>View</code>. Some layers cannot function properly with a null <code>View</code>. It is
103 * recommended that the <code>View</code> is never set to null during a normal render pass.
105 * @param view the enw <code>View</code>
106 * @since 1.5
108 void setView(View view);
111 * Retrieves the current <code>View</code>, which may be null.
113 * @return the current <code>View</code>, which may be null
114 * @since 1.5
116 View getView();
119 * Assign a new <code>Model</code>. Some layers cannot function properly with a null <code>Model</code>. It is
120 * recommended that the <code>Model</code> is never set to null during a normal render pass.
122 * @param model the new <code>Model</code>
123 * @since 1.5
125 void setModel(Model model);
128 * Retrieves the current <code>Model</code>, which may be null.
130 * @return the current <code>Model</code>, which may be null
131 * @since 1.5
133 Model getModel();
136 * Retrieves the current <code>Globe</code>, which may be null.
138 * @return the current <code>Globe</code>, which may be null
139 * @since 1.5
141 Globe getGlobe();
144 * Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.
146 * @return a <code>LayerList</code> containing all the current layers
147 * @since 1.5
149 LayerList getLayers();
152 * Retrieves a <code>Sector</code> which is at least as large as the current visible sector. The value returned is
153 * the value passed to <code>SetVisibleSector</code>. This method may return null.
155 * @return a <code>Sector</code> at least the size of the curernt visible sector, null if unavailable
156 * @since 1.5
158 Sector getVisibleSector();
161 * Sets the visible <code>Sector</code>. The new visible sector must completely encompass the Sector which is
162 * visible on the display.
164 * @param s the new visible <code>Sector</code>
165 * @since 1.5
167 void setVisibleSector(Sector s);
170 * Sets the vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A
171 * vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying
172 * <code>Globe</code>. A vertical exaggeration of 3 will create mountains and valleys which are three times as
173 * high/deep as they really are.
175 * @param verticalExaggeration the new vertical exaggeration.
176 * @since 1.5
178 void setVerticalExaggeration(double verticalExaggeration);
181 * Retrieves the current vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied
182 * elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying
183 * <code>Globe</code>. A vertical exaggeration of 3 will create mountains and valleys which are three times as
184 * high/deep as they really are.
186 * @return the current vertical exaggeration
187 * @since 1.5
189 double getVerticalExaggeration();
191 // not used (12th January 2007)
192 final static String HIGH_PRIORITY = "gov.nasa.worldwind.DrawContext.HighPriority";
193 final static String LOW_PRIORITY = "gov.nasa.worldwind.DrawContext.LowPriority";
196 * Retrieves a list of all the sectors rendered so far this frame.
198 * @return a <code>SectorGeometryList</code> containing every <code>SectorGeometry</code> rendered so far this
199 * render pass.
200 * @since 1.5
202 SectorGeometryList getSurfaceGeometry();
205 // /**
206 // * Sets the average render time per frame in milliseconds.
207 // *
208 // * @param timeMillis the new average time in milliseconds
209 // * @since 1.5
210 // */
211 // void setAverageRenderTimeMillis(double timeMillis);
213 // /**
214 // * Retrieves the current average render time for a frame. The average render time can be used to calculate the
215 // * framerate.
216 // *
217 // * @return the current average render time for a frame
218 // * @since 1.5
219 // */
220 // double getAverageRenderTimeMillis();
223 * Returns the list of objects picked during the most recent pick traversal.
225 * @return the list of picked objects
227 PickedObjectList getPickedObjects();
230 * Adds a collection of picked objects to the current picked-object list
232 * @param pickedObjects the objects to add
234 void addPickedObjects(PickedObjectList pickedObjects);
237 * Adds a single insatnce of the picked object to the current picked-object list
239 * @param pickedObject the object to add
241 void addPickedObject(PickedObject pickedObject);
244 * Returns a unique color to serve as a pick identifier during picking.
246 * @return a unique pick color
248 java.awt.Color getUniquePickColor();
250 java.awt.Color getClearColor();
253 * Enables color picking mode
255 void enablePickingMode();
258 * Returns true if the Picking mode is active, otherwise return false
260 * @return true for Picking mode, otherwise false
262 boolean isPickingMode();
265 * Disables color picking mode
267 void disablePickingMode();
269 void addOrderedRenderable(OrderedRenderable orderedRenderable);
271 java.util.Queue<OrderedRenderable> getOrderedRenderables();
273 void drawUnitQuad();
275 void drawUnitQuad(TextureCoords texCoords);
277 int getNumTextureUnits();
279 void setNumTextureUnits(int numTextureUnits);
281 void setSurfaceGeometry(SectorGeometryList surfaceGeometry);
283 Vec4 getPointOnGlobe(Angle latitude, Angle longitude);
285 SurfaceTileRenderer getGeographicSurfaceTileRenderer();
287 Point getPickPoint();
289 void setPickPoint(Point pickPoint);
291 TextureCache getTextureCache();
293 void setTextureCache(TextureCache textureCache);
295 Collection<PerformanceStatistic> getPerFrameStatistics();
297 void setPerFrameStatisticsKeys(Set<String> statKeys, Collection<PerformanceStatistic> stats);
299 void setPerFrameStatistic(String key, String displayName, Object statistic);
301 void setPerFrameStatistics(Collection<PerformanceStatistic> stats);
303 Set<String> getPerFrameStatisticsKeys();