Constructor
new Level(sector, levelZeroDelta, numLevels, tileWidth, tileHeight)
Constructs a level set.
Parameters:
Name | Type | Description |
---|---|---|
sector |
Sector | The sector spanned by this level set. |
levelZeroDelta |
Location | The geographic size of tiles in the lowest resolution level of this level set. |
numLevels |
Number | The number of levels in the level set. |
tileWidth |
Number | The height in pixels of images associated with tiles in this level set, or the number of sample points in the longitudinal direction of elevation tiles associate with this level set. |
tileHeight |
Number | The height in pixels of images associated with tiles in this level set, or the number of sample points in the latitudinal direction of elevation tiles associate with this level set. |
- Source:
Throws:
-
If the specified sector or level-zero-delta is null or undefined, the level zero delta values are less than or equal to zero, or any of the number-of-levels, tile-width or tile-height arguments are less than 1.
- Type
- ArgumentError
Members
levelNumber :Number
The level's ordinal in its parent level set.
Type:
- Number
- Source:
(readonly) levelZeroDelta :Location
The geographic size of the lowest resolution (level 0) tiles in this level set.
Type:
- Source:
(readonly) numLevels :Number
The number of levels in this level set.
Type:
- Number
- Source:
parent :LevelSet
The level set that this level is a member of.
Type:
- LevelSet
- Source:
sector :Sector
The sector spanned by this level.
Type:
- Source:
(readonly) sector :Sector
The sector spanned by this level set.
Type:
- Source:
texelSize :Number
The size of pixels or elevation cells within this level, in radians per pixel or per cell.
Type:
- Number
- Source:
tileDelta :Location
The geographic size of tiles within this level.
Type:
- Source:
tileHeight :Number
The height in pixels or cells of the resource associated with tiles within this level.
Type:
- Number
- Source:
(readonly) tileHeight :Number
The height in pixels of images associated with tiles in this level set, or the number of sample points
in the latitudinal direction of elevation tiles associated with this level set.
Type:
- Number
- Source:
tileWidth :Number
The width in pixels or cells of the resource associated with tiles within this level.
Type:
- Number
- Source:
(readonly) tileWidth :Number
The width in pixels of images associated with tiles in this level set, or the number of sample points
in the longitudinal direction of elevation tiles associated with this level set.
Type:
- Number
- Source:
Methods
(static) numLevelsForResolution(firstLevelResolution, lastLevelResolution) → {Number}
Returns the number of levels that match the specified resolution. firstLevelResolution indicates the
resolution of the first level's tiles, in degrees per pixel. This depends only on the LevelSet configuration,
and is derived by evaluating {@code levelZeroDelta.latitude / tileHeight}. lastLevelResolution indicates the
resolution of the data represented by the LevelSet.
The returned level count is a fractional value. The dataset resolution is rarely an even multiple of the
first level resolution, so the ideal last level is typically somewhere in between two levels. An integer
level count can be computed depending on the desired behavior. If the last level should
match or exceed the data resolution, take the ceiling of the returned value. Otherwise, if the last
level should be no more than the data resolution, take the floor of the returned value.
Parameters:
Name | Type | Description |
---|---|---|
firstLevelResolution |
Number | the known resolution of the first level in degrees per pixel |
lastLevelResolution |
Number | the desired resolution of the last level in degrees per pixel |
- Source:
Throws:
-
If either resolution is null, undefined, or zero
- Type
- ArgumentError
Returns:
the number of levels as a fractional level count
- Type
- Number
compare(that) → {Number}
Compare this level's ordinal to that of a specified level.
Parameters:
Name | Type | Description |
---|---|---|
that |
Level | The level to compare this one to. |
- Source:
Throws:
-
If the specified level is null or undefined.
- Type
- ArgumentError
Returns:
0 if the two ordinals are equivalent. -1 if this level's ordinal is less than the specified
level's ordinal. 1 if this level's ordinal is greater than the specified level's ordinal.
- Type
- Number
firstLevel() → {Level}
Returns the first (lowest resolution) level of this level set.
- Source:
Returns:
The first level of this level set.
- Type
- Level
isFirstLevel() → {Boolean}
Indicates whether this level is the lowest resolution level (level 0) within its parent's level set.
- Source:
Returns:
true If this tile is the lowest resolution in the parent level set,
otherwise false.
- Type
- Boolean
isLastLevel() → {Boolean}
Indicates whether this level is the highest resolution level within its parent's level set.
- Source:
Returns:
true If this tile is the highest resolution in the parent level set,
otherwise false.
- Type
- Boolean
lastLevel() → {Level}
Returns the last (highest resolution) level of this level set.
- Source:
Returns:
The last level of this level set.
- Type
- Level
level(levelNumber) → {Level}
Returns the Level for a specified level number.
Parameters:
Name | Type | Description |
---|---|---|
levelNumber |
Number | The number of the desired level. |
- Source:
Returns:
The requested level, or null if the level does not exist.
- Type
- Level
levelForTexelSize(texelSize)
Returns the level with a specified texel size.
This function returns the first level if the specified texel size is greater than the first level's texel
size, and returns the last level if the delta is less than the last level's texel size.
Parameters:
Name | Type | Description |
---|---|---|
texelSize |
Number | The size of pixels or elevation cells in the level, in radians per pixel or cell. |
- Source:
nextLevel() → {Level}
Returns the level whose ordinal occurs immediately after this level's ordinal in the parent level set, or
null if this is the last level.
- Source:
Returns:
The next level, or null if this is the last level.
- Type
- Level
previousLevel() → {Level}
Returns the level whose ordinal occurs immediately before this level's ordinal in the parent level set, or
null if this is the fist level.
- Source:
Returns:
The previous level, or null if this is the first level.
- Type
- Level