|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectDimensionIdentification
public class DimensionIdentification
Identifies a domain dimension by its index, its name or its axis direction. This class is relevant mostly for n-dimensional datasets where n>2. The dimension can be identified in any of the following ways:
As a zero-based index using an Integer. This is the most straightforward approach
when the set of dimensions is known.
Example: If the dimensions are known to be (x, y, z, t), then the t dimension can be identified by the index 3.
As a dimension name using a String. This is a better approach than indexes when
dimensions have known names, because it is insensitive to dimension order and whatever other
dimensions exist or not.
Example: If the list of dimensions can be either ("longitude","latitude","depth","time") or ("latitude","longitude","time"), then the index of the time dimension can be either 3 or 2. It is better to identify the time dimension by its name:"time".
As a direction using an AxisDirection. This provides similar benefit to using
a named dimension, but can work without knowledge of the actual name. It can also be used
with file formats that don't support named dimensions.
"height" and "depth". In case of ambiguity, a warning will be emitted to any registered listeners at image reading or writing time.
See the DimensionSlice javadoc for usage examples.
MultidimensionalImageStore,
IllegalImageDimensionException
| coverage/geotk-coverageio (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from interface WarningProducer |
|---|
LOGGER |
| Constructor Summary | |
|---|---|
protected |
DimensionIdentification(DimensionSet owner,
DimensionSlice.API api)
Creates a new DimensionIdentification instance for the given API. |
| Method Summary | |
|---|---|
void |
addDimensionId(AxisDirection... axes)
Adds an identifier for the dimension represented by this object. |
void |
addDimensionId(int index)
Declares the index for the dimension represented by this object. |
void |
addDimensionId(String... names)
Adds an identifier for the dimension represented by this object. |
int |
findDimensionIndex(Iterable<?> properties)
Returns the index of this dimension in a data file. |
Object[] |
getDimensionIds()
Returns all identifiers for this dimension. |
Locale |
getLocale()
Returns the locale used for formatting error messages, or null if none. |
boolean |
hasDimensionIds()
Returns true if this dimension contains at least one identifier. |
void |
removeDimensionId(Object... identifiers)
Removes identifiers for the dimension represented by this object. |
String |
toString()
Returns a string representation of this object. |
boolean |
warningOccurred(LogRecord record)
Invoked when a warning occurred. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected DimensionIdentification(DimensionSet owner,
DimensionSlice.API api)
throws IllegalArgumentException
DimensionIdentification instance for the given API. This
constructor is protected for subclasses usage only. The public API for fetching
new instances is the DimensionSet.getOrCreate(DimensionSlice.API) method.
owner - The collection that created this object.api - The API to assign to this dimension.
IllegalArgumentException - If an other dimension is already assigned to the given API.| Method Detail |
|---|
public void addDimensionId(int index)
throws IllegalArgumentException
addDimensionId(3); setSliceIndex(25);
Note: ThesetSliceIndex(int)method is available only if this object is actually an instance ofDimensionSlice.
index - The index of the dimension. Must be non-negative.
IllegalArgumentException - If the given dimension index is negative
or already assigned to an other DimensionSlice instance.
public void addDimensionId(String... names)
throws IllegalArgumentException
addDimensionId("time");
setSliceIndex(25);
Note: TheMore than one name can be specified if they should be considered as possible identifiers for the same dimension. For example in order to set the index for the z dimension, it may be necessary to specify both thesetSliceIndex(int)method is available only if this object is actually an instance ofDimensionSlice.
"height" and "depth" names.
names - The names of the dimension.
IllegalArgumentException - If a name is already assigned to an
other DimensionSlice instance.
public void addDimensionId(AxisDirection... axes)
throws IllegalArgumentException
addDimensionId(AxisDirection.FUTURE); setSliceIndex(25);
Note: TheMore than one direction can be specified if they should be considered as possible identifiers for the same dimension. For example in order to set the index for the z dimension, it may be necessary to specify both thesetSliceIndex(int)method is available only if this object is actually an instance ofDimensionSlice.
UP and
DOWN directions.
axes - The axis directions of the dimension.
IllegalArgumentException - If a name is already assigned to an
other DimensionSlice instance.public void removeDimensionId(Object... identifiers)
identifiers
argument can contain the identifiers given to any addDimensionId(...) method.
Unknown identifiers are silently ignored.
identifiers - The identifiers to remove.public Object[] getDimensionIds()
addDimensionId(...) method call on this instance.
public boolean hasDimensionIds()
true if this dimension contains at least one identifier. Invoking
this method is equivalent to the code below, but is potentially more efficient:
boolean hasDimensionIds = (getDimensionIds().length != 0);
true if this dimension contains at least one identifier.public int findDimensionIndex(Iterable<?> properties)
SpatialImageReader or SpatialImageWriter subclasses when a dataset
is about to be read from a file, or written to a file. The caller needs to know the
set of dimensions that exist in the file dataset, which may not be identical to the set
of dimensions declared in SpatialImageReadParam or SpatialImageWriteParam.
The default implementation makes the following choice:
If addDimensionId(int) has been invoked, then the value specified to
that method is returned regardless the properties argument value.
Otherwise if an other addDimensionId(...) method
has been invoked and the properties argument is non-null, then this method
iterates over the given properties. The iteration must return exactly one element
for each dimension, in order. If an element is equals to a value specified to a
addDimensionId(...) method, then the position of that element in the
properties iteration is returned.
Otherwise this method returns -1.
properties - Contains one property (the dimension name as a String or the axis
direction as an AxisDirection) for each dimension in the dataset being read
or written. The iteration order shall be the order of dimensions in the dataset. This
argument can be null if no such properties are available.
public Locale getLocale()
null if none.
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.public String toString()
toString in class ObjectSpatialImageReadParam.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||