QvisRenderingWindow.C 66.6 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
#include <QvisRenderingWindow.h>
#include <float.h>
hrchilds's avatar
hrchilds committed
41
#include <limits.h>
hrchilds's avatar
hrchilds committed
42

whitlocb's avatar
whitlocb committed
43 44 45 46 47 48 49 50 51 52
#include <QButtonGroup>
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
#include <QLayout>
#include <QRadioButton>
#include <QSlider>
#include <QSpinBox>
#include <QLineEdit>
#include <QTabWidget>
hrchilds's avatar
hrchilds committed
53 54 55 56

#include <RenderingAttributes.h>
#include <ViewerProxy.h>
#include <WindowInformation.h>
hrchilds's avatar
hrchilds committed
57
#include <QvisOpacitySlider.h>
hrchilds's avatar
hrchilds committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73

// ****************************************************************************
// Method: QvisRenderingWindow::QvisRenderingWindow
//
// Purpose: 
//   Constructor for the QvisRenderingWindow class.
//
// Arguments:
//   caption : The window caption.
//   shortName : The name shown in the notepad.
//   n         : The notepad area.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:46:40 PST 2002
//
// Modifications:
hrchilds's avatar
hrchilds committed
74 75 76
//
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshold to scalrenActivationMode
hrchilds's avatar
hrchilds committed
77
//   
hrchilds's avatar
hrchilds committed
78 79 80
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Initialize dlMode.
//
hrchilds's avatar
hrchilds committed
81 82
//   Mark C. Miller, Thu Nov  3 16:59:41 PST 2005
//   Added compression controls
83 84 85 86
//
//   Brad Whitlock, Wed Apr  9 11:52:02 PDT 2008
//   QString for caption, shortName.
//
87 88 89
//   Jeremy Meredith, Fri Apr 30 15:04:34 EDT 2010
//   Added an automatic start/end setting capability for depth cueing.
//
90 91 92
//    Dave Pugmire, Tue Aug 24 11:32:12 EDT 2010
//    Add compact domain options.
//
hrchilds's avatar
hrchilds committed
93 94
// ****************************************************************************

95 96
QvisRenderingWindow::QvisRenderingWindow(const QString &caption,
    const QString &shortName, QvisNotepadArea *n) :
hrchilds's avatar
hrchilds committed
97
    QvisPostableWindowSimpleObserver(caption, shortName, n, ApplyButton)
hrchilds's avatar
hrchilds committed
98 99 100 101 102
{
    renderAtts = 0;
    windowInfo = 0;

    objectRepresentation = 0;
hrchilds's avatar
hrchilds committed
103
    dlMode = 0;
hrchilds's avatar
hrchilds committed
104
    stereoType = 0;
hrchilds's avatar
hrchilds committed
105
    scalrenActivationMode = 0;
hrchilds's avatar
hrchilds committed
106
    scalrenCompressMode = 0;
107
    compactDomainsActivationMode = 0;
hrchilds's avatar
hrchilds committed
108 109 110 111 112 113 114 115 116 117 118 119 120
}

// ****************************************************************************
// Method: QvisRenderingWindow::~QvisRenderingWindow
//
// Purpose: 
//   This is the destructor for the QvisRenderingWindow class.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:47:29 PST 2002
//
// Modifications:
//   
hrchilds's avatar
hrchilds committed
121 122
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshold to scalrenActivationMode
hrchilds's avatar
hrchilds committed
123 124 125 126
//
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Delete dlMode.
//
hrchilds's avatar
hrchilds committed
127 128
//   Mark C. Miller, Thu Nov  3 16:59:41 PST 2005
//   Added compression controls
whitlocb's avatar
whitlocb committed
129
//
hrchilds's avatar
hrchilds committed
130 131 132 133 134 135 136 137 138 139 140 141
// ****************************************************************************

QvisRenderingWindow::~QvisRenderingWindow()
{
    if(renderAtts)
        renderAtts->Detach(this);

    if(windowInfo)
        windowInfo->Detach(this);
}

// ****************************************************************************
whitlocb's avatar
whitlocb committed
142
// Method: QvisRenderingWindow::CreateBasicPage
hrchilds's avatar
hrchilds committed
143 144
//
// Purpose: 
whitlocb's avatar
whitlocb committed
145
//   Creates the widgets on the basic page.
hrchilds's avatar
hrchilds committed
146
//
whitlocb's avatar
whitlocb committed
147
// Arguments:
hrchilds's avatar
hrchilds committed
148
//
whitlocb's avatar
whitlocb committed
149
// Returns:    The basic page widget.
hrchilds's avatar
hrchilds committed
150
//
whitlocb's avatar
whitlocb committed
151
// Note:       
152
//
whitlocb's avatar
whitlocb committed
153 154
// Programmer: Brad Whitlock
// Creation:   Thu Jun 19 12:10:45 PDT 2008
155
//
whitlocb's avatar
whitlocb committed
156
// Modifications:
157 158 159
//   Eric Brugger, Tue Oct 25 12:32:40 PDT 2011
//   Add a multi resolution display capability for AMR data.
//
hrchilds's avatar
hrchilds committed
160
// ****************************************************************************
161

