#2392 3D View Context command: "Color Result"

This commit is contained in:
Rebecca Cox 2018-02-12 08:42:05 +01:00
parent c6846f0d57
commit cf3a1ad43f
4 changed files with 109 additions and 0 deletions

View File

@ -35,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewSliceRangeFilterFeature.h
${CEE_CURRENT_LIST_DIR}RicHideIntersectionFeature.h
${CEE_CURRENT_LIST_DIR}RicHideIntersectionBoxFeature.h
${CEE_CURRENT_LIST_DIR}RicImportElementPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSelectColorResult.h
${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h
@ -118,6 +119,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewSliceRangeFilterFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHideIntersectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHideIntersectionBoxFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportElementPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSelectColorResult.cpp
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RicSelectColorResult.h"
#include "RiaApplication.h"
#include "RicWellLogTools.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechView.h"
#include "RimGridView.h"
#include "RiuMainWindow.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicSelectColorResult, "RicSelectColorResult");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectColorResult::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Color Result");
actionToSetup->setIcon(QIcon(":/CellResult.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSelectColorResult::isCommandEnabled()
{
if (RicWellLogTools::isWellPathOrSimWellSelectedInView()) return false;
return RiaApplication::instance()->activeGridView() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectColorResult::onActionTriggered(bool isChecked)
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
if (eclView)
{
RiuMainWindow::instance()->selectAsCurrentItem(eclView->cellResult());
return;
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(activeView);
if (geoMechView)
{
RiuMainWindow::instance()->selectAsCurrentItem(geoMechView->cellResult());
}
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 RicSelectColorResult : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -421,6 +421,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
menuBuilder << "RicSaveEclipseInputActiveVisibleCellsFeature";
menuBuilder << "RicShowGridStatisticsFeature";
menuBuilder << "RicSelectColorResult";
menuBuilder.appendToMenu(&menu);