1 #ifndef CubeAttribute_h
2 #define CubeAttribute_h
29 #include <QStringList>
73 QString msg =
"Invalid label attachment type [" + QString(labelType) +
"]";
87 QString temp = labelType.toUpper();
92 QString msg =
"Invalid label attachment type string [" + labelType +
"]";
195 QString upcaseAtt = attribute.toUpper();
197 if (attribute.contains(
"+")) {
199 "Individual attributes (for example, BSQ) cannot contain the '+' "
200 "character because that is used to denote the separation of individual "
207 bool (ChildClass::*tester)(QString)
const;
209 if ( (static_cast<const ChildClass *>(
this)->*tester)(upcaseAtt) ) {
212 QObject::tr(
"Attribute [%1] is ambiguous").arg(attribute),
222 QObject::tr(
"Attribute [%1] is not recognized").arg(attribute),
279 QStringList attributes = fileName.attributes().split(
"+", QString::SkipEmptyParts);
282 foreach (QString attribute, attributes)
300 QString upcaseAtt = attribute.toUpper();
301 if ( (static_cast<const ChildClass *>(
this)->*tester)(upcaseAtt) ) {
302 relevantAttributes.append(upcaseAtt);
306 return relevantAttributes;
321 void setAttribute(QString newValue,
bool (ChildClass::*tester)(QString)
const) {
325 while (it.hasNext()) {
326 QString &attribute = it.next();
328 QString upcaseAtt = attribute.toUpper();
329 if ( (static_cast<const ChildClass *>(
this)->*tester)(upcaseAtt) ) {
330 if (found || newValue ==
"") {
336 attribute = newValue;
344 if (!found && newValue !=
"") {
420 std::vector<QString>
bands()
const;
436 void setBands(
const std::vector<QString> &bands);
441 bool isBandRange(QString attribute)
const;
443 static QString
toString(
const std::vector<QString> &bands);
562 bool isByteOrder(QString attribute)
const;
563 bool isFileFormat(QString attribute)
const;
564 bool isLabelAttachment(QString attribute)
const;
565 bool isPixelType(QString attribute)
const;
566 bool isRange(QString attribute)
const;
virtual ~CubeAttribute()
Destroys the object.
The label is pointing to an external DN file - the label is also external to the data.
LabelAttachment LabelAttachmentEnumeration(const QString &labelType)
Return the appropriate LabelType depending on which of the valid values the argument spells...
QString byteOrderString() const
Return the byte order as a string.
bool propagateMinimumMaximum() const
Return true if the min/max are to be propagated from an input cube.
double maximum() const
Return the output cube attribute maximum.
bool propagatePixelType() const
Return true if the pixel type is to be propagated from an input cube.
File name manipulation and expansion.
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers)
Constructs an empty CubeAttribute.
void addAttribute(QString attribute)
Add a single attribute to these attributes.
void addAttributes(const char *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.
ByteOrder
Tests the current architecture for byte order.
void setAttributes(const FileName &fileName)
Replaces the current attributes with the attributes in the given file name.
void setLabelAttachment(LabelAttachment attachment)
Set the label attachment type to the parameter value.
void setFileFormat(Cube::Format fmt)
Set the format to the fmt parameter.
This error is for when a programmer made an API call that was illegal.
QList< bool(ChildClass::*)(QString) const > m_attributeTypeTesters
These testers determine if an attribute looks like a particular option.
PixelType
Enumerations for Isis Pixel Types.
CubeAttributeOutput()
Constructs an empty CubeAttributeOutput.
The input label is in a separate data file from the image.
void setAttribute(QString newValue, bool(ChildClass::*tester)(QString) const)
Set the attribute(s) for which tester returns true to newValue.
QStringList m_attributes
These are the attributes that this cube attribute stores.
#define _FILEINFO_
Macro for the filename and line number.
Manipulate and parse attributes of output cube filenames.
A type of error that cannot be classified as any of the other error types.
QString LabelAttachmentName(LabelAttachment labelType)
Return the string representation of the contents of a variable of type LabelAttachment.
Cube::Format fileFormat() const
Return the file format an Cube::Format.
void addAttributes(const QString &attributesString)
Append the attributes in the string to these cube attributes.
The input label is embedded in the image file.
double minimum() const
Return the output cube attribute minimum.
void setPixelType(PixelType type)
Set the pixel type to that given by the parameter.
void setMinimum(double min)
Set the output cube attribute minimum.
QString fileFormatString() const
Return the file format as a string.
void addAttributes(const FileName &fileNameWithAtts)
Append the attributes found in the filename to these cube attributes.
RangeType
Output cube range tracker.
~CubeAttributeOutput()
Destroys the object.
Propagate the range from an input cube.
ByteOrder byteOrder() const
Return the byte order as an Isis::ByteOrder.
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers, const FileName &fileName)
Constructs a CubeAttribute using the argument.
Parent class for CubeAttributeInput and CubeAttributeOutput.
QString toString() const
Return a string-representation of this cube attributes.
LabelAttachment
Input cube label type tracker.
Format
These are the possible storage formats of Isis3 cubes.
void setByteOrder(ByteOrder order)
Set the order according to the parameter order.
void setMaximum(double max)
Set the output cube attribute maximum.
PixelType pixelType() const
Return the pixel type as an Isis::PixelType.