whitlocb's avatar
whitlocb committed
162 163 164 165 166 167 168 169
QWidget *
QvisRenderingWindow::CreateBasicPage()
{
    int row = 0;
    QWidget *basicOptions = new QWidget(central);
    QGridLayout *basicLayout = new QGridLayout(basicOptions);
    basicLayout->setSpacing(5);
    basicLayout->setMargin(10);
hrchilds's avatar
hrchilds committed
170 171

    // Create the antialiasing widgets.
whitlocb's avatar
whitlocb committed
172
    antialiasingToggle = new QCheckBox(tr("Antialiasing"), basicOptions);
hrchilds's avatar
hrchilds committed
173 174
    connect(antialiasingToggle, SIGNAL(toggled(bool)),
            this, SLOT(antialiasingToggled(bool)));
whitlocb's avatar
whitlocb committed
175
    basicLayout->addWidget(antialiasingToggle, row, 0, 1, 3);
176
    row++;
hrchilds's avatar
hrchilds committed
177

178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
    // Create the multi resolution widgets.
    multiresolutionModeToggle = new QCheckBox(tr("Multi resolution for 2d AMR data"), basicOptions);
    connect(multiresolutionModeToggle, SIGNAL(toggled(bool)),
            this, SLOT(multiresolutionModeToggled(bool)));
    basicLayout->addWidget(multiresolutionModeToggle, row, 0, 1, 3);
    row++;

    multiresolutionSmallestCellLabel = new QLabel(tr("Smallest cell"), basicOptions);
    basicLayout->addWidget(multiresolutionSmallestCellLabel, row, 1);
    multiresolutionSmallestCellLineEdit = new QLineEdit(basicOptions);
    connect(multiresolutionSmallestCellLineEdit, SIGNAL(returnPressed()),
            this, SLOT(processMultiresolutionSmallestCellText()));
    connect(multiresolutionSmallestCellLineEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT(processMultiresolutionSmallestCellText(const QString &)));
    basicLayout->addWidget(multiresolutionSmallestCellLineEdit, row, 2, 1, 2);
    row++;

hrchilds's avatar
hrchilds committed
195
    // Create the surface rep widgets.
whitlocb's avatar
whitlocb committed
196 197 198 199
    QLabel *drawObjLabel = new QLabel(tr("Draw objects as"), basicOptions);
    basicLayout->addWidget(drawObjLabel, row, 0, 1, 3);
    objectRepresentation = new QButtonGroup(basicOptions);
    connect(objectRepresentation, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
200
            this, SLOT(objectRepresentationChanged(int)));
201 202
    row++;

whitlocb's avatar
whitlocb committed
203 204 205 206 207 208 209 210 211
    QRadioButton *surfaces = new QRadioButton(tr("Surfaces"), basicOptions);
    objectRepresentation->addButton(surfaces, 0);
    basicLayout->addWidget(surfaces, row, 1);
    QRadioButton *wires = new QRadioButton(tr("Wireframe"), basicOptions);
    objectRepresentation->addButton(wires, 1);
    basicLayout->addWidget(wires, row, 2);
    QRadioButton *points = new QRadioButton(tr("Points"), basicOptions);
    objectRepresentation->addButton(points, 2);
    basicLayout->addWidget(points, row, 3);
212
    row++;
hrchilds's avatar
hrchilds committed
213

hrchilds's avatar
hrchilds committed
214
    // Create the display list widgets.
whitlocb's avatar
whitlocb committed
215 216 217 218
    QLabel *displayListLabel = new QLabel(tr("Use display lists"), basicOptions);
    basicLayout->addWidget(displayListLabel, row, 0, 1, 3);
    dlMode = new QButtonGroup(basicOptions);
    connect(dlMode, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
219
            this, SLOT(displayListModeChanged(int)));
220 221
    row++;

whitlocb's avatar
whitlocb committed
222 223 224 225 226 227 228 229 230
    QRadioButton *dl_auto = new QRadioButton(tr("Auto"), basicOptions);
    dlMode->addButton(dl_auto, 0);
    basicLayout->addWidget(dl_auto, row, 1);
    QRadioButton *dl_always = new QRadioButton(tr("Always"), basicOptions);
    dlMode->addButton(dl_always, 1);
    basicLayout->addWidget(dl_always, row, 2);
    QRadioButton *dl_never = new QRadioButton(tr("Never"), basicOptions);
    dlMode->addButton(dl_never, 2);
    basicLayout->addWidget(dl_never, row, 3);
231
    row++;
hrchilds's avatar
hrchilds committed
232 233

    // Create the stereo widgets.
whitlocb's avatar
whitlocb committed
234
    stereoToggle = new QCheckBox(tr("Stereo"), basicOptions);
hrchilds's avatar
hrchilds committed
235 236
    connect(stereoToggle, SIGNAL(toggled(bool)),
            this, SLOT(stereoToggled(bool)));
whitlocb's avatar
whitlocb committed
237
    basicLayout->addWidget(stereoToggle, row, 0, 1, 3);
238 239
    row++;

whitlocb's avatar
whitlocb committed
240 241
    stereoType = new QButtonGroup(basicOptions);
    connect(stereoType, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
242
            this, SLOT(stereoTypeChanged(int)));
whitlocb's avatar
whitlocb committed
243 244 245 246 247 248
    redblue = new QRadioButton(tr("Red/Blue"), basicOptions);
    stereoType->addButton(redblue, 0);
    basicLayout->addWidget(redblue, row, 1);
    interlace = new QRadioButton(tr("Interlace"), basicOptions);
    stereoType->addButton(interlace, 1);
    basicLayout->addWidget(interlace, row, 2);
249
    row++;
whitlocb's avatar
whitlocb committed
250 251 252 253 254 255
    crystalEyes = new QRadioButton(tr("Crystal Eyes"), basicOptions);
    stereoType->addButton(crystalEyes, 2);
    basicLayout->addWidget(crystalEyes, row, 1);
    redgreen = new QRadioButton(tr("Red/Green"), basicOptions);
    stereoType->addButton(redgreen, 3);
    basicLayout->addWidget(redgreen, row, 2);
256 257 258
    row++;

    // Create the specular lighting options
whitlocb's avatar
whitlocb committed
259
    specularToggle = new QCheckBox(tr("Specular lighting"), basicOptions);
260 261
    connect(specularToggle, SIGNAL(toggled(bool)),
            this, SLOT(specularToggled(bool)));
whitlocb's avatar
whitlocb committed
262
    basicLayout->addWidget(specularToggle, row, 0, 1, 3);
263 264
    row++;

whitlocb's avatar
whitlocb committed
265
    specularStrengthSlider = new QvisOpacitySlider(0, 100, 10, 60, basicOptions);
266 267 268
    specularStrengthSlider->setTickInterval(25);
    connect(specularStrengthSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(specularStrengthChanged(int, const void*)));
whitlocb's avatar
whitlocb committed
269 270 271 272
    specularStrengthLabel = new QLabel(tr("Strength"), basicOptions);
    specularStrengthLabel->setBuddy(specularStrengthSlider);
    basicLayout->addWidget(specularStrengthLabel, row, 1);
    basicLayout->addWidget(specularStrengthSlider, row, 2, 1, 2);
273 274
    row++;

whitlocb's avatar
whitlocb committed
275
    specularPowerSlider = new QvisOpacitySlider(0, 1000, 100, 100, basicOptions);
276 277 278
    specularPowerSlider->setTickInterval(100);
    connect(specularPowerSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(specularPowerChanged(int, const void*)));
whitlocb's avatar
whitlocb committed
279 280 281 282
    specularPowerLabel = new QLabel(tr("Sharpness"), basicOptions);
    specularPowerLabel->setBuddy(specularPowerSlider);
    basicLayout->addWidget(specularPowerLabel, row,1);
    basicLayout->addWidget(specularPowerSlider, row, 2, 1, 2);
283 284
    row++;

whitlocb's avatar
whitlocb committed
285 286
    return basicOptions;
}
287

whitlocb's avatar
whitlocb committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
// ****************************************************************************
// Method: QvisRenderingWindow::CreateAdvancedPage
//
// Purpose: 
//   Creates the advanced page widgets
//
// Arguments:
//
// Returns:    
//
// Note:       Moved from CreateWindowContents.
//
// Programmer: Brad Whitlock
// Creation:   Thu Jun 19 13:18:25 PDT 2008
//
// Modifications:
//   
// ****************************************************************************

