Isis 3.0 Programmer Reference
Back | Home
MdiCubeViewport.cpp
Go to the documentation of this file.
1 
21 #include "MdiCubeViewport.h"
22 
23 #include <QIcon>
24 #include <QPainter>
25 
26 #include <iostream>
27 #include <string>
28 
29 #include "FileName.h"
30 #include "IString.h"
31 #include "RubberBandTool.h"
32 #include "StretchTool.h"
33 #include "Tool.h"
34 
35 
36 using namespace std;
37 
38 
39 namespace Isis {
40  MdiCubeViewport::MdiCubeViewport(Cube *cube, CubeDataThread * cdt,
41  QWidget *parent) : CubeViewport(cube, cdt, parent) {
42  p_linked = false;
43 
44  QString unlinkedIcon = FileName("$base/icons/unlinked.png").expanded();
45  static QIcon unlinked(unlinkedIcon);
46  parentWidget()->setWindowIcon(unlinked);
47 
48  }
49 
50  MdiCubeViewport::~MdiCubeViewport() {
51  }
52 
53 
59  void MdiCubeViewport::registerTool(Tool *tool) {
60  p_toolList.push_back(tool);
61  }
62 
63 
70  void MdiCubeViewport::setLinked(bool b) {
71  if(!parentWidget() || !parentWidget()->parentWidget())
72  return;
73 
74  QString unlinkedIcon = FileName("$base/icons/unlinked.png").expanded();
75  static QIcon unlinked(unlinkedIcon);
76  QString linkedIcon = FileName("$base/icons/linked.png").expanded();
77  static QIcon linked(linkedIcon);
78 
79  bool notify = false;
80  if(b != p_linked)
81  notify = true;
82 
83  p_linked = b;
84  if(p_linked) {
85  parentWidget()->parentWidget()->setWindowIcon(linked);
86  }
87  else {
88  parentWidget()->parentWidget()->setWindowIcon(unlinked);
89  }
90 
91  if(notify)
92  emit linkChanging(b);
93  }
94 
95 
106  void MdiCubeViewport::paintEvent(QPaintEvent *e) {
107  CubeViewport::paintEvent(e);
108 
109  QPainter painter(viewport());
110  painter.drawPixmap(0, 0, p_pixmap);
111  emit viewportUpdated();
112 
113  // Draw anything the tools might need
114  for(int i = 0; i < p_toolList.size(); i++) {
115  p_toolList[i]->paintViewport(this, &painter);
116  }
117 
118  painter.end();
119  }
120 
121 
122  void MdiCubeViewport::viewGray(int band) {
123  CubeViewport::viewGray(band);
124 
125  for(int i = 0; i < p_toolList.size(); i++)
126  p_toolList[i]->updateTool();
127  }
128 
129 
130  void MdiCubeViewport::viewRGB(int rband, int gband, int bband) {
131  CubeViewport::viewRGB(rband, gband, bband);
132 
133  for(int i = 0; i < p_toolList.size(); i++)
134  p_toolList[i]->updateTool();
135  }
136 
137 
138  void MdiCubeViewport::restretch(ViewportBuffer *buffer) {
139  if(buffer == grayBuffer()) {
140  emit requestRestretch(this, (int)StretchTool::Gray);
141  }
142  else if(buffer == redBuffer()) {
143  emit requestRestretch(this, (int)StretchTool::Red);
144  }
145  else if(buffer == greenBuffer()) {
146  emit requestRestretch(this, (int)StretchTool::Green);
147  }
148  else if(buffer == blueBuffer()) {
149  emit requestRestretch(this, (int)StretchTool::Blue);
150  }
151  }
152 }
Reads and stores visible DN values.
File name manipulation and expansion.
Definition: FileName.h:111
Base class for the Qisis tools.
Definition: Tool.h:81

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:23:14