#3706 Annotations. First commit. Not tested

This commit is contained in:
Bjørn Erik Jensen
2018-11-23 13:33:59 +01:00
parent 39a838b406
commit 35405ebafc
47 changed files with 2944 additions and 91 deletions

View File

@@ -122,6 +122,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapView.h
${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPolylineAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.h
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
)
@@ -248,6 +254,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolylineAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -25,6 +25,7 @@
#include "RiaViewRedrawScheduler.h"
#include "Rim3dWellLogCurve.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimMainPlotCollection.h"
@@ -34,6 +35,7 @@
#include "RimViewLinker.h"
#include "RimWellPathCollection.h"
#include "RivAnnotationsPartMgr.h"
#include "RivWellPathsPartMgr.h"
#include "RiuMainWindow.h"
@@ -131,6 +133,7 @@ Rim3dView::Rim3dView(void)
m_wellPathPipeVizModel->setName("WellPathPipeModel");
m_wellPathsPartManager = new RivWellPathsPartMgr(this);
m_annotationsPartManager = new RivAnnotationsPartMgr(this);
this->setAs3DViewMdiWindow();
}
@@ -313,6 +316,8 @@ void Rim3dView::setCurrentTimeStepAndUpdate(int frameIndex)
RimProject* project;
firstAncestorOrThisOfTypeAsserted(project);
project->mainPlotCollection()->updateCurrentTimeStepInPlots();
appendAnnotationsToModel();
}
//--------------------------------------------------------------------------------------------------
@@ -665,6 +670,29 @@ void Rim3dView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBas
wellPathModelBasicList->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::addAnnotationsToModel(cvf::ModelBasicList* wellPathModelBasicList)
{
if (!this->ownerCase()) return;
std::vector<RimAnnotationInViewCollection*> annotationCollections;
descendantsIncludingThisOfType(annotationCollections);
if (annotationCollections.empty() || !annotationCollections.front()->isActive())
{
m_annotationsPartManager->clearGeometryCache();
}
else
{
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
m_annotationsPartManager->appendGeometryPartsToModel(wellPathModelBasicList, transForm.p());
}
wellPathModelBasicList->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -961,11 +989,23 @@ void Rim3dView::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::appendAnnotationsToModel()
{
if (!m_viewer) return;
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
cvf::String name = "Annotations";
this->removeModelByName(frameScene, name);
cvf::ref<cvf::ModelBasicList> model = new cvf::ModelBasicList;
model->setName(name);
addAnnotationsToModel(model.p());
frameScene->addModel(model.p());
}
}

View File

@@ -41,6 +41,7 @@ class RimCase;
class RimLegendConfig;
class RimWellPathCollection;
class RiuViewer;
class RivAnnotationsPartMgr;
class RivWellPathsPartMgr;
namespace cvf
@@ -166,6 +167,8 @@ protected:
void addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::BoundingBox& wellPathClipBoundingBox);
void addAnnotationsToModel(cvf::ModelBasicList* wellPathModelBasicList);
void createHighlightAndGridBoxDisplayModel();
// Implementation of RiuViewerToViewInterface
@@ -201,6 +204,7 @@ protected:
cvf::ref<cvf::ModelBasicList> m_highlightVizModel;
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
cvf::ref<RivAnnotationsPartMgr> m_annotationsPartManager;
private:
// Overridden PdmObject methods:
@@ -230,6 +234,7 @@ private:
caf::PdmObjectHandle* implementingPdmObject() override { return this; }
void handleMdiWindowClosed() override;
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry) override;
void appendAnnotationsToModel();
private:
caf::PdmField<QString> m_name;

View File

