18#include "IException.h"
35 if(labelType == Cube::GdalLabel)
return "Gdal";
37 QString msg =
"Invalid label attachment type [" + QString::number(labelType) +
"]";
38 throw IException(IException::Programmer, msg, _FILEINFO_);
51 QString temp = labelType.toUpper();
55 if(temp ==
"GDAL")
return Cube::GdalLabel;
57 QString msg =
"Invalid label attachment type string [" + labelType +
"]";
58 throw IException(IException::Unknown, msg, _FILEINFO_);
118 const FileName &fileName) {
158 QString upcaseAtt = attribute.toUpper();
160 if (attribute.contains(
"+")) {
161 throw IException(IException::Unknown,
162 "Individual attributes (for example, BSQ) cannot contain the '+' "
163 "character because that is used to denote the separation of individual "
170 bool (ChildClass::*tester)(QString)
const;
172 if ( (
static_cast<const ChildClass *
>(
this)->*tester)(upcaseAtt) ) {
174 throw IException(IException::Unknown,
175 QObject::tr(
"Attribute [%1] is ambiguous").arg(attribute),
184 throw IException(IException::Unknown,
185 QObject::tr(
"Attribute [%1] is not recognized").arg(attribute),
242 QStringList attributes = fileName.attributes().split(
"+", Qt::SkipEmptyParts);
245 foreach (QString attribute, attributes)
263 QString upcaseAtt = attribute.toUpper();
264 if ( (
static_cast<const ChildClass *
>(
this)->*tester)(upcaseAtt) ) {
265 relevantAttributes.append(upcaseAtt);
269 return relevantAttributes;
284 void setAttribute(QString newValue,
bool (ChildClass::*tester)(QString)
const) {
288 while (it.hasNext()) {
289 QString &attribute = it.next();
291 QString upcaseAtt = attribute.toUpper();
292 if ( (
static_cast<const ChildClass *
>(
this)->*tester)(upcaseAtt) ) {
293 if (found || newValue ==
"") {
299 attribute = newValue;
307 if (!found && newValue !=
"") {
385 std::vector<QString>
bands()
const;
406 bool isBandRange(QString attribute)
const;
533 bool isByteOrder(QString attribute)
const;
534 bool isFileFormat(QString attribute)
const;
535 bool isLabelAttachment(QString attribute)
const;
536 bool isPixelType(QString attribute)
const;
537 bool isRange(QString attribute)
const;
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers, const FileName &fileName)
Constructs a CubeAttribute using the argument.
void addAttributes(const FileName &fileNameWithAtts)
Append the attributes found in the filename to these cube attributes.
void addAttribute(QString attribute)
Add a single attribute to these attributes.
QString toString() const
Return a string-representation of this cube attributes.
virtual ~CubeAttribute()
Destroys the object.
void addAttributes(const QString &attributesString)
Append the attributes in the string to these cube attributes.
QStringList attributeList(bool(ChildClass::*tester)(QString) const) const
Get a list of attributes that the tester returns true on.
QList< bool(ChildClass::*)(QString) const > m_attributeTypeTesters
These testers determine if an attribute looks like a particular option.
void setAttributes(const FileName &fileName)
Replaces the current attributes with the attributes in the given file name.
QStringList m_attributes
These are the attributes that this cube attribute stores.
void setAttribute(QString newValue, bool(ChildClass::*tester)(QString) const)
Set the attribute(s) for which tester returns true to newValue.
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers)
Constructs an empty CubeAttribute.
void addAttributes(const char *attributesString)
Append the attributes in the string to these cube attributes.
Manipulate and parse attributes of output cube filenames.
double minimum() const
Return the output cube attribute minimum.
ByteOrder byteOrder() const
Return the byte order as an Isis::ByteOrder.
double maximum() const
Return the output cube attribute maximum.
void setByteOrder(ByteOrder order)
Set the order according to the parameter order.
bool propagateFileFormat() const
Return true if the file format 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.
bool propagatePixelType() const
Return true if the pixel type is 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 setLabelAttachment(Cube::LabelAttachment attachment)
Set the label attachment type to the parameter value.
QString byteOrderString() const
Return the byte order as a string.
CubeAttributeOutput()
Constructs an empty CubeAttributeOutput.
PixelType pixelType() const
Return the pixel type as an Isis::PixelType.
void setMinimum(double min)
Set the output cube attribute minimum.
void setMaximum(double max)
Set the output cube attribute maximum.
~CubeAttributeOutput()
Destroys the object.
void setPixelType(PixelType type)
Set the pixel type to that given by the parameter.
void setFileFormat(Cube::Format fmt)
Set the format to the fmt parameter.
RangeType
Output cube range tracker.
@ PropagateRange
Propagate the range from an input cube.
@ RangeSet
The range has been set.
LabelAttachment
Input cube label type tracker.
@ ExternalLabel
The label is pointing to an external DN file - the label is also external to the data.
@ AttachedLabel
The input label is embedded in the image file.
@ DetachedLabel
The input label is in a separate data file from the image.
Format
These are the possible storage formats of ISIS cubes.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
QString LabelAttachmentName(Cube::LabelAttachment labelType)
Return the string representation of the contents of a variable of type LabelAttachment.
Cube::LabelAttachment LabelAttachmentEnumeration(const QString &labelType)
Return the appropriate LabelType depending on which of the valid values the argument spells.