#3756 Annotation. Refactore features. Add view local text annotations

This commit is contained in:
Bjørn Erik Jensen 2018-11-26 14:48:06 +01:00
parent 9297c5888c
commit cdaa5e2af6
19 changed files with 472 additions and 166 deletions

View File

@ -76,7 +76,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewAnnotationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.h
)
@ -151,7 +153,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewAnnotationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.cpp
)

View File

@ -1,8 +1,6 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
// Copyright (C) 2016- Statoil 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
@ -18,57 +16,67 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimAnnotationInView.h"
#include "RicCreateReachCircleAnnotationFeature.h"
#include "cafPdmUiTreeOrdering.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_PDM_SOURCE_INIT(RimAnnotationInView, "Annotation");
CAF_CMD_SOURCE_INIT(RicCreateReachCircleAnnotationFeature, "RicCreateReachCircleAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInView::RimAnnotationInView()
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled()
{
CAF_PDM_InitObject("Well", ":/Well.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInView::~RimAnnotationInView()
void RicCreateReachCircleAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimReachCircleAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RicCreateReachCircleAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create Reach Circle Annotation");
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
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 /*= ""*/)
RimAnnotationCollection* RicCreateReachCircleAnnotationFeature::annotationCollection() const
{
auto project = RiaApplication::instance()->project();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicCreateReachCircleAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
private:
RimAnnotationCollection* annotationCollection() const;
};

View File

@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RicCreateTextAnnotationFeature.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(RicCreateTextAnnotationFeature, "RicCreateTextAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTextAnnotationFeature::isCommandEnabled()
{
auto selObjsGlobal = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
auto selObjs2InView = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
return selObjsGlobal.size() == 1 || selObjs2InView.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTextAnnotationFeature::onActionTriggered(bool isChecked)
{
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimTextAnnotation();
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 RicCreateTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create Text Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicCreateTextAnnotationFeature::annotationCollection() const
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1 ? selObjs.front() : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection* RicCreateTextAnnotationFeature::annotationInViewCollection() const
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
return selObjs.size() == 1 ? selObjs.front() : nullptr;
}

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
class RimAnnotationInViewCollection;
//==================================================================================================
///
//==================================================================================================
class RicCreateTextAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
RimAnnotationCollection* annotationCollection() const;
RimAnnotationInViewCollection* annotationInViewCollection() const;
};

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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 "RicCreateUserDefinedPolylinesAnnotationFeature.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(RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimUserDefinedPolyLinesAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("Create User Defined Polyline Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
{
auto project = RiaApplication::instance()->project();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicCreateUserDefinedPolylinesAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
private:
RimAnnotationCollection* annotationCollection() const;
};

View File

@ -1,84 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicNewAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
RimAnnotationCollection* annotationCollection() const;
};
//==================================================================================================
///
//==================================================================================================
class RicNewTextAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};
//==================================================================================================
///
//==================================================================================================
class RicNewReachCircleAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -33,8 +33,6 @@
#include "cvfTransform.h"
#include "cafDisplayCoordTransform.h"
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -126,7 +126,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.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
)
@ -258,7 +257,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.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
)

View File

@ -30,7 +30,6 @@
#include <QString>
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,28 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>

View File

@ -20,35 +20,23 @@
#pragma once
#include "cafPdmField.h"
#include "RiaEclipseUnitTools.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"
#include "cvfObject.h"
#include "cvfVector3.h"
class RimTextAnnotation;
class RimReachCircleAnnotation;
class RimPolylineAnnotation;
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationInView : public caf::PdmObject
class RimAnnotationCollectionInterface : 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;
virtual std::vector<RimTextAnnotation*> textAnnotations() const = 0;
virtual std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const = 0;
virtual std::vector<RimPolylineAnnotation*> polylineAnnotations() const = 0;
};

View File

