mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'Geomech-DisplayCS' into dev
This commit is contained in:
commit
2e9341c6d1
@ -47,7 +47,6 @@
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechModels.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimObservedData.h"
|
||||
@ -561,8 +560,18 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
stimPlanColors[0]->updateConductivityResultName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if ( m_project->isProjectFileVersionEqualOrOlderThan("2018.1.1.110") )
|
||||
{
|
||||
auto* geoView = dynamic_cast<RimGeoMechView*>(riv);
|
||||
if ( geoView )
|
||||
{
|
||||
geoView->convertCameraPositionFromOldProjectFiles();
|
||||
}
|
||||
}
|
||||
|
||||
this->setActiveReservoirView(riv);
|
||||
|
||||
RimGridView* rigv = dynamic_cast<RimGridView*>(riv);
|
||||
|
@ -834,6 +834,22 @@ cvf::ref<caf::DisplayCoordTransform> Rim3dView::displayCoordTransform() const
|
||||
return coordTrans;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Mat4d Rim3dView::cameraPosition() const
|
||||
{
|
||||
return m_cameraPosition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d Rim3dView::cameraPointOfInterest() const
|
||||
{
|
||||
return m_cameraPointOfInterest();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -147,6 +147,9 @@ protected:
|
||||
virtual void setDefaultView();
|
||||
void disableGridBoxField();
|
||||
void disablePerspectiveProjectionField();
|
||||
cvf::Mat4d cameraPosition() const;
|
||||
cvf::Vec3d cameraPointOfInterest() const;
|
||||
|
||||
|
||||
RimWellPathCollection* wellPathCollection() const;
|
||||
void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
|
||||
|
@ -52,10 +52,11 @@
|
||||
|
||||
#include "cafCadNavigation.h"
|
||||
#include "cafCeetronPlusNavigation.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafFrameAnimationControl.h"
|
||||
#include "cafOverlayScalarMapperLegend.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafOverlayScalarMapperLegend.h"
|
||||
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
@ -126,8 +127,8 @@ void RimGeoMechView::onLoadDataAndUpdate()
|
||||
QString displayMessage = errorMessage.empty() ? "Could not open the Odb file: \n" + m_geomechCase->caseFileName() : QString::fromStdString(errorMessage);
|
||||
|
||||
QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"File open error",
|
||||
displayMessage);
|
||||
"File open error",
|
||||
displayMessage);
|
||||
m_geomechCase = nullptr;
|
||||
return;
|
||||
}
|
||||
@ -561,6 +562,51 @@ RigFemPartCollection* RimGeoMechView::femParts()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::convertCameraPositionFromOldProjectFiles()
|
||||
{
|
||||
auto geoMechCase = this->geoMechCase();
|
||||
if ( geoMechCase )
|
||||
{
|
||||
// Up-cast to get access to public interface for camera functions
|
||||
RimCase* rimCase = geoMechCase;
|
||||
RiuViewerToViewInterface* viewerToViewInterface = this;
|
||||
cvf::Vec3d offset = rimCase->displayModelOffset();
|
||||
auto diplayCoordTrans = this->displayCoordTransform();
|
||||
|
||||
{
|
||||
cvf::Mat4d cameraMx = this->cameraPosition().getInverted();
|
||||
|
||||
cvf::Vec3d translation = cameraMx.translation();
|
||||
|
||||
cvf::Vec3d translationDomainCoord = diplayCoordTrans->scaleToDomainSize(translation);
|
||||
translationDomainCoord -= offset;
|
||||
|
||||
cvf::Vec3d newCameraTranslation = diplayCoordTrans->scaleToDisplaySize(translationDomainCoord);
|
||||
|
||||
cameraMx.setTranslation(newCameraTranslation);
|
||||
|
||||
viewerToViewInterface->setCameraPosition(cameraMx.getInverted());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec3d pointOfInterest = this->cameraPointOfInterest();
|
||||
|
||||
cvf::Vec3d pointOfInterestDomain = diplayCoordTrans->scaleToDomainSize(pointOfInterest);
|
||||
pointOfInterestDomain -= offset;
|
||||
|
||||
cvf::Vec3d newPointOfInterest = diplayCoordTrans->scaleToDisplaySize(pointOfInterestDomain);
|
||||
|
||||
viewerToViewInterface->setCameraPointOfInterest(newPointOfInterest);
|
||||
}
|
||||
|
||||
m_viewer->mainCamera()->setViewMatrix( this->cameraPosition());
|
||||
m_viewer->setPointOfInterest(this->cameraPointOfInterest());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechView::geoMechCase()
|
||||
{
|
||||
return m_geomechCase;
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
const RigFemPartCollection* femParts() const;
|
||||
RigFemPartCollection* femParts();
|
||||
|
||||
void convertCameraPositionFromOldProjectFiles();
|
||||
|
||||
protected:
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
Loading…
Reference in New Issue
Block a user