mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -06:00
#3716 Ensure static results can be shown if there are no dynamic results.
This commit is contained in:
parent
9145e6011d
commit
66d5cedb2e
@ -188,30 +188,36 @@ RimContourMapProjection::ContourPolygons RimContourMapProjection::generateContou
|
||||
std::fabs(maxValue() - minValue()) > 1.0e-8)
|
||||
{
|
||||
std::vector<double> contourLevels;
|
||||
legendConfig()->scalarMapper()->majorTickValues(&contourLevels);
|
||||
int nContourLevels = static_cast<int>(contourLevels.size());
|
||||
if (nContourLevels > 2)
|
||||
if (legendConfig()->mappingMode() != RimRegularLegendConfig::CATEGORY_INTEGER)
|
||||
{
|
||||
// Slight fudge to avoid very jagged contour lines at the very edge
|
||||
// Shift the contour levels inwards.
|
||||
contourLevels[0] += (contourLevels[1] - contourLevels[0]) * 0.1;
|
||||
contourLevels[nContourLevels - 1] -= (contourLevels[nContourLevels - 1] - contourLevels[nContourLevels - 2]) * 0.1;
|
||||
std::vector<std::vector<cvf::Vec2d>> contourLines;
|
||||
caf::ContourLines::create(m_aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels, &contourLines);
|
||||
|
||||
contourPolygons.reserve(contourLines.size());
|
||||
for (size_t i = 0; i < contourLines.size(); ++i)
|
||||
legendConfig()->scalarMapper()->majorTickValues(&contourLevels);
|
||||
int nContourLevels = static_cast<int>(contourLevels.size());
|
||||
if (nContourLevels > 2)
|
||||
{
|
||||
if (!contourLines[i].empty())
|
||||
if (legendConfig()->mappingMode() == RimRegularLegendConfig::LINEAR_CONTINUOUS || legendConfig()->mappingMode() == RimRegularLegendConfig::LINEAR_DISCRETE)
|
||||
{
|
||||
cvf::ref<cvf::Vec3fArray> contourPolygon = new cvf::Vec3fArray(contourLines[i].size());
|
||||
for (size_t j = 0; j < contourLines[i].size(); ++j)
|
||||
// Slight fudge to avoid very jagged contour lines at the very edge
|
||||
// Shift the contour levels inwards.
|
||||
contourLevels[0] += (contourLevels[1] - contourLevels[0]) * 0.1;
|
||||
contourLevels[nContourLevels - 1] -= (contourLevels[nContourLevels - 1] - contourLevels[nContourLevels - 2]) * 0.1;
|
||||
}
|
||||
std::vector<std::vector<cvf::Vec2d>> contourLines;
|
||||
caf::ContourLines::create(m_aggregatedVertexResults, xVertexPositions(), yVertexPositions(), contourLevels, &contourLines);
|
||||
|
||||
contourPolygons.reserve(contourLines.size());
|
||||
for (size_t i = 0; i < contourLines.size(); ++i)
|
||||
{
|
||||
if (!contourLines[i].empty())
|
||||
{
|
||||
cvf::Vec3d contourPoint3d = cvf::Vec3d(contourLines[i][j], m_fullBoundingBox.min().z());
|
||||
cvf::Vec3d displayPoint3d = displayCoordTransform->transformToDisplayCoord(contourPoint3d);
|
||||
(*contourPolygon)[j] = cvf::Vec3f(displayPoint3d);
|
||||
cvf::ref<cvf::Vec3fArray> contourPolygon = new cvf::Vec3fArray(contourLines[i].size());
|
||||
for (size_t j = 0; j < contourLines[i].size(); ++j)
|
||||
{
|
||||
cvf::Vec3d contourPoint3d = cvf::Vec3d(contourLines[i][j], m_fullBoundingBox.min().z());
|
||||
cvf::Vec3d displayPoint3d = displayCoordTransform->transformToDisplayCoord(contourPoint3d);
|
||||
(*contourPolygon)[j] = cvf::Vec3f(displayPoint3d);
|
||||
}
|
||||
contourPolygons.push_back(contourPolygon);
|
||||
}
|
||||
contourPolygons.push_back(contourPolygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,18 +120,6 @@ QString RimContourMapView::createAutoName() const
|
||||
return autoName.join(": ");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimContourMapView::isTimeStepDependentDataVisible() const
|
||||
{
|
||||
if (RimEclipseView::isTimeStepDependentDataVisible())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return m_contourMapProjection->isChecked();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -153,6 +141,12 @@ void RimContourMapView::createDisplayModel()
|
||||
{
|
||||
RimEclipseView::createDisplayModel();
|
||||
|
||||
if (!this->isTimeStepDependentDataVisible())
|
||||
{
|
||||
// Need to add geometry even if it hasn't happened during dynamic time step update.
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
if (this->viewer()->mainCamera()->viewMatrix() == defaultViewMatrix)
|
||||
{
|
||||
this->zoomAll();
|
||||
@ -198,9 +192,16 @@ void RimContourMapView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrder
|
||||
void RimContourMapView::updateCurrentTimeStep()
|
||||
{
|
||||
static_cast<RimEclipsePropertyFilterCollection*>(nativePropertyFilterCollection())->updateFromCurrentTimeStep();
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContourMapView::updateGeometry()
|
||||
{
|
||||
this->updateVisibleGeometriesAndCellColors();
|
||||
|
||||
|
||||
if (m_contourMapProjection->isChecked())
|
||||
{
|
||||
m_contourMapProjection->generateResults();
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
RimContourMapProjection* contourMapProjection() const;
|
||||
|
||||
QString createAutoName() const override;
|
||||
bool isTimeStepDependentDataVisible() const override;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
@ -40,7 +39,7 @@ protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
void updateCurrentTimeStep() override;
|
||||
|
||||
void updateGeometry();
|
||||
void setFaultVisParameters();
|
||||
void appendContourMapProjectionToModel();
|
||||
void appendPickPointVisToModel();
|
||||
|
Loading…
Reference in New Issue
Block a user