QWidget *
QvisRenderingWindow::CreateAdvancedPage()
{
    int row = 0;

    QWidget *advancedOptions = new QWidget(central);
    QGridLayout *advLayout = new QGridLayout(advancedOptions);
    advLayout->setSpacing(5);
    advLayout->setMargin(10);
hrchilds's avatar
hrchilds committed
316 317

    // Create the scalable rendering widgets.
whitlocb's avatar
whitlocb committed
318 319 320 321
    QLabel *scalrenLabel = new QLabel(tr("Use scalable rendering"), advancedOptions);
    advLayout->addWidget(scalrenLabel, row, 0, 1, 3);
    scalrenActivationMode = new QButtonGroup(advancedOptions);
    connect(scalrenActivationMode, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
322
            this, SLOT(scalrenActivationModeChanged(int)));
323 324
    row++;

whitlocb's avatar
whitlocb committed
325 326 327 328 329 330 331 332 333
    scalrenAuto = new QRadioButton(tr("Auto"), advancedOptions);
    scalrenActivationMode->addButton(scalrenAuto, 0);
    advLayout->addWidget(scalrenAuto, row, 1);
    scalrenAlways = new QRadioButton(tr("Always"), advancedOptions);
    scalrenActivationMode->addButton(scalrenAlways, 1);
    advLayout->addWidget(scalrenAlways, row, 2);
    scalrenNever = new QRadioButton(tr("Never"), advancedOptions);
    scalrenActivationMode->addButton(scalrenNever, 2);
    advLayout->addWidget(scalrenNever, row, 3);
334
    row++;
hrchilds's avatar
hrchilds committed
335

hrchilds's avatar
hrchilds committed
336
    // Create the polygon count spin box for scalable rendering threshold
whitlocb's avatar
whitlocb committed
337 338 339 340 341
    scalrenGeometryLabel =  new QLabel(tr("When polygon count exceeds"), advancedOptions);
    advLayout->addWidget(scalrenGeometryLabel, row, 1, 1, 2);
    scalrenAutoThreshold = new QSpinBox(advancedOptions);
    scalrenAutoThreshold->setMinimum(0);
    scalrenAutoThreshold->setMaximum(10000);
hrchilds's avatar
hrchilds committed
342 343
    scalrenAutoThreshold->setValue(RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD);
    scalrenAutoThresholdChanged(RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD);
hrchilds's avatar
hrchilds committed
344 345
    connect(scalrenAutoThreshold, SIGNAL(valueChanged(int)),
            this, SLOT(scalrenAutoThresholdChanged(int)));
whitlocb's avatar
whitlocb committed
346
    advLayout->addWidget(scalrenAutoThreshold, row, 3);
347
    row++;
hrchilds's avatar
hrchilds committed
348

hrchilds's avatar
hrchilds committed
349
    // Create the compress mode widgets.
whitlocb's avatar
whitlocb committed
350 351 352 353 354
    scalrenCompressLabel = new QLabel(tr("Compress images (geometry too) from engine"),
                                      advancedOptions);
    advLayout->addWidget(scalrenCompressLabel, row, 0, 1, 3);
    scalrenCompressMode = new QButtonGroup(advancedOptions);
    connect(scalrenCompressMode, SIGNAL(buttonClicked(int)),
hrchilds's avatar
hrchilds committed
355
            this, SLOT(scalrenCompressModeChanged(int)));
356 357
    row++;

whitlocb's avatar
whitlocb committed
358
    QRadioButton *cmp_auto = new QRadioButton(tr("Auto"), advancedOptions);
hrchilds's avatar
hrchilds committed
359
    cmp_auto->setEnabled(0); // disabled until implemented
whitlocb's avatar
whitlocb committed
360 361 362 363 364 365 366 367
    scalrenCompressMode->addButton(cmp_auto, 0);
    advLayout->addWidget(cmp_auto, row, 1);
    QRadioButton *cmp_always = new QRadioButton(tr("Always"), advancedOptions);
    scalrenCompressMode->addButton(cmp_always, 1);
    advLayout->addWidget(cmp_always, row, 2);
    QRadioButton *cmp_never = new QRadioButton(tr("Never"), advancedOptions);
    scalrenCompressMode->addButton(cmp_never, 2);
    advLayout->addWidget(cmp_never, row, 3);
368
    row++;
hrchilds's avatar
hrchilds committed
369

370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
    // Create the compact domains widgets.
    QLabel *compactDomainsLabel = new QLabel(tr("Compact domains on engine"), advancedOptions);
    advLayout->addWidget(compactDomainsLabel, row, 0, 1, 3);
    compactDomainsActivationMode = new QButtonGroup(advancedOptions);
    connect(compactDomainsActivationMode, SIGNAL(buttonClicked(int)),
            this, SLOT(compactDomainsActivationModeChanged(int)));
    row++;

    compactDomainsAuto = new QRadioButton(tr("Auto"), advancedOptions);
    compactDomainsActivationMode->addButton(compactDomainsAuto, 0);
    advLayout->addWidget(compactDomainsAuto, row, 1);
    compactDomainsAlways = new QRadioButton(tr("Always"), advancedOptions);
    compactDomainsActivationMode->addButton(compactDomainsAlways, 1);
    advLayout->addWidget(compactDomainsAlways, row, 2);
    compactDomainsNever = new QRadioButton(tr("Never"), advancedOptions);
    compactDomainsActivationMode->addButton(compactDomainsNever, 2);
    advLayout->addWidget(compactDomainsNever, row, 3);
    row++;

    // Create the polygon count spin box for scalable rendering threshold
    compactDomainsGeometryLabel =  new QLabel(tr("When domains per process exceeds"), advancedOptions);
    advLayout->addWidget(compactDomainsGeometryLabel, row, 1, 1, 2);
    compactDomainsAutoThreshold = new QSpinBox(advancedOptions);
    compactDomainsAutoThreshold->setMinimum(0);
    compactDomainsAutoThreshold->setMaximum(100000);
    compactDomainsAutoThreshold->setValue(RenderingAttributes::DEFAULT_COMPACT_DOMAINS_AUTO_THRESHOLD);
    compactDomainsAutoThresholdChanged(RenderingAttributes::DEFAULT_COMPACT_DOMAINS_AUTO_THRESHOLD);
    connect(compactDomainsAutoThreshold, SIGNAL(valueChanged(int)),
            this, SLOT(compactDomainsAutoThresholdChanged(int)));
    advLayout->addWidget(compactDomainsAutoThreshold, row, 3);
    row++;

hrchilds's avatar
hrchilds committed
402
    // Create the shadow lighting options
whitlocb's avatar
whitlocb committed
403
    shadowToggle = new QCheckBox(tr("Shadows (scalable rendering only)"), advancedOptions);
hrchilds's avatar
hrchilds committed
404 405
    connect(shadowToggle, SIGNAL(toggled(bool)),
            this, SLOT(shadowToggled(bool)));
whitlocb's avatar
whitlocb committed
406
    advLayout->addWidget(shadowToggle, row, 0, 1, 3);
407
    row++;
hrchilds's avatar
hrchilds committed
408

whitlocb's avatar
whitlocb committed
409
    shadowStrengthSlider = new QvisOpacitySlider(0, 100, 10, 60, advancedOptions);
hrchilds's avatar
hrchilds committed
410 411 412
    shadowStrengthSlider->setTickInterval(25);
    connect(shadowStrengthSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(shadowStrengthChanged(int, const void*)));
whitlocb's avatar
whitlocb committed
413 414 415 416
    shadowStrengthLabel = new QLabel(tr("Strength"), advancedOptions);
    shadowStrengthLabel->setBuddy(shadowStrengthSlider);
    advLayout->addWidget(shadowStrengthLabel, row,1);
    advLayout->addWidget(shadowStrengthSlider, row, 2, 1, 2);
417 418 419
    row++;

    // Create the depth cueing options
whitlocb's avatar
whitlocb committed
420
    depthCueingToggle = new QCheckBox(tr("Depth Cueing (scalable rendering only)"), advancedOptions);
421 422
    connect(depthCueingToggle, SIGNAL(toggled(bool)),
            this, SLOT(depthCueingToggled(bool)));
whitlocb's avatar
whitlocb committed
423
    advLayout->addWidget(depthCueingToggle, row, 0, 1, 3);
424 425
    row++;

426 427 428 429 430 431 432
    depthCueingAutoToggle = new QCheckBox(tr("Cue automatically along camera depth"), advancedOptions);
    connect(depthCueingAutoToggle, SIGNAL(toggled(bool)),
            this, SLOT(depthCueingAutoToggled(bool)));
    advLayout->addWidget(depthCueingAutoToggle, row, 1, 1, 3);
    row++;

    depthCueingStartLabel = new QLabel(tr("Manual start point"));
whitlocb's avatar
whitlocb committed
433 434 435
    advLayout->addWidget(depthCueingStartLabel, row, 1);
    depthCueingStartEdit = new QLineEdit(advancedOptions);
    advLayout->addWidget(depthCueingStartEdit, row, 2, 1, 2);
436 437 438 439
    connect(depthCueingStartEdit, SIGNAL(returnPressed()),
            this, SLOT(depthCueingStartChanged()));
    row++;

440
    depthCueingEndLabel = new QLabel(tr("Manual end point"));
whitlocb's avatar
whitlocb committed
441 442 443
    advLayout->addWidget(depthCueingEndLabel, row, 1);
    depthCueingEndEdit = new QLineEdit(advancedOptions);
    advLayout->addWidget(depthCueingEndEdit, row, 2, 1, 2);
444 445 446 447
    connect(depthCueingEndEdit, SIGNAL(returnPressed()),
            this, SLOT(depthCueingEndChanged()));
    row++;
    
hrchilds's avatar
hrchilds committed
448
    // Create color texturing options.
whitlocb's avatar
whitlocb committed
449
    colorTexturingToggle = new QCheckBox(tr("Apply color using textures"), advancedOptions);
hrchilds's avatar
hrchilds committed
450 451
    connect(colorTexturingToggle, SIGNAL(toggled(bool)),
            this, SLOT(colorTexturingToggled(bool)));
whitlocb's avatar
whitlocb committed
452
    advLayout->addWidget(colorTexturingToggle, row, 0, 1, 3);
453
    row++;
hrchilds's avatar
hrchilds committed
454

whitlocb's avatar
whitlocb committed
455 456
    return advancedOptions;
}
hrchilds's avatar
hrchilds committed
457

whitlocb's avatar
whitlocb committed
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
// ****************************************************************************
// Method: QvisRenderingWindow::CreateInformationPage
//
// Purpose: 
//   Creates the information page.
//
// Arguments:
//
// Returns:    The information page.
//
// Note:       
//
// Programmer: Brad Whitlock
// Creation:   Thu Jun 19 13:18:51 PDT 2008
//
// Modifications:
//   
// ****************************************************************************

