Isis 3 Programmer Reference
ChipViewport.h
1#ifndef ChipViewport_h
2#define ChipViewport_h
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include <QPaintEvent>
13#include <QResizeEvent>
14#include <QWidget>
15
16#include "Chip.h"
17#include "Histogram.h"
18#include "Stretch.h"
19
20class QImage;
21
22namespace Isis {
23 class ControlNet;
24 class CubeViewport;
25
71 class ChipViewport : public QWidget {
72 Q_OBJECT
73
74
75 public:
76 ChipViewport(int width, int height, QWidget *parent = 0);
77 virtual ~ChipViewport();
78
79 bool cubeToViewport(double samp, double line, int &x, int &y);
80
82 void setChip(Chip *chip, Cube *chipCube);
83
85 void loadView(ChipViewport &newView);
86
88 Chip *chip() const {
89 return m_chip;
90 };
91
92 Cube *chipCube() const {
93 return m_chipCube;
94 };
95
97 int chipSamples() const {
98 return m_chip->Samples();
99 };
100
102 int chipLines() const {
103 return m_chip->Lines();
104 };
105
107 int grayBand() const {
108 return m_gray.band;
109 };
110
112 double tackSample();
113 double tackLine();
114
116 double zoomFactor();
117
119 //void markPoint (double sample, double line);
120
123 return m_gray.stretch;
124 };
125
126
127 signals:
129 void tackPointChanged(double);
130
131 // TODO: This needs better name, tackPointChanged signal is emitted
132 // even if user does not initiate, maybe change tackPointChanged signal
133 // to only emit if user moves the tack point???
134 void userMovedTackPoint();
135
136
137 public slots:
138 void autoStretch();
140 void changeStretchLock(int);
141 void setPoints(bool checked);
142 void setCross(bool checked);
143 void rotateChip(int rotation);
144 void setCircle(bool checked);
145 void setCircleSize(int size);
146
147 void geomChip(Chip *matchChip, Cube *matchChipCube);
148 void nogeomChip();
149
150 void panUp();
151 void panDown();
152 void panLeft();
153 void panRight();
154
155 void zoomIn();
156 void zoomOut();
157 void zoom1();
158 void zoom(double zoomFactor);
159
160 void refreshView(double tackSample, double tackLine);
161
167 void setControlNet(ControlNet *newControlNet) {
168 m_controlNet = newControlNet;
169 }
170
171
172 protected:
173 void paintEvent(QPaintEvent *e);
174 void enterEvent(QEvent *e);
175 void keyPressEvent(QKeyEvent *e);
176 void mousePressEvent(QMouseEvent *event);
177
178
179 private:
180 void reloadChip(double tackSample = 0., double tackLine = 0.);
181
182 void computeStretch(Stretch &stretch, bool force = false);
183 void paintImage();
184
192 class BandInfo {
193 public:
194 int band;
197 BandInfo() {
198 band = 1;
199 stretch.SetNull(0.0);
200 stretch.SetLis(0.0);
201 stretch.SetLrs(0.0);
202 stretch.SetHis(255.0);
203 stretch.SetHrs(255.0);
204 };
205 };
206
210
213
214 bool m_geomIt;
217
220
221 QImage *m_image;
224 bool m_cross;
225 bool m_circle;
227
229
230 // The ControlNet pointed to by this pointer is not owned by this class!
231 // It is ok for m_controlNet to be NULL any time. If it is not NULL then
232 // it is used to paint measures in the viewport.
233 //
234 // After construction, it is the responsibility of the user of this class
235 // to maintain this pointer with the setControlNet method (to make sure
236 // that either NULL or a valid ControlNet is being pointed to).
237 ControlNet *m_controlNet;
238
241 };
242};
243
244#endif
A small chip of data used for pattern matching.
Definition Chip.h:86
int Samples() const
Definition Chip.h:99
int Lines() const
Definition Chip.h:106
Sets the mapping for gray band stretch.
Stretch stretch
Stretch for the band BandInfo constructor.
Viewport for Isis Chips.
bool m_stretchLocked
Whether or not to lock the stretch when transforming.
Cube * m_chipCube
The chip's cube.
void loadView(ChipViewport &newView)
Load with another ChipViewport, used for blinking.
ChipViewport * m_tempView
Temporary viewport.
int m_rotation
Rotation.
void setPoints(bool checked)
Slot to set whether control points are drawn.
Stretch * m_stretch
Current stretch on the chip viewport.
int m_width
Chip width.
void setCircle(bool checked)
Slot to change state of circle.
virtual ~ChipViewport()
Destructor.
void enterEvent(QEvent *e)
If mouse enters, make sure key events are processed w/o clicking.
void paintImage()
Paints the chip viewport after the chip has been updated.
void setControlNet(ControlNet *newControlNet)
sets the ControlNet to be used for drawing measure locations
Chip * chip() const
Return chip.
Chip * m_matchChip
The matching chip.
double m_zoomFactor
Zoom Factor.
ChipViewport(int width, int height, QWidget *parent=0)
Construct an empty viewport.
double tackSample()
Return the position of cube under cross hair.
void zoomOut()
Zoom out.
double tackLine()
Returns tack line.
void zoom(double zoomFactor)
Zoom by a specified factor.
void nogeomChip()
Slot to un-geom chip (revert geometry transformation)
void rotateChip(int rotation)
Slot to rotate chip.
double zoomFactor()
Return the zoom factor.
bool m_geomIt
geomIt?
Chip * m_chip
The chip.
void paintEvent(QPaintEvent *e)
Repaint the viewport.
Stretch grayStretch() const
Draw X on point.
bool m_cross
Draw crosshair.
void computeStretch(Stretch &stretch, bool force=false)
Compute automatic stretch for a portion of the cube.
void panLeft()
Pan left.
int grayBand() const
Return the gray band currently viewed.
void panRight()
Pan right.
void panUp()
Pan up.
Cube * m_matchChipCube
The matching chip's cube.
int m_circleSize
Circle size.
void reloadChip(double tackSample=0., double tackLine=0.)
Reloads the chip at the given tack point on the cube.
bool cubeToViewport(double samp, double line, int &x, int &y)
Get viewport x and y from cube sample and line.
void panDown()
Pan down.
void autoStretch()
Apply automatic stretch using data from entire chip.
void geomChip(Chip *matchChip, Cube *matchChipCube)
Slot to geom chip (apply geometry transformation)
bool m_circle
Draw circle.
void changeStretchLock(int)
Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan,...
void setCircleSize(int size)
Set the size of the circle.
void stretchFromCubeViewport(Stretch *, CubeViewport *)
Applies a new stretch to the specified cube viewport.
void tackPointChanged(double)
< Signal sent when tack point changes
void zoomIn()
Zoom in.
bool m_paintImage
Paint Image?
int chipSamples() const
Return the number of samples in the chip.
void mousePressEvent(QMouseEvent *event)
Process mouse events.
void setCross(bool checked)
Slot to change state of crosshair.
bool m_showPoints
Draw control points.
void zoom1()
Zoom by a factor of one.
BandInfo m_gray
Info for the gray bands.
int chipLines() const
Return the number of lines in the chip.
QImage * m_image
The image.
void refreshView(double tackSample, double tackLine)
Slot to refresh viewport when the tack point has changed.
int m_height
Chip height.
void keyPressEvent(QKeyEvent *e)
Process arrow keystrokes on cube.
void setChip(Chip *chip, Cube *chipCube)
Set chip.
a control network
Definition ControlNet.h:258
IO Handler for Isis Cubes.
Definition Cube.h:168
Widget to display Isis cubes for qt apps.
Pixel value mapper.
Definition Stretch.h:58
void SetNull(const double value)
Sets the mapping for NULL pixels.
Definition Stretch.h:94
void SetHrs(const double value)
Sets the mapping for HRS pixels.
Definition Stretch.h:138
void SetHis(const double value)
Sets the mapping for HIS pixels.
Definition Stretch.h:127
void SetLis(const double value)
Sets the mapping for LIS pixels.
Definition Stretch.h:105
void SetLrs(const double value)
Sets the mapping for LRS pixels.
Definition Stretch.h:116
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16