Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken UGRID/large map and PRegionSelector edge case #3584

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/vaporgui/ImageEventRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ImageEventRouter::ImageEventRouter(QWidget *parent, ControlExec *ce) : RenderEve
new PTMSLODInput()
}));

AddGeometrySubtab(new PGeometrySubtab);
AddGeometrySubtab(new PGeometrySubtab(ce));

// clang-format on
}
Expand Down
2 changes: 1 addition & 1 deletion apps/vaporgui/PGeometrySubtab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#include "PCopyRegionWidget.h"
#include "PTransformWidget.h"

PGeometrySubtab::PGeometrySubtab() : PGroup({new PRegionSelector, new PCopyRegionWidget, new PRendererTransformSection}) {}
PGeometrySubtab::PGeometrySubtab(VAPoR::ControlExec* ce) : PGroup({new PRegionSelector(ce), new PCopyRegionWidget, new PRendererTransformSection}) {}
3 changes: 2 additions & 1 deletion apps/vaporgui/PGeometrySubtab.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once

#include "PGroup.h"
#include <vapor/ControlExecutive.h>

class PGeometrySubtab : public PGroup {
public:
PGeometrySubtab();
PGeometrySubtab(VAPoR::ControlExec* ce = nullptr);
};
26 changes: 20 additions & 6 deletions apps/vaporgui/PRegionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

using namespace VAPoR;

PRegionSelector::PRegionSelector(const std::string &label) : PSection(label)
PRegionSelector::PRegionSelector(VAPoR::ControlExec* ce, const std::string &label) : PSection(label)
{
Add(new PRegionSelectorX);
Add(new PRegionSelectorY);
Add(new PRegionSelectorZ);
Add(new PRegionSelectorX(ce));
Add(new PRegionSelectorY(ce));
Add(new PRegionSelectorZ(ce));
}

PRegionSelector1D::PRegionSelector1D(int dim) : PLineItem("", dim == 0 ? "X" : dim == 1 ? "Y" : "Z", _slider = new QRangeSliderTextCombo), _dim(dim)
PRegionSelector1D::PRegionSelector1D(int dim, VAPoR::ControlExec* ce) : PLineItem("", dim == 0 ? "X" : dim == 1 ? "Y" : "Z", _slider = new QRangeSliderTextCombo), _dim(dim), _ce(ce)
{
QObject::connect(_slider, &QRangeSliderTextCombo::ValueChanged, this, &PRegionSelector1D::sliderValueChanged);
_slider->AllowCustomRange();
Expand All @@ -29,6 +29,21 @@ void PRegionSelector1D::updateGUI() const
int lod = rp->GetCompressionLevel();
string varName = rp->GetFirstVariableName();

Box *box = getBox();

// In some cases (ImageRenderer), there may be no variable to configure extents with.
// Therefore, configure the sliders with the extents of the data domain, acquired from DataStatus
if (varName == "") {
box->GetExtents(min, max);
_slider->SetValue(min[_dim], max[_dim]);
VAPoR::ParamsMgr* pm = _ce->GetParamsMgr();
VAPoR::DataStatus* ds = _ce->GetDataStatus();
VAPoR::CoordType minExts, maxExts;
ds->GetActiveExtents(pm, ts, minExts, maxExts);
_slider->SetRange(minExts[_dim], maxExts[_dim]);
return;
}

int ret = getDataMgr()->GetVariableExtents(ts, varName, level, lod, min, max);
if (ret < 0) {
_slider->SetRange(0, 0);
Expand All @@ -38,7 +53,6 @@ void PRegionSelector1D::updateGUI() const

_slider->SetRange(min[_dim], max[_dim]);

Box *box = getBox();
box->GetExtents(min, max);
_slider->SetValue(min[_dim], max[_dim]);
}
Expand Down
8 changes: 5 additions & 3 deletions apps/vaporgui/PRegionSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "PSection.h"
#include "PLineItem.h"
#include <vapor/ControlExecutive.h>

class QRangeSliderTextCombo;

Expand All @@ -12,17 +13,18 @@ class Box;
//! \class PRegionSelector
class PRegionSelector : public PSection {
public:
PRegionSelector(const std::string &label = "Region");
PRegionSelector(VAPoR::ControlExec* ce= nullptr, const std::string &label = "Region");
};

class PRegionSelector1D : public PLineItem {
QRangeSliderTextCombo *_slider;
const int _dim;

public:
PRegionSelector1D(int dim);
PRegionSelector1D(int dim, VAPoR::ControlExec* ce = nullptr);

protected:
VAPoR::ControlExec *_ce;
virtual void updateGUI() const override;
virtual bool isShown() const override;
virtual bool requireDataMgr() const override { return true; }
Expand All @@ -34,7 +36,7 @@ class PRegionSelector1D : public PLineItem {

template<int dim> class __PRegionSelector1D : public PRegionSelector1D {
public:
__PRegionSelector1D() : PRegionSelector1D(dim) {}
__PRegionSelector1D(VAPoR::ControlExec* ce = nullptr) : PRegionSelector1D(dim, ce) {}
};
typedef __PRegionSelector1D<0> PRegionSelectorX;
typedef __PRegionSelector1D<1> PRegionSelectorY;
Expand Down
6 changes: 6 additions & 0 deletions lib/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <vapor/glutil.h> // Must be included first!!!
#include <vapor/Renderer.h>
#include <vapor/TwoDDataRenderer.h>
#include <vapor/DataMgrUtils.h>
#include "vapor/GLManager.h"
#include "vapor/FontManager.h"
Expand Down Expand Up @@ -120,6 +121,11 @@ int Renderer::paintGL(bool fast)

mm->MatrixModeModelView();
mm->PushMatrix();

if (dynamic_cast<TwoDDataRenderer*>(this) != nullptr) {
float zOffset = GetDefaultZ(_dataMgr, GetActiveParams()->GetCurrentTimestep());
_glManager->matrixManager->Translate(0, 0, zOffset);
}
ApplyTransform(_glManager, GetDatasetTransform(), rParams->GetTransform());

int rc = _paintGL(fast);
Expand Down
4 changes: 0 additions & 4 deletions lib/render/TwoDRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ int TwoDRenderer::_initializeGL()

int TwoDRenderer::_paintGL(bool)
{
float zOffset = GetDefaultZ(_dataMgr, GetActiveParams()->GetCurrentTimestep());
_glManager->matrixManager->Translate(0, 0, zOffset);

// Get the 2D texture
//
_texture = GetTexture(_dataMgr, _texWidth, _texHeight, _texInternalFormat, _texFormat, _texType, _texelSize, _gridAligned);
Expand All @@ -105,7 +102,6 @@ int TwoDRenderer::_paintGL(bool)

_texCoords = (GLfloat *)_sb_texCoords.Alloc(_meshWidth * _meshHeight * 2 * sizeof(*_texCoords));
_computeTexCoords(_texCoords, _meshWidth, _meshHeight);

_renderMeshUnAligned();
} else {
VAssert(_meshWidth == _texWidth);
Expand Down