Commit da297a92 authored by Marc R.'s avatar Marc R.

skew-T: code cleanup, removed old code in h/cpp

parent 72d1a948
......@@ -58,7 +58,6 @@ MSkewTActor::MSkewTActor() : MNWPMultiVarActor(),
vbHighlightVertices(nullptr),
vbWyomingVertices(nullptr),
wyomingVerticesCount(0),
offsetPickPositionToHandleCentre(QVector2D(0., 0.)),
dragEventActive(false)
{
enablePicking(true);
......@@ -268,33 +267,6 @@ void MSkewTActor::saveConfiguration(QSettings *settings)
settings->setValue("dryAdiabatesEnabled",
properties->mBool()->value(drawDryAdiabatesProperty));
for (int i = 0; i < diagramConfiguration.varConfigs.size(); i++)
{
VariableConfig var = diagramConfiguration.varConfigs.at(i);
settings->setValue(QString("%1VariableIndex").arg(i), var.index);
settings->setValue(QString("%1VariableColor").arg(i), var.color);
}
settings->setValue("temperatureShowMinMaxProperty",
properties->mBool()->value(
temperatureShowProbabilityTubeProperty));
settings->setValue("temperatureShowDeviationProperty",
properties->mBool()->value(
temperatureShowDeviationTubeProperty));
settings->setValue("temperatureMinMaxColourProperty",
properties->mColor()->value(
temperatureMinMaxVariableColorProperty));
settings->setValue("humidityShowMinMaxProperty",
properties->mBool()->value(
dewPointShowProbabilityTubeProperty));
settings->setValue("humidityShowDeviationProperty",
properties->mBool()->value(
dewPointShowDeviationTubeProperty));
settings->setValue("humidityMinMaxColourProperty",
properties->mColor()->value(
dewPointMinMaxVariableColorProperty));
poleActor->saveConfiguration(settings);
settings->endGroup();
}
......@@ -359,49 +331,6 @@ void MSkewTActor::loadConfiguration(QSettings *settings)
drawDryAdiabatesProperty,
settings->value("dryAdiabatesEnabled", true).toBool());
for (int i = 0; i < diagramConfiguration.varConfigs.size(); i++)
{
int index = settings->value(
QString("%1VariableIndex").arg(i)).toInt();
QColor color = settings->value(QString("%1VariableColor").arg(i),
QColor(0, 0, 0, 255)).value<QColor>();
VariableConfig *var = &diagramConfiguration.varConfigs.data()[i];
var->color = color;
var->index = index;
properties->mEnum()->setEnumNames(var->property, varNameList);
properties->mEnum()->setValue(var->property, index);
if (index > 0 && index <= variables.size())
{
var->variable = dynamic_cast<MNWPSkewTActorVariable*>(
variables.at(index - 1));
properties->mColor()->setValue(var->variable->profileColourProperty, color);
}
}
properties->mBool()->setValue(
temperatureShowProbabilityTubeProperty,
settings->value("temperatureShowMinMaxProperty", true).toBool());
properties->mBool()->setValue(
temperatureShowDeviationTubeProperty,
settings->value("temperatureShowDeviationProperty",
true).toBool());
properties->mColor()->setValue(
temperatureMinMaxVariableColorProperty,
settings->value("temperatureMinMaxColourProperty",
QColor(201, 10, 5, 255)).value<QColor>());
properties->mBool()->setValue(
dewPointShowProbabilityTubeProperty,
settings->value("humidityShowMinMaxProperty", true).toBool());
properties->mBool()->setValue(
dewPointShowDeviationTubeProperty,
settings->value("humidityShowDeviationProperty", true).toBool());
properties->mColor()->setValue(
dewPointMinMaxVariableColorProperty,
settings->value("humidityMinMaxColourProperty",
QColor(17, 98, 208, 255)).value<QColor>());
settings->endGroup();
copyDiagramConfigurationFromQtProperties();
updateVerticalProfilesAndLabels();
......@@ -411,9 +340,8 @@ void MSkewTActor::loadConfiguration(QSettings *settings)
const QList<MVerticalLevelType> MSkewTActor::supportedLevelTypes()
{
return (QList<MVerticalLevelType>() <<
HYBRID_SIGMA_PRESSURE_3D <<
PRESSURE_LEVELS_3D);
return (QList<MVerticalLevelType>() << HYBRID_SIGMA_PRESSURE_3D <<
PRESSURE_LEVELS_3D << AUXILIARY_PRESSURE_3D);
}
......@@ -779,36 +707,6 @@ void MSkewTActor::onQtPropertyChanged(QtProperty *property)
}
emitActorChangedSignal();
}
else
{
for (int i = 0; i < diagramConfiguration.varConfigs.size(); i++)
{
VariableConfig *var = &diagramConfiguration.varConfigs[i];
int index = properties->mEnum()->value(var->property);
var->index = index;
if (var->index <= 0)
{
if (property == var->property)
{
var->variable = nullptr;
emitActorChangedSignal();
return;
}
continue;
}
if (property == var->property
|| property == var->variable->profileColourProperty
|| property == var->variable->lineThicknessProperty)
{
var->variable = dynamic_cast<MNWPSkewTActorVariable*>(
variables.at(var->index - 1));
var->color = var->variable->profileColour;
var->thickness = var->variable->lineThickness;
emitActorChangedSignal();
return;
}
}
}
}
......@@ -890,11 +788,8 @@ void MSkewTActor::copyDiagramConfigurationFromQtProperties()
diagramConfiguration.dryAdiabatSpacing =
properties->mDDouble()->value(dryAdiabatesSpacingProperty);
skewTDiagramConfiguration.pressureEqualsWorldPressure =
diagramConfiguration.alignWithCamera;
diagramConfiguration.init();
skewTDiagramConfiguration.init(&diagramConfiguration, "_normal");
skewTDiagramConfiguration.init(&diagramConfiguration);
// After the configuration has been copied from the properties, recompute
// the (T, log(p)) to (x, y) transformation matrix to transform (T, p)
......@@ -1170,8 +1065,7 @@ void MSkewTActor::generateDiagramGeometry(
// Upload geometry to vertex buffer.
config->recomputeAdiabateGeometries = false;
uploadVec2ToVertexBuffer(
vertexArray, QString("skewTDiagramVertices%1_actor#%2")
.arg(config->bufferNameSuffix).arg(myID),
vertexArray, QString("skewTDiagramVertices%1_actor#%2").arg(myID),
vbDiagramVertices);
LOG4CPLUS_DEBUG(mlog, "Generation of Skew-T diagram geometry finished.");
......@@ -1332,8 +1226,7 @@ void MSkewTActor::generateFullScreenHighlightGeometry(
// Upload geometry to vertex buffer.
uploadVec2ToVertexBuffer(
vertexArray, QString("skewTHighlightVertices%1_actor#%2")
.arg(config->bufferNameSuffix).arg(myID),
vertexArray, QString("skewTHighlightVertices%1_actor#%2").arg(myID),
vbDiagramVertices);
}
......@@ -1512,20 +1405,17 @@ void MSkewTActor::DiagramConfiguration::init()
void MSkewTActor::ModeSpecificDiagramConfiguration::init(
DiagramConfiguration *dconfig, QString bufferNameSuffix)
DiagramConfiguration *dconfig)
{
this->dconfig = dconfig;
this->bufferNameSuffix = bufferNameSuffix;
}
void MSkewTActor::drawDiagram3DView(MSceneViewGLWidget* sceneView)
{
skewTDiagramConfiguration.layer = -0.005f;
drawDiagramGeometryAndLabels(
sceneView, vbDiagramVertices,
&skewTDiagramConfiguration.vertexArrayDrawRanges);
skewTDiagramConfiguration.layer = -.1f;
drawDiagram2(sceneView);
poleActor->render(sceneView);
}
......
......@@ -4,9 +4,9 @@
** three-dimensional visual exploration of numerical ensemble weather
** prediction data.
**
** Copyright 2015-2019 Marc Rautenhaus [*, previously +]
** Copyright 2015-2016 Christoph Heidelmann [+]
** Copyright 2018 Bianca Tost [+]
** Copyright 2015-2019 Marc Rautenhaus [*, previously +]
**
** * Regional Computing Center, Visualization
** Universitaet Hamburg, Hamburg, Germany
......@@ -123,26 +123,6 @@ protected:
void printDebugOutputOnUserRequest();
private:
/**
@brief Stores the current variable index and color of a variable.
*/
struct VariableConfig
{
QtProperty *property = nullptr;
MNWPSkewTActorVariable *variable = nullptr;
int index = 0;
QColor color;
double thickness;
};
/**
@brief Stores the coordinates of the diagram outline.
*/
struct Outline
{
float data[16];
};
/**
@brief Stores a vertex range that has to be drawn by the draw
calls for the diagram auxiliary lines.
......@@ -167,77 +147,9 @@ private:
VertexRange isobars;
};
struct VARIABLES
{
struct TEMPERATURE
{
int MEMBER = 0;
int MEAN = 1;
int MINIMUM = 2;
int MAXIMUM = 3;
int DEVIATION = 4;
int SPAGHETTI = 5;
};
TEMPERATURE temperature;
struct DEWPOINT
{
int MEMBER = 6;
int MEAN = 7;
int MINIMUM = 8;
int MAXIMUM = 9;
int DEVIATION = 10;
int SPAGHETTI = 11;
};
DEWPOINT dewPoint;
};
VARIABLES variablesIndices;
/**
@brief Describes the drawing area.
*/
struct Area
{
float top, bottom;
float left, right;
float width() const
{
return right - left;
}
float height() const
{
return top - bottom;
}
struct Outline outline() const
{
Outline outline;
float data[16] = { left , top , left , 0.0,
left , bottom, right, bottom,
left , top , right, top,
right, bottom, right, top
};
std::copy(std::begin(data), std::end(data),
std::begin(outline.data));
return outline;
}
};
struct Amplitude
{
float min, max;
float amplitude() const
{
return std::abs(max) + std::abs(min);
}
float center() const
{
return amplitude() / 2.f;
}
};
struct Size
{
float width, height;
};
/**
......@@ -249,50 +161,34 @@ private:
DiagramConfiguration() {}
void init();
QVector<VariableConfig> varConfigs;
QVector2D geoPosition;
QVector2D clipPos;
struct Area area;
float layer;
struct Amplitude vertical_p_hPa;
struct Amplitude temperature_degC;
float skewFactor;
struct Size offscreenTextureSize;
GLint maxTextureSize;
bool alignWithCamera = false;
double diagramWidth3D = 15.;
bool overDragHandle = false;
bool drawDryAdiabates = true;
bool drawMoistAdiabates = true;
bool regenerateAdiabates = true;
bool fullscreen = false;
bool drawInPerspective = false;
VertexRanges vertexRanges;
QVector4D diagramColor;
float isothermSpacing = 10.;
float moistAdiabatSpacing = 10.0;
float dryAdiabatSpacing = 10.0;
float yOffset = 0;
};
struct ModeSpecificDiagramConfiguration
{
ModeSpecificDiagramConfiguration() {}
void init(DiagramConfiguration *dconfig, QString bufferNameSuffix);
bool pressureEqualsWorldPressure = false;
struct Area drawingRegionClipSpace;
QVector2D clipPos;
float layer;
void init(DiagramConfiguration *dconfig);
DiagramConfiguration *dconfig;
bool recomputeAdiabateGeometries = true;
VertexRanges vertexArrayDrawRanges;
QVector<QVector2D> dryAdiabatesVertices;
QVector<QVector2D> moistAdiabatesVertices;
QString bufferNameSuffix;
VertexRanges highlightGeometryDrawRanges;
};
......@@ -305,39 +201,18 @@ private:
QList<MLabel*> labels3D;
QtProperty *geoPositionProperty,
*appearanceGroupProperty, *alignWithCameraProperty,
*bottomPressureProperty, *topPressureProperty,
*alignWithCameraProperty,
*wyomingStationsProperty,
*enableWyomingProperty,
*dewPointColorWyomingProperty,
*temperatureColorWyomingProperty, *groupWyoming,
*temperatureMinProperty, *temperatureMaxProperty,
*skewFactorProperty,
*isothermsSpacingProperty,
*drawDryAdiabatesProperty,
*drawMoistAdiabatesProperty,
*moistAdiabatesSpcaingProperty,
*dryAdiabatesSpacingProperty,
*appearanceGroupProperty,
*isothermsSpacingProperty, *skewFactorProperty,
*drawDryAdiabatesProperty, *dryAdiabatesSpacingProperty,
*drawMoistAdiabatesProperty, *moistAdiabatesSpcaingProperty,
*diagramWidth3DProperty,
*groupVariables, *temperatureGroupProperty,
*temperatureMinMaxVariableColorProperty,
*temperatureShowProbabilityTubeProperty,
*temperatureShowDeviationTubeProperty,
*humidityGroupProperty,
*dewPointMinMaxVariableColorProperty,
*dewPointShowProbabilityTubeProperty,
*dewPointShowDeviationTubeProperty;
/**
@brief Stores the names of the variables.
*/
QList<QString> varNameList;
QHash<QString, int> varNamesIndices;
*temperatureColorWyomingProperty, *groupWyoming,
*wyomingStationsProperty, *enableWyomingProperty,
*dewPointColorWyomingProperty;
std::shared_ptr<GL::MShaderEffect> skewTShader;
std::shared_ptr<GL::MShaderEffect> positionSpheresShader;
/**
@brief Buffer used for the diagram auxiliary lines.
......@@ -375,10 +250,6 @@ private:
GL::MVertexBuffer** vbDiagramVertices,
ModeSpecificDiagramConfiguration *config);
void drawDiagram(MSceneViewGLWidget* sceneView,
GL::MVertexBuffer *vbDiagramVertices,
ModeSpecificDiagramConfiguration *config);
void drawDiagram2(MSceneViewGLWidget* sceneView);
void loadObservationalDataFromUWyoming(int stationNum);
......@@ -392,11 +263,6 @@ private:
void drawDiagramGeometryAndLabelsFullScreen(MSceneViewGLWidget* sceneView);
// If the user picks the handle not in its centre, we cannot move the handle
// by setting the centre point to the mouse position so we need this offset
// to place the handle relative to the mouse position.
QVector2D offsetPickPositionToHandleCentre;
// Stores the transformation matrix that transforms (T, log(p)) coordinates
// into the diagram's (x, y) coordinates. Computed by
// computeTlogp2xyTransformationMatrix().
......@@ -468,8 +334,7 @@ public:
MSkewTActorFactory() : MAbstractActorFactory() {}
protected:
MActor* createInstance() override
{ displayWarningExperimentalStatus(); return new MSkewTActor(); }
MActor* createInstance() override { return new MSkewTActor(); }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment