1 #include "ImageTreeWidgetItem.h"
7 #include "DisplayProperties.h"
10 #include "IException.h"
12 #include "ImageList.h"
13 #include "ImageTreeWidget.h"
14 #include "SpecialPixel.h"
29 m_imageList = imageList;
33 connect(displayProps, SIGNAL(supportAdded(
int)),
this, SLOT(onDisplayPropertiesChanged()));
36 setColumnValue(ResolutionColumn, m_image->
resolution());
40 setColumnValue(AspectRatioColumn, m_image->
aspectRatio());
45 setFlags(Qt::ItemIsEnabled |
46 Qt::ItemIsUserCheckable |
47 Qt::ItemIsSelectable |
48 Qt::ItemIsDragEnabled |
49 Qt::ItemIsDropEnabled);
55 ImageTreeWidgetItem::~ImageTreeWidgetItem() {
59 Image *ImageTreeWidgetItem::image() {
64 QString ImageTreeWidgetItem::imageListName()
const {
65 return m_imageList->
name();
69 void ImageTreeWidgetItem::forgetImage() {
74 void ImageTreeWidgetItem::update(
bool save) {
80 displayProps->
setShowFill(checkState(FootprintColumn));
83 displayProps->setShowOutline(checkState(OutlineColumn));
86 displayProps->setShowDNs(checkState(ImageColumn));
89 displayProps->setShowLabel(checkState(LabelColumn));
92 displayProps->setSelected(isSelected() || parent()->isSelected());
97 setBackground(NameColumn,
103 setCheckState(FootprintColumn,
107 setCheckState(OutlineColumn,
111 setCheckState(ImageColumn,
115 setCheckState(LabelColumn,
118 bool displaySelected =
122 if (displaySelected && !isSelected() && !parent()->isSelected()) {
125 else if (!displaySelected && (isSelected() || parent()->isSelected())) {
127 parent()->setSelected(
false);
135 Qt::CheckState ImageTreeWidgetItem::toCheck(QVariant var) {
139 return Qt::Unchecked;
143 QString ImageTreeWidgetItem::treeColumnToString(TreeColumn column) {
147 case FootprintColumn:
156 case ResolutionColumn:
158 case EmissionAngleColumn:
159 return "Emission Angle";
160 case IncidenceAngleColumn:
161 return "Incidence Angle";
162 case PhaseAngleColumn:
163 return "Phase Angle";
164 case AspectRatioColumn:
165 return "Aspect Ratio";
166 case SampleResolutionColumn:
167 return "Sample Resolution";
168 case LineResolutionColumn:
169 return "Line Resolution";
170 case NorthAzimuthColumn:
171 return "North Azimuth";
178 "Invalid tree column passed to treeColumnToString", _FILEINFO_);
182 void ImageTreeWidgetItem::onDisplayPropertiesChanged() {
183 ImageTreeWidget *tree = qobject_cast<ImageTreeWidget *>(treeWidget());
186 tree->enqueueReadDisplayProperties(
this);
194 void ImageTreeWidgetItem::setColumnValue(TreeColumn column,
double value) {
196 setText(column, QString::number(value));
201 bool ImageTreeWidgetItem::operator<(
const QTreeWidgetItem &other)
const {
202 int column = treeWidget()->sortColumn();
204 switch((TreeColumn)column) {
205 case FootprintColumn:
210 return text(column) < other.text(column);
212 case EmissionAngleColumn:
213 case IncidenceAngleColumn:
214 case PhaseAngleColumn:
215 case ResolutionColumn:
216 case AspectRatioColumn:
217 case SampleResolutionColumn:
218 case LineResolutionColumn:
219 case NorthAzimuthColumn:
220 return text(column).toDouble() <
221 other.text(column).toDouble();