mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
3767 Annotations. Feature for deleting annotations
This commit is contained in:
parent
08de39f15a
commit
d138770a2a
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
|
@ -0,0 +1,94 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicDeleteAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeleteAnnotationFeature, "RicDeleteAnnotationFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto textAnnots = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
auto lineBasedAnnots = caf::selectedObjectsByTypeStrict<RimLineBasedAnnotation*>();
|
||||
|
||||
return !textAnnots.empty() || !lineBasedAnnots.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
{
|
||||
auto annotations = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
while(!annotations.empty())
|
||||
{
|
||||
auto annotation = annotations.front();
|
||||
|
||||
RimAnnotationCollection* coll;
|
||||
annotation->firstAncestorOrThisOfType(coll);
|
||||
if (coll)
|
||||
{
|
||||
coll->addAnnotation()
|
||||
}
|
||||
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto coll = annotationInViewCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/minus-sign-red.png"));
|
||||
actionToSetup->setText("Delete Annotation");
|
||||
}
|
@ -24,6 +24,8 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
@ -300,6 +302,24 @@ void RicDeleteItemExec::redo()
|
||||
ensembleCurveFilterColl->firstAncestorOrThisOfType(plot);
|
||||
if (plot) plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
{
|
||||
RimAnnotationCollection* annotationColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType(annotationColl);
|
||||
if (annotationColl)
|
||||
{
|
||||
annotationColl->onAnnotationDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimAnnotationInViewCollection* annotationColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType(annotationColl);
|
||||
if (annotationColl)
|
||||
{
|
||||
annotationColl->onAnnotationDeleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,8 @@
|
||||
#include "RimWellLogRftCurve.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimSimWellFracture.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
@ -125,7 +126,8 @@ bool isDeletable(caf::PdmUiItem* uiItem)
|
||||
if (dynamic_cast<RimEnsembleCurveFilter*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimDerivedEnsembleCaseCollection*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimWellPathValve*>(uiItem)) return true;
|
||||
|
||||
if (dynamic_cast<RimTextAnnotation*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimLineBasedAnnotation*>(uiItem)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
@ -115,6 +117,20 @@ std::vector<RimPolylinesFromFileAnnotation*> RimAnnotationCollection::polylinesF
|
||||
return m_polylineFromFileAnnotations.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// At least one annotation have been deleted. Typically by the generic delete command
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::onAnnotationDeleted()
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
std::vector<RimGridView*> views;
|
||||
project->allVisibleGridViews(views);
|
||||
for (auto& view : views)
|
||||
{
|
||||
if(view->annotationCollection()->isActive()) view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
|
||||
|
||||
void onAnnotationDeleted();
|
||||
|
||||
RimPolylinesFromFileAnnotation* importOrUpdatePolylinesFromFile(const QStringList& fileNames );
|
||||
void scheduleRedrawOfRelevantViews();
|
||||
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
@ -53,6 +56,20 @@ void RimAnnotationInViewCollection::addAnnotation(RimTextAnnotation* annotation)
|
||||
m_textAnnotations.push_back(annotation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// At least one annotation have been deleted. Typically by the generic delete command
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::onAnnotationDeleted()
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
std::vector<RimGridView*> views;
|
||||
project->allVisibleGridViews(views);
|
||||
for (auto& view : views)
|
||||
{
|
||||
if (view->annotationCollection()->isActive()) view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
~RimAnnotationInViewCollection() override;
|
||||
|
||||
void addAnnotation(RimTextAnnotation* annotation);
|
||||
void onAnnotationDeleted();
|
||||
|
||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||
bool isActive() const;
|
||||
|
Loading…
Reference in New Issue
Block a user