@ -21,6 +21,7 @@
#include "RimAnnotationInViewCollection.h"
#include "RimGridView.h"
#include "RimTextAnnotation.h"
CAF_PDM_SOURCE_INIT(RimAnnotationInViewCollection, "Annotations");
@ -32,7 +33,10 @@ RimAnnotationInViewCollection::RimAnnotationInViewCollection()
{
CAF_PDM_InitObject("Annotations", ":/Plus.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
m_textAnnotations.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
}
@ -43,6 +47,22 @@ RimAnnotationInViewCollection::~RimAnnotationInViewCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::addAnnotation(RimTextAnnotation* annotation)
{
m_textAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimTextAnnotation*> RimAnnotationInViewCollection::textAnnotations() const
{
return m_textAnnotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -70,13 +90,6 @@ void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -27,6 +27,7 @@
#include "cafPdmPointer.h"
#include "cafTristate.h"
class RimTextAnnotation;
//==================================================================================================
///
@ -40,13 +41,16 @@ public:
RimAnnotationInViewCollection();
~RimAnnotationInViewCollection() override;
bool isActive() const;
void addAnnotation(RimTextAnnotation* annotation);
std::vector<RimTextAnnotation*> textAnnotations() const;
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;
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
caf::PdmField<bool> m_isActive;
};

View File

@ -27,6 +27,7 @@
#include "Rim3dWellLogFileCurve.h"
#include "Rim3dWellLogRftCurve.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCalcScript.h"
#include "RimCaseCollection.h"
#include "RimCellRangeFilter.h"
@ -682,10 +683,14 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
}
else if (dynamic_cast<RimAnnotationCollection*>(uiItem))
{
menuBuilder << "RicCreateTextAnnotationFeature";
menuBuilder << "RicCreateReachCircleAnnotationFeature";
menuBuilder << "RicCreateUserDefinedPolylinesAnnotationFeature";
menuBuilder << "RicImportPolylinesAnnotationFeature";
menuBuilder << "RicNewTextAnnotationFeature";
menuBuilder << "RicNewReachCircleAnnotationFeature";
menuBuilder << "RicNewPolygonAnnotationFeature";
}
else if (dynamic_cast<RimAnnotationInViewCollection*>(uiItem))
{
menuBuilder << "RicCreateTextAnnotationFeature";
}
if (dynamic_cast<Rim3dView*>(uiItem))

View File

@ -31,8 +31,8 @@
#include "RigGridBase.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimPolylinesAnnotation.h"
#include "RimCalcScript.h"
#include "RimCase.h"
#include "RimCaseCollection.h"
@ -683,7 +683,7 @@ void RimProject::allNotLinkedViews(std::vector<RimGridView*>& views)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::allVisibleViews(std::vector<Rim3dView*>& views)
void RimProject::allVisibleViews(std::vector<Rim3dView*>& views) const
{
std::vector<RimCase*> cases;
allCases(cases);
@ -707,7 +707,7 @@ void RimProject::allVisibleViews(std::vector<Rim3dView*>& views)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::allVisibleGridViews(std::vector<RimGridView*>& views)
void RimProject::allVisibleGridViews(std::vector<RimGridView*>& views) const
{
std::vector<Rim3dView*> visibleViews;
this->allVisibleViews(visibleViews);
@ -966,6 +966,8 @@ std::vector<RimWellPath*> RimProject::allWellPaths() const
std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
{
std::vector<RimTextAnnotation*> annotations;
// 'Global' text annotations
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
@ -974,6 +976,24 @@ std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
annotations.push_back(annotation);
}
}
// 'Local' text annotations
std::vector<RimGridView*> visibleViews;
allVisibleGridViews(visibleViews);
for (const auto& view : visibleViews)
{
std::vector<RimAnnotationInViewCollection*> annotationColls;
view->descendantsIncludingThisOfType(annotationColls);
if (annotationColls.size() == 1)
{
for (const auto& annotation : annotationColls.front()->textAnnotations())
{
annotations.push_back(annotation);
}
}
}
return annotations;
}

View File

@ -115,8 +115,8 @@ public:
std::vector<RimSummaryCaseCollection*> summaryGroups() const;
RimSummaryCaseMainCollection* firstSummaryCaseMainCollection() const;
void allVisibleViews(std::vector<Rim3dView*>& views);
void allVisibleGridViews(std::vector<RimGridView*>& views);
void allVisibleViews(std::vector<Rim3dView*>& views) const;
void allVisibleGridViews(std::vector<RimGridView*>& views) const;
void allNotLinkedViews(std::vector<RimGridView*>& views);
void scheduleCreateDisplayModelAndRedrawAllViews();

View File

@ -71,7 +71,7 @@ RimTextAnnotation::RimTextAnnotation()
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", "", "", "");
CAF_PDM_InitField(&m_text, "Text", QString("(New text)"), "Text", "", "", "");
}
//--------------------------------------------------------------------------------------------------