mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1078 Context menu commands for multi select of EclipseWell objects
This commit is contained in:
@@ -119,6 +119,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
Commands/ApplicationCommands/CMakeLists_files.cmake
|
||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||
Commands/EclipseCommands/CMakeLists_files.cmake
|
||||
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
|
||||
Commands/FlowCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
|
||||
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseWellFeatureImpl.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseWellShowFeatures.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseWellFeatureImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseWellShowFeatures.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\Eclipse\\Well" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RicEclipseWellFeatureImpl.h"
|
||||
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellFeatureImpl::isAnyWellSelected()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseWell*> RicEclipseWellFeatureImpl::selectedWells()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimEclipseWell;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellFeatureImpl
|
||||
{
|
||||
public:
|
||||
static bool isAnyWellSelected();
|
||||
static std::vector<RimEclipseWell*> selectedWells();
|
||||
};
|
||||
@@ -0,0 +1,263 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RicEclipseWellShowFeatures.h"
|
||||
|
||||
#include "RicEclipseWellFeatureImpl.h"
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowLabelFeature, "RicEclipseWellShowLabelFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowLabelFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellLabel.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowLabelFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Label");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowLabelFeature::isCommandEnabled()
|
||||
{
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowLabelFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellLabel();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowHeadFeature, "RicEclipseWellShowHeadFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowHeadFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellHead.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowHeadFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Head");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowHeadFeature::isCommandEnabled()
|
||||
{
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowHeadFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellHead();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowPipeFeature, "RicEclipseWellShowPipeFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowPipeFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellPipes.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowPipeFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Pipes");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowPipeFeature::isCommandEnabled()
|
||||
{
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowPipeFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellPipes();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowSpheresFeature, "RicEclipseWellShowSpheresFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowSpheresFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellSpheres.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowSpheresFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Spheres");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowSpheresFeature::isCommandEnabled()
|
||||
{
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowSpheresFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellSpheres();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowLabelFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowHeadFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowPipeFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowSpheresFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
@@ -403,6 +403,13 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicExportFaultsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseWell*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEclipseWellShowLabelFeature";
|
||||
commandIds << "RicEclipseWellShowHeadFeature";
|
||||
commandIds << "RicEclipseWellShowPipeFeature";
|
||||
commandIds << "RicEclipseWellShowSpheresFeature";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user