public class SpriteIndex extends Object
SpriteIndex.IconInfo
objects. For example:
{
"goldfish": {
"height": 32,
"pixelRatio": 1,
"width": 32,
"x": 64,
"y": 64
},
"owl": {
"height": 64,
"pixelRatio": 1,
"width": 64,
"x": 0,
"y": 0
}
}
Modifier and Type | Class and Description |
---|---|
static class |
SpriteIndex.IconInfo
Wrapper for parsing the properties of an individual sprite index entry (JSONObject) for a
single icon.
|
Constructor and Description |
---|
SpriteIndex(String spriteIndexUrl,
JSONObject json) |
Modifier and Type | Method and Description |
---|---|
SpriteIndex.IconInfo |
getIcon(String iconName)
Get information about a single icon from the index
|
ImmutableMap<String,SpriteIndex.IconInfo> |
getIcons()
Get the names and data of all icons in the index
|
protected static SpriteIndex.IconInfo |
parseIconInfoFromIndex(JSONObject iconIndex,
String iconName)
Parse the
SpriteIndex.IconInfo for the provided iconName in the provided icon index. |
public SpriteIndex(String spriteIndexUrl, JSONObject json)
spriteIndexUrl
- The URL of the sprite index file (used for error messages).json
- The sprite index file as a JSONObject
.protected static SpriteIndex.IconInfo parseIconInfoFromIndex(JSONObject iconIndex, String iconName)
SpriteIndex.IconInfo
for the provided iconName in the provided icon index.iconIndex
- The icon index file.iconName
- The name of the icon in the index file.SpriteIndex.IconInfo
for the icon.public ImmutableMap<String,SpriteIndex.IconInfo> getIcons()
SpriteIndex.IconInfo
public SpriteIndex.IconInfo getIcon(String iconName)
iconName
- Name of the iconCopyright © 1996–2023 Geotools. All rights reserved.