|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractCollection<E>
AbstractSet<DimensionIdentification>
DimensionSet
public class DimensionSet
The set of DimensionIdentification instances managed by a given
MultidimensionalImageStore instance. This class is provided for
MultidimensionalImageStore implementations and usually don't need
to be accessed directly by users. The code snippet below gives an example
of implementation using a DimensionSet:
public class MyReader extends SpatialImageReader implements MultidimensionalImageStore {
private final DimensionSet dimensionsForAPI;
public SpatialImageReader(Spi provider) {
super(provider);
dimensionsForAPI = new DimensionSet(this);
}
public DimensionIdentification getDimensionForAPI(DimensionSlice.API api) {
return dimensionsForAPI.getOrCreate(api);
}
public DimensionSlice.API getAPIForDimension(Object... identifiers) {
return dimensionsForAPI.getAPI(identifiers);
}
public Set<DimensionSlice.API> getAPIForDimensions() {
return dimensionsForAPI.getAPIs();
}
public BufferedImage read(int imageIndex, ImageReadParam param) {
DimensionIdentification bandsDimension = dimensionsForAPI.get(DimensionSlice.API.BANDS);
if (bandsDimension != null) {
Collection<?> propertiesOfAxes = ...; // This is plugin-specific.
int index = bandsDimension.findDimensionIndex(propertiesOfAxes);
if (index >= 0) {
// We have found the dimension index of bands.
}
}
// Continue the process of reading the image...
}
}
DimensionSet is not modifiable through the Set interface, since it doesn't
support the add method. However new elements can be created by calls to the
getOrCreate(DimensionSlice.API) method.
MultidimensionalImageStore,
DimensionIdentification
| coverage/geotk-coverageio (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from interface WarningProducer |
|---|
LOGGER |
| Constructor Summary | |
|---|---|
DimensionSet(MultidimensionalImageStore store)
Creates a new DimensionSet instance for the given image reader or writer. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears any setting in this object. |
boolean |
contains(Object value)
Returns true if this set contains the given dimension. |
DimensionIdentification |
get(DimensionSlice.API api)
Returns the dimension which has been assigned to the given API, or null if none. |
DimensionSlice.API |
getAPI(Object... identifiers)
Returns the API assigned to the given dimension identifiers. |
Set<DimensionSlice.API> |
getAPIs()
Returns the set of APIs for which at least one dimension has identifiers. |
Locale |
getLocale()
Returns the locale used for formatting error messages, or null if none. |
DimensionIdentification |
getOrCreate(DimensionSlice.API api)
Returns the dimension assigned to the given API. |
boolean |
isEmpty()
Returns true if this set doesn't contains any dimension. |
Iterator<DimensionIdentification> |
iterator()
Returns an iterator over all dimensions contained in this set. |
int |
size()
Returns the number of dimensions contained in this set. |
boolean |
warningOccurred(LogRecord record)
Invoked when a warning occurred. |
| Methods inherited from class AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class AbstractCollection |
|---|
add, addAll, containsAll, remove, retainAll, toArray, toArray, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface Set |
|---|
add, addAll, containsAll, remove, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public DimensionSet(MultidimensionalImageStore store)
DimensionSet instance for the given image reader or writer.
store - The image reader or writer for which this instance is created, or null.| Method Detail |
|---|
public void clear()
clear in interface Collection<DimensionIdentification>clear in interface Set<DimensionIdentification>clear in class AbstractCollection<DimensionIdentification>public boolean isEmpty()
true if this set doesn't contains any dimension.
isEmpty in interface Collection<DimensionIdentification>isEmpty in interface Set<DimensionIdentification>isEmpty in class AbstractCollection<DimensionIdentification>public int size()
size in interface Collection<DimensionIdentification>size in interface Set<DimensionIdentification>size in class AbstractCollection<DimensionIdentification>public Iterator<DimensionIdentification> iterator()
iterator in interface Iterable<DimensionIdentification>iterator in interface Collection<DimensionIdentification>iterator in interface Set<DimensionIdentification>iterator in class AbstractCollection<DimensionIdentification>public boolean contains(Object value)
true if this set contains the given dimension.
contains in interface Collection<DimensionIdentification>contains in interface Set<DimensionIdentification>contains in class AbstractCollection<DimensionIdentification>value - The dimension to test for inclusion.
true if this set contains the given dimension.public DimensionIdentification get(DimensionSlice.API api)
null if none.
This method is typically invoked by SpatialImageReader implementations together
with DimensionIdentification.findDimensionIndex(Iterable) in order to locate the
index of the dimension to read as bands. See Assigning a third dimension to bands
in the MultidimensionalImageStore class javadoc.
api - The API for which to test if a dimension slice has been assigned.
null if none.public DimensionIdentification getOrCreate(DimensionSlice.API api)
In order to check if a dimension exists without creating a new one, use the
get(DimensionSlice.API) method instead.
api - The API for which to return a dimension.
public DimensionSlice.API getAPI(Object... identifiers)
null is returned.
identifiers - The identifiers of the dimension to query.
DimensionSlice.API.NONE if none.public Set<DimensionSlice.API> getAPIs()
getOrCreate(...).addDimensionId(...);
public Locale getLocale()
null if none.
The default implementation delegates to the store given at construction time,
if it implements the Localized interface.
getLocale in interface Localizednull if not explicitly defined.public boolean warningOccurred(LogRecord record)
warningOccurred in interface WarningProducerrecord - The warning that occurred.
true if the message has been sent to at least one warning listener,
or false if it has been sent to the logging system as a fallback.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||