@@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RimAnnotationCollection.h"
#include "RimTextAnnotation.h"
#include "RimReachCircleAnnotation.h"
#include "RimPolylineAnnotation.h"
#include <QString>
namespace caf
{
// template<>
// void RimWellPathCollection::WellVisibilityEnum::setUp()
// {
// addItem(RimWellPathCollection::FORCE_ALL_OFF, "FORCE_ALL_OFF", "Off");
// addItem(RimWellPathCollection::ALL_ON, "ALL_ON", "Individual");
// addItem(RimWellPathCollection::FORCE_ALL_ON, "FORCE_ALL_ON", "On");
// }
}
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection::RimAnnotationCollection()
{
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_polylineAnnotations, "PolylineAnnotations", "Polyline Annotations", "", "", "");
m_textAnnotations.uiCapability()->setUiHidden(true);
m_reachCircleAnnotations.uiCapability()->setUiHidden(true);
m_polylineAnnotations.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection::~RimAnnotationCollection()
{
// wellPaths.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimTextAnnotation* annotation)
{
m_textAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation)
{
m_reachCircleAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimPolylineAnnotation* annotation)
{
m_polylineAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimTextAnnotation*> RimAnnotationCollection::textAnnotations() const
{
return m_textAnnotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnotations() const
{
return m_reachCircleAnnotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylineAnnotation*> RimAnnotationCollection::polylineAnnotations() const
{
return m_polylineAnnotations.childObjects();
}

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RiaEclipseUnitTools.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildField.h"
#include "cvfObject.h"
class QString;
class RimTextAnnotation;
class RimReachCircleAnnotation;
class RimPolylineAnnotation;
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimAnnotationCollection();
~RimAnnotationCollection() override;
void addAnnotation(RimTextAnnotation* annotation);
void addAnnotation(RimReachCircleAnnotation* annotation);
void addAnnotation(RimPolylineAnnotation* annotation);
std::vector<RimTextAnnotation*> textAnnotations() const;
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
std::vector<RimPolylineAnnotation*> polylineAnnotations() const;
private:
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
caf::PdmChildArrayField<RimPolylineAnnotation*> m_polylineAnnotations;
};

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RimAnnotationInView.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT(RimAnnotationInView, "Annotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInView::RimAnnotationInView()
{
CAF_PDM_InitObject("Well", ":/Well.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInView::~RimAnnotationInView()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimAnnotationInView::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
}

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"
#include "cvfObject.h"
#include "cvfVector3.h"
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationInView : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimAnnotationInView();
~RimAnnotationInView() override;
caf::PdmFieldHandle* objectToggleField() override;
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
private:
caf::PdmField<bool> m_isActive;
};

View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RimAnnotationInViewCollection.h"
#include "RimGridView.h"
CAF_PDM_SOURCE_INIT(RimAnnotationInViewCollection, "Annotations");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection::RimAnnotationInViewCollection()
{
CAF_PDM_InitObject("Annotations", ":/Plus.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection::~RimAnnotationInViewCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimAnnotationInViewCollection::isActive() const
{
return m_isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (&m_isActive == changedField)
{
this->updateUiIconFromToggleField();
RimGridView* view;
firstAncestorOrThisOfType(view);
if (view)
{
//view->hasUserRequestedAnimation = true;
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimAnnotationInViewCollection::objectToggleField()
{
return &m_isActive;
}

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafTristate.h"
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationInViewCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimAnnotationInViewCollection();
~RimAnnotationInViewCollection() override;
bool isActive() const;
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
caf::PdmFieldHandle* objectToggleField() override;
private:
caf::PdmField<bool> m_isActive;
};

View File

@@ -26,6 +26,7 @@
#include "Rim3dWellLogExtractionCurve.h"
#include "Rim3dWellLogFileCurve.h"
#include "Rim3dWellLogRftCurve.h"
#include "RimAnnotationCollection.h"
#include "RimCalcScript.h"
#include "RimCaseCollection.h"
#include "RimCellRangeFilter.h"
@@ -679,6 +680,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "Separator";
menuBuilder << "RicConvertFractureTemplateUnitFeature";
}
else if (dynamic_cast<RimAnnotationCollection*>(uiItem))
{
menuBuilder << "RicNewTextAnnotationFeature";
menuBuilder << "RicNewPolygonAnnotationFeature";
}
if (dynamic_cast<Rim3dView*>(uiItem))
{

View File

@@ -22,6 +22,7 @@
#include "RiuViewer.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCase.h"
#include "RimCellRangeFilterCollection.h"
#include "RimContourMapNameConfig.h"
@@ -181,6 +182,7 @@ void RimContourMapView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrder
cellResult()->uiCapability()->setUiReadOnly(m_contourMapProjection->isColumnResult());
uiTreeOrdering.add(wellCollection());
uiTreeOrdering.add(faultCollection());
uiTreeOrdering.add(annotationCollection());
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(nativePropertyFilterCollection());

View File

@@ -38,6 +38,7 @@
#include "Rim2dIntersectionView.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCellEdgeColors.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
@@ -141,6 +142,10 @@ RimEclipseView::RimEclipseView()
m_faultCollection = new RimFaultInViewCollection;
m_faultCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_annotationCollection, "AnnotationCollection", "Annotations", "", "", "");
m_annotationCollection = new RimAnnotationInViewCollection;
m_annotationCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "");
m_propertyFilterCollection = new RimEclipsePropertyFilterCollection();
m_propertyFilterCollection.uiCapability()->setUiHidden(true);
@@ -176,6 +181,7 @@ RimEclipseView::~RimEclipseView()
delete m_propertyFilterCollection;
delete wellCollection();
delete faultCollection();
delete annotationCollection();
m_reservoirGridPartManager->clearGeometryCache();
@@ -568,7 +574,7 @@ void RimEclipseView::updateCurrentTimeStep()
updateVisibleGeometriesAndCellColors();
appendWellsAndFracturesToModel();
m_overlayInfoConfig()->update3DInfo();
// Invisible Wells are marked as read only when "show wells intersecting visible cells" is enabled
@@ -1521,6 +1527,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
uiTreeOrdering.add(m_virtualPerforationResult);
uiTreeOrdering.add(faultCollection());
uiTreeOrdering.add(annotationCollection());
uiTreeOrdering.add(crossSectionCollection());
uiTreeOrdering.add(m_rangeFilterCollection());

View File

@@ -21,6 +21,7 @@
#include "RiaApplication.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCellRangeFilterCollection.h"
#include "RimGridCollection.h"
#include "RimIntersectionCollection.h"
@@ -179,6 +180,14 @@ const RimCellRangeFilterCollection* RimGridView::rangeFilterCollection() const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection* RimGridView::annotationCollection() const
{
return m_annotationCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -23,6 +23,7 @@
#include "cvfBase.h"
#include "cvfArray.h"
class RimAnnotationInViewCollection;
class RimContourMapProjection;
class Rim3dOverlayInfoConfig;
class RimIntersectionCollection;
@@ -50,7 +51,9 @@ public:
void rangeFiltersUpdated();
RimCellRangeFilterCollection* rangeFilterCollection();
const RimCellRangeFilterCollection* rangeFilterCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
bool hasOverridenRangeFilterCollection();
void setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc);
void replaceRangeFilterCollectionWithOverride();
@@ -78,6 +81,8 @@ protected: // Fields
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;
caf::PdmChildField<RimGridCollection*> m_gridCollection;
caf::PdmChildField<RimAnnotationInViewCollection*> m_annotationCollection;
protected:
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;

View File

@@ -20,6 +20,7 @@
#include "RimOilField.h"
#include "RimAnnotationCollection.h"
#include "RimEclipseCaseCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimFractureTemplateCollection.h"
@@ -49,12 +50,15 @@ RimOilField::RimOilField(void)
CAF_PDM_InitFieldNoDefault(&formationNamesCollection,"FormationNamesCollection","Formations","","","");
CAF_PDM_InitFieldNoDefault(&observedDataCollection, "ObservedDataCollection", "Observed Data", ":/Cases16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&annotationCollection, "AnnotationCollection", "Annotations", "", "", "");
fractureDefinitionCollection = new RimFractureTemplateCollection();
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseMainCollection = new RimSummaryCaseMainCollection();
observedDataCollection = new RimObservedDataCollection();
formationNamesCollection = new RimFormationNamesCollection();
annotationCollection = new RimAnnotationCollection();
}
//--------------------------------------------------------------------------------------------------
@@ -70,6 +74,7 @@ RimOilField::~RimOilField(void)
if (summaryCaseMainCollection()) delete summaryCaseMainCollection();
if (formationNamesCollection()) delete formationNamesCollection();
if (observedDataCollection()) delete observedDataCollection();
if (annotationCollection()) delete annotationCollection();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -33,6 +33,7 @@ class RimObservedDataCollection;
class RimSummaryCase;
class RimSummaryCaseMainCollection;
class RimWellPathCollection;
class RimAnnotationCollection;
//==================================================================================================
///
@@ -55,5 +56,5 @@ public:
caf::PdmChildField<RimSummaryCaseMainCollection*> summaryCaseMainCollection;
caf::PdmChildField<RimObservedDataCollection*> observedDataCollection;
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
caf::PdmChildField<RimAnnotationCollection*> annotationCollection;
};

View File

@@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RimPolylineAnnotation.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimGridView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimPerforationCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
CAF_PDM_SOURCE_INIT(RimPolylineAnnotation, "RimPolylineAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPolylineAnnotation::RimPolylineAnnotation()
{
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&m_points, "Points", {}, "", "", "", "");
}
RimPolylineAnnotation::~RimPolylineAnnotation()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolylineAnnotation::setPoints(const std::vector<Vec3d>& points)
{
m_points = points;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RimPolylineAnnotation::Vec3d>& RimPolylineAnnotation::points() const
{
return m_points();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolylineAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_points);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolylineAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
auto views = gridViewsContainingAnnotations();
if (!views.empty())
{
if (changedField == &m_points)
{
for (auto& view : views)
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimPolylineAnnotation::gridViewsContainingAnnotations() const
{
std::vector<RimGridView*> views;
RimProject* project = nullptr;
this->firstAncestorOrThisOfType(project);
if (!project) return views;
std::vector<RimGridView*> visibleGridViews;
project->allVisibleGridViews(visibleGridViews);
for (auto& gridView : visibleGridViews)
{
if (gridView->annotationCollection()->isActive()) views.push_back(gridView);
}
return views;
}

View File

@@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmUiOrdering.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include <vector>
class QString;
class RimGridView;
//==================================================================================================
///
///
//==================================================================================================
class RimPolylineAnnotation : public caf::PdmObject
{
using Vec3d = cvf::Vec3d;
CAF_PDM_HEADER_INIT;
public:
RimPolylineAnnotation();
~RimPolylineAnnotation();
void setPoints(const std::vector<Vec3d>& points);
const std::vector<Vec3d>& points() const;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
private:
caf::PdmField<std::vector<Vec3d>> m_points;
};

View File

@@ -30,6 +30,7 @@
#include "RigEclipseCaseData.h"
#include "RigGridBase.h"
#include "RimAnnotationCollection.h"
#include "RimCalcScript.h"
#include "RimCase.h"
#include "RimCaseCollection.h"
@@ -707,7 +708,7 @@ void RimProject::allVisibleViews(std::vector<Rim3dView*>& views)
void RimProject::allVisibleGridViews(std::vector<RimGridView*>& views)
{
std::vector<Rim3dView*> visibleViews;
this->allVisibleViews(visibleViews);
this->allVisibleViews(visibleViews);
for ( Rim3dView* view : visibleViews )
{
RimGridView* gridView = dynamic_cast<RimGridView*>(view);
@@ -957,6 +958,57 @@ std::vector<RimWellPath*> RimProject::allWellPaths() const
return paths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
{
std::vector<RimTextAnnotation*> annotations;
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->textAnnotations())
{
annotations.push_back(annotation);
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimReachCircleAnnotation*> RimProject::reachCircleAnnotations() const
{
std::vector<RimReachCircleAnnotation*> annotations;
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->reachCircleAnnotations())
{
annotations.push_back(annotation);
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylineAnnotation*> RimProject::polylineAnnotations() const
{
std::vector<RimPolylineAnnotation*> annotations;
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->polylineAnnotations())
{
annotations.push_back(annotation);
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1128,6 +1180,7 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
if (oilField->wellPathCollection()) uiTreeOrdering.add(oilField->wellPathCollection());
if (oilField->formationNamesCollection()) uiTreeOrdering.add(oilField->formationNamesCollection());
if (oilField->fractureDefinitionCollection()) uiTreeOrdering.add(oilField->fractureDefinitionCollection());
if (oilField->annotationCollection()) uiTreeOrdering.add(oilField->annotationCollection());
}
uiTreeOrdering.add(scriptCollection());

View File

@@ -35,6 +35,9 @@ class RigGridManager;
class RigMainGrid;
class RigWellPath;
class RimTextAnnotation;
class RimReachCircleAnnotation;
class RimPolylineAnnotation;
class RimSummaryCalculationCollection;
class RimCase;
class RimCommandObject;
@@ -142,6 +145,9 @@ public:
RimWellPath* wellPathFromSimWellName(const QString& simWellName, int branchIndex = -1);
RimWellPath* wellPathByName(const QString& wellPathName) const;
std::vector<RimWellPath*> allWellPaths() const;
std::vector<RimTextAnnotation*> textAnnotations() const;
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
std::vector<RimPolylineAnnotation*> polylineAnnotations() const;
std::vector<RimGeoMechCase*> geoMechCases() const;

View File

@@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RimReachCircleAnnotation.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimGridView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimPerforationCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
CAF_PDM_SOURCE_INIT(RimReachCircleAnnotation, "RimReachCircleAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimReachCircleAnnotation::RimReachCircleAnnotation()
{
CAF_PDM_InitObject("CircleAnnotation", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&m_centerPoint, "CenterPoint", Vec3d::ZERO, "Center Point", "", "", "");
CAF_PDM_InitField(&m_radius, "Radius", 0.0, "Radius", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimReachCircleAnnotation::setRadius(double radius)
{
m_radius = radius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimReachCircleAnnotation::radius() const
{
return m_radius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimReachCircleAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_centerPoint);
uiOrdering.add(&m_radius);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimReachCircleAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
auto views = gridViewsContainingAnnotations();
if (!views.empty())
{
if (changedField == &m_centerPoint || changedField == &m_radius)
{
for (auto& view : views)
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimReachCircleAnnotation::gridViewsContainingAnnotations() const
{
std::vector<RimGridView*> views;
RimProject* project = nullptr;
this->firstAncestorOrThisOfType(project);
if (!project) return views;
std::vector<RimGridView*> visibleGridViews;
project->allVisibleGridViews(visibleGridViews);
for (auto& gridView : visibleGridViews)
{
if (gridView->annotationCollection()->isActive()) views.push_back(gridView);
}
return views;
}

View File

@@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmUiOrdering.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include <vector>
class QString;
class RimGridView;
//==================================================================================================
///
///
//==================================================================================================
class RimReachCircleAnnotation : public caf::PdmObject
{
using Vec3d = cvf::Vec3d;
CAF_PDM_HEADER_INIT;
public:
RimReachCircleAnnotation();
void setRadius(double radius);
double radius() const;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
private:
caf::PdmField<Vec3d> m_centerPoint;
caf::PdmField<double> m_radius;
};

View File

@@ -0,0 +1,160 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "RimTextAnnotation.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimGridView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimPerforationCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
CAF_PDM_SOURCE_INIT(RimTextAnnotation, "RimTextAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTextAnnotation::RimTextAnnotation()
{
CAF_PDM_InitObject("TextAnnotation", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&m_anchorPoint, "AnchorPoint", Vec3d::ZERO, "Anchor Point", "", "", "");
CAF_PDM_InitField(&m_labelPoint, "LabelPoint", Vec3d::ZERO, "Label Point", "", "", "");
CAF_PDM_InitField(&m_text, "Text", QString(), "Text", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimTextAnnotation::anchorPoint() const
{
return m_anchorPoint;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimTextAnnotation::labelPoint() const
{
return m_labelPoint;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTextAnnotation::setText(const QString& text)
{
m_text = text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RimTextAnnotation::text() const
{
return m_text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTextAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_anchorPoint);
uiOrdering.add(&m_labelPoint);
uiOrdering.add(&m_text);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTextAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
auto views = gridViewsContainingAnnotations();
if (!views.empty())
{
if (changedField == &m_text)
{
for (auto& view : views)
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimTextAnnotation::gridViewsContainingAnnotations() const
{
std::vector<RimGridView*> views;
RimProject* project = nullptr;
this->firstAncestorOrThisOfType(project);
if (!project) return views;
std::vector<RimGridView*> visibleGridViews;
project->allVisibleGridViews(visibleGridViews);
for (auto& gridView : visibleGridViews)
{
if (gridView->annotationCollection()->isActive()) views.push_back(gridView);
}
return views;
}

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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 "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmUiOrdering.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include <vector>
class QString;
class RimGridView;
//==================================================================================================
///
///
//==================================================================================================
class RimTextAnnotation : public caf::PdmObject
{
using Vec3d = cvf::Vec3d;
CAF_PDM_HEADER_INIT;
public:
RimTextAnnotation();
Vec3d anchorPoint() const;
Vec3d labelPoint() const;
void setText(const QString& text);
const QString& text() const;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
private:
caf::PdmField<Vec3d> m_anchorPoint;
caf::PdmField<Vec3d> m_labelPoint;
caf::PdmField<QString> m_text;
};