Isis 3.0 Programmer Reference
Back | Home
ChipViewport.h
Go to the documentation of this file.
1 #ifndef ChipViewport_h
2 #define ChipViewport_h
3 
26 #include <QPaintEvent>
27 #include <QResizeEvent>
28 #include <QWidget>
29 
30 #include "Chip.h"
31 #include "Histogram.h"
32 #include "Stretch.h"
33 
34 class QImage;
35 
36 namespace Isis {
37  class ControlNet;
38  class CubeViewport;
39 
85  class ChipViewport : public QWidget {
86  Q_OBJECT
87 
88 
89  public:
90  ChipViewport(int width, int height, QWidget *parent = 0);
91  virtual ~ChipViewport();
92 
93  bool cubeToViewport(double samp, double line, int &x, int &y);
94 
96  void setChip(Chip *chip, Cube *chipCube);
97 
99  void loadView(ChipViewport &newView);
100 
102  Chip *chip() const {
103  return m_chip;
104  };
105 
106  Cube *chipCube() const {
107  return m_chipCube;
108  };
109 
111  int chipSamples() const {
112  return m_chip->Samples();
113  };
114 
116  int chipLines() const {
117  return m_chip->Lines();
118  };
119 
121  int grayBand() const {
122  return m_gray.band;
123  };
124 
126  double tackSample();
127  double tackLine();
128 
130  double zoomFactor();
131 
133  //void markPoint (double sample, double line);
134 
137  return m_gray.stretch;
138  };
139 
140 
141  signals:
143  void tackPointChanged(double);
144 
145  // TODO: This needs better name, tackPointChanged signal is emitted
146  // even if user does not initiate, maybe change tackPointChanged signal
147  // to only emit if user moves the tack point???
148  void userMovedTackPoint();
149 
150 
151  public slots:
152  void autoStretch();
154  void changeStretchLock(int);
155  void setPoints(bool checked);
156  void setCross(bool checked);
157  void rotateChip(int rotation);
158  void setCircle(bool checked);
159  void setCircleSize(int size);
160 
161  void geomChip(Chip *matchChip, Cube *matchChipCube);
162  void nogeomChip();
163 
164  void panUp();
165  void panDown();
166  void panLeft();
167  void panRight();
168 
169  void zoomIn();
170  void zoomOut();
171  void zoom1();
172  void zoom(double zoomFactor);
173 
174  void refreshView(double tackSample, double tackLine);
175 
181  void setControlNet(ControlNet *newControlNet) {
182  m_controlNet = newControlNet;
183  }
184 
185 
186  protected:
187  void paintEvent(QPaintEvent *e);
188  void enterEvent(QEvent *e);
189  void keyPressEvent(QKeyEvent *e);
190  void mousePressEvent(QMouseEvent *event);
191 
192 
193  private:
194  void reloadChip(double tackSample = 0., double tackLine = 0.);
195 
196  void computeStretch(Stretch &stretch, bool force = false);
197  void paintImage();
198 
206  class BandInfo {
207  public:
208  int band;
210  BandInfo() {
212  band = 1;
213  stretch.SetNull(0.0);
214  stretch.SetLis(0.0);
215  stretch.SetLrs(0.0);
216  stretch.SetHis(255.0);
217  stretch.SetHrs(255.0);
218  };
219  };
220 
224 
225  int m_width;
226  int m_height;
227 
228  bool m_geomIt;
231 
232  double m_zoomFactor;
234 
235  QImage *m_image;
238  bool m_cross;
239  bool m_circle;
241 
243 
244  // The ControlNet pointed to by this pointer is not owned by this class!
245  // It is ok for m_controlNet to be NULL any time. If it is not NULL then
246  // it is used to paint measures in the viewport.
247  //
248  // After construction, it is the responsibility of the user of this class
249  // to maintain this pointer with the setControlNet method (to make sure
250  // that either NULL or a valid ControlNet is being pointed to).
251  ControlNet *m_controlNet;
252 
255  };
256 };
257 
258 #endif
Stretch grayStretch() const
Draw X on point.
Definition: ChipViewport.h:136
void zoom(double zoomFactor)
Zoom by a specified factor.
void enterEvent(QEvent *e)
If mouse enters, make sure key events are processed w/o clicking.
void panUp()
Pan up.
double m_zoomFactor
Zoom Factor.
Definition: ChipViewport.h:232
int chipSamples() const
Return the number of samples in the chip.
Definition: ChipViewport.h:111
int m_circleSize
Circle size.
Definition: ChipViewport.h:240
void setCircleSize(int size)
Set the size of the circle.
A small chip of data used for pattern matching.
Definition: Chip.h:101
BandInfo m_gray
Info for the gray bands.
Definition: ChipViewport.h:221
Cube * m_chipCube
The chip&#39;s cube.
Definition: ChipViewport.h:223
void zoomOut()
Zoom out.
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition: Stretch.h:119
Stretch stretch
Stretch for the band BandInfo constructor
Definition: ChipViewport.h:209
void paintImage()
Paints the chip viewport after the chip has been updated.
bool m_stretchLocked
Whether or not to lock the stretch when transforming.
Definition: ChipViewport.h:253
void setCross(bool checked)
Slot to change state of crosshair.
Widget to display Isis cubes for qt apps.
Definition: CubeViewport.h:121
double tackLine()
Returns tack line.
void computeStretch(Stretch &stretch, bool force=false)
Compute automatic stretch for a portion of the cube.
double tackSample()
Return the position of cube under cross hair.
void setControlNet(ControlNet *newControlNet)
sets the ControlNet to be used for drawing measure locations
Definition: ChipViewport.h:181
void rotateChip(int rotation)
Slot to rotate chip.
int Samples() const
Return the number of samples in the chip.
Definition: Chip.h:114
void keyPressEvent(QKeyEvent *e)
Process arrow keystrokes on cube.
QImage * m_image
The image.
Definition: ChipViewport.h:235
bool m_showPoints
Draw control points.
Definition: ChipViewport.h:237
void SetHrs(const double value)
Sets the mapping for HRS pixels.
Definition: Stretch.h:152
ChipViewport * m_tempView
Temporary viewport.
Definition: ChipViewport.h:242
virtual ~ChipViewport()
Destructor.
a control network
Definition: ControlNet.h:207
Sets the mapping for gray band stretch.
Definition: ChipViewport.h:206
Pixel value mapper.
Definition: Stretch.h:72
int m_height
Chip height.
Definition: ChipViewport.h:226
void SetLrs(const double value)
Sets the mapping for LRS pixels.
Definition: Stretch.h:130
bool m_geomIt
geomIt?
Definition: ChipViewport.h:228
void SetHis(const double value)
Sets the mapping for HIS pixels.
Definition: Stretch.h:141
void refreshView(double tackSample, double tackLine)
Slot to refresh viewport when the tack point has changed.
void reloadChip(double tackSample=0., double tackLine=0.)
Reloads the chip at the given tack point on the cube.
void geomChip(Chip *matchChip, Cube *matchChipCube)
Slot to geom chip (apply geometry transformation)
ChipViewport(int width, int height, QWidget *parent=0)
Construct an empty viewport.
void paintEvent(QPaintEvent *e)
Repaint the viewport.
Cube * m_matchChipCube
The matching chip&#39;s cube.
Definition: ChipViewport.h:230
double zoomFactor()
Return the zoom factor.
int band
The gray band.
Definition: ChipViewport.h:208
void autoStretch()
Apply automatic stretch using data from entire chip.
bool m_circle
Draw circle.
Definition: ChipViewport.h:239
void zoom1()
Zoom by a factor of one.
void mousePressEvent(QMouseEvent *event)
Process mouse events.
Stretch * m_stretch
Current stretch on the chip viewport.
Definition: ChipViewport.h:254
void changeStretchLock(int)
Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.)
void panLeft()
Pan left.
Viewport for Isis Chips.
Definition: ChipViewport.h:85
int Lines() const
Return the number of lines in the chip.
Definition: Chip.h:121
Chip * chip() const
Return chip.
Definition: ChipViewport.h:102
void setChip(Chip *chip, Cube *chipCube)
Set chip.
void tackPointChanged(double)
&lt; Signal sent when tack point changes
void panRight()
Pan right.
void zoomIn()
Zoom in.
int m_rotation
Rotation.
Definition: ChipViewport.h:233
bool m_cross
Draw crosshair.
Definition: ChipViewport.h:238
int chipLines() const
Return the number of lines in the chip.
Definition: ChipViewport.h:116
void panDown()
Pan down.
void setPoints(bool checked)
Slot to set whether control points are drawn.
void setCircle(bool checked)
Slot to change state of circle.
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition: Stretch.h:108
Chip * m_chip
The chip.
Definition: ChipViewport.h:222
void loadView(ChipViewport &newView)
Load with another ChipViewport, used for blinking.
int m_width
Chip width.
Definition: ChipViewport.h:225
void stretchFromCubeViewport(Stretch *, CubeViewport *)
Applies a new stretch to the specified cube viewport.
void nogeomChip()
Slot to un-geom chip (revert geometry transformation)
int grayBand() const
Return the gray band currently viewed.
Definition: ChipViewport.h:121
bool cubeToViewport(double samp, double line, int &x, int &y)
Get viewport x and y from cube sample and line.
bool m_paintImage
Paint Image?
Definition: ChipViewport.h:236
Chip * m_matchChip
The matching chip.
Definition: ChipViewport.h:229
IO Handler for Isis Cubes.
Definition: Cube.h:158

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:15:53