Isis Developer Reference
|
Manipulate and parse attributes of output cube filenames. More...
#include <CubeAttribute.h>
Public Member Functions | |
CubeAttributeOutput () | |
Constructs an empty CubeAttributeOutput. | |
CubeAttributeOutput (const FileName &fileName) | |
Constructs a CubeAttributeOutput and initialized it with the contents of the string parameter. | |
~CubeAttributeOutput () | |
Destroys the object. | |
bool | propagatePixelType () const |
Return true if the pixel type is to be propagated from an input cube. | |
bool | propagateMinimumMaximum () const |
Return true if the min/max are to be propagated from an input cube. | |
Cube::Format | fileFormat () const |
Return the file format an Cube::Format. | |
QString | fileFormatString () const |
Return the file format as a string. | |
void | setFileFormat (Cube::Format fmt) |
Set the format to the fmt parameter. | |
ByteOrder | byteOrder () const |
Return the byte order as an Isis::ByteOrder. | |
QString | byteOrderString () const |
Return the byte order as a string. | |
void | setByteOrder (ByteOrder order) |
Set the order according to the parameter order. | |
double | minimum () const |
Return the output cube attribute minimum. | |
double | maximum () const |
Return the output cube attribute maximum. | |
void | setMinimum (double min) |
Set the output cube attribute minimum. | |
void | setMaximum (double max) |
Set the output cube attribute maximum. | |
PixelType | pixelType () const |
Return the pixel type as an Isis::PixelType. | |
void | setPixelType (PixelType type) |
Set the pixel type to that given by the parameter. | |
void | setLabelAttachment (LabelAttachment attachment) |
Set the label attachment type to the parameter value. | |
LabelAttachment | labelAttachment () const |
QString | toString () const |
Return a string-representation of this cube attributes. | |
void | addAttribute (QString attribute) |
Add a single attribute to these attributes. | |
void | addAttributes (const FileName &fileNameWithAtts) |
Append the attributes found in the filename to these cube attributes. | |
void | addAttributes (const char *attributesString) |
Append the attributes in the string to these cube attributes. | |
void | addAttributes (const QString &attributesString) |
Append the attributes in the string to these cube attributes. | |
void | setAttributes (const FileName &fileName) |
Replaces the current attributes with the attributes in the given file name. | |
Protected Member Functions | |
QStringList | attributeList (bool(ChildClass::*tester)(QString) const) const |
Get a list of attributes that the tester returns true on. | |
void | setAttribute (QString newValue, bool(ChildClass::*tester)(QString) const) |
Set the attribute(s) for which tester returns true to newValue. | |
Manipulate and parse attributes of output cube filenames.
This class provides parsing and manipulation of attributes associated with output cube filenames. Output cube filenames can have an attributes of "minimum:maximum", "pixel type", "file format", "byte order", and "label placement"
Isis::CubeAttributeOutput::CubeAttributeOutput | ( | ) |
Constructs an empty CubeAttributeOutput.
Isis::CubeAttributeOutput::CubeAttributeOutput | ( | const FileName & | fileName | ) |
Constructs a CubeAttributeOutput and initialized it with the contents of the string parameter.
The string is parased to obtain any min/max, pixel type, byte order, file format or label placement. Any attribute information that is not valie for an output cube will throw an error.
att | A string containing the file attributes. All characters before the first "+" are assumed to be the filename and are ignored. |
Isis::CubeAttributeOutput::~CubeAttributeOutput | ( | ) |
Destroys the object.
|
inlineinherited |
Add a single attribute to these attributes.
This attribute should NOT have a '+' in it. For example, if you wanted to add BandSequential to the CubeAttributeOutput class, you could call addAttribute("BSQ") or addAttribute("BandSequential") or any valid deviation of that string. This will preserve existing attributes unless it's of the same type (if Tile was already set, then this will overwrite Tile). If the attribute is unrecognized or ambiguous, then an exception will be thrown.
attribute | The attribute we're adding to the current cube attributes |
|
inlineinherited |
Append the attributes in the string to these cube attributes.
This will call addAttribute() for every attribute in the string. The initial "+" is not expected but allowed. This should NOT be called with a file name.
attributesString | A string of recognizable attributes, for example "+Bsq+Real" or "Bsq+Real" |
|
inlineinherited |
Append the attributes found in the filename to these cube attributes.
This will call addAttribute() for every attribute found in the file name.
fileNameWithAtts | A filename with attributes appended, for example FileName("out.cub+Bsq") |
|
inlineinherited |
Append the attributes in the string to these cube attributes.
attributesString | A string of recognizable attributes, for example "+Bsq+Real" or "Bsq+Real" |
|
inlineprotectedinherited |
Get a list of attributes that the tester returns true on.
This is helpful for accessing the values of existing attributes. The strings will always be the UPPER CASE version of the attribute, i.e. not Bsq but BSQ. The returned attributes do not contain delimiters.
tester | A method that determines whether the attribute should be returned/is relevant |
ByteOrder Isis::CubeAttributeOutput::byteOrder | ( | ) | const |
Return the byte order as an Isis::ByteOrder.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::IsLsb(), Isis::Lsb, and Isis::Msb.
Referenced by byteOrderString().
QString Isis::CubeAttributeOutput::byteOrderString | ( | ) | const |
Return the byte order as a string.
References byteOrder(), and Isis::ByteOrderName().
Cube::Format Isis::CubeAttributeOutput::fileFormat | ( | ) | const |
Return the file format an Cube::Format.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Cube::Bsq, and Isis::Cube::Tile.
Referenced by fileFormatString().
QString Isis::CubeAttributeOutput::fileFormatString | ( | ) | const |
Return the file format as a string.
References fileFormat(), and Isis::CubeAttribute< CubeAttributeOutput >::toString().
LabelAttachment Isis::CubeAttributeOutput::labelAttachment | ( | ) | const |
double Isis::CubeAttributeOutput::maximum | ( | ) | const |
Return the output cube attribute maximum.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Null, propagateMinimumMaximum(), and Isis::toDouble().
Referenced by setMinimum().
double Isis::CubeAttributeOutput::minimum | ( | ) | const |
Return the output cube attribute minimum.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Null, propagateMinimumMaximum(), and Isis::toDouble().
Referenced by setMaximum().
PixelType Isis::CubeAttributeOutput::pixelType | ( | ) | const |
Return the pixel type as an Isis::PixelType.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::None, propagatePixelType(), Isis::Real, Isis::SignedInteger, Isis::SignedWord, Isis::UnsignedByte, Isis::UnsignedInteger, and Isis::UnsignedWord.
bool Isis::CubeAttributeOutput::propagateMinimumMaximum | ( | ) | const |
Return true if the min/max are to be propagated from an input cube.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList().
bool Isis::CubeAttributeOutput::propagatePixelType | ( | ) | const |
Return true if the pixel type is to be propagated from an input cube.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList().
Referenced by pixelType().
|
inlineprotectedinherited |
Set the attribute(s) for which tester returns true to newValue.
If multiple attributes match (tester returns true on them), only the first one is preserved and it's value becomes newValue. Subsequent matching attributes are removed/deleted. This is done to simplify the resulting attribute string to be minimal with this particular attribute.
newValue | The string to set the attribute to... tester(newValue) really ought to return true. |
tester | A method that determines if an attribute is of the same type of newValue, so that existing attributes can be overwritten. |
|
inlineinherited |
Replaces the current attributes with the attributes in the given file name.
This will call addAttribute() for every attribute in the file name.
fileName | A file name with (or without) attributes on the end, for example FileName("out.cub+Bsq") |
void Isis::CubeAttributeOutput::setByteOrder | ( | ByteOrder | order | ) |
Set the order according to the parameter order.
References Isis::Msb, and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().
void Isis::CubeAttributeOutput::setFileFormat | ( | Cube::Format | fmt | ) |
Set the format to the fmt parameter.
References Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::Cube::Tile.
void Isis::CubeAttributeOutput::setLabelAttachment | ( | LabelAttachment | attachment | ) |
Set the label attachment type to the parameter value.
References Isis::LabelAttachmentName(), and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().
void Isis::CubeAttributeOutput::setMaximum | ( | double | max | ) |
Set the output cube attribute maximum.
References Isis::IsSpecial(), minimum(), Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::toString().
void Isis::CubeAttributeOutput::setMinimum | ( | double | min | ) |
Set the output cube attribute minimum.
References Isis::IsSpecial(), maximum(), Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::toString().
void Isis::CubeAttributeOutput::setPixelType | ( | PixelType | type | ) |
Set the pixel type to that given by the parameter.
References Isis::PixelTypeName(), and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().
|
inlineinherited |
Return a string-representation of this cube attributes.
This will typically be exactl the string passed in if you used setAttributes(...). This can be an empty string ("") or if there are attributes then it will be +att1+att2+... The result of this method could be used to re-create this instance.