2018-10-23 09:32:40 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2018- Equinor ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-01-11 06:56:35 -06:00
|
|
|
#include "RimEclipseContourMapView.h"
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
#include "RivContourMapProjectionPartMgr.h"
|
2018-10-23 09:32:40 -05:00
|
|
|
#include "RiuViewer.h"
|
|
|
|
|
|
|
|
#include "Rim3dOverlayInfoConfig.h"
|
2018-11-23 06:33:59 -06:00
|
|
|
#include "RimAnnotationInViewCollection.h"
|
2018-11-09 03:12:33 -06:00
|
|
|
#include "RimCase.h"
|
2018-10-23 09:32:40 -05:00
|
|
|
#include "RimCellRangeFilterCollection.h"
|
2018-12-11 08:35:04 -06:00
|
|
|
#include "RimViewNameConfig.h"
|
2019-01-11 06:03:46 -06:00
|
|
|
#include "RimEclipseContourMapProjection.h"
|
2018-10-23 09:32:40 -05:00
|
|
|
#include "RimEclipseCellColors.h"
|
2018-11-14 08:37:13 -06:00
|
|
|
#include "RimEclipseFaultColors.h"
|
2018-10-23 09:32:40 -05:00
|
|
|
#include "RimEclipsePropertyFilterCollection.h"
|
|
|
|
#include "RimFaultInViewCollection.h"
|
|
|
|
#include "RimGridCollection.h"
|
|
|
|
#include "RimSimWellInViewCollection.h"
|
2018-11-15 04:24:09 -06:00
|
|
|
#include "RimScaleLegendConfig.h"
|
2019-02-08 05:40:38 -06:00
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2019-02-08 05:40:38 -06:00
|
|
|
#include "cafProgressInfo.h"
|
2018-10-23 09:32:40 -05:00
|
|
|
|
|
|
|
#include "cvfCamera.h"
|
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfScene.h"
|
|
|
|
|
2019-01-11 06:56:35 -06:00
|
|
|
CAF_PDM_SOURCE_INIT(RimEclipseContourMapView, "RimContourMapView");
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2019-01-16 08:56:04 -06:00
|
|
|
const cvf::Mat4d RimEclipseContourMapView::sm_defaultViewMatrix = cvf::Mat4d(1, 0, 0, 0,
|
|
|
|
0, 1, 0, 0,
|
|
|
|
0, 0, 1, 1000,
|
|
|
|
0, 0, 0, 1);
|
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2019-01-11 06:56:35 -06:00
|
|
|
RimEclipseContourMapView::RimEclipseContourMapView()
|
2019-01-03 10:07:55 -06:00
|
|
|
: m_cameraPositionLastUpdate(cvf::Vec3d::UNDEFINED)
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-09 02:04:40 -06:00
|
|
|
CAF_PDM_InitObject("Contour Map View", ":/2DMap16x16.png", "", "");
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_contourMapProjection, "ContourMapProjection", "Contour Map Projection", "", "", "");
|
2019-01-11 06:03:46 -06:00
|
|
|
m_contourMapProjection = new RimEclipseContourMapProjection();
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2018-11-15 04:24:09 -06:00
|
|
|
CAF_PDM_InitField(&m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend", "", "", "");
|
2018-10-31 06:13:04 -05:00
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
m_gridCollection->setActive(false); // This is also not added to the tree view, so cannot be enabled.
|
2018-11-14 08:37:13 -06:00
|
|
|
setFaultVisParameters();
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
setDefaultCustomName();
|
2018-11-09 03:12:33 -06:00
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr(contourMapProjection(), this);
|
2018-11-15 04:24:09 -06:00
|
|
|
|
2019-01-16 08:56:04 -06:00
|
|
|
((RiuViewerToViewInterface*)this)->setCameraPosition(sm_defaultViewMatrix);
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
RimEclipseContourMapProjection* RimEclipseContourMapView::contourMapProjection() const
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-09 02:04:40 -06:00
|
|
|
return m_contourMapProjection().p();
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
|
|
|
|
2018-11-09 03:12:33 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
QString RimEclipseContourMapView::createAutoName() const
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
|
|
|
QStringList autoName;
|
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
if (!nameConfig()->customName().isEmpty())
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
2018-12-14 06:41:35 -06:00
|
|
|
autoName.push_back(nameConfig()->customName());
|
2018-11-09 03:12:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList generatedAutoTags;
|
|
|
|
|
|
|
|
RimCase* ownerCase = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(ownerCase);
|
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
if (nameConfig()->addCaseName())
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
|
|
|
generatedAutoTags.push_back(ownerCase->caseUserDescription());
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
if (nameConfig()->addAggregationType())
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
|
|
|
generatedAutoTags.push_back(contourMapProjection()->resultAggregationText());
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
if (nameConfig()->addProperty() && !contourMapProjection()->isColumnResult())
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
|
|
|
generatedAutoTags.push_back(cellResult()->resultVariable());
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
if (nameConfig()->addSampleSpacing())
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
|
|
|
generatedAutoTags.push_back(QString("%1").arg(contourMapProjection()->sampleSpacingFactor(), 3, 'f', 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!generatedAutoTags.empty())
|
|
|
|
{
|
|
|
|
autoName.push_back(generatedAutoTags.join(", "));
|
|
|
|
}
|
|
|
|
return autoName.join(": ");
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:41:35 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::setDefaultCustomName()
|
2018-12-14 06:41:35 -06:00
|
|
|
{
|
|
|
|
nameConfig()->setCustomName("Contour Map");
|
|
|
|
nameConfig()->hideCaseNameField(false);
|
|
|
|
nameConfig()->hideAggregationTypeField(false);
|
|
|
|
nameConfig()->hidePropertyField(false);
|
|
|
|
nameConfig()->hideSampleSpacingField(false);
|
|
|
|
}
|
|
|
|
|
2019-01-16 03:51:43 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseContourMapView::updatePickPointAndRedraw()
|
|
|
|
{
|
|
|
|
appendPickPointVisToModel();
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseContourMapView::updateCurrentTimeStepAndRedraw()
|
|
|
|
{
|
|
|
|
m_contourMapProjection->clearGeometry();
|
|
|
|
RimEclipseView::updateCurrentTimeStepAndRedraw();
|
|
|
|
}
|
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::initAfterRead()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
|
|
|
m_gridCollection->setActive(false); // This is also not added to the tree view, so cannot be enabled.
|
|
|
|
disablePerspectiveProjectionField();
|
2018-10-31 06:13:04 -05:00
|
|
|
setShowGridBox(false);
|
2018-10-31 04:36:04 -05:00
|
|
|
meshMode.setValue(NO_MESH);
|
|
|
|
surfaceMode.setValue(FAULTS);
|
2018-11-14 08:37:13 -06:00
|
|
|
setFaultVisParameters();
|
2018-10-31 10:09:14 -05:00
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::createDisplayModel()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
|
|
|
RimEclipseView::createDisplayModel();
|
2018-11-14 05:53:44 -06:00
|
|
|
|
2018-11-20 07:54:30 -06:00
|
|
|
if (!this->isTimeStepDependentDataVisible())
|
|
|
|
{
|
|
|
|
// Need to add geometry even if it hasn't happened during dynamic time step update.
|
|
|
|
updateGeometry();
|
|
|
|
}
|
|
|
|
|
2019-01-16 08:56:04 -06:00
|
|
|
if (this->viewer()->mainCamera()->viewMatrix() == sm_defaultViewMatrix)
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
|
|
|
this->zoomAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-31 04:36:04 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
2018-10-31 04:36:04 -05:00
|
|
|
{
|
|
|
|
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroup("Viewer");
|
|
|
|
viewGroup->add(this->userDescriptionField());
|
|
|
|
viewGroup->add(this->backgroundColorField());
|
2018-10-31 06:13:04 -05:00
|
|
|
viewGroup->add(&m_showAxisLines);
|
2018-11-15 04:24:09 -06:00
|
|
|
viewGroup->add(&m_showScaleLegend);
|
2018-11-09 03:12:33 -06:00
|
|
|
|
2018-11-09 03:39:23 -06:00
|
|
|
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Contour Map Name");
|
2018-12-14 06:41:35 -06:00
|
|
|
nameConfig()->uiOrdering(uiConfigName, *nameGroup);
|
2018-11-09 03:39:23 -06:00
|
|
|
|
2018-10-31 04:36:04 -05:00
|
|
|
uiOrdering.skipRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
|
|
|
uiTreeOrdering.add(m_overlayInfoConfig());
|
2018-11-09 02:04:40 -06:00
|
|
|
uiTreeOrdering.add(m_contourMapProjection);
|
2018-10-23 09:32:40 -05:00
|
|
|
uiTreeOrdering.add(cellResult());
|
2018-11-09 02:04:40 -06:00
|
|
|
cellResult()->uiCapability()->setUiReadOnly(m_contourMapProjection->isColumnResult());
|
2018-10-23 09:32:40 -05:00
|
|
|
uiTreeOrdering.add(wellCollection());
|
|
|
|
uiTreeOrdering.add(faultCollection());
|
2018-11-23 06:33:59 -06:00
|
|
|
uiTreeOrdering.add(annotationCollection());
|
2018-10-23 09:32:40 -05:00
|
|
|
uiTreeOrdering.add(m_rangeFilterCollection());
|
2018-11-13 04:51:04 -06:00
|
|
|
uiTreeOrdering.add(nativePropertyFilterCollection());
|
2018-10-23 09:32:40 -05:00
|
|
|
|
|
|
|
uiTreeOrdering.skipRemainingChildren();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::updateCurrentTimeStep()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-13 04:51:04 -06:00
|
|
|
static_cast<RimEclipsePropertyFilterCollection*>(nativePropertyFilterCollection())->updateFromCurrentTimeStep();
|
2018-11-20 07:54:30 -06:00
|
|
|
updateGeometry();
|
|
|
|
}
|
2018-11-13 04:51:04 -06:00
|
|
|
|
2018-11-20 07:54:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::updateGeometry()
|
2018-11-20 07:54:30 -06:00
|
|
|
{
|
2019-02-08 05:40:38 -06:00
|
|
|
caf::ProgressInfo progress(100, "Generate Contour Map", true);
|
|
|
|
|
2018-11-13 04:51:04 -06:00
|
|
|
this->updateVisibleGeometriesAndCellColors();
|
2018-11-20 07:54:30 -06:00
|
|
|
|
2019-02-08 05:40:38 -06:00
|
|
|
{ // Step 1: generate results and some minor updates. About 30% of the time.
|
|
|
|
if (m_contourMapProjection->isChecked())
|
|
|
|
{
|
|
|
|
m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep());
|
|
|
|
}
|
|
|
|
progress.setProgress(30);
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
2019-01-11 03:48:28 -06:00
|
|
|
|
2018-11-05 07:31:07 -06:00
|
|
|
updateLegends(); // To make sure the scalar mappers are set up correctly
|
2018-11-13 04:51:04 -06:00
|
|
|
appendWellsAndFracturesToModel();
|
|
|
|
|
2019-02-08 05:40:38 -06:00
|
|
|
{ // Step 2: generate geometry. Takes about 60% of the time.
|
|
|
|
createContourMapGeometry();
|
|
|
|
progress.setProgress(90);
|
|
|
|
}
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2019-02-08 05:40:38 -06:00
|
|
|
{ // Step 3: generate drawables. Takes about 10% of the time.
|
|
|
|
appendContourMapProjectionToModel();
|
|
|
|
appendContourLinesToModel();
|
|
|
|
appendPickPointVisToModel();
|
|
|
|
progress.setProgress(100);
|
|
|
|
}
|
2019-01-09 02:04:11 -06:00
|
|
|
m_overlayInfoConfig()->update3DInfo();
|
2018-11-13 04:51:04 -06:00
|
|
|
}
|
|
|
|
|
2018-11-14 08:37:13 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::setFaultVisParameters()
|
2018-11-14 08:37:13 -06:00
|
|
|
{
|
2018-11-19 01:28:45 -06:00
|
|
|
faultCollection()->setShowFaultsOutsideFilter(false);
|
2018-11-14 08:37:13 -06:00
|
|
|
faultCollection()->showOppositeFaultFaces = true;
|
|
|
|
faultCollection()->faultResult = RimFaultInViewCollection::FAULT_NO_FACE_CULLING;
|
|
|
|
faultResultSettings()->showCustomFaultResult = true;
|
|
|
|
faultResultSettings()->customFaultResult()->setResultVariable("None");
|
|
|
|
}
|
|
|
|
|
2019-01-03 10:07:55 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::createContourMapGeometry()
|
2019-01-03 10:07:55 -06:00
|
|
|
{
|
|
|
|
if (m_viewer && m_contourMapProjection->isChecked())
|
|
|
|
{
|
|
|
|
m_contourMapProjectionPartMgr->createProjectionGeometry();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-13 04:51:04 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::appendContourMapProjectionToModel()
|
2018-11-13 04:51:04 -06:00
|
|
|
{
|
2018-11-09 02:04:40 -06:00
|
|
|
if (m_viewer && m_contourMapProjection->isChecked())
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-05 02:56:03 -06:00
|
|
|
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
2018-11-14 07:24:22 -06:00
|
|
|
if (frameScene)
|
|
|
|
{
|
|
|
|
cvf::String name = "ContourMapProjection";
|
|
|
|
this->removeModelByName(frameScene, name);
|
2018-11-05 02:56:03 -06:00
|
|
|
|
2018-11-14 07:24:22 -06:00
|
|
|
cvf::ref<cvf::ModelBasicList> contourMapProjectionModelBasicList = new cvf::ModelBasicList;
|
|
|
|
contourMapProjectionModelBasicList->setName(name);
|
2018-10-23 09:32:40 -05:00
|
|
|
|
2018-11-14 07:24:22 -06:00
|
|
|
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
|
2018-11-06 06:39:23 -06:00
|
|
|
|
2018-11-14 07:24:22 -06:00
|
|
|
m_contourMapProjectionPartMgr->appendProjectionToModel(contourMapProjectionModelBasicList.p(), transForm.p());
|
|
|
|
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
|
|
|
|
frameScene->addModel(contourMapProjectionModelBasicList.p());
|
|
|
|
}
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-03 10:07:55 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::appendContourLinesToModel()
|
2019-01-03 10:07:55 -06:00
|
|
|
{
|
|
|
|
if (m_viewer && m_contourMapProjection->isChecked())
|
|
|
|
{
|
|
|
|
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
|
|
|
if (frameScene)
|
|
|
|
{
|
|
|
|
cvf::String name = "ContourMapLines";
|
|
|
|
this->removeModelByName(frameScene, name);
|
|
|
|
|
|
|
|
cvf::ref<cvf::ModelBasicList> contourMapLabelModelBasicList = new cvf::ModelBasicList;
|
|
|
|
contourMapLabelModelBasicList->setName(name);
|
|
|
|
|
|
|
|
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
|
|
|
|
|
|
|
|
m_contourMapProjectionPartMgr->appendContourLinesToModel(viewer()->mainCamera(), contourMapLabelModelBasicList.p(), transForm.p());
|
|
|
|
contourMapLabelModelBasicList->updateBoundingBoxesRecursive();
|
|
|
|
frameScene->addModel(contourMapLabelModelBasicList.p());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-15 14:40:10 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::appendPickPointVisToModel()
|
2018-11-15 14:40:10 -06:00
|
|
|
{
|
|
|
|
if (m_viewer && m_contourMapProjection->isChecked())
|
|
|
|
{
|
|
|
|
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
|
|
|
if (frameScene)
|
|
|
|
{
|
|
|
|
cvf::String name = "ContourMapPickPoint";
|
|
|
|
this->removeModelByName(frameScene, name);
|
|
|
|
|
|
|
|
cvf::ref<cvf::ModelBasicList> contourMapProjectionModelBasicList = new cvf::ModelBasicList;
|
|
|
|
contourMapProjectionModelBasicList->setName(name);
|
|
|
|
|
|
|
|
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
|
|
|
|
|
|
|
|
m_contourMapProjectionPartMgr->appendPickPointVisToModel(contourMapProjectionModelBasicList.p(), transForm.p());
|
|
|
|
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
|
|
|
|
frameScene->addModel(contourMapProjectionModelBasicList.p());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-23 09:32:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::updateLegends()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->removeAllColorLegends();
|
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
if (m_contourMapProjection && m_contourMapProjection->isChecked())
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-09 02:04:40 -06:00
|
|
|
RimRegularLegendConfig* projectionLegend = m_contourMapProjection->legendConfig();
|
2018-11-05 02:56:03 -06:00
|
|
|
if (projectionLegend)
|
2018-10-31 10:09:14 -05:00
|
|
|
{
|
2018-11-09 02:04:40 -06:00
|
|
|
m_contourMapProjection->updateLegend();
|
2018-11-05 02:56:03 -06:00
|
|
|
if (projectionLegend->showLegend())
|
|
|
|
{
|
|
|
|
m_viewer->addColorLegendToBottomLeftCorner(projectionLegend->titledOverlayFrame());
|
|
|
|
}
|
2018-10-31 10:09:14 -05:00
|
|
|
}
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
2018-11-15 04:24:09 -06:00
|
|
|
|
2018-11-20 05:07:39 -06:00
|
|
|
m_viewer->showScaleLegend(m_showScaleLegend());
|
2018-10-23 09:32:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::updateViewWidgetAfterCreation()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-05 02:56:03 -06:00
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->showAxisCross(false);
|
|
|
|
m_viewer->showEdgeTickMarksXY(true, m_showAxisLines());
|
|
|
|
m_viewer->enableNavigationRotation(false);
|
|
|
|
}
|
2018-10-23 09:32:40 -05:00
|
|
|
|
|
|
|
Rim3dView::updateViewWidgetAfterCreation();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::updateViewFollowingRangeFilterUpdates()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
2018-11-09 02:04:40 -06:00
|
|
|
m_contourMapProjection->setCheckState(true);
|
2018-10-23 09:32:40 -05:00
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::onLoadDataAndUpdate()
|
2018-10-23 09:32:40 -05:00
|
|
|
{
|
|
|
|
RimEclipseView::onLoadDataAndUpdate();
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->setView(cvf::Vec3d(0, 0, -1), cvf::Vec3d(0, 1, 0));
|
|
|
|
}
|
|
|
|
}
|
2018-10-31 06:13:04 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
2018-10-31 06:13:04 -05:00
|
|
|
{
|
2018-10-31 10:09:14 -05:00
|
|
|
RimEclipseView::fieldChangedByUi(changedField, oldValue, newValue);
|
|
|
|
|
2018-10-31 06:13:04 -05:00
|
|
|
if (changedField == &m_showAxisLines)
|
|
|
|
{
|
|
|
|
m_viewer->showEdgeTickMarksXY(true, m_showAxisLines());
|
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2018-10-31 10:09:14 -05:00
|
|
|
else if (changedField == backgroundColorField())
|
2018-10-31 06:13:04 -05:00
|
|
|
{
|
2018-10-31 10:09:14 -05:00
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
2018-10-31 06:13:04 -05:00
|
|
|
}
|
2018-11-20 05:07:39 -06:00
|
|
|
else if (changedField == &m_showScaleLegend)
|
|
|
|
{
|
|
|
|
updateLegends();
|
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2018-10-31 06:13:04 -05:00
|
|
|
}
|
2018-11-09 03:12:33 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
caf::PdmFieldHandle* RimEclipseContourMapView::userDescriptionField()
|
2018-11-09 03:12:33 -06:00
|
|
|
{
|
2018-12-14 06:41:35 -06:00
|
|
|
return nameConfig()->nameField();
|
2018-11-09 03:12:33 -06:00
|
|
|
}
|
2018-11-13 04:51:04 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
std::set<RivCellSetEnum> RimEclipseContourMapView::allVisibleFaultGeometryTypes() const
|
2018-11-13 04:51:04 -06:00
|
|
|
{
|
|
|
|
std::set<RivCellSetEnum> faultGeoTypes;
|
|
|
|
// Normal eclipse views always shows faults for active and visible eclipse cells.
|
|
|
|
if (faultCollection()->showFaultCollection())
|
|
|
|
{
|
|
|
|
faultGeoTypes = RimEclipseView::allVisibleFaultGeometryTypes();
|
|
|
|
}
|
|
|
|
return faultGeoTypes;
|
|
|
|
}
|
2018-12-13 06:20:49 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
QWidget* RimEclipseContourMapView::createViewWidget(QWidget* mainWindowParent)
|
2018-12-13 06:20:49 -06:00
|
|
|
{
|
|
|
|
auto widget = Rim3dView::createViewWidget(mainWindowParent);
|
|
|
|
|
|
|
|
if (viewer())
|
|
|
|
{
|
|
|
|
viewer()->showZScaleLabel(false);
|
|
|
|
viewer()->hideZScaleCheckbox(true);
|
|
|
|
}
|
|
|
|
return widget;
|
|
|
|
}
|
2019-01-03 10:07:55 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
void RimEclipseContourMapView::onViewNavigationChanged()
|
2019-01-03 10:07:55 -06:00
|
|
|
{
|
|
|
|
cvf::Vec3d currentCameraPosition = viewer()->mainCamera()->position();
|
|
|
|
if (m_cameraPositionLastUpdate.isUndefined() || zoomChangeAboveTreshold(currentCameraPosition))
|
|
|
|
{
|
|
|
|
appendContourLinesToModel();
|
|
|
|
m_cameraPositionLastUpdate = currentCameraPosition;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-11 06:56:35 -06:00
|
|
|
bool RimEclipseContourMapView::zoomChangeAboveTreshold(const cvf::Vec3d& currentCameraPosition) const
|
2019-01-03 10:07:55 -06:00
|
|
|
{
|
|
|
|
double distance = std::max(std::fabs(m_cameraPositionLastUpdate.z()), std::fabs(currentCameraPosition.z()));
|
2019-01-09 02:04:11 -06:00
|
|
|
const double threshold = 0.05 * distance;
|
|
|
|
return std::fabs(m_cameraPositionLastUpdate.z() - currentCameraPosition.z()) > threshold;
|
2019-01-03 10:07:55 -06:00
|
|
|
}
|