mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7166 Use common delete functionality for PLT and RFT plots.
This commit is contained in:
parent
1f7cb2b973
commit
05048fe79b
@ -4,9 +4,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicAddWellLogToPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCurveExtractionFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogRftCurveFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteRftPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPltPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeletePltPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogFileCurveFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeatureImpl.h
|
||||
@ -36,9 +34,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicAddWellLogToPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCurveExtractionFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogRftCurveFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewRftPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteRftPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPltPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeletePltPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogFileCurveFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeatureImpl.cpp
|
||||
|
@ -1,78 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicDeletePltPlotFeature.h"
|
||||
|
||||
#include "RimPltPlotCollection.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeletePltPlotFeature, "RicDeletePltPlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeletePltPlotFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPltPlot*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
if ( objects.size() > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeletePltPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellPltPlot*> selectedPlots;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedPlots );
|
||||
|
||||
if ( selectedPlots.size() == 0 ) return;
|
||||
|
||||
RimWellPltPlot* firstPlot = selectedPlots[0];
|
||||
|
||||
RimPltPlotCollection* pltPlotCollection = nullptr;
|
||||
firstPlot->firstAncestorOrThisOfType( pltPlotCollection );
|
||||
if ( !pltPlotCollection ) return;
|
||||
|
||||
for ( RimWellPltPlot* plot : selectedPlots )
|
||||
{
|
||||
pltPlotCollection->removePlot( plot );
|
||||
delete plot;
|
||||
}
|
||||
|
||||
pltPlotCollection->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeletePltPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete PLT Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 RicDeletePltPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -1,80 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicDeleteRftPlotFeature.h"
|
||||
|
||||
#include "RimRftPlotCollection.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteRftPlotFeature, "RicDeleteRftPlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteRftPlotFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellRftPlot*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
if ( objects.size() > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteRftPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellRftPlot*> selectedPlots;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedPlots );
|
||||
|
||||
if ( selectedPlots.size() == 0 ) return;
|
||||
|
||||
RimWellRftPlot* firstPlot = selectedPlots[0];
|
||||
|
||||
RimRftPlotCollection* rftPlotCollection = nullptr;
|
||||
firstPlot->firstAncestorOrThisOfType( rftPlotCollection );
|
||||
if ( !rftPlotCollection ) return;
|
||||
|
||||
for ( RimWellRftPlot* plot : selectedPlots )
|
||||
{
|
||||
rftPlotCollection->removePlot( plot );
|
||||
delete plot;
|
||||
}
|
||||
|
||||
rftPlotCollection->uiCapability()->updateConnectedEditors();
|
||||
// rftPlotCollection->scheduleRedrawAffectedViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteRftPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete RFT Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
|
||||
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 RicDeleteRftPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -148,7 +148,6 @@
|
||||
#include "RimWellPathFracture.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
#include "RimGridStatisticsPlotCollection.h"
|
||||
@ -471,14 +470,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
else if ( dynamic_cast<RimWellRftPlot*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicDeleteRftPlotFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimWellPltPlot*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicDeletePltPlotFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimCalcScript*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicEditScriptFeature";
|
||||
@ -583,7 +574,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimWellLogPlot*>( firstUiItem ) )
|
||||
else if ( dynamic_cast<RimWellLogPlot*>( firstUiItem ) && !dynamic_cast<RimWellPltPlot*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicPasteWellLogPlotFeature";
|
||||
menuBuilder << "RicPasteWellLogTrackFeature";
|
||||
|
Loading…
Reference in New Issue
Block a user