QWidget *
QvisRenderingWindow::CreateInformationPage()
{
    QWidget *info = new QWidget(central);
hrchilds's avatar
hrchilds committed
481 482 483 484
    QVBoxLayout *vLayout = new QVBoxLayout(info);
    vLayout->addSpacing(10);
    vLayout->setMargin(10);

whitlocb's avatar
whitlocb committed
485
    renderNotifyToggle = new QCheckBox(tr("Query after each render"), info);
hrchilds's avatar
hrchilds committed
486 487 488 489 490
    connect(renderNotifyToggle, SIGNAL(toggled(bool)),
            this, SLOT(renderNotifyToggled(bool)));
    vLayout->addWidget(renderNotifyToggle);
    vLayout->addSpacing(5);

whitlocb's avatar
whitlocb committed
491 492 493 494 495 496 497
    QGridLayout *iLayout = new QGridLayout(0);
    iLayout->setSpacing(5);
    vLayout->addLayout(iLayout);
    QLabel *scalrenLabel2 = new QLabel(tr("Using Scalable Rendering: "), info);
    iLayout->addWidget(scalrenLabel2, 0, 0);
    scalrenUsingLabel = new QLabel(tr("N/A"), info);
    iLayout->addWidget(scalrenUsingLabel, 0, 1, 1, 3);
hrchilds's avatar
hrchilds committed
498 499
    vLayout->addSpacing(5);

whitlocb's avatar
whitlocb committed
500 501 502 503 504 505 506 507 508 509 510 511 512
    fpsLabel = new QLabel(tr("Frames per second:"), info);
    iLayout->addWidget(fpsLabel, 1, 0);
    fpsMinLabel = new QLabel("0.", info);
    iLayout->addWidget(fpsMinLabel, 1, 1);
    fpsAvgLabel = new QLabel("0.", info);
    iLayout->addWidget(fpsAvgLabel, 1, 2);
    fpsMaxLabel = new QLabel("0.", info);
    iLayout->addWidget(fpsMaxLabel, 1, 3);

    QLabel *ntri = new QLabel(tr("Approximate polygon count:"), info);
    iLayout->addWidget(ntri, 2, 0);
    approxNumPrimitives = new QLabel("0.", info);
    iLayout->addWidget(approxNumPrimitives, 2, 1);
hrchilds's avatar
hrchilds committed
513 514
    vLayout->addSpacing(5);

whitlocb's avatar
whitlocb committed
515
    QGridLayout *eLayout = new QGridLayout(0);
hrchilds's avatar
hrchilds committed
516
    eLayout->setSpacing(5);
whitlocb's avatar
whitlocb committed
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
    vLayout->addLayout(eLayout);
    QLabel *xExtentsLabel = new QLabel(tr("X Extents:"), info);
    eLayout->addWidget(xExtentsLabel, 0, 0);
    extents[0] = new QLabel("0.", info);
    eLayout->addWidget(extents[0], 0, 1);
    extents[1] = new QLabel("0.", info);
    eLayout->addWidget(extents[1], 0, 2);

    QLabel *yExtentsLabel = new QLabel(tr("Y Extents:"), info);
    eLayout->addWidget(yExtentsLabel, 1, 0);
    extents[2] = new QLabel("0.", info);
    eLayout->addWidget(extents[2], 1, 1);
    extents[3] = new QLabel("0.", info);
    eLayout->addWidget(extents[3], 1, 2);

    QLabel *zExtentsLabel = new QLabel(tr("Z Extents:"), info);
    eLayout->addWidget(zExtentsLabel, 2, 0);
    extents[4] = new QLabel("0.", info);
    eLayout->addWidget(extents[4], 2, 1);
    extents[5] = new QLabel("0.", info);
    eLayout->addWidget(extents[5], 2, 2);
538
    vLayout->addStretch(1000);
whitlocb's avatar
whitlocb committed
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560

    return info;
}

// ****************************************************************************
// Method: QvisRenderingWindow::CreateWindowContents
//
// Purpose: 
//   This method creates all of the window's widgets.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:47:57 PST 2002
//
// Modifications:
//   Brad Whitlock, Thu Jun 19 11:57:46 PDT 2008
//   Moved code to helper functions.
//
// ****************************************************************************

