Class SimpleTile
- java.lang.Object
-
- org.orekit.rugged.raster.SimpleTile
-
- All Implemented Interfaces:
Tile
,UpdatableTile
- Direct Known Subclasses:
MinMaxTreeTile
public class SimpleTile extends Object implements Tile
Simple implementation of aTile
.- Author:
- Luc Maisonobe, Guylaine Prat
- See Also:
SimpleTileFactory
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.orekit.rugged.raster.Tile
Tile.Location
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleTile()
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NormalizedGeodeticPoint
cellIntersection(NormalizedGeodeticPoint p, Vector3D los, int latitudeIndex, int longitudeIndex)
Find the intersection of a line-of-sight and a Digital Elevation Model cell.protected double
getDoubleLatitudeIndex(double latitude)
Get the latitude index of a point.protected double
getDoubleLongitudeIndex(double longitude)
Get the longitude index of a point.double
getElevationAtIndices(int latitudeIndex, int longitudeIndex)
Get the elevation of an exact grid point.int
getFloorLatitudeIndex(double latitude)
Get the floor latitude index of a point.int
getFloorLongitudeIndex(double longitude)
Get the floor longitude index of a point.double
getLatitudeAtIndex(int latitudeIndex)
Get the latitude at some index.int
getLatitudeRows()
Get number of latitude rows.double
getLatitudeStep()
Get step in latitude (size of one raster element).Tile.Location
getLocation(double latitude, double longitude)
Check if a tile covers a ground point.double
getLongitudeAtIndex(int longitudeIndex)
Get the longitude at some index.int
getLongitudeColumns()
Get number of longitude columns.double
getLongitudeStep()
Get step in longitude (size of one raster element).double
getMaxElevation()
Get the maximum elevation in the tile.int
getMaxElevationLatitudeIndex()
Get the latitude index of max elevation.int
getMaxElevationLongitudeIndex()
Get the longitude index of max elevation.double
getMaximumLatitude()
Get maximum latitude.double
getMaximumLongitude()
Get maximum longitude.double
getMinElevation()
Get the minimum elevation in the tile.int
getMinElevationLatitudeIndex()
Get the latitude index of min elevation.int
getMinElevationLongitudeIndex()
Get the longitude index of min elevation.double
getMinimumLatitude()
Get minimum latitude of grid interpolation points.double
getMinimumLongitude()
Get minimum longitude.double
interpolateElevation(double latitude, double longitude)
Interpolate elevation.protected void
processUpdatedElevation(double[] elevationsArray)
Process elevation array at completion.void
setElevation(int latitudeIndex, int longitudeIndex, double elevation)
Set the elevation for one raster element.void
setGeometry(double newMinLatitude, double newMinLongitude, double newLatitudeStep, double newLongitudeStep, int newLatitudeRows, int newLongitudeColumns)
Set the tile global geometry.void
tileUpdateCompleted()
Hook called at the end of tile update completion.
-
-
-
Method Detail
-
setGeometry
public void setGeometry(double newMinLatitude, double newMinLongitude, double newLatitudeStep, double newLongitudeStep, int newLatitudeRows, int newLongitudeColumns)
Set the tile global geometry.- Specified by:
setGeometry
in interfaceUpdatableTile
- Parameters:
newMinLatitude
- minimum latitude (rad)newMinLongitude
- minimum longitude (rad)newLatitudeStep
- step in latitude (size of one raster element) (rad)newLongitudeStep
- step in longitude (size of one raster element) (rad)newLatitudeRows
- number of latitude rowsnewLongitudeColumns
- number of longitude columns
-
tileUpdateCompleted
public void tileUpdateCompleted()
Hook called at the end of tile update completion.- Specified by:
tileUpdateCompleted
in interfaceTile
-
processUpdatedElevation
protected void processUpdatedElevation(double[] elevationsArray)
Process elevation array at completion.This method is called at tile update completion, it is expected to be overridden by subclasses. The default implementation does nothing.
- Parameters:
elevationsArray
- elevations array
-
getMinimumLatitude
public double getMinimumLatitude()
Get minimum latitude of grid interpolation points.- Specified by:
getMinimumLatitude
in interfaceTile
- Returns:
- minimum latitude of grid interpolation points (rad) (latitude of the center of the cells of South row)
-
getLatitudeAtIndex
public double getLatitudeAtIndex(int latitudeIndex)
Get the latitude at some index.- Specified by:
getLatitudeAtIndex
in interfaceTile
- Parameters:
latitudeIndex
- latitude index- Returns:
- latitude at the specified index (rad) (latitude of the center of the cells of specified row)
-
getMaximumLatitude
public double getMaximumLatitude()
Get maximum latitude.Beware that as a point at maximum latitude is the northernmost one of the grid, it doesn't have a northwards neighbor and therefore calling
getLocation
on such a latitude will return eitherTile.Location.NORTH_WEST
,Tile.Location.NORTH
orTile.Location.NORTH_EAST
, but can never returnTile.Location.HAS_INTERPOLATION_NEIGHBORS
!- Specified by:
getMaximumLatitude
in interfaceTile
- Returns:
- maximum latitude (rad) (latitude of the center of the cells of North row)
-
getMinimumLongitude
public double getMinimumLongitude()
Get minimum longitude.- Specified by:
getMinimumLongitude
in interfaceTile
- Returns:
- minimum longitude (rad) (longitude of the center of the cells of West column)
-
getLongitudeAtIndex
public double getLongitudeAtIndex(int longitudeIndex)
Get the longitude at some index.- Specified by:
getLongitudeAtIndex
in interfaceTile
- Parameters:
longitudeIndex
- longitude index- Returns:
- longitude at the specified index (rad) (longitude of the center of the cells of specified column)
-
getMaximumLongitude
public double getMaximumLongitude()
Get maximum longitude.Beware that as a point at maximum longitude is the easternmost one of the grid, it doesn't have an eastwards neighbor and therefore calling
getLocation
on such a longitude will return eitherTile.Location.SOUTH_EAST
,Tile.Location.EAST
orTile.Location.NORTH_EAST
, but can never returnTile.Location.HAS_INTERPOLATION_NEIGHBORS
!- Specified by:
getMaximumLongitude
in interfaceTile
- Returns:
- maximum longitude (rad) (longitude of the center of the cells of East column)
-
getLatitudeStep
public double getLatitudeStep()
Get step in latitude (size of one raster element).- Specified by:
getLatitudeStep
in interfaceTile
- Returns:
- step in latitude (rad)
-
getLongitudeStep
public double getLongitudeStep()
Get step in longitude (size of one raster element).- Specified by:
getLongitudeStep
in interfaceTile
- Returns:
- step in longitude (rad)
-
getLatitudeRows
public int getLatitudeRows()
Get number of latitude rows.- Specified by:
getLatitudeRows
in interfaceTile
- Returns:
- number of latitude rows
-
getLongitudeColumns
public int getLongitudeColumns()
Get number of longitude columns.- Specified by:
getLongitudeColumns
in interfaceTile
- Returns:
- number of longitude columns
-
getMinElevation
public double getMinElevation()
Get the minimum elevation in the tile.- Specified by:
getMinElevation
in interfaceTile
- Returns:
- minimum elevation in the tile (m)
-
getMinElevationLatitudeIndex
public int getMinElevationLatitudeIndex()
Get the latitude index of min elevation.- Specified by:
getMinElevationLatitudeIndex
in interfaceTile
- Returns:
- latitude index of min elevation
-
getMinElevationLongitudeIndex
public int getMinElevationLongitudeIndex()
Get the longitude index of min elevation.- Specified by:
getMinElevationLongitudeIndex
in interfaceTile
- Returns:
- longitude index of min elevation
-
getMaxElevation
public double getMaxElevation()
Get the maximum elevation in the tile.- Specified by:
getMaxElevation
in interfaceTile
- Returns:
- maximum elevation in the tile (m)
-
getMaxElevationLatitudeIndex
public int getMaxElevationLatitudeIndex()
Get the latitude index of max elevation.- Specified by:
getMaxElevationLatitudeIndex
in interfaceTile
- Returns:
- latitude index of max elevation
-
getMaxElevationLongitudeIndex
public int getMaxElevationLongitudeIndex()
Get the longitude index of max elevation.- Specified by:
getMaxElevationLongitudeIndex
in interfaceTile
- Returns:
- longitude index of max elevation
-
setElevation
public void setElevation(int latitudeIndex, int longitudeIndex, double elevation)
Set the elevation for one raster element.BEWARE! The order of the indices follows geodetic conventions, i.e. the latitude is given first and longitude afterwards, so the first index specifies a row index with zero at South and max value at North, and the second index specifies a column index with zero at West and max value at East. This is not the same as some raster conventions (as our row index increases from South to North) and this is also not the same as Cartesian coordinates as our ordinate index appears before our abscissa index).
- Specified by:
setElevation
in interfaceUpdatableTile
- Parameters:
latitudeIndex
- index of latitude (row index)longitudeIndex
- index of longitude (column index)elevation
- elevation (m)
-
getElevationAtIndices
public double getElevationAtIndices(int latitudeIndex, int longitudeIndex)
Get the elevation of an exact grid point.- Specified by:
getElevationAtIndices
in interfaceTile
- Parameters:
latitudeIndex
- grid point index along latitudelongitudeIndex
- grid point index along longitude- Returns:
- elevation at grid point (m)
-
interpolateElevation
public double interpolateElevation(double latitude, double longitude)
Interpolate elevation.In order to cope with numerical accuracy issues when computing points at tile boundary, a slight tolerance (typically 1/8 cell) around the tile is allowed. Elevation can therefore be interpolated (really extrapolated in this case) even for points slightly overshooting tile boundaries, using the closest tile cell. Attempting to interpolate too far from the tile will trigger an exception.
This classes uses an arbitrary 1/8 cell tolerance for interpolating slightly out of tile points.
- Specified by:
interpolateElevation
in interfaceTile
- Parameters:
latitude
- ground point latitudelongitude
- ground point longitude- Returns:
- interpolated elevation (m)
-
cellIntersection
public NormalizedGeodeticPoint cellIntersection(NormalizedGeodeticPoint p, Vector3D los, int latitudeIndex, int longitudeIndex)
Find the intersection of a line-of-sight and a Digital Elevation Model cell.Beware that for continuity reasons, the point argument in
cellIntersection
is normalized with respect to other points used by the caller. This implies that the longitude may be outside of the [-π ; +π] interval (or the [0 ; 2π] interval, depending on the DEM). In particular, when a Line Of Sight crosses the antimeridian at ±π longitude, the library may call thecellIntersection
method with a point having a longitude of -π-ε to ensure this continuity. As tiles are stored with longitude clipped to a some DEM specific interval (either [-π ; +π] or [0 ; 2π]), implementations MUST take care to clip the input point back to the tile interval usingMathUtils.normalizeAngle(p.getLongitude(), someLongitudeWithinTheTile)
. The output point normalization should also be made consistent with the current tile.- Specified by:
cellIntersection
in interfaceTile
- Parameters:
p
- point on the line (beware its longitude is not normalized with respect to tile)los
- line-of-sight, in the topocentric frame (East, North, Zenith) of the point, scaled to match radians in the horizontal plane and meters along the vertical axislatitudeIndex
- latitude index of the Digital Elevation Model celllongitudeIndex
- longitude index of the Digital Elevation Model cell- Returns:
- point corresponding to line-of-sight crossing the Digital Elevation Model surface if it lies within the cell, null otherwise
-
getFloorLatitudeIndex
public int getFloorLatitudeIndex(double latitude)
Get the floor latitude index of a point.The specified latitude is always between index and index+1.
- Specified by:
getFloorLatitudeIndex
in interfaceTile
- Parameters:
latitude
- geodetic latitude- Returns:
- floor latitude index (it may lie outside of the tile!)
-
getFloorLongitudeIndex
public int getFloorLongitudeIndex(double longitude)
Get the floor longitude index of a point.The specified longitude is always between index and index+1.
- Specified by:
getFloorLongitudeIndex
in interfaceTile
- Parameters:
longitude
- geodetic longitude- Returns:
- floor longitude index (it may lie outside of the tile!)
-
getDoubleLatitudeIndex
protected double getDoubleLatitudeIndex(double latitude)
Get the latitude index of a point.- Parameters:
latitude
- geodetic latitude (rad)- Returns:
- latitude index (it may lie outside of the tile!)
-
getDoubleLongitudeIndex
protected double getDoubleLongitudeIndex(double longitude)
Get the longitude index of a point.- Parameters:
longitude
- geodetic longitude (rad)- Returns:
- longitude index (it may lie outside of the tile!)
-
getLocation
public Tile.Location getLocation(double latitude, double longitude)
Check if a tile covers a ground point.- Specified by:
getLocation
in interfaceTile
- Parameters:
latitude
- ground point latitudelongitude
- ground point longitude- Returns:
- location of the ground point with respect to tile
-
-