Isis 3 Programmer Reference
AdvancedStretch.cpp
1 #include "AdvancedStretch.h"
2 
3 #include <QStackedWidget>
4 #include <QVBoxLayout>
5 #include <QHBoxLayout>
6 #include <QLabel>
7 #include <QComboBox>
8 
9 #include "Stretch.h"
10 #include "IString.h"
11 #include "IException.h"
12 #include "StretchType.h"
13 #include "LinearStretchType.h"
14 #include "SawtoothStretchType.h"
15 #include "BinaryStretchType.h"
16 #include "ManualStretchType.h"
17 
18 namespace Isis {
28  const Stretch &curStretch,
29  const QString &name, const QColor &color) {
30  setLayout(new QVBoxLayout());
31 
32  setSizePolicy(QSizePolicy::MinimumExpanding,
33  QSizePolicy::MinimumExpanding);
34  QWidget *typeSelectionArea = new QWidget();
35  typeSelectionArea->setLayout(new QHBoxLayout());
36  typeSelectionArea->layout()->addWidget(new QLabel("Stretch Type"));
37 
38  QComboBox *stretchTypeSelection = new QComboBox();
39  stretchTypeSelection->addItem("Linear", 0);
40  stretchTypeSelection->addItem("Sawtooth", 1);
41  stretchTypeSelection->addItem("Binary", 2);
42  stretchTypeSelection->addItem("Manual", 3);
43 
44  typeSelectionArea->layout()->addWidget(stretchTypeSelection);
45  layout()->addWidget(typeSelectionArea);
46 
47  p_stretchTypeStack = new QStackedWidget();
48  LinearStretchType *linear = new LinearStretchType(hist, curStretch,
49  name, color);
50  connect(linear, SIGNAL(stretchChanged()), this, SIGNAL(stretchChanged()));
51  p_stretchTypeStack->addWidget(linear);
52 
53  SawtoothStretchType *sawtooth = new SawtoothStretchType(hist, curStretch,
54  name, color);
55  connect(sawtooth, SIGNAL(stretchChanged()), this, SIGNAL(stretchChanged()));
56  p_stretchTypeStack->addWidget(sawtooth);
57 
58  BinaryStretchType *binary = new BinaryStretchType(hist, curStretch,
59  name, color);
60  connect(binary, SIGNAL(stretchChanged()), this, SIGNAL(stretchChanged()));
61  p_stretchTypeStack->addWidget(binary);
62 
63  ManualStretchType *manual = new ManualStretchType(hist, curStretch,
64  name, color);
65  connect(manual, SIGNAL(stretchChanged()), this, SIGNAL(stretchChanged()));
66  p_stretchTypeStack->addWidget(manual);
67 
68  layout()->addWidget(p_stretchTypeStack);
69  connect(stretchTypeSelection, SIGNAL(currentIndexChanged(int)),
70  p_stretchTypeStack, SLOT(setCurrentIndex(int)));
71  connect(stretchTypeSelection, SIGNAL(currentIndexChanged(int)),
72  this, SIGNAL(stretchChanged()));
73  }
74 
75 
80  }
81 
82 
89  return ((StretchType *)p_stretchTypeStack->currentWidget())->getStretch();
90  }
91 
92 
102  StretchType *stretchType = (StretchType *)
103  p_stretchTypeStack->currentWidget();
104  stretchType->setStretch(newStretch);
105  }
106 
107 
117  for(int stretch = 0; stretch < p_stretchTypeStack->count(); stretch ++) {
118  StretchType *stretchType = (StretchType *)
119  p_stretchTypeStack->widget(stretch);
120  stretchType->setHistogram(newHist);
121  }
122  }
123 };
QStackedWidget * p_stretchTypeStack
StretchType&#39;s.
AdvancedStretch(Histogram &, const Stretch &, const QString &, const QColor &)
This constructs an advanced stretch.
This handles the advanced sawtooth stretch.
~AdvancedStretch()
Destructor.
void stretchChanged()
Emitted when a new stretch is available.
void setHistogram(const Histogram &newHist)
This is called when the visible area changes, so that the histogram can be updated.
Container of a cube histogram.
Definition: Histogram.h:86
Pixel value mapper.
Definition: Stretch.h:72
virtual void setHistogram(const Histogram &)
This should be called when the visible area changes.
Definition: StretchType.cpp:91
void setStretch(Stretch newStretch)
This is called when the user creates a stretch outside of the advanced stretch.
virtual void setStretch(Stretch)=0
Children must re-implement this to update their stretch pairs and GUI elements appropriately.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
This is the base class for advanced stretches.
Definition: StretchType.h:38
This handles the advanced linear stretch.
This handles the advanced binary stretch.
Stretch getStretch()
This returns the current stretch type&#39;s stretch.
This handles arbitrary user-input stretches.