void
QvisRenderingWindow::CreateWindowContents()
{
hkrishna's avatar
hkrishna committed
561
    //int row = 0;
whitlocb's avatar
whitlocb committed
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579

    QTabWidget *topTab = new QTabWidget(central);
    topLayout->addWidget(topTab);

    //
    // Create the basic renderer options page.
    //
    topTab->addTab(CreateBasicPage(), tr("Basic"));

    //
    // Create the advanced renderer options group.
    //
    topTab->addTab(CreateAdvancedPage(), tr("Advanced"));

    //
    // Create the renderer information group.
    //
    topTab->addTab(CreateInformationPage(), tr("Information"));
hrchilds's avatar
hrchilds committed
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateWindow
//
// Purpose: 
//   This method updates the window's widgets when its subjects update.
//
// Arguments:
//   doAll : Whether or not to ignore field selection.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:48:24 PST 2002
//
// Modifications:
hrchilds's avatar
hrchilds committed
595
//
hrchilds's avatar
hrchilds committed
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
// ****************************************************************************

void
QvisRenderingWindow::UpdateWindow(bool doAll)
{
    if(SelectedSubject() == renderAtts || doAll)
        UpdateOptions(doAll);
    if(SelectedSubject() == windowInfo || doAll)
        UpdateInformation(doAll);
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateOptions
//
// Purpose: 
//   Updates the widgets that control the rendering options.
//
// Arguments:
//   doAll : Whether or not to ignore selection and update all widgets.
//
// Programmer: Brad Whitlock
// Creation:   Tue Sep 24 11:28:53 PDT 2002
//
// Modifications:
//   Brad Whitlock, Thu Oct 24 13:35:22 PST 2002
//   I added code to enable/disable the stereo rendering buttons.
//
//   Kathleen Bonnell, Wed Dec  4 18:42:48 PST 2002 
//   Renumber switch cases, to reflect antialisingFrames removed from atts. 
//
hrchilds's avatar
hrchilds committed
626 627 628
//   Jeremy Meredith, Fri Nov 14 17:44:35 PST 2003
//   Added specular options.
//
hrchilds's avatar
hrchilds committed
629 630 631
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshld to scalrenActivationMode
//
hrchilds's avatar
hrchilds committed
632 633 634
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Add support for multiple display list modes.
//
hrchilds's avatar
hrchilds committed
635 636 637 638
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
639 640 641
//   Hank Childs, Sun Oct 24 07:36:18 PDT 2004
//   Added shadow options.
//
hrchilds's avatar
hrchilds committed
642 643 644
//   Mark C. Miller, Tue Jan  4 10:23:19 PST 2005
//   Fixed problem with updating scalable auto threshold
//
hrchilds's avatar
hrchilds committed
645 646 647
//   Kathleen Bonnell, Thu Jun 30 15:29:55 PDT 2005 
//   Added redgreen radiobutton.
//
hrchilds's avatar
hrchilds committed
648 649
//   Mark C. Miller, Thu Nov  3 16:59:41 PST 2005
//   Added compression controls
hrchilds's avatar
hrchilds committed
650 651 652 653
//
//   Brad Whitlock, Mon Sep 18 10:49:51 PDT 2006
//   Added colorTexturingFlag.
//
654 655 656
//   Jeremy Meredith, Wed Aug 29 15:27:16 EDT 2007
//   Added depth cueing.  Simplified and corrected window sensitivity.
//
whitlocb's avatar
whitlocb committed
657 658 659
//   Brad Whitlock, Mon Dec 17 10:25:23 PST 2007
//   Made it use ids.
//
whitlocb's avatar
whitlocb committed
660 661 662
//   Brad Whitlock, Thu Jun 19 13:26:50 PDT 2008
//   Qt 4.
//
663 664 665
//   Jeremy Meredith, Fri Apr 30 15:04:34 EDT 2010
//   Added an automatic start/end setting capability for depth cueing.
//
666 667 668
//   Eric Brugger, Tue Oct 25 12:32:40 PDT 2011
//   Add a multi resolution display capability for AMR data.
//
hrchilds's avatar
hrchilds committed
669 670 671 672 673 674
// ****************************************************************************

void
QvisRenderingWindow::UpdateOptions(bool doAll)
{
    QString tmp;
hrchilds's avatar
hrchilds committed
675
    int itmp, itmp2;
hrchilds's avatar
hrchilds committed
676 677 678 679 680 681 682 683 684 685 686 687 688 689

    // Loop through all the attributes and do something for
    // each of them that changed. This function is only responsible
    // for displaying the state values and setting widget sensitivity.
    for(int i = 0; i < renderAtts->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!renderAtts->IsSelected(i))
            continue;
        }

        switch(i)
        {
whitlocb's avatar
whitlocb committed
690
        case RenderingAttributes::ID_antialiasing:
hrchilds's avatar
hrchilds committed
691 692 693 694
            antialiasingToggle->blockSignals(true);
            antialiasingToggle->setChecked(renderAtts->GetAntialiasing());
            antialiasingToggle->blockSignals(false);
            break;
695 696 697 698 699 700 701 702 703 704 705
        case RenderingAttributes::ID_multiresolutionMode:
            multiresolutionModeToggle->blockSignals(true);
            multiresolutionModeToggle->setChecked(renderAtts->GetMultiresolutionMode());
            multiresolutionModeToggle->blockSignals(false);
            break;
        case RenderingAttributes::ID_multiresolutionCellSize:
            multiresolutionSmallestCellLineEdit->blockSignals(true);
            tmp = DoubleToQString(renderAtts->GetMultiresolutionCellSize());
            multiresolutionSmallestCellLineEdit->setText(tmp);
            multiresolutionSmallestCellLineEdit->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
706
        case RenderingAttributes::ID_geometryRepresentation:
hrchilds's avatar
hrchilds committed
707 708
            itmp = (int)renderAtts->GetGeometryRepresentation();
            objectRepresentation->blockSignals(true);
whitlocb's avatar
whitlocb committed
709
            objectRepresentation->button(itmp)->setChecked(true);
hrchilds's avatar
hrchilds committed
710 711
            objectRepresentation->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
712
        case RenderingAttributes::ID_displayListMode:
hrchilds's avatar
hrchilds committed
713 714 715 716 717 718 719 720
            itmp = (int) renderAtts->GetDisplayListMode();
            if (itmp == 2) // Auto for atts's enum type order
                itmp2 = 0; // Order of Auto in window
            else if (itmp == 1) // Always for atts' enum type order
                itmp2 = 1; // Order of Always in window.
            else           // Never for atts' enum type order
                itmp2 = 2; // Order of Never in window.
            dlMode->blockSignals(true);
whitlocb's avatar
whitlocb committed
721
            dlMode->button(itmp2)->setChecked(true);
hrchilds's avatar
hrchilds committed
722
            dlMode->blockSignals(false);
hrchilds's avatar
hrchilds committed
723
            break;
whitlocb's avatar
whitlocb committed
724
        case RenderingAttributes::ID_stereoRendering:
hrchilds's avatar
hrchilds committed
725 726 727 728
            stereoToggle->blockSignals(true);
            stereoToggle->setChecked(renderAtts->GetStereoRendering());
            stereoToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
729
        case RenderingAttributes::ID_stereoType:
hrchilds's avatar
hrchilds committed
730
            stereoType->blockSignals(true);
whitlocb's avatar
whitlocb committed
731
            stereoType->button((int)renderAtts->GetStereoType())->setChecked(true);
hrchilds's avatar
hrchilds committed
732 733
            stereoType->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
734
        case RenderingAttributes::ID_notifyForEachRender:
hrchilds's avatar
hrchilds committed
735 736 737 738
            renderNotifyToggle->blockSignals(true);
            renderNotifyToggle->setChecked(renderAtts->GetNotifyForEachRender());
            renderNotifyToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
739
        case RenderingAttributes::ID_scalableActivationMode:
whitlocb's avatar
whitlocb committed
740
            { // new scope
hrchilds's avatar
hrchilds committed
741 742
            RenderingAttributes::TriStateMode rtmp;
            rtmp = renderAtts->GetScalableActivationMode();
hrchilds's avatar
hrchilds committed
743
            scalrenActivationMode->blockSignals(true);
hrchilds's avatar
hrchilds committed
744
            if (rtmp == RenderingAttributes::Always)
whitlocb's avatar
whitlocb committed
745
               scalrenActivationMode->button(1)->setChecked(true);
hrchilds's avatar
hrchilds committed
746
            else if (rtmp == RenderingAttributes::Never)
whitlocb's avatar
whitlocb committed
747
               scalrenActivationMode->button(2)->setChecked(true);
hrchilds's avatar
hrchilds committed
748
            else
whitlocb's avatar
whitlocb committed
749
               scalrenActivationMode->button(0)->setChecked(true);
hrchilds's avatar
hrchilds committed
750
            scalrenActivationMode->blockSignals(false);
whitlocb's avatar
whitlocb committed
751
            }
hrchilds's avatar
hrchilds committed
752
            break;
whitlocb's avatar
whitlocb committed
753
        case RenderingAttributes::ID_scalableAutoThreshold:
whitlocb's avatar
whitlocb committed
754
            { // new scope
hrchilds's avatar
hrchilds committed
755 756 757 758 759 760
            QString suffix;           
            int step, widgetVal;
            int actualVal = renderAtts->GetScalableAutoThreshold();
            InterpretScalableAutoThreshold(actualVal, &step, &suffix, &widgetVal);
            scalrenAutoThreshold->blockSignals(true);
            scalrenAutoThreshold->setSuffix(suffix);
whitlocb's avatar
whitlocb committed
761
            scalrenAutoThreshold->setSingleStep(step);
hrchilds's avatar
hrchilds committed
762 763 764
            scalrenAutoThreshold->setValue(widgetVal);
            scalrenAutoThreshold->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
765
            }
766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788
        case RenderingAttributes::ID_compactDomainsActivationMode:
            {
            RenderingAttributes::TriStateMode rtmp;
            rtmp = renderAtts->GetCompactDomainsActivationMode();
            compactDomainsActivationMode->blockSignals(true);
            if (rtmp == RenderingAttributes::Always)
                compactDomainsActivationMode->button(1)->setChecked(true);
            else if (rtmp == RenderingAttributes::Never)
                compactDomainsActivationMode->button(2)->setChecked(true);
            else
                compactDomainsActivationMode->button(0)->setChecked(true);
            compactDomainsActivationMode->blockSignals(false);
            }
          break;
        case RenderingAttributes::ID_compactDomainsAutoThreshold:
            { // new scope
            compactDomainsAutoThreshold->blockSignals(true);
            int val = renderAtts->GetCompactDomainsAutoThreshold();
            compactDomainsAutoThreshold->setValue(val);
            compactDomainsAutoThreshold->blockSignals(false);
            break;
            }

whitlocb's avatar
whitlocb committed
789
        case RenderingAttributes::ID_specularFlag:
hrchilds's avatar
hrchilds committed
790 791 792 793
            specularToggle->blockSignals(true);
            specularToggle->setChecked(renderAtts->GetSpecularFlag());
            specularToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
794
        case RenderingAttributes::ID_specularCoeff:
hrchilds's avatar
hrchilds committed
795 796 797 798
            specularStrengthSlider->blockSignals(true);
            specularStrengthSlider->setValue(int(renderAtts->GetSpecularCoeff()*100.));
            specularStrengthSlider->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
799
        case RenderingAttributes::ID_specularPower:
hrchilds's avatar
hrchilds committed
800 801 802 803
            specularPowerSlider->blockSignals(true);
            specularPowerSlider->setValue(int(renderAtts->GetSpecularPower()*10.));
            specularPowerSlider->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
804
        case RenderingAttributes::ID_specularColor:
hrchilds's avatar
hrchilds committed
805 806
            // Not user-modifiable at this time
            break;
whitlocb's avatar
whitlocb committed
807
        case RenderingAttributes::ID_doShadowing:
hrchilds's avatar
hrchilds committed
808 809 810 811
            shadowToggle->blockSignals(true);
            shadowToggle->setChecked(renderAtts->GetDoShadowing());
            shadowToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
812
        case RenderingAttributes::ID_shadowStrength:
hrchilds's avatar
hrchilds committed
813 814 815 816
            shadowStrengthSlider->blockSignals(true);
            shadowStrengthSlider->setValue(int(renderAtts->GetShadowStrength()*100.));
            shadowStrengthSlider->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
817
        case RenderingAttributes::ID_doDepthCueing:
818 819 820 821
            depthCueingToggle->blockSignals(true);
            depthCueingToggle->setChecked(renderAtts->GetDoDepthCueing());
            depthCueingToggle->blockSignals(false);
            break;
822 823 824 825 826
        case RenderingAttributes::ID_depthCueingAutomatic:
            depthCueingAutoToggle->blockSignals(true);
            depthCueingAutoToggle->setChecked(renderAtts->GetDepthCueingAutomatic());
            depthCueingAutoToggle->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
827
        case RenderingAttributes::ID_startCuePoint:
828
            depthCueingStartEdit->blockSignals(true);
whitlocb's avatar
whitlocb committed
829
            tmp = DoublesToQString(renderAtts->GetStartCuePoint(), 3);
830 831 832
            depthCueingStartEdit->setText(tmp);
            depthCueingStartEdit->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
833
        case RenderingAttributes::ID_endCuePoint:
834
            depthCueingEndEdit->blockSignals(true);
whitlocb's avatar
whitlocb committed
835
            tmp = DoublesToQString(renderAtts->GetEndCuePoint(), 3);
836 837 838
            depthCueingEndEdit->setText(tmp);
            depthCueingEndEdit->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
839
        case RenderingAttributes::ID_compressionActivationMode:
hrchilds's avatar
hrchilds committed
840 841 842 843 844 845 846 847
            itmp = (int) renderAtts->GetCompressionActivationMode();
            if (itmp == 2) // Auto for atts's enum type order
                itmp2 = 0; // Order of Auto in window
            else if (itmp == 1) // Always for atts' enum type order
                itmp2 = 1; // Order of Always in window.
            else           // Never for atts' enum type order
                itmp2 = 2; // Order of Never in window.
            scalrenCompressMode->blockSignals(true);
whitlocb's avatar
whitlocb committed
848
            scalrenCompressMode->button(itmp2)->setChecked(true);
hrchilds's avatar
hrchilds committed
849 850
            scalrenCompressMode->blockSignals(false);
            break;
whitlocb's avatar
whitlocb committed
851
        case RenderingAttributes::ID_colorTexturingFlag:
hrchilds's avatar
hrchilds committed
852 853 854 855
            colorTexturingToggle->blockSignals(true);
            colorTexturingToggle->setChecked(renderAtts->GetColorTexturingFlag());
            colorTexturingToggle->blockSignals(false);
            break;
hrchilds's avatar
hrchilds committed
856 857
        }
    }
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875

    UpdateWindowSensitivity();
}


