#3884 Implemented Valve Templates for MSW parameters

This commit is contained in:
Gaute Lindkvist
2018-12-13 19:49:37 +01:00
parent c575e1d29e
commit 3adb1cc4bd
39 changed files with 1117 additions and 157 deletions

View File

@@ -7,6 +7,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalAtMeasuredDepthFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewValveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewValveTemplateFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportCompletionsFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportPerforationIntervalsFeature.h
)
@@ -19,6 +20,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewValveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewValveTemplateFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportCompletionsFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportPerforationIntervalsFeature.cpp
)

View File

@@ -3,6 +3,7 @@
#include "RiaApplication.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimWellPathValve.h"
#include "RimWellPathCollection.h"
@@ -18,7 +19,7 @@ CAF_CMD_SOURCE_INIT(RicNewValveFeature, "RicNewValveFeature");
bool RicNewValveFeature::isCommandEnabled()
{
const RimPerforationInterval* perfInterval = caf::SelectionManager::instance()->selectedItemOfType<RimPerforationInterval>();
return perfInterval != nullptr && RiaApplication::enableDevelopmentFeatures();
return perfInterval != nullptr;
}
//--------------------------------------------------------------------------------------------------
@@ -30,6 +31,19 @@ void RicNewValveFeature::onActionTriggered(bool isChecked)
if (perfInterval)
{
RimWellPathValve* valve = new RimWellPathValve;
RimProject* project = nullptr;
perfInterval->firstAncestorOrThisOfTypeAsserted(project);
std::vector<RimWellPathValve*> existingValves = perfInterval->valves();
valve->setName(QString("Valve #%1").arg(existingValves.size() + 1));
std::vector<RimValveTemplate*> allValveTemplates = project->allValveTemplates();
if (!allValveTemplates.empty())
{
valve->setValveTemplate(allValveTemplates.front());
}
perfInterval->addValve(valve);
valve->setMeasuredDepthAndCount(perfInterval->startMD(), perfInterval->endMD() - perfInterval->startMD(), 1);

View File

@@ -0,0 +1,106 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewValveTemplateFeature.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimValveTemplate.h"
#include "RimValveTemplateCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewValveTemplateFeature, "RicNewValveTemplateFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewValveTemplateFeature::selectValveTemplateAndUpdate(RimValveTemplateCollection* templateCollection,
RimValveTemplate* valveTemplate)
{
valveTemplate->loadDataAndUpdate();
templateCollection->updateConnectedEditors();
RimProject* project = RiaApplication::instance()->project();
std::vector<Rim3dView*> views;
project->allVisibleViews(views);
for (Rim3dView* view : views)
{
if (dynamic_cast<RimEclipseView*>(view))
{
view->updateConnectedEditors();
}
}
Riu3DMainWindowTools::selectAsCurrentItem(valveTemplate);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewValveTemplateFeature::onActionTriggered(bool isChecked)
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
RimOilField* oilfield = project->activeOilField();
if (oilfield == nullptr) return;
RimValveTemplateCollection* valveTemplateColl = oilfield->valveTemplateCollection();
if (valveTemplateColl)
{
RimValveTemplate* valveTemplate = new RimValveTemplate();
QString userLabel = QString("Valve Template #%1").arg(valveTemplateColl->valveTemplates().size() + 1);
valveTemplate->setUserLabel(userLabel);
valveTemplateColl->addValveTemplate(valveTemplate);
valveTemplate->setUnitSystem(valveTemplateColl->defaultUnitSystemType());
valveTemplate->setDefaultValuesFromUnits();
selectValveTemplateAndUpdate(valveTemplateColl, valveTemplate);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewValveTemplateFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/ICDValve16x16.png"));
actionToSetup->setText("New Valve Template");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewValveTemplateFeature::isCommandEnabled()
{
return true;
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
class RimValveTemplate;
class RimValveTemplateCollection;
//==================================================================================================
///
//==================================================================================================
class RicNewValveTemplateFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void selectValveTemplateAndUpdate(RimValveTemplateCollection* templateCollection,
RimValveTemplate* valveTemplate);
protected:
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
bool isCommandEnabled() override;
};