mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
WIP : try to fix import of geomech project files
This commit is contained in:
parent
06ae9cf155
commit
82d6db94cb
@ -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"
|
||||
@ -562,7 +561,14 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
}
|
||||
}
|
||||
|
||||
auto* geoView = dynamic_cast<RimGeoMechView*>(riv);
|
||||
if (geoView)
|
||||
{
|
||||
geoView->updateDisplayModelCoordinates();
|
||||
}
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -141,6 +141,9 @@ public:
|
||||
virtual RimCase* ownerCase() const = 0;
|
||||
virtual std::vector<RimLegendConfig*> legendConfigs() const = 0;
|
||||
|
||||
cvf::Mat4d cameraPosition() const;
|
||||
cvf::Vec3d cameraPointOfInterest() const;
|
||||
|
||||
protected:
|
||||
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigFemPartCollection.h"
|
||||
@ -36,6 +37,7 @@
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGridCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimTensorResults.h"
|
||||
#include "RimViewLinker.h"
|
||||
@ -52,10 +54,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"
|
||||
@ -561,6 +564,68 @@ RigFemPartCollection* RimGeoMechView::femParts()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::updateDisplayModelCoordinates()
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (!proj) return;
|
||||
|
||||
if (proj->isProjectFileVersionEqualOrOlderThan("2018.1.1.110"))
|
||||
{
|
||||
auto geoMechCase = this->geoMechCase();
|
||||
if (geoMechCase)
|
||||
{
|
||||
std::string errorMessage;
|
||||
if (!geoMechCase->openGeoMechCase(&errorMessage))
|
||||
{
|
||||
QString displayMessage = errorMessage.empty() ? "Could not open the Odb file: \n" + geoMechCase->caseFileName()
|
||||
: QString::fromStdString(errorMessage);
|
||||
|
||||
RiaLogging::error(displayMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Up-cast to get access to public interface for camera functions
|
||||
RimCase* rimCase = geoMechCase;
|
||||
RiuViewerToViewInterface* viewerToViewInterface = this;
|
||||
auto offset = -rimCase->displayModelOffset();
|
||||
|
||||
auto diplayCoordTrans = this->displayCoordTransform();
|
||||
|
||||
/* Does not work as expected
|
||||
|
||||
{
|
||||
auto pointOfInterest = this->cameraPointOfInterest();
|
||||
|
||||
auto pointOfInterestDomain = diplayCoordTrans->scaleToDomainSize(pointOfInterest);
|
||||
pointOfInterestDomain += offset;
|
||||
|
||||
auto newPointOfInterest = diplayCoordTrans->transformToDisplayCoord(pointOfInterestDomain);
|
||||
|
||||
viewerToViewInterface->setCameraPointOfInterest(newPointOfInterest);
|
||||
}
|
||||
|
||||
{
|
||||
auto cameraPosition = this->cameraPosition();
|
||||
auto translation = cameraPosition.translation();
|
||||
|
||||
auto translationDomainCoord = diplayCoordTrans->scaleToDomainSize(translation);
|
||||
translationDomainCoord += offset;
|
||||
|
||||
auto newCameraPosition = diplayCoordTrans->transformToDisplayCoord(translationDomainCoord);
|
||||
|
||||
cameraPosition.setTranslation(newCameraPosition);
|
||||
viewerToViewInterface->setCameraPosition(cameraPosition);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechView::geoMechCase()
|
||||
{
|
||||
return m_geomechCase;
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
const RigFemPartCollection* femParts() const;
|
||||
RigFemPartCollection* femParts();
|
||||
|
||||
void updateDisplayModelCoordinates();
|
||||
|
||||
protected:
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
Loading…
Reference in New Issue
Block a user