// ****************************************************************************
//  Method:  QvisRenderingWindow::UpdateWindowSensitivity
//
//  Purpose:
//    Set the sensitivity of all widgets in this window based on
//    values in the attributes.
//
//  Arguments:
//    none
//
//  Programmer:  Jeremy Meredith
//  Creation:    August 29, 2007
//
whitlocb's avatar
whitlocb committed
876 877 878 879 880 881 882
//  Modifications:
//    Brad Whitlock, Thu Jun 19 13:44:11 PDT 2008
//    Qt 4.
//
//    Cyrus Harrison, Mon Jul 28 15:23:05 PDT 2008
//    I added code to enable/disable the scalable auto threshold spin box based
//    on the scalable rendering mode. 
883
//
884 885 886
//    Jeremy Meredith, Fri Apr 30 15:04:34 EDT 2010
//    Added an automatic start/end setting capability for depth cueing.
//
887 888 889
//    Dave Pugmire, Tue Aug 24 11:32:12 EDT 2010
//    Add compact domain options.
//
890 891 892 893
//    Hank Childs, Wed Oct 12 07:26:39 PDT 2011
//    Don't disable shadowing or depth cueing ... they now manually force
//    SR to always.
//
894 895 896
//    Eric Brugger, Tue Oct 25 12:32:40 PDT 2011
//    Add a multi resolution display capability for AMR data.
//
897
// ****************************************************************************
whitlocb's avatar
whitlocb committed
898

899 900 901
void
QvisRenderingWindow::UpdateWindowSensitivity()
{
902
    bool multiresolutionOn = renderAtts->GetMultiresolutionMode();
hkrishna's avatar
hkrishna committed
903 904
    //bool scalableAlways =
    //    renderAtts->GetScalableActivationMode() == RenderingAttributes::Always;
905 906
    bool scalableAuto =
        renderAtts->GetScalableActivationMode() == RenderingAttributes::Auto;
907 908
    bool compactAuto =
        renderAtts->GetCompactDomainsActivationMode() == RenderingAttributes::Auto;
909 910
    bool shadowOn = renderAtts->GetDoShadowing();
    bool depthCueingOn = renderAtts->GetDoDepthCueing();
911
    bool depthCueingAuto = renderAtts->GetDepthCueingAutomatic();
912 913 914
    bool stereoOn = renderAtts->GetStereoRendering();
    bool specularOn = renderAtts->GetSpecularFlag();

915 916 917
    multiresolutionSmallestCellLabel->setEnabled(multiresolutionOn);
    multiresolutionSmallestCellLineEdit->setEnabled(multiresolutionOn);

918
    scalrenAutoThreshold->setEnabled(scalableAuto);
919
    compactDomainsAutoThreshold->setEnabled(compactAuto);
920 921
    shadowStrengthSlider->setEnabled(shadowOn);
    shadowStrengthLabel->setEnabled(shadowOn);
922

923 924 925 926 927
    depthCueingAutoToggle->setEnabled(depthCueingOn);
    depthCueingStartEdit->setEnabled(depthCueingOn && !depthCueingAuto);
    depthCueingStartLabel->setEnabled(depthCueingOn && !depthCueingAuto);
    depthCueingEndEdit->setEnabled(depthCueingOn && !depthCueingAuto);
    depthCueingEndLabel->setEnabled(depthCueingOn && !depthCueingAuto);
928 929 930 931 932 933 934 935 936 937

    redblue->setEnabled(stereoOn);
    interlace->setEnabled(stereoOn);
    crystalEyes->setEnabled(stereoOn);
    redgreen->setEnabled(stereoOn);

    specularStrengthSlider->setEnabled(specularOn);
    specularPowerSlider->setEnabled(specularOn);
    specularStrengthLabel->setEnabled(specularOn);
    specularPowerLabel->setEnabled(specularOn);
hrchilds's avatar
hrchilds committed
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateInformation
//
// Purpose: 
//   Updates the information labels with statistics from the viewer.
//
// Arguments:
//   doAll : Whether or not to ignore selection and update all widgets.
//
// Programmer: Brad Whitlock
// Creation:   Tue Sep 24 11:29:35 PDT 2002
//
// Modifications:
//   Eric Brugger, Fri Apr 18 11:52:33 PDT 2003
//   I removed auto center view.
//   
hrchilds's avatar
hrchilds committed
956 957 958 959
//   Jeremy Meredith, Tue Nov 16 11:39:53 PST 2004
//   Replaced simple QString::sprintf's with a setNum because there seems
//   to be a bug causing numbers to be incremented by .00001.  See '5263.
//
hrchilds's avatar
hrchilds committed
960 961 962
//   Mark C. Miller, Wed Jan  5 16:23:01 PST 2005
//   Fixed problem with case lables not matching Select statements
//
hrchilds's avatar
hrchilds committed
963 964 965
//   Mark C. Miller, Fri Mar  4 13:05:02 PST 2005
//   Changed GetNumTriangles to GetNumPrimitives
//
hrchilds's avatar
hrchilds committed
966 967 968
//   Mark C. Miller, Thu Jul 21 20:16:42 PDT 2005
//   Added a break; statement after case label 16
//
hrchilds's avatar
hrchilds committed
969 970
//   Mark C. Miller, Wed Nov 16 10:46:36 PST 2005
//   Added seconds per frame for < 1 fps cases 
whitlocb's avatar
whitlocb committed
971 972 973 974
//
//   Brad Whitlock, Mon Dec 17 10:30:33 PST 2007
//   Made it use ids.
//
975 976 977
//   Brad Whitlock, Tue Apr  8 15:26:49 PDT 2008
//   Support for internationalization.
//
hrchilds's avatar
hrchilds committed
978 979 980 981 982 983 984
// ****************************************************************************

void
QvisRenderingWindow::UpdateInformation(bool doAll)
{
    QString tmp;
    float fps;
hrchilds's avatar
hrchilds committed
985
    int j;
hrchilds's avatar
hrchilds committed
986 987 988 989 990 991 992 993 994 995 996 997 998 999

    // Loop through all the attributes and do something for
    // each of them that changed. This function is only responsible
    // for displaying the state values and setting widget sensitivity.
    for(int i = 0; i < windowInfo->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!windowInfo->IsSelected(i))
            continue;
        }

        switch(i)
        {
whitlocb's avatar
whitlocb committed
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
        case WindowInformation::ID_activeSource:
        case WindowInformation::ID_activeTimeSlider:
        case WindowInformation::ID_timeSliders:
        case WindowInformation::ID_timeSliderCurrentStates:
        case WindowInformation::ID_animationMode:
        case WindowInformation::ID_interactionMode:
        case WindowInformation::ID_boundingBoxNavigate:
        case WindowInformation::ID_spin:
        case WindowInformation::ID_fullFrame:
        case WindowInformation::ID_perspective:
        case WindowInformation::ID_lockView:
        case WindowInformation::ID_lockTools:
        case WindowInformation::ID_lockTime:
        case WindowInformation::ID_viewExtentsType:
        case WindowInformation::ID_viewDimension:
        case WindowInformation::ID_viewKeyframes:
        case WindowInformation::ID_cameraViewMode:
hrchilds's avatar
hrchilds committed
1017
            break;
whitlocb's avatar
whitlocb committed
1018
        case WindowInformation::ID_usingScalableRendering:
1019
            scalrenUsingLabel->setText(windowInfo->GetUsingScalableRendering() ? tr("yes") : tr("no"));
hrchilds's avatar
hrchilds committed
1020
            break;
whitlocb's avatar
whitlocb committed
1021
        case WindowInformation::ID_lastRenderMin:
hrchilds's avatar
hrchilds committed
1022 1023 1024 1025 1026 1027 1028 1029 1030
            // Determine the fps.
            if(windowInfo->GetLastRenderMin() > 0. &&
               windowInfo->GetLastRenderMin() < 1.e05)
                fps = 1. / windowInfo->GetLastRenderMin();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsMaxLabel->setText(tmp);
            break;
whitlocb's avatar
whitlocb committed
1031
        case WindowInformation::ID_lastRenderAvg:
hrchilds's avatar
hrchilds committed
1032 1033 1034 1035 1036
            // Determine the fps.
            if(windowInfo->GetLastRenderAvg() > 0.)
                fps = 1. / windowInfo->GetLastRenderAvg();
            else
                fps = 0.;
hrchilds's avatar
hrchilds committed
1037 1038 1039
            if (fps > 0.0 && fps < 1.0)
            {
                fps = 1.0 / fps;
1040
                fpsLabel->setText(tr("Seconds per frame:"));
hrchilds's avatar
hrchilds committed
1041 1042 1043
            }
            else
            {
1044
                fpsLabel->setText(tr("Frames per second:"));
hrchilds's avatar
hrchilds committed
1045
            }
hrchilds's avatar
hrchilds committed
1046 1047 1048
            tmp.sprintf("%1.3g", fps);
            fpsAvgLabel->setText(tmp);
            break;
whitlocb's avatar
whitlocb committed
1049
        case WindowInformation::ID_lastRenderMax:
hrchilds's avatar
hrchilds committed
1050 1051 1052 1053 1054 1055 1056 1057
            // Determine the fps.
            if(windowInfo->GetLastRenderMax() > 0.)
                fps = 1. / windowInfo->GetLastRenderMax();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsMinLabel->setText(tmp);
            break;
whitlocb's avatar
whitlocb committed
1058
        case WindowInformation::ID_numPrimitives:
hrchilds's avatar
hrchilds committed
1059 1060
            tmp.sprintf("%d", windowInfo->GetNumPrimitives());
            approxNumPrimitives->setText(tmp);
hrchilds's avatar
hrchilds committed
1061
            break;
whitlocb's avatar
whitlocb committed
1062
        case WindowInformation::ID_extents:
hrchilds's avatar
hrchilds committed
1063
            for(j = 0; j < 6; ++j)
hrchilds's avatar
hrchilds committed
1064 1065 1066
            {
                double d = windowInfo->GetExtents()[j];
                if(d == DBL_MAX || d == -DBL_MAX)
1067
                    tmp = tr("not set");
hrchilds's avatar
hrchilds committed
1068
                else
hrchilds's avatar
hrchilds committed
1069
                    tmp.setNum(windowInfo->GetExtents()[j]);
hrchilds's avatar
hrchilds committed
1070 1071 1072
                extents[j]->setText(tmp);
            }
            break;
whitlocb's avatar
whitlocb committed
1073 1074 1075
        case WindowInformation::ID_windowSize:
        case WindowInformation::ID_winMode:
            break;
hrchilds's avatar
hrchilds committed
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102
        }            
    }
}

