1 #ifndef CubeAttribute_h 2 #define CubeAttribute_h 29 #include <QStringList> 73 QString msg =
"Invalid label attachment type [" + QString::number(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);
422 std::vector<QString>
bands()
const;
443 bool isBandRange(QString attribute)
const;
449 std::vector<QString> m_bands;
566 bool isByteOrder(QString attribute)
const;
567 bool isFileFormat(QString attribute)
const;
568 bool isLabelAttachment(QString attribute)
const;
569 bool isPixelType(QString attribute)
const;
570 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
PixelType pixelType() const
Return the pixel type as an Isis::PixelType.
Definition: CubeAttribute.cpp:376
LabelAttachment LabelAttachmentEnumeration(const QString &labelType)
Return the appropriate LabelType depending on which of the valid values the argument spells...
Definition: CubeAttribute.h:86
ByteOrder byteOrder() const
Return the byte order as an Isis::ByteOrder.
Definition: CubeAttribute.cpp:471
File name manipulation and expansion.
Definition: FileName.h:116
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
ByteOrder
Tests the current architecture for byte order.
Definition: Endian.h:59
bool propagatePixelType() const
Return true if the pixel type is to be propagated from an input cube.
Definition: CubeAttribute.cpp:181
void setAttributes(const FileName &fileName)
Replaces the current attributes with the attributes in the given file name.
Definition: CubeAttribute.h:278
bool propagateMinimumMaximum() const
Return true if the min/max are to be propagated from an input cube.
Definition: CubeAttribute.cpp:193
void setLabelAttachment(LabelAttachment attachment)
Set the label attachment type to the parameter value.
Definition: CubeAttribute.cpp:411
void setFileFormat(Cube::Format fmt)
Set the format to the fmt parameter.
Definition: CubeAttribute.cpp:304
QString byteOrderString() const
Return the byte order as a string.
Definition: CubeAttribute.cpp:485
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
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:40
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:489
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
QString LabelAttachmentName(LabelAttachment labelType)
Return the string representation of the contents of a variable of type LabelAttachment.
Definition: CubeAttribute.h:68
double maximum() const
Return the output cube attribute maximum.
Definition: CubeAttribute.cpp:325
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
Cube::Format fileFormat() const
Return the file format an Cube::Format.
Definition: CubeAttribute.cpp:283
void setPixelType(PixelType type)
Set the pixel type to that given by the parameter.
Definition: CubeAttribute.cpp:406
QString fileFormatString() const
Return the file format as a string.
Definition: CubeAttribute.cpp:299
void setMinimum(double min)
Set the output cube attribute minimum.
Definition: CubeAttribute.cpp:340
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
LabelAttachment labelAttachment() const
Definition: CubeAttribute.cpp:416
Isis exception class.
Definition: IException.h:107
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers)
Constructs an empty CubeAttribute.
Definition: CubeAttribute.h:138
Parent class for CubeAttributeInput and CubeAttributeOutput.
Definition: CubeAttribute.h:134
QString attributes() const
Returns a QString of the attributes in a filename, attributes are expected to be of type CubeAttribut...
Definition: FileName.cpp:137
double minimum() const
Return the output cube attribute minimum.
Definition: CubeAttribute.cpp:310
LabelAttachment
Input cube label type tracker.
Definition: CubeAttribute.h:47
Format
These are the possible storage formats of Isis3 cubes.
Definition: Cube.h:180
QString toString() const
Return a string-representation of this cube attributes.
Definition: CubeAttribute.h:174
void setByteOrder(ByteOrder order)
Set the order according to the parameter order.
Definition: CubeAttribute.cpp:490
void setMaximum(double max)
Set the output cube attribute maximum.
Definition: CubeAttribute.cpp:358
CubeAttribute(QList< bool(ChildClass::*)(QString) const > testers, const FileName &fileName)
Constructs a CubeAttribute using the argument.
Definition: CubeAttribute.h:154
QStringList attributeList(bool(ChildClass::*tester)(QString) const) const
Get a list of attributes that the tester returns true on.
Definition: CubeAttribute.h:296