mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
3D Well Log Curves: Command to Delete curve #2667
* Add delete command with explicit delete feature class.
This commit is contained in:
parent
a73526f85b
commit
2cc93fb09d
@ -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
|
||||
|
@ -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"));
|
||||
}
|
@ -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;
|
||||
};
|
@ -19,6 +19,7 @@
|
||||
#include "Rim3dWellLogCurveCollection.h"
|
||||
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection");
|
||||
@ -79,6 +80,14 @@ void Rim3dWellLogCurveCollection::add3dWellLogCurve(Rim3dWellLogCurve* curve)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurveCollection::remove3dWellLogCurve(Rim3dWellLogCurve* curve)
|
||||
{
|
||||
m_3dWellLogCurves.removeChildObject(curve);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -117,6 +126,25 @@ std::vector<Rim3dWellLogCurve*> Rim3dWellLogCurveCollection::vectorOf3dWellLogCu
|
||||
return curves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurveCollection::redrawAffectedViewsAndEditors()
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (proj)
|
||||
{
|
||||
proj->createDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
RimWellPath* path = nullptr;
|
||||
this->firstAncestorOrThisOfType(path);
|
||||
if (path)
|
||||
{
|
||||
path->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
|
||||
bool has3dWellLogCurves() const;
|
||||
void add3dWellLogCurve(Rim3dWellLogCurve* curve);
|
||||
void remove3dWellLogCurve(Rim3dWellLogCurve* curve);
|
||||
|
||||
bool isShowingGrid() const;
|
||||
bool isShowingPlot() const;
|
||||
@ -53,7 +54,7 @@ public:
|
||||
PlanePosition planePosition() const;
|
||||
|
||||
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
|
||||
|
||||
void redrawAffectedViewsAndEditors();
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
@ -760,18 +760,22 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicDeleteSubItemsFeature";
|
||||
}
|
||||
|
||||
// Special delete commands for specific features
|
||||
// Placed here to fit context menu location of general delete feature
|
||||
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicWellPathDeleteFeature")->canFeatureBeExecuted())
|
||||
{
|
||||
// Special delete command for Well paths
|
||||
// Placed here to fit context menu location of general delete feature
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicWellPathDeleteFeature";
|
||||
}
|
||||
|
||||
if (caf::CmdFeatureManager::instance()->getCommandFeature("Ric3dWellLogCurveDeleteFeature")->canFeatureBeExecuted())
|
||||
{
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "Ric3dWellLogCurveDeleteFeature";
|
||||
}
|
||||
|
||||
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicWellLogFileCloseFeature")->canFeatureBeExecuted())
|
||||
{
|
||||
// Special delete command for Well paths
|
||||
// Placed here to fit context menu location of general delete feature
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicWellLogFileCloseFeature";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user