QvisViewWindow.h 10.5 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
/*****************************************************************************
*
3
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
hrchilds's avatar
hrchilds committed
4
* Produced at the Lawrence Livermore National Laboratory
5
* LLNL-CODE-442911
hrchilds's avatar
hrchilds committed
6 7
* All rights reserved.
*
8
* This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
hrchilds's avatar
hrchilds committed
9 10 11 12 13 14 15 16 17 18
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution  and  use  in  source  and  binary  forms,  with  or  without
* modification, are permitted provided that the following conditions are met:
*
*  - Redistributions of  source code must  retain the above  copyright notice,
*    this list of conditions and the disclaimer below.
*  - Redistributions in binary form must reproduce the above copyright notice,
*    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
19 20 21
*    documentation and/or other materials provided with the distribution.
*  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
*    be used to endorse or promote products derived from this software without
hrchilds's avatar
hrchilds committed
22 23 24 25 26
*    specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT  LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE
27 28 29
* ARE  DISCLAIMED. IN  NO EVENT  SHALL LAWRENCE  LIVERMORE NATIONAL  SECURITY,
* LLC, THE  U.S.  DEPARTMENT OF  ENERGY  OR  CONTRIBUTORS BE  LIABLE  FOR  ANY
* DIRECT,  INDIRECT,   INCIDENTAL,   SPECIAL,   EXEMPLARY,  OR   CONSEQUENTIAL
hrchilds's avatar
hrchilds committed
30 31 32 33 34 35 36 37 38
* DAMAGES (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF  SUBSTITUTE GOODS OR
* SERVICES; LOSS OF  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER
* CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT
* LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY  WAY
* OUT OF THE  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/

hrchilds's avatar
hrchilds committed
39 40 41 42 43 44 45
#ifndef QVIS_VIEW_WINDOW_H
#define QVIS_VIEW_WINDOW_H
#include <gui_exports.h>
#include <QvisPostableWindowSimpleObserver.h>

// Forward declarations.
class DataNode;
hrchilds's avatar
hrchilds committed
46
class QButtonGroup;
hrchilds's avatar
hrchilds committed
47 48 49 50
class QCheckBox;
class QComboBox;
class QLabel;
class QLineEdit;
hrchilds's avatar
hrchilds committed
51
class QRadioButton;
hrchilds's avatar
hrchilds committed
52
class QSlider;
hrchilds's avatar
hrchilds committed
53 54
class QTabWidget;
class QVBox;
55
class ViewAxisArrayAttributes;
hrchilds's avatar
hrchilds committed
56 57 58
class ViewCurveAttributes;
class View2DAttributes;
class View3DAttributes;
hrchilds's avatar
hrchilds committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
class WindowInformation;
class QPushButton;

// ****************************************************************************
// Class: QvisViewWindow
//
// Purpose:
//   This class implements the VisIt view window.
//
// Notes:      
//
// Programmer: Brad Whitlock
// Creation:   Thu Jul 26 16:03:25 PST 2001
//
// Modifications:
//   Eric Brugger, Tue Aug 21 13:45:36 PDT 2001
//   I redesigned the window fairly extensively.
//
//   Brad Whitlock, Mon Aug 27 11:35:11 PDT 2001
//   I made the window postable and added some default view buttons for 3d.
//
//   Eric Brugger, Tue Aug  6 10:30:24 PDT 2002
//   I added a view command processor.
//
//   Brad Whitlock, Tue Sep 17 12:58:39 PDT 2002
//   I reorganized the window.
//
//   Eric Brugger, Mon Jan 13 14:50:38 PST 2003
//   Add the vp and wp commands to the cli.
//
//   Jeremy Meredith, Tue Feb  4 17:44:53 PST 2003
//   Added controls for the camera and view keyframes.
//
//   Eric Brugger, Fri Apr 18 11:45:10 PDT 2003
//   Removed auto center view.
//
hrchilds's avatar
hrchilds committed
95 96 97
//   Eric Brugger, Tue Jun 10 12:48:03 PDT 2003
//   I added image pan and image zoom fields to the 3d view.
//
hrchilds's avatar
hrchilds committed
98 99 100 101
//   Eric Brugger, Wed Aug 20 14:02:49 PDT 2003
//   I added support for curve views and split the view attributes into
//   2d and 3d parts.
//
hrchilds's avatar
hrchilds committed
102 103 104
//   Brad Whitlock, Thu Sep 11 09:33:08 PDT 2003
//   I added slots to reset or recenter the view.
//
hrchilds's avatar
hrchilds committed
105 106 107
//   Eric Brugger, Thu Oct 16 12:21:13 PDT 2003
//   I added full frame mode to the 2D view tab.
//
hrchilds's avatar
hrchilds committed
108 109 110
//   Eric Brugger, Tue Feb 10 10:29:21 PST 2004
//   I added center of rotation controls to the advanced tab.
//
hrchilds's avatar
hrchilds committed
111 112
//   Mark C. Miller, Thu Jul 21 12:52:42 PDT 2005
//   Added stuff for auto full frame mode
hrchilds's avatar
hrchilds committed
113 114 115 116
//
//   Kathleen Bonnell, Thu Mar 22 16:07:56 PDT 2007 
//   Added radio buttons for log scaling.
//
hrchilds's avatar
hrchilds committed
117 118 119
//   Kathleen Bonnell, Wed May  9 11:15:13 PDT 2007 
//   Added radio buttons for 2d log scaling.
//
120 121 122 123
//   Jeremy Meredith, Mon Feb  4 13:44:33 EST 2008
//   Added support for axis-array views.  Renamed some curve view
//   buttons to avoid namespace collisions.
//
124 125 126
//   Brad Whitlock, Wed Apr  9 11:02:38 PDT 2008
//   QString for caption, shortName.
//
127 128 129
//   Cyrus Harrison, Thu Dec 18 09:36:57 PST 2008
//   Changed argument for tabSelected slot to an integer for Qt4.
//
130 131 132
//   Jeremy Meredith, Wed Feb  3 15:29:17 EST 2010
//   Added maintain view here.  (moved from main window)
//
133 134 135
//   Jeremy Meredith, Wed May 19 14:15:58 EDT 2010
//   Account for 3D axis scaling (3D equivalent of full-frame mode).
//
136 137 138
//   Jeremy Meredith, Mon Aug  2 13:55:42 EDT 2010
//   Added shear support for oblique projections.
//
hrchilds's avatar
hrchilds committed
139 140 141 142 143 144
// ****************************************************************************

class GUI_API QvisViewWindow : public QvisPostableWindowSimpleObserver
{
    Q_OBJECT
public:
145 146
    QvisViewWindow(const QString &caption = QString::null,
                   const QString &shortName = QString::null,
hrchilds's avatar
hrchilds committed
147 148 149 150 151
                   QvisNotepadArea *notepad = 0);
    virtual ~QvisViewWindow();
    virtual void CreateWindowContents();
    void SubjectRemoved(Subject *TheRemovedSubject);

152
    void ConnectAxisArrayAttributes(ViewAxisArrayAttributes *v);
hrchilds's avatar
hrchilds committed
153 154 155
    void ConnectCurveAttributes(ViewCurveAttributes *v);
    void Connect2DAttributes(View2DAttributes *v);
    void Connect3DAttributes(View3DAttributes *v);
hrchilds's avatar
hrchilds committed
156 157 158 159 160
    void ConnectWindowInformation(WindowInformation *);

    virtual void CreateNode(DataNode *parentNode);
    virtual void SetFromNode(DataNode *parentNode, const int *borders);
public slots:
hrchilds's avatar
hrchilds committed
161
    virtual void apply();
hrchilds's avatar
hrchilds committed
162 163 164 165
    virtual void show();
protected:
    void Apply(bool ignore = false);
    void GetCurrentValues(int which_widget);
166
    void GetCurrentValuesAxisArray(int which_widget);
hrchilds's avatar
hrchilds committed
167
    void GetCurrentValuesCurve(int which_widget);
hrchilds's avatar
hrchilds committed
168 169 170 171
    void GetCurrentValues2d(int which_widget);
    void GetCurrentValues3d(int which_widget);

    virtual void UpdateWindow(bool doAll);
172
    void UpdateAxisArray(bool doAll);
hrchilds's avatar
hrchilds committed
173
    void UpdateCurve(bool doAll);
hrchilds's avatar
hrchilds committed
174 175 176 177 178 179
    void Update2D(bool doAll);
    void Update3D(bool doAll);
    void UpdateGlobal(bool doAll);
private slots:
    void processCommandText();

180 181 182 183
    void processViewportAxisArrayText();
    void processDomainAxisArrayText();
    void processRangeAxisArrayText();

hrchilds's avatar
hrchilds committed
184 185 186
    void processViewportCurveText();
    void processDomainText();
    void processRangeText();
hrchilds's avatar
hrchilds committed
187 188
    void domainScaleModeChanged(int);
    void rangeScaleModeChanged(int);
hrchilds's avatar
hrchilds committed
189 190 191

    void processViewportText();
    void processWindowText();
hrchilds's avatar
hrchilds committed
192
    void fullFrameActivationModeChanged(int);
hrchilds's avatar
hrchilds committed
193 194
    void xScaleModeChanged(int);
    void yScaleModeChanged(int);
hrchilds's avatar
hrchilds committed
195 196 197 198 199 200 201 202

    void processNormalText();
    void processFocusText();
    void processUpVectorText();
    void processViewAngleText();
    void processParallelScaleText();
    void processNearText();
    void processFarText();
hrchilds's avatar
hrchilds committed
203 204
    void processImagePanText();
    void processImageZoomText();
hrchilds's avatar
hrchilds committed
205 206
    void perspectiveToggled(bool val);
    void viewButtonClicked(int index);
207 208
    void axis3DScaleFlagToggled(bool val);
    void processAxis3DScalesText();
209
    void processShearText();
hrchilds's avatar
hrchilds committed
210

hrchilds's avatar
hrchilds committed
211 212
    void processEyeAngleText();
    void eyeAngleSliderChanged(int val);
hrchilds's avatar
hrchilds committed
213 214
    void copyViewFromCameraChecked(bool);
    void makeViewKeyframe();
hrchilds's avatar
hrchilds committed
215 216
    void centerChecked(bool);
    void processCenterText();
hrchilds's avatar
hrchilds committed
217 218

    void lockedViewChecked(bool);
219
    void maintainViewChecked(bool);
hrchilds's avatar
hrchilds committed
220
    void extentTypeChanged(int);
hrchilds's avatar
hrchilds committed
221 222
    void resetView();
    void recenterView();
hrchilds's avatar
hrchilds committed
223
    void undoView();
224
    void tabSelected(int);
hrchilds's avatar
hrchilds committed
225 226 227 228 229 230 231
private:
    void ParseViewCommands(const char *str);
    void Pan(double panx, double pany);
    void RotateAxis(int axis, double angle);
    void Zoom(double zoom);
    void Viewport(const double *viewport);
    void Window(const double *window);
hrchilds's avatar
hrchilds committed
232
    void UpdateEyeAngleSliderFromAtts(void);
hrchilds's avatar
hrchilds committed
233

234
    ViewAxisArrayAttributes *viewAxisArray;
hrchilds's avatar
hrchilds committed
235 236 237 238 239
    ViewCurveAttributes *viewCurve;
    View2DAttributes    *view2d;
    View3DAttributes    *view3d;
    WindowInformation   *windowInfo;
    int                 activeTab;
hrchilds's avatar
hrchilds committed
240
    bool                activeTabSetBySlot;
hrchilds's avatar
hrchilds committed
241 242

    // Curve widgets
whitlocb's avatar
whitlocb committed
243
    QWidget      *pageCurve;
hrchilds's avatar
hrchilds committed
244
    QLineEdit    *viewportCurveLineEdit;
245 246
    QLineEdit    *domainCurveLineEdit;
    QLineEdit    *rangeCurveLineEdit;
hrchilds's avatar
hrchilds committed
247 248 249 250 251 252 253 254
    QLabel       *domainScaleLabel;
    QButtonGroup *domainScaleMode;
    QRadioButton *domainLinear;
    QRadioButton *domainLog;
    QLabel       *rangeScaleLabel;
    QButtonGroup *rangeScaleMode;
    QRadioButton *rangeLinear;
    QRadioButton *rangeLog;
hrchilds's avatar
hrchilds committed
255 256

    // 2d widgets
whitlocb's avatar
whitlocb committed
257
    QWidget      *page2D;
hrchilds's avatar
hrchilds committed
258 259 260 261 262 263 264
    QLineEdit    *viewportLineEdit;
    QLineEdit    *windowLineEdit;
    QLabel       *fullFrameLabel;
    QButtonGroup *fullFrameActivationMode;
    QRadioButton *fullFrameAuto;
    QRadioButton *fullFrameOn;
    QRadioButton *fullFrameOff;
hrchilds's avatar
hrchilds committed
265 266 267 268 269 270 271 272
    QLabel       *xScaleLabel;
    QButtonGroup *xScaleMode;
    QRadioButton *xLinear;
    QRadioButton *xLog;
    QLabel       *yScaleLabel;
    QButtonGroup *yScaleMode;
    QRadioButton *yLinear;
    QRadioButton *yLog;
hrchilds's avatar
hrchilds committed
273 274

    // 3d widgets
whitlocb's avatar
whitlocb committed
275
    QWidget     *page3D;
hrchilds's avatar
hrchilds committed
276 277 278 279 280 281 282
    QLineEdit   *normalLineEdit;
    QLineEdit   *focusLineEdit;
    QLineEdit   *upvectorLineEdit;
    QLineEdit   *viewAngleLineEdit;
    QLineEdit   *parallelScaleLineEdit;
    QLineEdit   *nearLineEdit;
    QLineEdit   *farLineEdit;
hrchilds's avatar
hrchilds committed
283 284
    QLineEdit   *imagePanLineEdit;
    QLineEdit   *imageZoomLineEdit;
hrchilds's avatar
hrchilds committed
285 286
    QLineEdit   *eyeAngleLineEdit;
    QSlider     *eyeAngleSlider;
hrchilds's avatar
hrchilds committed
287 288
    QCheckBox   *perspectiveToggle;
    QComboBox   *alignComboBox;
289 290
    QCheckBox   *axis3DScaleFlagToggle;
    QLineEdit   *axis3DScalesLineEdit;
291
    QLineEdit   *shearLineEdit;
hrchilds's avatar
hrchilds committed
292

293
    // AxisArray widgets
whitlocb's avatar
whitlocb committed
294
    QWidget      *pageAxisArray;
295 296 297 298
    QLineEdit    *viewportAxisArrayLineEdit;
    QLineEdit    *domainAxisArrayLineEdit;
    QLineEdit    *rangeAxisArrayLineEdit;

hrchilds's avatar
hrchilds committed
299 300 301 302 303
    // Global and advanced option widgets
    QTabWidget  *tabs;
    QLineEdit   *commandLineEdit;
    QComboBox   *extentComboBox;
    QCheckBox   *lockedViewToggle;
304
    QCheckBox   *maintainViewToggle;
hrchilds's avatar
hrchilds committed
305 306
    QCheckBox   *copyViewFromCameraToggle;
    QPushButton *makeViewKeyframeButton;
whitlocb's avatar
whitlocb committed
307
    QWidget     *pageAdvanced;
hrchilds's avatar
hrchilds committed
308 309
    QCheckBox   *centerToggle;
    QLineEdit   *centerLineEdit;
hrchilds's avatar
hrchilds committed
310 311 312
};

#endif