2017-09-27 05:39:28 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-09-29 04:24:18 -05:00
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2017-09-27 05:39:28 -05:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-09-29 04:24:18 -05:00
|
|
|
#include "RicDeleteRftPlotFeature.h"
|
|
|
|
|
|
|
|
#include "RimRftPlotCollection.h"
|
2017-09-27 05:39:28 -05:00
|
|
|
#include "RimWellRftPlot.h"
|
2017-09-29 04:24:18 -05:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-29 04:24:18 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicDeleteRftPlotFeature, "RicDeleteRftPlotFeature");
|
2017-09-27 05:39:28 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-09-29 04:24:18 -05:00
|
|
|
bool RicDeleteRftPlotFeature::isCommandEnabled()
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2017-09-29 04:24:18 -05:00
|
|
|
std::vector<RimWellRftPlot*> objects;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&objects);
|
|
|
|
|
|
|
|
if (objects.size() > 0)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-29 04:24:18 -05:00
|
|
|
return false;
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-09-29 04:24:18 -05:00
|
|
|
void RicDeleteRftPlotFeature::onActionTriggered(bool isChecked)
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2017-09-29 04:24:18 -05:00
|
|
|
std::vector<RimWellRftPlot*> selectedPlots;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&selectedPlots);
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-29 04:24:18 -05:00
|
|
|
if (selectedPlots.size() == 0) return;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-29 04:24:18 -05:00
|
|
|
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();
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-09-29 04:24:18 -05:00
|
|
|
void RicDeleteRftPlotFeature::setupActionLook(QAction* actionToSetup)
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2017-09-29 04:24:18 -05:00
|
|
|
actionToSetup->setText("Delete RFT Plot");
|
|
|
|
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|