3D Well Log Curves: Command to Delete curve #2667

* Add delete command with explicit delete feature class.
This commit is contained in:
Gaute Lindkvist
2018-04-10 10:57:04 +02:00
parent a73526f85b
commit 2cc93fb09d
6 changed files with 157 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicMoveWellLogFilesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogFileCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogRftCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/Ric3dWellLogCurveDeleteFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -55,6 +56,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicMoveWellLogFilesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogFileCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogRftCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/Ric3dWellLogCurveDeleteFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "Ric3dWellLogCurveDeleteFeature.h"
#include "RiaApplication.h"
#include "Rim3dWellLogCurve.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimProject.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(Ric3dWellLogCurveDeleteFeature, "Ric3dWellLogCurveDeleteFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Ric3dWellLogCurveDeleteFeature::isCommandEnabled()
{
std::vector<Rim3dWellLogCurve*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() > 0)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Ric3dWellLogCurveDeleteFeature::onActionTriggered(bool isChecked)
{
std::vector<Rim3dWellLogCurve*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 0) return;
Rim3dWellLogCurve* firstCurve = objects[0];
Rim3dWellLogCurveCollection* curveCollection = nullptr;
firstCurve->firstAncestorOrThisOfType(curveCollection);
if (!curveCollection) return;
for (Rim3dWellLogCurve* curve : objects)
{
curveCollection->remove3dWellLogCurve(curve);
delete curve;
}
curveCollection->redrawAffectedViewsAndEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Ric3dWellLogCurveDeleteFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete 3D Well Log Curve(s)");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 Ric3dWellLogCurveDeleteFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
};