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 +
"]";
139 m_attributeTypeTesters = testers;
156 m_attributeTypeTesters = testers;
177 if (!m_attributes.isEmpty())
178 result =
"+" + m_attributes.join(
"+");
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;
208 foreach (tester, m_attributeTypeTesters) {
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),
226 m_attributes.append(attribute);
281 m_attributes.clear();
282 foreach (QString attribute, attributes)
299 foreach (QString attribute, m_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) {
322 QMutableListIterator<QString> it(m_attributes);
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 !=
"") {
345 m_attributes.append(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);
447 std::vector<QString> m_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.
Definition: CubeAttribute.h:162
The label is pointing to an external DN file - the label is also external to the data.
Definition: CubeAttribute.h:56
LabelAttachment LabelAttachmentEnumeration(const QString &labelType)
Return the appropriate LabelType depending on which of the valid values the argument spells...
Definition: CubeAttribute.h:86
QString byteOrderString() const
Return the byte order as a string.
Definition: CubeAttribute.cpp:477
bool propagateMinimumMaximum() const
Return true if the min/max are to be propagated from an input cube.
Definition: CubeAttribute.cpp:193
double maximum() const
Return the output cube attribute maximum.
Definition: CubeAttribute.cpp:325
bool propagatePixelType() const
Return true if the pixel type is to be propagated from an input cube.
Definition: CubeAttribute.cpp:181
File name manipulation and expansion.
Definition: FileName.h:111
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers)
Constructs an empty CubeAttribute.
Definition: CubeAttribute.h:138
void addAttribute(QString attribute)
Add a single attribute to these attributes.
Definition: CubeAttribute.h:194
void addAttributes(const char *attributesString)
Append the attributes in the string to these cube attributes.
Definition: CubeAttribute.h:251
QStringList attributeList(bool(ChildClass::*tester)(QString) const) const
Get a list of attributes that the tester returns true on.
Definition: CubeAttribute.h:296
ByteOrder
Tests the current architecture for byte order.
Definition: Endian.h:59
void setAttributes(const FileName &fileName)
Replaces the current attributes with the attributes in the given file name.
Definition: CubeAttribute.h:278
void setLabelAttachment(LabelAttachment attachment)
Set the label attachment type to the parameter value.
Definition: CubeAttribute.cpp:405
void setFileFormat(Cube::Format fmt)
Set the format to the fmt parameter.
Definition: CubeAttribute.cpp:304
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:154
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:43
CubeAttributeOutput()
Constructs an empty CubeAttributeOutput.
Definition: CubeAttribute.cpp:168
The input label is in a separate data file from the image.
Definition: CubeAttribute.h:49
void setAttribute(QString newValue, bool(ChildClass::*tester)(QString) const)
Set the attribute(s) for which tester returns true to newValue.
Definition: CubeAttribute.h:321
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:485
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:126
QString LabelAttachmentName(LabelAttachment labelType)
Return the string representation of the contents of a variable of type LabelAttachment.
Definition: CubeAttribute.h:68
Cube::Format fileFormat() const
Return the file format an Cube::Format.
Definition: CubeAttribute.cpp:283
QString attributes() const
Definition: FileName.cpp:93
void addAttributes(const QString &attributesString)
Append the attributes in the string to these cube attributes.
Definition: CubeAttribute.h:264
The input label is embedded in the image file.
Definition: CubeAttribute.h:48
double minimum() const
Return the output cube attribute minimum.
Definition: CubeAttribute.cpp:310
void setPixelType(PixelType type)
Set the pixel type to that given by the parameter.
Definition: CubeAttribute.cpp:400
void setMinimum(double min)
Set the output cube attribute minimum.
Definition: CubeAttribute.cpp:340
QString fileFormatString() const
Return the file format as a string.
Definition: CubeAttribute.cpp:299
void addAttributes(const FileName &fileNameWithAtts)
Append the attributes found in the filename to these cube attributes.
Definition: CubeAttribute.h:238
~CubeAttributeOutput()
Destroys the object.
Definition: CubeAttribute.cpp:177
Isis exception class.
Definition: IException.h:99
Definition: BoxcarCachingAlgorithm.h:29
ByteOrder byteOrder() const
Return the byte order as an Isis::ByteOrder.
Definition: CubeAttribute.cpp:463
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers, const FileName &fileName)
Constructs a CubeAttribute using the argument.
Definition: CubeAttribute.h:154
Parent class for CubeAttributeInput and CubeAttributeOutput.
Definition: CubeAttribute.h:134
LabelAttachment labelAttachment() const
Definition: CubeAttribute.cpp:410
QString toString() const
Return a string-representation of this cube attributes.
Definition: CubeAttribute.h:174
LabelAttachment
Input cube label type tracker.
Definition: CubeAttribute.h:47
Format
These are the possible storage formats of Isis3 cubes.
Definition: Cube.h:168
void setByteOrder(ByteOrder order)
Set the order according to the parameter order.
Definition: CubeAttribute.cpp:482
void setMaximum(double max)
Set the output cube attribute maximum.
Definition: CubeAttribute.cpp:358
PixelType pixelType() const
Return the pixel type as an Isis::PixelType.
Definition: CubeAttribute.cpp:376