Class CompoundElevationModel

    • Field Detail

      • elevationModels

        protected java.util.concurrent.CopyOnWriteArrayList<ElevationModel> elevationModels
    • Constructor Detail

      • CompoundElevationModel

        public CompoundElevationModel()
    • Method Detail

      • containsElevationModel

        public boolean containsElevationModel​(ElevationModel em)
        Returns true if this CompoundElevationModel contains the specified ElevationModel, and false otherwise.
        Parameters:
        em - the ElevationModel to test.
        Returns:
        true if the ElevationModel is in this CompoundElevationModel; false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the ElevationModel is null.
      • sortElevationModels

        protected void sortElevationModels()
      • addElevationModel

        public void addElevationModel​(ElevationModel em)
        Adds an elevation to this compound elevation model. The list of elevation models for this class is sorted from lowest resolution to highest. This method inserts the specified elevation model at the appropriate position in the list, and as a side effect resorts the entire list.
        Parameters:
        em - The elevation model to add.
        Throws:
        java.lang.IllegalArgumentException - if the specified elevation model is null.
      • addElevationModel

        public void addElevationModel​(int index,
                                      ElevationModel em)
        Adds a specified elevation model to a specified position in this compound elevation model's elevation model list. It's expected that this class' elevation model list is sorted from lowest resolution to highest. The method addElevationModel(gov.nasa.worldwind.globes.ElevationModel) inserts added elevation models at the appropriate place in the list. This method, however, inserts the elevation model at the specified position in the list. For proper operation of this compound elevation model, the caller should ensure that the specified position is the appropriate one for the inserted elevation model's resolution.
        Parameters:
        index - The position at which to insert the specified model, zero origin. Existing models are shifted to the right.
        em - The elevation model to insert.
        Throws:
        java.lang.IllegalArgumentException - if the specified elevation model is null.
        java.lang.IndexOutOfBoundsException - if the specified index is invalid.
      • removeElevationModel

        public void removeElevationModel​(ElevationModel em)
      • removeElevationModel

        public void removeElevationModel​(int index)
      • setElevationModel

        public void setElevationModel​(int index,
                                      ElevationModel em)
      • getElevationModels

        public java.util.List<ElevationModel> getElevationModels()
      • setExpiryTime

        public void setExpiryTime​(long expiryTime)
        Recursively specifies the time of the most recent dataset update for this compound model, and for each elevation model contained within this compound model. Any cached data older than this time is invalid.
        Specified by:
        setExpiryTime in interface ElevationModel
        Overrides:
        setExpiryTime in class AbstractElevationModel
        Parameters:
        expiryTime - the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch.
        See Also:
        for a description of milliseconds beyond the epoch.
      • getMaxElevation

        public double getMaxElevation()
        Description copied from interface: ElevationModel
        Returns the maximum elevation contained in the elevation model. When the elevation model is associated with a globe, this value is the elevation of the highest point on the globe.
        Returns:
        The maximum elevation of the elevation model.
      • getMinElevation

        public double getMinElevation()
        Description copied from interface: ElevationModel
        Returns the minimum elevation contained in the elevation model. When associated with a globe, this value is the elevation of the lowest point on the globe. It may be negative, indicating a value below mean surface level. (Sea level in the case of Earth.)
        Returns:
        The minimum elevation of the model.
      • getExtremeElevations

        public double[] getExtremeElevations​(Angle latitude,
                                             Angle longitude)
        Description copied from interface: ElevationModel
        Returns the minimum and maximum elevations at a specified location.
        Parameters:
        latitude - the latitude of the location in question.
        longitude - the longitude of the location in question.
        Returns:
        A two-element double array indicating, respectively, the minimum and maximum elevations at the specified location. These values are the global minimum and maximum if the local minimum and maximum values are currently unknown.
      • getExtremeElevations

        public double[] getExtremeElevations​(Sector sector)
        Description copied from interface: ElevationModel
        Returns the minimum and maximum elevations within a specified sector of the elevation model.
        Parameters:
        sector - the sector in question.
        Returns:
        A two-element double array indicating, respectively, the sector's minimum and maximum elevations. These elements are the global minimum and maximum if the local minimum and maximum values are currently unknown.
      • getBestResolution

        public double getBestResolution​(Sector sector)
        Description copied from interface: ElevationModel
        Indicates the best resolution attainable for a specified sector.
        Parameters:
        sector - the sector in question. If null, the elevation model's best overall resolution is returned. This is the best attainable at some locations but not necessarily at all locations.
        Returns:
        the best resolution attainable for the specified sector, in radians, or Double.MAX_VALUE if the sector does not intersect the elevation model.
      • getDetailHint

        public double getDetailHint​(Sector sector)
        Description copied from interface: ElevationModel
        Returns the detail hint associated with the specified sector. If the elevation model does not have any detail hint for the sector, this method returns zero.
        Specified by:
        getDetailHint in interface ElevationModel
        Overrides:
        getDetailHint in class AbstractElevationModel
        Parameters:
        sector - the sector in question.
        Returns:
        The detail hint corresponding to the specified sector.
      • intersects

        public int intersects​(Sector sector)
        Description copied from interface: ElevationModel
        Indicates whether the elevation model covers a specified sector either partially or fully.
        Parameters:
        sector - the sector in question.
        Returns:
        0 if the elevation model fully contains the sector, 1 if the elevation model intersects the sector but does not fully contain it, or -1 if the sector does not intersect the elevation model.
      • contains

        public boolean contains​(Angle latitude,
                                Angle longitude)
        Description copied from interface: ElevationModel
        Indicates whether a specified location is within the elevation model's domain.
        Parameters:
        latitude - the latitude of the location in question.
        longitude - the longitude of the location in question.
        Returns:
        true if the location is within the elevation model's domain, otherwise false.
      • getUnmappedElevation

        public double getUnmappedElevation​(Angle latitude,
                                           Angle longitude)
        Description copied from interface: ElevationModel
        Returns the elevation at a specified location, but without replacing missing data with the elevation model's missing data replacement value. When a missing data signal is found, the signal value is returned, not the replacement value.
        Parameters:
        latitude - the latitude of the location for which to return the elevation.
        longitude - the longitude of the location for which to return the elevation.
        Returns:
        the elevation at the specified location, or the elevation model's missing data signal. If no data is currently in memory for the location, and the location is within the elevation model's coverage area, the elevation model's minimum elevation at that location is returned.
      • getElevations

        public double getElevations​(Sector sector,
                                    java.util.List<? extends LatLon> latlons,
                                    double targetResolution,
                                    double[] buffer)
        Returns the elevations of a collection of locations. Replaces any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.

        NOTE: This method returns only unmapped elevations if the compound model contains more than one elevation model. This enables the compound model's lower resolution elevation models to specify missing data values for the higher resolution elevation models.

        Parameters:
        sector - the sector in question.
        latlons - the locations to return elevations for. If a location is null, the output buffer for that location is not modified.
        targetResolution - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.)
        buffer - an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.
        Returns:
        the resolution achieved, in radians, or Double.MAX_VALUE if individual elevations cannot be determined for all of the locations.
        See Also:
        ElevationModel.setMissingDataSignal(double)
      • getUnmappedElevations

        public double getUnmappedElevations​(Sector sector,
                                            java.util.List<? extends LatLon> latlons,
                                            double targetResolution,
                                            double[] buffer)
        Returns the elevations of a collection of locations. Does not replace any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.

        NOTE: This method returns only unmapped elevations if the compound model contains more than one elevation model. This enables the compound model's lower resolution elevation models to specify missing data values for the higher resolution elevation models.

        Parameters:
        sector - the sector in question.
        latlons - the locations to return elevations for. If a location is null, the output buffer for that location is not modified.
        targetResolution - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.)
        buffer - an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.
        Returns:
        the resolution achieved, in radians, or Double.MAX_VALUE if individual elevations cannot be determined for all of the locations.
        See Also:
        ElevationModel.setMissingDataSignal(double)
      • getElevations

        public double[] getElevations​(Sector sector,
                                      java.util.List<? extends LatLon> latLons,
                                      double[] targetResolutions,
                                      double[] elevations)
        Description copied from interface: ElevationModel
        Returns the elevations of a collection of locations. Replaces any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.
        Specified by:
        getElevations in interface ElevationModel
        Overrides:
        getElevations in class AbstractElevationModel
        Parameters:
        sector - the sector in question.
        latLons - the locations to return elevations for. If a location is null, the output buffer for that location is not modified.
        targetResolutions - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.) This is an array to enable specification of a target resolution per elevation model for CompoundElevationModel. The entries must be in the same order as the elevations in CompoundElevationModel.
        elevations - an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.
        Returns:
        the resolutions achieved, in radians, which will be Double.MAX_VALUE if individual elevations cannot be determined for all of the locations. The entries are in the same order as the elevations in CompoundElevationModel.
        See Also:
        ElevationModel.setMissingDataSignal(double)
      • getUnmappedElevations

        public double[] getUnmappedElevations​(Sector sector,
                                              java.util.List<? extends LatLon> latLons,
                                              double[] targetResolutions,
                                              double[] elevations)
        Description copied from interface: ElevationModel
        Returns the elevations of a collection of locations. Does not replace any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.
        Specified by:
        getUnmappedElevations in interface ElevationModel
        Overrides:
        getUnmappedElevations in class AbstractElevationModel
        Parameters:
        sector - the sector in question.
        latLons - the locations to return elevations for. If a location is null, the output buffer for that location is not modified.
        targetResolutions - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.) This is an array to enable specification of a target resolution per elevation model for CompoundElevationModel. The entries must be in the same order as the elevations in CompoundElevationModel.
        elevations - an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.
        Returns:
        the resolutions achieved, in radians, which will be Double.MAX_VALUE if individual elevations cannot be determined for all of the locations. The entries are in the same order as the elevations in CompoundElevationModel.
        See Also:
        ElevationModel.setMissingDataSignal(double)
      • doGetElevations

        protected double[] doGetElevations​(Sector sector,
                                           java.util.List<? extends LatLon> latlons,
                                           double[] targetResolution,
                                           double[] buffer,
                                           boolean mapMissingData)
      • composeElevations

        public void composeElevations​(Sector sector,
                                      java.util.List<? extends LatLon> latlons,
                                      int tileWidth,
                                      double[] buffer)
                               throws java.lang.Exception
        Description copied from interface: ElevationModel
        Determines the elevations at specified locations within a specified Sector.
        Specified by:
        composeElevations in interface ElevationModel
        Overrides:
        composeElevations in class AbstractElevationModel
        Parameters:
        sector - the sector containing the locations.
        latlons - the locations for which to return elevations.
        tileWidth - the number of locations that comprise one row in the latlons argument.
        buffer - a buffer in which to put the elevations. The buffer must have at least as many elements as the number of specified locations.
        Throws:
        java.lang.Exception - if the method fails. Different elevation models may fail for different reasons.
        java.lang.IllegalArgumentException - if either the sector, list of locations or buffer is null, if the buffer size is not at least as large as the location list, or the tile width is greater than the locations list length or less than 1.
      • setNetworkRetrievalEnabled

        public void setNetworkRetrievalEnabled​(boolean networkRetrievalEnabled)
        Description copied from interface: ElevationModel
        Controls whether the elevation model is allowed to retrieve data from the network. Some elevation models have no need for data from the network. This flag may be set but is meaningless for such elevation models.
        Specified by:
        setNetworkRetrievalEnabled in interface ElevationModel
        Overrides:
        setNetworkRetrievalEnabled in class AbstractElevationModel
        Parameters:
        networkRetrievalEnabled - true if network retrieval is allowed, else false.
      • getLocalDataAvailability

        public double getLocalDataAvailability​(Sector sector,
                                               java.lang.Double targetResolution)
        Description copied from interface: ElevationModel
        Returns the proportion of this elevation model's data that is local -- in the computer's data cache or installed data filestore -- for a specified sector and target resolution.
        Specified by:
        getLocalDataAvailability in interface ElevationModel
        Overrides:
        getLocalDataAvailability in class AbstractElevationModel
        Parameters:
        sector - the sector of interest.
        targetResolution - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.) Specify null to use this elevation model's best resolution.
        Returns:
        the fraction of the data that is local. A value of 1.0 indicates that all the data is available.
      • setExtremesCachingEnabled

        public void setExtremesCachingEnabled​(boolean enabled)
        Description copied from interface: ElevationModel
        Indicates whether extreme values of sectors should be cached as they're computed. Caching should be disabled if especially many sectors are to be used when querying extreme elevations of this elevation model, such as during terrain intersection calculations. The default is for caching to be enabled. During normal operation caching enhances performance, but during terrain intersection computation it can hamper performance.
        Parameters:
        enabled - true if extreme value caching should be performed.
      • getUnmappedLocalSourceElevation

        public double getUnmappedLocalSourceElevation​(Angle latitude,
                                                      Angle longitude)
        Returns the elevation for this elevation model's highest level of detail at a specified location if the source file for that level and the specified location exists in the local elevation cache on disk. Note that this method consults only those elevation models whose type is BasicElevationModel.
        Specified by:
        getUnmappedLocalSourceElevation in interface ElevationModel
        Overrides:
        getUnmappedLocalSourceElevation in class AbstractElevationModel
        Parameters:
        latitude - The latitude of the location whose elevation is desired.
        longitude - The longitude of the location whose elevation is desired.
        Returns:
        The elevation at the specified location, if that location is contained in this elevation model and the source file for the highest-resolution elevation at that location exists in the current disk cache. Otherwise this elevation model's missing data signal is returned (see AbstractElevationModel.getMissingDataSignal()).