// ****************************************************************************
// Method: QvisRenderingWindow::Apply
//
// Purpose: 
//   Tells the viewer to apply the rendering attributes.
//
// Arguments:
//   ignore : A flag that causes us to unconditionally apply the
//            rendering attributes.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:49:19 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::Apply(bool ignore)
{
    if(AutoUpdate() || ignore)
    {
        renderAtts->Notify();
hrchilds's avatar
hrchilds committed
1103
        GetViewerMethods()->SetRenderingAttributes();
hrchilds's avatar
hrchilds committed
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194
    }
    else
        renderAtts->Notify();
}

// ****************************************************************************
// Method: QvisRenderingWindow::SubjectRemoved
//
// Purpose: 
//   This method makes sure that we don't Detach from the subject if it is
//   destroyed first.
//
// Arguments:
//   TheRemovedSubject : The subject being deleted.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:50:04 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::SubjectRemoved(Subject *TheRemovedSubject)
{
    if(TheRemovedSubject == renderAtts)
        renderAtts = 0;
    else if(TheRemovedSubject == windowInfo)
        windowInfo = 0;
}

// ****************************************************************************
// Method: QvisRenderingWindow::ConnectRenderingAttributes
//
// Purpose: 
//   Makes this window observe the rendering attributes.
//
// Arguments:
//   w : The rendering attributes.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:11 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::ConnectRenderingAttributes(RenderingAttributes *w)
{
    renderAtts = w;
    renderAtts->Attach(this);
}

// ****************************************************************************
// Method: QvisRenderingWindow::ConnectWindowInformation
//
// Purpose: 
//   Makes this window observe the window information.
//
// Arguments:
//   w : The window information.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:11 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::ConnectWindowInformation(WindowInformation *w)
{
    windowInfo = w;
    windowInfo->Attach(this);
}

//
// Qt slot functions
//

// ****************************************************************************
// Method: QvisRenderingWindow::apply
//
// Purpose: 
//   This Qt slot function is called by clicking the apply button.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:45 PST 2002
//
// Modifications:
1195 1196
//   Jeremy Meredith, Wed Aug 29 15:27:16 EDT 2007
//   Added call to GetCurrentValues.
hrchilds's avatar
hrchilds committed
1197 1198 1199 1200 1201 1202
//   
// ****************************************************************************

void
QvisRenderingWindow::apply()
{
1203
    GetCurrentValues();
hrchilds's avatar
hrchilds committed
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230
    Apply(true);
}

// ****************************************************************************
// Method: QvisRenderingWindow::antialiasingToggled
//
// Purpose: 
//   This Qt slot function is called when the antialiasing checkbox is clicked.
//
// Arguments:
//   val : The new AA value.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:52:07 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::antialiasingToggled(bool val)
{
    renderAtts->SetAntialiasing(val);
    SetUpdate(false);
    Apply();
}

1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318
// ****************************************************************************
// Method: QvisRenderingWindow::multiresolutionModeToggled
//
// Purpose: 
//   This Qt slot function is called when the multiresolution mode checkbox is
//   clicked.
//
// Arguments:
//   val : The new multi resolution value.
//
// Programmer: Eric Brugger
// Creation:   Tue Oct 25 12:32:40 PDT 2011
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::multiresolutionModeToggled(bool val)
{
    renderAtts->SetMultiresolutionMode(val);
    SetUpdate(false);
    Apply();
    UpdateWindowSensitivity();
}

// ****************************************************************************
// Method: QvisRenderingWindow::processMultiresolutionSmallestCellText
//
// Purpose: 
//   This Qt slot function is called when the multiresolution smallest
//   cell text is changed.
//
// Arguments:
//
// Programmer: Eric Brugger
// Creation:   Tue Oct 25 12:32:40 PDT 2011
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::processMultiresolutionSmallestCellText()
{
    double temp = -1.0;
    bool okay = sscanf(multiresolutionSmallestCellLineEdit->displayText().toStdString().c_str(),
                       "%lg", &temp) == 1;

    if (okay && temp >= 0.0)
    {
        renderAtts->SetMultiresolutionCellSize(temp);
        SetUpdate(false);
        Apply();
    }
}

