mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1474 Ask user to automatically set scale to 1 for fishbones
This commit is contained in:
parent
6e78c0b2cc
commit
1acc54d059
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RicNewFishbonesSubsAtMeasuredDepthFeature.h"
|
||||
|
||||
#include "RicNewFishbonesSubsFeature.h"
|
||||
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "RimProject.h"
|
||||
@ -51,6 +53,8 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked
|
||||
int integerValue = wellPathSelItem->m_measuredDepth;
|
||||
obj->setMeasuredDepthAndCount(integerValue, 24, 1);
|
||||
|
||||
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(wellPath->fishbonesCollection());
|
||||
|
||||
wellPath->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(obj);
|
||||
|
||||
|
@ -18,14 +18,20 @@
|
||||
|
||||
#include "RicNewFishbonesSubsFeature.h"
|
||||
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimFishboneWellPathCollection.h"
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "RimView.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature");
|
||||
@ -42,6 +48,8 @@ void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
|
||||
obj->setName(QString("Fishbones Subs (%1)").arg(fishbonesCollection->fishbonesSubs.size()));
|
||||
fishbonesCollection->fishbonesSubs.push_back(obj);
|
||||
|
||||
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);
|
||||
|
||||
fishbonesCollection->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(obj);
|
||||
}
|
||||
@ -85,3 +93,59 @@ bool RicNewFishbonesSubsFeature::isCommandEnabled()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(RimFishbonesCollection* fishboneCollection)
|
||||
{
|
||||
// Always reset well path collection scale factor
|
||||
CVF_ASSERT(fishboneCollection);
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
fishboneCollection->firstAncestorOrThisOfTypeAsserted(wellPathColl);
|
||||
wellPathColl->wellPathRadiusScaleFactor = 0.01;
|
||||
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString sessionKey = "AutoAdjustSettingsForFishbones";
|
||||
|
||||
bool autoAdjustSettings = false;
|
||||
QVariant v = app->cacheDataObject(sessionKey);
|
||||
if (!v.isValid())
|
||||
{
|
||||
double currentScaleFactor = activeView->scaleZ();
|
||||
if (fabs(currentScaleFactor - 1.0) < 0.1) return;
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
||||
QString questionText;
|
||||
questionText = QString("When displaying Fishbones structures, the view scaling should be set to 1.\n\nDo you want ResInsight to automatically set view scaling to 1?");
|
||||
|
||||
msgBox.setText(questionText);
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::Yes)
|
||||
{
|
||||
autoAdjustSettings = true;
|
||||
}
|
||||
|
||||
app->setCacheDataObject(sessionKey, autoAdjustSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
autoAdjustSettings = v.toBool();
|
||||
}
|
||||
|
||||
if (autoAdjustSettings)
|
||||
{
|
||||
activeView->setScaleZAndUpdate(1.0);
|
||||
|
||||
wellPathColl->scheduleGeometryRegenAndRedrawViews();
|
||||
|
||||
RiuMainWindow::instance()->updateScaleValue();
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,11 @@ class RimFishbonesCollection;
|
||||
class RicNewFishbonesSubsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
public:
|
||||
static void askUserToSetUsefulScaling(RimFishbonesCollection* fishboneCollection);
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT(RimWellPathCompletions, "WellPathCompletions");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathCompletions::RimWellPathCompletions()
|
||||
{
|
||||
CAF_PDM_InitObject("WellPathCompletions", ":/WellCollection.png", "", "");
|
||||
CAF_PDM_InitObject("Completions", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_perforationCollection, "Perforations", "Perforations", "", "", "");
|
||||
m_perforationCollection = new RimPerforationCollection;
|
||||
|
Loading…
Reference in New Issue
Block a user