Skip to content

Commit

Permalink
inc
Browse files Browse the repository at this point in the history
  • Loading branch information
StasJ committed Jan 7, 2022
1 parent 9575f2b commit 47c8bc8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
22 changes: 0 additions & 22 deletions apps/vaporgui/PDimensionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,5 @@ void PDimensionSelector::dropdownTextChanged(std::string text)
rp->GetBox()->SetOrientation(VAPoR::Box::XYZ);
}
rp->SetDefaultVariables(dim, true);

if (!rp->GetBox()->IsPlanar()) {
vector<double> min, max;
rp->GetBox()->GetExtents(min, max);
float minZ = min[2];
float maxZ = max[2];
float epsilon = std::max(abs(minZ), abs(maxZ)) * __FLT_EPSILON__;
if (abs(maxZ - minZ) <= epsilon) {
vector<double> dmin, dmax;
size_t ts = rp->GetCurrentTimestep();
int level = rp->GetRefinementLevel();
int lod = rp->GetCompressionLevel();
string varName = rp->GetFirstVariableName();

int ret = getDataMgr()->GetVariableExtents(ts, varName, level, lod, dmin, dmax);
if (ret == 0) {
min[2] = dmin[2];
max[2] = dmax[2];
rp->GetBox()->SetExtents(min, max);
}
}
}
rp->EndGroup();
}
27 changes: 27 additions & 0 deletions lib/params/RenderParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,33 @@ void RenderParams::SetDefaultVariables(int dim = 3, bool secondaryColormapVariab
if (ok = DataMgrUtils::GetFirstExistingVariable(_dataMgr, 0, 0, i, varname, ts)) break;
}
if (!ok) varname = "";

if (!varname.empty()) {
int lastDims = _dataMgr->GetNumDimensions(GetVariableName());
int newDims = _dataMgr->GetNumDimensions(varname);

if (lastDims == 2 && newDims == 3) {
vector<double> min, max;
GetBox()->GetExtents(min, max);
float minZ = min[2];
float maxZ = max[2];
float epsilon = std::max(abs(minZ), abs(maxZ)) * __FLT_EPSILON__;
if (abs(maxZ - minZ) <= epsilon) {
vector<double> dmin, dmax;
size_t ts = GetCurrentTimestep();
int level = GetRefinementLevel();
int lod = GetCompressionLevel();

int ret = _dataMgr->GetVariableExtents(ts, varname, level, lod, dmin, dmax);
if (ret == 0) {
min[2] = dmin[2];
max[2] = dmax[2];
GetBox()->SetExtents(min, max);
}
}
}
}

SetVariableName(varname);
SetColorMapVariableName(varname);

Expand Down

0 comments on commit 47c8bc8

Please sign in to comment.