Worldwind public release 0.2
[worldwind-tracker.git] / gov / nasa / worldwind / ElevationModel.java
blob6f88de997da0070bb5b9f13c7028e6fa04119fa0
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 gov.nasa.worldwind.geom.*;
11 /**
12 * <p/>
13 * Provides the elevations of all points on a {@link Globe} . Every <code>Globe</code> has an elevation model
14 * implementing this interface.
15 * <p/>
16 * Elevations are organized by {@link Sector}. Elevation models return an {@link Elevations} object for requested
17 * sectors. This object is then used to query elevations at latitude/longitude positions within that sector.
18 * <p/>
19 * An <code>ElevationModel</code> typically approximates elevations at multiple levels of spatial resolution. For any
20 * given viewing position the model determines an appropriate target resolution. That target resolution may not be
21 * immediately achievable, however, because the corresponding elevation data might not be locally available and must be
22 * retrieved from a remote location. When this is the case, the <code>Elevations</code> object returned for a sector
23 * holds the resolution achievable with the data currently available. That resolution may not be the same as the target
24 * resolution. The target resolution and the actual resolution are made available in the interface so that users of this
25 * class may use the resolution values to compare previously computed elevation sectors with newly computed ones, and
26 * thereby enable effective caching of elevations computed for the sector.
27 * <p/>
29 * @author Tom Gaskins
30 * @version $Id: ElevationModel.java 1709 2007-05-03 23:39:21Z tgaskins $
32 public interface ElevationModel extends WWObject
34 boolean isEnabled();
36 void setEnabled(boolean enable);
38 /**
39 * Returns the maximum elevation contained in the elevevation model. This value is the height of the highest point
40 * on the globe.
42 * @return The maximum elevation of the model
44 double getMaximumElevation();
46 /**
47 * Returns the minimum elevation contained in the elevevation model. This value is the height of the lowest point on
48 * the globe. It may be negative, indicating a value below mean surface level. (Sea level in the case of Earth.)
50 * @return The minimum elevation of the model
52 double getMinimumElevation();
54 /**
55 * Computes and returns an {@link Elevations} object for the specified {@link Sector} and target resolution. If the
56 * target resolution can not currently be achieved, the best available elevations are returned.
57 * <p/>
58 * Implementing classes of <code>ElevationModel</code> interpret <code>resolution</code> in a class-specific way.
59 * See the descriptions of those classes to learn their use of this value. The elevations returned are in the form
60 * of an {@link Elevations} object. Specific elevations are returned by that object.
62 * @param sector the sector to return elevations for.
63 * @param resolution a value interpreted in a class-specific way by implementing classes.
64 * @return An object representing the elevations for the specified sector. Its resolution value will be either the
65 * specified resolution or the best available alternative.
67 Elevations getElevations(Sector sector, int resolution);
69 /**
70 * Returns the resolution appropriate to the given {@link Sector} and view parameters. The view parameters are read
71 * from the specified {@link DrawContext}. Implementing classes of <code>ElevationModel</code> interpret
72 * <code>resolution</code> in class-specific ways. See the descriptions of subclasses to learn their use of this
73 * value. This method is used to determine the resolution the model will use if all resources are available to
74 * compute that resolution. It is subsequently passed to {@link #getElevations(Sector, int)} when a sector's
75 * resolutions are queried.
77 * @param dc the draw context to read the view and rendering parameters from.
78 * @param sector the {@link Sector} to compute the target resolution for.
79 * @return The appropriate resolution for the sector and draw context values.
81 int getTargetResolution(DrawContext dc, Sector sector, int density);
83 double getElevation(Angle latitude, Angle longitude);
85 /**
86 * The <code>Elevations</code> interface provides elevations at specified latitude and longitude positions. Objects
87 * implementing this interface are created by {@link ElevationModel#getElevations(Sector, int)}.
89 public interface Elevations
91 /**
92 * Indicates whether the object contains useful elevations. An <code>Elevations</code> instance may exist
93 * without holding any elevations. This can occur when the resources needed to determine elevations are not yet
94 * local. This method enables the detection of that case. Callers typically use it to avoid time-consuming
95 * computations that require valid elevations.
97 * @return <code>true</code> if a call to {@link #getElevation(double, double)} will return valid elevations,
98 * otherwise <code>false</code> indicating that the value 0 will always be returned from that method.
100 boolean hasElevations();
103 * Returns the elevation at a specific latitude and longitude, each specified in radians.
105 * @param latRadians the position's latitude in radians, in the range [-&pi;/2, +&pi;/2].
106 * @param lonRadians the position's longitude in radians, in the range [-&pi;, +&pi;].
107 * @return The elevation at the given position, or 0 if elevations are not available.
109 double getElevation(double latRadians, double lonRadians);
112 * Returns the resolution value of the elevations. The meaning and use of this value is defined by subclasses of
113 * <code>ElevationModel</code>.
115 * @return the resolution associated with <code>this</code>.
117 int getResolution();
120 * Returns the {@link Sector} the elevations pertain to.
122 * @return The sector the elevations pertain to.
124 Sector getSector();