// ****************************************************************************
// Method: QvisRenderingWindow::processMultiresolutionSmallestCellText
//
// Purpose: 
//   This Qt slot function is called when the multiresolution smallest
//   cell text is changed.
//
// Arguments:
//
// Programmer: Eric Brugger
// Creation:   Tue Oct 25 12:32:40 PDT 2011
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::processMultiresolutionSmallestCellText(const QString &tols)
{
    double temp = -1.0;
    bool okay = sscanf(multiresolutionSmallestCellLineEdit->displayText().toStdString().c_str(),
                       "%lg", &temp) == 1;

    if (okay && temp >= 0.0)
    {
        renderAtts->SetMultiresolutionCellSize(temp);
        SetUpdate(false);
        Apply();
    }
}

hrchilds's avatar
hrchilds committed
1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344
// ****************************************************************************
// Method: QvisRenderingWindow::objectRepresentationChanged
//
// Purpose: 
//   This Qt slot function is called when we change surface representations.
//
// Arguments:
//   val : The new surface representation.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:53:28 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::objectRepresentationChanged(int val)
{
    renderAtts->SetGeometryRepresentation(
        (RenderingAttributes::GeometryRepresentation)val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
hrchilds's avatar
hrchilds committed
1345
// Method: QvisRenderingWindow::displayListModeChanged
hrchilds's avatar
hrchilds committed
1346 1347
//
// Purpose: 
hrchilds's avatar
hrchilds committed
1348
//   This Qt slot function is called when we change the display list mode.
hrchilds's avatar
hrchilds committed
1349 1350
//
// Arguments:
hrchilds's avatar
hrchilds committed
1351
//   mode : The new display list mode.
hrchilds's avatar
hrchilds committed
1352
//
hrchilds's avatar
hrchilds committed
1353 1354
// Programmer: Hank Childs
// Creation:   May 9, 2004
hrchilds's avatar
hrchilds committed
1355 1356 1357 1358 1359 1360
//
// Modifications:
//   
// ****************************************************************************

void
hrchilds's avatar
hrchilds committed
1361
QvisRenderingWindow::displayListModeChanged(int mode)
hrchilds's avatar
hrchilds committed
1362
{
hrchilds's avatar
hrchilds committed
1363 1364 1365 1366 1367 1368 1369 1370
    int itmp = 0;
    if (mode == 0)      // Auto in Window
        itmp = 2;       // Auto for atts' enum type
    else if (mode == 1) // Always in window
        itmp = 1;       // Always for atts' enum type
    else                // Never in window.
        itmp = 0;       // Never for atts' enum type

hrchilds's avatar
hrchilds committed
1371
    renderAtts->SetDisplayListMode((RenderingAttributes::TriStateMode)itmp);
hrchilds's avatar
hrchilds committed
1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::stereoToggled
//
// Purpose: 
//   This Qt slot function is called when we change turn stereo on/off.
//
// Arguments:
//   val : The new stereo enabled mode.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:54:52 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::stereoToggled(bool val)
{
    renderAtts->SetStereoRendering(val);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::stereoTypeChanged
//
// Purpose: 
//   This Qt slot function is called when the stereo type changes.
//
// Arguments:
//   val : The new stereo type.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:55:32 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::stereoTypeChanged(int val)
{
    renderAtts->SetStereoType((RenderingAttributes::StereoTypes)val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::renderNotifyToggled
//
// Purpose: 
//   This Qt slot function is called when the "Query after render" toggle
//   button is clicked.
//
// Arguments:
//   val : The new query mode.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:56:12 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::renderNotifyToggled(bool val)
{
    renderAtts->SetNotifyForEachRender(val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
hrchilds's avatar
hrchilds committed
1449
// Method: QvisRenderingWindow::scalrenActivationModeChanged
hrchilds's avatar
hrchilds committed
1450 1451
//
// Purpose: 
hrchilds's avatar
hrchilds committed
1452
//   This Qt slot function is called when the scalable activation mode changes.
hrchilds's avatar
hrchilds committed
1453 1454
//
// Arguments:
hrchilds's avatar
hrchilds committed
1455
//   val : The new scalable activation mode flag.
hrchilds's avatar
hrchilds committed
1456
//         0 = Auto, 1 = Always, 2 = Never
hrchilds's avatar
hrchilds committed
1457 1458 1459 1460 1461
//
// Programmer: Mark C. Miller 
// Creation:   Wed Nov 20 17:09:59 PST 2002 
//
// Modifications:
hrchilds's avatar
hrchilds committed
1462 1463 1464
//
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Added scalrenAutoThreshold spinbox and geometry label
hrchilds's avatar
hrchilds committed
1465
//   
hrchilds's avatar
hrchilds committed
1466 1467 1468 1469
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
1470 1471 1472
//   Hank Childs, Sun Dec  4 18:41:39 PST 2005
//   Automatically update the shadow toggle ['5596].
//
1473 1474 1475
//   Jeremy Meredith, Wed Aug 29 15:28:05 EDT 2007
//   Moved window sensitivity handling to its own function.
//
hrchilds's avatar
hrchilds committed
1476 1477 1478
// ****************************************************************************

void
hrchilds's avatar
hrchilds committed
1479
QvisRenderingWindow::scalrenActivationModeChanged(int val)
hrchilds's avatar
hrchilds committed
1480
{
hrchilds's avatar
hrchilds committed
1481
    if (val == 0)
hrchilds's avatar
hrchilds committed
1482
    {
hrchilds's avatar
hrchilds committed
1483
        renderAtts->SetScalableActivationMode(RenderingAttributes::Auto);
hrchilds's avatar
hrchilds committed
1484 1485
        scalrenAutoThresholdChanged(scalrenAutoThreshold->value());
    }
hrchilds's avatar
hrchilds committed
1486
    else if (val == 1)
hrchilds's avatar
hrchilds committed
1487
    {
hrchilds's avatar
hrchilds committed
1488
        renderAtts->SetScalableActivationMode(RenderingAttributes::Always);
hrchilds's avatar
hrchilds committed
1489
    }
hrchilds's avatar
hrchilds committed
1490
    else
hrchilds's avatar
hrchilds committed
1491
    {
hrchilds's avatar
hrchilds committed
1492
        renderAtts->SetScalableActivationMode(RenderingAttributes::Never);
hrchilds's avatar
hrchilds committed
1493 1494 1495
    }
    SetUpdate(false);
    Apply();
1496
    UpdateWindowSensitivity();
hrchilds's avatar
hrchilds committed
1497 1498
}

hrchilds's avatar
hrchilds committed
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531
// ****************************************************************************
// Method: QvisRenderingWindow::InterpretScalableAutoThreshold
//
// Purpose: Determine widget controls given scalable auto threshold 
//
// Programmer: Mark C. Miller 
// Creation:   January 4, 2005 
//
// ****************************************************************************
void
QvisRenderingWindow::InterpretScalableAutoThreshold(int actualVal,
    int *step, QString *suffix, int *widgetVal) const
{
    // compute the step size and suffix for the displayed value in the GUI
    if      (actualVal < 1e3) { *step = 50;  *suffix = "  Polys"; }
    else if (actualVal < 1e4) { *step = 500; *suffix = "  Polys"; }
    else if (actualVal < 1e5) { *step = 5;   *suffix = " KPolys"; }
    else if (actualVal < 1e6) { *step = 50;  *suffix = " KPolys"; }
    else if (actualVal < 1e7) { *step = 500; *suffix = " KPolys"; }
    else if (actualVal < 1e8) { *step = 5;   *suffix = " MPolys"; }
    else if (actualVal < 1e9) { *step = 50;  *suffix = " MPolys"; }
    else                      { *step = 1;   *suffix = " GPolys"; }

    // compute the divisor for the displayed value in the GUI
    int div;
    if      (*suffix == " KPolys") div = (int) 1e3;
    else if (*suffix == " MPolys") div = (int) 1e6; 
    else if (*suffix == " GPolys") div = (int) 1e9;
    else                          div = 1;

    *widgetVal = actualVal / div;
}

hrchilds's avatar
hrchilds committed
1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546
// ****************************************************************************
// Method: QvisRenderingWindow::scalrenAutoThresholdChanged
//
// Purpose: 
//   This Qt slot function is called when the scalable rendering automatic
//   polygon count threshold changes.
//
// Arguments:
//   val : The new polygon count threshold.
//
// Programmer: Mark C. Miller 
// Creation:   Wed Apr 21 22:42:57 PDT 2004 
//
// Modifications:
//   
hrchilds's avatar
hrchilds committed
1547 1548 1549 1550