mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3788 Annotations. Mirror global annotations into view annotation collection. Not thorougly testet yet
This commit is contained in:
@@ -10,6 +10,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -23,6 +29,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
@@ -47,6 +48,14 @@ RimAnnotationCollection::RimAnnotationCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_userDefinedPolylineAnnotations, "UserDefinedPolylineAnnotations", "User Defined Polyline Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_polylineFromFileAnnotations, "PolylineFromFileAnnotations", "Polylines From File", "", "", "");
|
||||
|
||||
m_reachCircleAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_userDefinedPolylineAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_polylineFromFileAnnotations.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_reachCircleAnnotations = new RimAnnotationGroupCollection("Reach Circle Annotations");
|
||||
m_userDefinedPolylineAnnotations = new RimAnnotationGroupCollection("User Defined Polyline Annotations");
|
||||
m_polylineFromFileAnnotations = new RimAnnotationGroupCollection("Polylines From File");
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +71,8 @@ RimAnnotationCollection::~RimAnnotationCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation)
|
||||
{
|
||||
m_reachCircleAnnotations.push_back(annotation);
|
||||
m_reachCircleAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -71,7 +81,8 @@ void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation
|
||||
void RimAnnotationCollection::addAnnotation(RimUserDefinedPolylinesAnnotation* annotation)
|
||||
{
|
||||
|
||||
m_userDefinedPolylineAnnotations.push_back(annotation);
|
||||
m_userDefinedPolylineAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -79,7 +90,8 @@ void RimAnnotationCollection::addAnnotation(RimUserDefinedPolylinesAnnotation* a
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation(RimPolylinesFromFileAnnotation* annotation)
|
||||
{
|
||||
m_polylineFromFileAnnotations.push_back(annotation);
|
||||
m_polylineFromFileAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -87,7 +99,12 @@ void RimAnnotationCollection::addAnnotation(RimPolylinesFromFileAnnotation* anno
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnotations() const
|
||||
{
|
||||
return m_reachCircleAnnotations.childObjects();
|
||||
std::vector<RimReachCircleAnnotation*> annotations;
|
||||
for (auto& a : m_reachCircleAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimReachCircleAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -95,7 +112,12 @@ std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnot
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> RimAnnotationCollection::userDefinedPolylineAnnotations() const
|
||||
{
|
||||
return m_userDefinedPolylineAnnotations.childObjects();
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> annotations;
|
||||
for (auto& a : m_userDefinedPolylineAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimUserDefinedPolylinesAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -103,7 +125,12 @@ std::vector<RimUserDefinedPolylinesAnnotation*> RimAnnotationCollection::userDef
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylinesFromFileAnnotation*> RimAnnotationCollection::polylinesFromFileAnnotations() const
|
||||
{
|
||||
return m_polylineFromFileAnnotations.childObjects();
|
||||
std::vector<RimPolylinesFromFileAnnotation*> annotations;
|
||||
for (auto& a : m_polylineFromFileAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimPolylinesFromFileAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -117,7 +144,7 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
for(const QString& newFileName : fileNames)
|
||||
{
|
||||
bool isFound = false;
|
||||
for(RimPolylinesFromFileAnnotation* polyLinesAnnot: m_polylineFromFileAnnotations)
|
||||
for(RimPolylinesFromFileAnnotation* polyLinesAnnot: polylinesFromFileAnnotations())
|
||||
{
|
||||
if(polyLinesAnnot->fileName() == newFileName)
|
||||
{
|
||||
@@ -144,7 +171,7 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||
newPolyLinesAnnot->appearance()->setColor(newColor);
|
||||
|
||||
m_polylineFromFileAnnotations.push_back(newPolyLinesAnnot);
|
||||
m_polylineFromFileAnnotations->addAnnotation(newPolyLinesAnnot);
|
||||
polyLinesObjsToReload.push_back(newPolyLinesAnnot);
|
||||
|
||||
++newLinesIdx;
|
||||
@@ -154,7 +181,7 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
|
||||
if (!newFileNames.empty())
|
||||
{
|
||||
return m_polylineFromFileAnnotations.childObjects().back();
|
||||
return polylinesFromFileAnnotations().back();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,7 +195,44 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimAnnotationCollection::lineBasedAnnotationsCount() const
|
||||
{
|
||||
return m_reachCircleAnnotations.size() + m_userDefinedPolylineAnnotations.size() + m_polylineFromFileAnnotations.size();
|
||||
return m_reachCircleAnnotations->annotations().size() +
|
||||
m_userDefinedPolylineAnnotations->annotations().size() +
|
||||
m_polylineFromFileAnnotations->annotations().size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Update view-local annotation collections, to mirror the state in the global collection (this collection)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::updateViewAnnotationCollections()
|
||||
{
|
||||
auto views = gridViewsContainingAnnotations();
|
||||
|
||||
for (const auto* view : views)
|
||||
{
|
||||
view->annotationCollection()->onGlobalCollectionChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::onAnnotationDeleted()
|
||||
{
|
||||
updateViewAnnotationCollections();
|
||||
RimAnnotationCollectionBase::onAnnotationDeleted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> RimAnnotationCollection::allPdmAnnotations() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> all;
|
||||
all.insert(all.end(), m_textAnnotations->m_annotations.begin(), m_textAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_reachCircleAnnotations->m_annotations.begin(), m_reachCircleAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_userDefinedPolylineAnnotations->m_annotations.begin(), m_userDefinedPolylineAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_polylineFromFileAnnotations->m_annotations.begin(), m_polylineFromFileAnnotations->m_annotations.end());
|
||||
return all;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -201,5 +265,5 @@ void RimAnnotationCollection::reloadPolylinesFromFile(const std::vector<RimPolyl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::loadDataAndUpdate()
|
||||
{
|
||||
reloadPolylinesFromFile(m_polylineFromFileAnnotations.childObjects());
|
||||
reloadPolylinesFromFile(polylinesFromFileAnnotations());
|
||||
}
|
||||
|
||||
@@ -24,10 +24,12 @@
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QString;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimReachCircleAnnotation;
|
||||
class RimUserDefinedPolylinesAnnotation;
|
||||
@@ -59,10 +61,16 @@ public:
|
||||
|
||||
size_t lineBasedAnnotationsCount() const;
|
||||
|
||||
private:
|
||||
void reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload);
|
||||
void updateViewAnnotationCollections() override;
|
||||
void onAnnotationDeleted() override;
|
||||
|
||||
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
|
||||
caf::PdmChildArrayField<RimUserDefinedPolylinesAnnotation*> m_userDefinedPolylineAnnotations;
|
||||
caf::PdmChildArrayField<RimPolylinesFromFileAnnotation*> m_polylineFromFileAnnotations;
|
||||
// Used by sync code
|
||||
std::vector<caf::PdmObject*> allPdmAnnotations() const;
|
||||
|
||||
private:
|
||||
void reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload);
|
||||
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_reachCircleAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_userDefinedPolylineAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_polylineFromFileAnnotations;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
|
||||
#include "QMessageBox"
|
||||
#include <QString>
|
||||
@@ -42,7 +43,11 @@ RimAnnotationCollectionBase::RimAnnotationCollectionBase()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
|
||||
|
||||
m_textAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_textAnnotations = new RimAnnotationGroupCollection("Text Annotations");
|
||||
}
|
||||
|
||||
|
||||
@@ -53,12 +58,21 @@ RimAnnotationCollectionBase::~RimAnnotationCollectionBase()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationCollectionBase::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::addAnnotation(RimTextAnnotation* annotation)
|
||||
{
|
||||
m_textAnnotations.push_back(annotation);
|
||||
m_textAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -66,7 +80,20 @@ void RimAnnotationCollectionBase::addAnnotation(RimTextAnnotation* annotation)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimTextAnnotation*> RimAnnotationCollectionBase::textAnnotations() const
|
||||
{
|
||||
return m_textAnnotations.childObjects();
|
||||
std::vector<RimTextAnnotation*> annotations;
|
||||
for (auto& a : m_textAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimTextAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::updateViewAnnotationCollections()
|
||||
{
|
||||
// Default implementation: No op
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -110,7 +137,29 @@ std::vector<RimGridView*> RimAnnotationCollectionBase::gridViewsContainingAnnota
|
||||
|
||||
for (auto& gridView : visibleGridViews)
|
||||
{
|
||||
if (gridView->annotationCollection()->isActive()) views.push_back(gridView);
|
||||
/*if (gridView->annotationCollection()->annotationsCount() > 0)*/ views.push_back(gridView);
|
||||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationCollectionBase::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QString;
|
||||
class RimTextAnnotation;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -40,15 +42,23 @@ public:
|
||||
RimAnnotationCollectionBase();
|
||||
~RimAnnotationCollectionBase() override;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
void addAnnotation(RimTextAnnotation* annotation);
|
||||
|
||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||
|
||||
void onAnnotationDeleted();
|
||||
virtual void updateViewAnnotationCollections();
|
||||
virtual void onAnnotationDeleted();
|
||||
|
||||
void scheduleRedrawOfRelevantViews();
|
||||
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_textAnnotations;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimAnnotationGroupCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "QMessageBox"
|
||||
#include <QString>
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationGroupCollection, "RimAnnotationGroupCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationGroupCollection::RimAnnotationGroupCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_title, "Title", QString("Annotations"), "Title", "", "", "");
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", "Annotations", "", "", "");
|
||||
|
||||
m_annotations.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationGroupCollection::RimAnnotationGroupCollection(const QString& title)
|
||||
: RimAnnotationGroupCollection()
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationGroupCollection::~RimAnnotationGroupCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::setTitle(const QString& title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationGroupCollection::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationGroupCollection::isVisible() const
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
bool visible = true;
|
||||
if (coll) visible = coll->isActive();
|
||||
if (visible) visible = m_isActive;
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::addAnnotation(caf::PdmObject* annotation)
|
||||
{
|
||||
m_annotations.push_back(annotation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> RimAnnotationGroupCollection::annotations() const
|
||||
{
|
||||
return m_annotations.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
if(coll) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationGroupCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationGroupCollection::userDescriptionField()
|
||||
{
|
||||
return &m_title;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QString;
|
||||
class RimTextAnnotation;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationGroupCollection : public caf::PdmObject
|
||||
{
|
||||
friend class RimAnnotationCollection;
|
||||
friend class RimAnnotationInViewCollection;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimAnnotationGroupCollection();
|
||||
RimAnnotationGroupCollection(const QString& title);
|
||||
~RimAnnotationGroupCollection() override;
|
||||
|
||||
void setTitle(const QString& title);
|
||||
bool isActive() const;
|
||||
bool isVisible() const;
|
||||
|
||||
void addAnnotation(caf::PdmObject* annotation);
|
||||
std::vector<caf::PdmObject*> annotations() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<QString> m_title;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildArrayField<caf::PdmObject*> m_annotations;
|
||||
};
|
||||
@@ -20,15 +20,56 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
#include "RimReachCircleAnnotationInView.h"
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
|
||||
#include <cvfBoundingBox.h>
|
||||
|
||||
#include <cafPdmUiDoubleSliderEditor.h>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal function
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* sourcePdmAnnotation(const caf::PdmObject* annotationInView)
|
||||
{
|
||||
auto t = dynamic_cast<const RimTextAnnotationInView*>(annotationInView);
|
||||
if (t)
|
||||
{
|
||||
return t->sourceAnnotation();
|
||||
}
|
||||
|
||||
auto c = dynamic_cast<const RimReachCircleAnnotationInView*>(annotationInView);
|
||||
if (c)
|
||||
{
|
||||
return c->sourceAnnotation();
|
||||
}
|
||||
|
||||
auto up = dynamic_cast<const RimUserDefinedPolylinesAnnotationInView*>(annotationInView);
|
||||
if (up)
|
||||
{
|
||||
return up->sourceAnnotation();
|
||||
}
|
||||
|
||||
auto pf = dynamic_cast<const RimPolylinesFromFileAnnotationInView*>(annotationInView);
|
||||
if (pf)
|
||||
{
|
||||
return pf->sourceAnnotation();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationInViewCollection, "Annotations");
|
||||
|
||||
@@ -39,14 +80,26 @@ RimAnnotationInViewCollection::RimAnnotationInViewCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/Annotations16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_annotationPlaneDepth, "AnnotationPlaneDepth", 0.0, "Annotation Plane Depth", "", "", "");
|
||||
CAF_PDM_InitField(&m_snapAnnotations, "SnapAnnotations", false, "Snap Annotations to Plane", "", "", "");
|
||||
|
||||
m_annotationPlaneDepth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
m_annotationPlaneDepth.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LabelPosType::TOP);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalTextAnnotations, "TextAnnotationsInView", "Global Text Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalReachCircleAnnotations, "ReachCircleAnnotationsInView", "Global Reach Circle Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalUserDefinedPolylineAnnotations, "UserDefinedPolylinesAnnotationsInView", "Global User Defined Polylines Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalPolylineFromFileAnnotations, "PolylinesFromFileAnnotationsInView", "Global Polylines From File Annotations", "", "", "");
|
||||
|
||||
m_globalTextAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_globalReachCircleAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_globalUserDefinedPolylineAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_globalPolylineFromFileAnnotations.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_globalTextAnnotations = new RimAnnotationGroupCollection("Global Text Annotations");
|
||||
m_globalReachCircleAnnotations = new RimAnnotationGroupCollection("Global Reach Circle Annotations");
|
||||
m_globalUserDefinedPolylineAnnotations = new RimAnnotationGroupCollection("Global User Defined Polylines Annotations");
|
||||
m_globalPolylineFromFileAnnotations = new RimAnnotationGroupCollection("Global Polylines From File Annotations");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -56,14 +109,6 @@ RimAnnotationInViewCollection::~RimAnnotationInViewCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationInViewCollection::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -80,6 +125,105 @@ bool RimAnnotationInViewCollection::snapAnnotations() const
|
||||
return m_snapAnnotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimTextAnnotationInView*> RimAnnotationInViewCollection::globalTextAnnotations() const
|
||||
{
|
||||
std::vector<RimTextAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalTextAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimTextAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimReachCircleAnnotationInView*> RimAnnotationInViewCollection::globalReachCircleAnnotations() const
|
||||
{
|
||||
std::vector<RimReachCircleAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalReachCircleAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimReachCircleAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimUserDefinedPolylinesAnnotationInView*> RimAnnotationInViewCollection::globalUserDefinedPolylineAnnotations() const
|
||||
{
|
||||
std::vector<RimUserDefinedPolylinesAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalUserDefinedPolylineAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimUserDefinedPolylinesAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylinesFromFileAnnotationInView*> RimAnnotationInViewCollection::globalPolylineFromFileAnnotations() const
|
||||
{
|
||||
std::vector<RimPolylinesFromFileAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalPolylineFromFileAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimPolylinesFromFileAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Called when the global annotation collection has changed
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::onGlobalCollectionChanged(const RimAnnotationCollection* globalCollection)
|
||||
{
|
||||
// Sync annotations from global annotation collection
|
||||
auto globals = globalCollection->allPdmAnnotations();
|
||||
auto locals = allGlobalPdmAnnotations();
|
||||
std::vector<const caf::PdmObject*> globalAnnotationsToDelete;
|
||||
std::set<caf::PdmObject*> globalsSet(globals.begin(), globals.end());
|
||||
|
||||
for(const auto local : locals)
|
||||
{
|
||||
auto sourceAnnotation = sourcePdmAnnotation(local);
|
||||
if (globalsSet.count(sourceAnnotation) > 0)
|
||||
{
|
||||
globalsSet.erase(sourceAnnotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalAnnotationsToDelete.push_back(local);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove deleted global annotations
|
||||
for(auto a : globalAnnotationsToDelete)
|
||||
{
|
||||
deleteGlobalAnnotation(a);
|
||||
}
|
||||
|
||||
// Add newly added global annotations
|
||||
for (const auto& global : globalsSet)
|
||||
{
|
||||
addGlobalAnnotation(global);
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimAnnotationInViewCollection::annotationsCount() const
|
||||
{
|
||||
return m_textAnnotations->m_annotations.size() + allGlobalPdmAnnotations().size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -97,21 +241,9 @@ void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (&m_isActive == changedField)
|
||||
{
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationInViewCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -142,3 +274,92 @@ void RimAnnotationInViewCollection::defineEditorAttribute(const caf::PdmFieldHan
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> RimAnnotationInViewCollection::allGlobalPdmAnnotations() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> all;
|
||||
all.insert(all.end(), m_globalTextAnnotations->m_annotations.begin(), m_globalTextAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_globalReachCircleAnnotations->m_annotations.begin(), m_globalReachCircleAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_globalUserDefinedPolylineAnnotations->m_annotations.begin(), m_globalUserDefinedPolylineAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_globalPolylineFromFileAnnotations->m_annotations.begin(), m_globalPolylineFromFileAnnotations->m_annotations.end());
|
||||
return all;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::addGlobalAnnotation(caf::PdmObject* annotation)
|
||||
{
|
||||
auto t = dynamic_cast<RimTextAnnotation*>(annotation);
|
||||
if (t)
|
||||
{
|
||||
m_globalTextAnnotations->addAnnotation(new RimTextAnnotationInView(t));
|
||||
return;
|
||||
}
|
||||
|
||||
auto c = dynamic_cast< RimReachCircleAnnotation*>(annotation);
|
||||
if (c)
|
||||
{
|
||||
m_globalReachCircleAnnotations->addAnnotation(new RimReachCircleAnnotationInView(c));
|
||||
return;
|
||||
}
|
||||
|
||||
auto up = dynamic_cast<RimUserDefinedPolylinesAnnotation*>(annotation);
|
||||
if (up)
|
||||
{
|
||||
m_globalUserDefinedPolylineAnnotations->addAnnotation(new RimUserDefinedPolylinesAnnotationInView(up));
|
||||
return;
|
||||
}
|
||||
|
||||
auto pf = dynamic_cast<RimPolylinesFromFileAnnotation*>(annotation);
|
||||
if (pf)
|
||||
{
|
||||
m_globalPolylineFromFileAnnotations->addAnnotation(new RimPolylinesFromFileAnnotationInView(pf));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::deleteGlobalAnnotation(const caf::PdmObject* annotation)
|
||||
{
|
||||
for(size_t i = 0; i < m_globalTextAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalTextAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalTextAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_globalReachCircleAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalReachCircleAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalReachCircleAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_globalUserDefinedPolylineAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalUserDefinedPolylineAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalUserDefinedPolylineAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_globalPolylineFromFileAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalPolylineFromFileAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalPolylineFromFileAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,18 @@
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
class RimAnnotationCollection;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimTextAnnotationInView;
|
||||
class RimReachCircleAnnotationInView;
|
||||
class RimUserDefinedPolylinesAnnotationInView;
|
||||
class RimPolylinesFromFileAnnotationInView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -41,20 +48,36 @@ public:
|
||||
RimAnnotationInViewCollection();
|
||||
~RimAnnotationInViewCollection() override;
|
||||
|
||||
bool isActive() const;
|
||||
double annotationPlaneZ() const;
|
||||
bool snapAnnotations() const;
|
||||
|
||||
std::vector<RimTextAnnotationInView*> globalTextAnnotations() const;
|
||||
std::vector<RimReachCircleAnnotationInView*> globalReachCircleAnnotations() const;
|
||||
std::vector<RimUserDefinedPolylinesAnnotationInView*> globalUserDefinedPolylineAnnotations() const;
|
||||
std::vector<RimPolylinesFromFileAnnotationInView*> globalPolylineFromFileAnnotations() const;
|
||||
|
||||
void onGlobalCollectionChanged(const RimAnnotationCollection* globalCollection);
|
||||
size_t annotationsCount() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
private:
|
||||
std::vector<caf::PdmObject*> allGlobalPdmAnnotations() const;
|
||||
void addGlobalAnnotation(caf::PdmObject* annotation);
|
||||
void deleteGlobalAnnotation(const caf::PdmObject* annotation);
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<double> m_annotationPlaneDepth;
|
||||
caf::PdmField<bool> m_snapAnnotations;
|
||||
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalTextAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalReachCircleAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalUserDefinedPolylineAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalPolylineFromFileAnnotations;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimLineBasedAnnotation, "RimLineBasedAnnotation");
|
||||
@@ -53,6 +54,17 @@ bool RimLineBasedAnnotation::isActive()
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimLineBasedAnnotation::isVisible()
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
return coll && coll->isActive() && m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
RimAnnotationLineAppearance* appearance() const;
|
||||
|
||||
bool isActive();
|
||||
bool isVisible();
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPolylinesAnnotationInView.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolylinesAnnotationInView, "RimPolylinesAnnotationInView");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotationInView::RimPolylinesAnnotationInView()
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLinesAnnotationInView", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_sourceAnnotation, "SourceAnnotation", "Source Annotation", "", "", "");
|
||||
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
m_sourceAnnotation = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotationInView::RimPolylinesAnnotationInView(RimPolylinesAnnotation* sourceAnnotation)
|
||||
: RimPolylinesAnnotationInView()
|
||||
{
|
||||
CVF_ASSERT(sourceAnnotation);
|
||||
|
||||
m_isActive = sourceAnnotation->isActive();
|
||||
m_sourceAnnotation = sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotationInView::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylinesAnnotationInView::setSourceAnnotation(RimPolylinesAnnotation* annotation)
|
||||
{
|
||||
m_sourceAnnotation = annotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotation* RimPolylinesAnnotationInView::sourceAnnotation() const
|
||||
{
|
||||
return m_sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotationInView::isVisible() const
|
||||
{
|
||||
RimAnnotationGroupCollection* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
bool visible = true;
|
||||
if (coll) visible = coll->isVisible();
|
||||
if (visible && m_sourceAnnotation)
|
||||
{
|
||||
visible = m_sourceAnnotation->isVisible();
|
||||
|
||||
if (visible)
|
||||
{
|
||||
RimAnnotationGroupCollection* globalColl;
|
||||
m_sourceAnnotation->firstAncestorOrThisOfType(globalColl);
|
||||
if (globalColl) visible = globalColl->isVisible();
|
||||
}
|
||||
}
|
||||
if (visible) visible = m_isActive;
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylinesAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
if (coll) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPolylinesAnnotationInView::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPolylinesAnnotationInView::userDescriptionField()
|
||||
{
|
||||
return m_sourceAnnotation ? m_sourceAnnotation->userDescriptionField() : nullptr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmPtrField.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 RimPolylinesAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylinesAnnotationInView : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPolylinesAnnotationInView();
|
||||
RimPolylinesAnnotationInView(RimPolylinesAnnotation* sourceAnnotation);
|
||||
~RimPolylinesAnnotationInView() override {}
|
||||
|
||||
bool isActive() const;
|
||||
void setSourceAnnotation(RimPolylinesAnnotation* annotation);
|
||||
RimPolylinesAnnotation* sourceAnnotation() const;
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmPtrField<RimPolylinesAnnotation*> m_sourceAnnotation;
|
||||
};
|
||||
@@ -23,7 +23,10 @@
|
||||
|
||||
class RimPolylinesFromFileAnnotation : public RimPolylinesAnnotation
|
||||
{
|
||||
friend class RimPolylinesFromFileAnnotationInView;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPolylinesFromFileAnnotation();
|
||||
~RimPolylinesFromFileAnnotation();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPolylinesFromFileAnnotationInView.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolylinesFromFileAnnotationInView, "RimPolylinesFromFileAnnotationInView");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesFromFileAnnotationInView::RimPolylinesFromFileAnnotationInView()
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesFromFileAnnotationInView::RimPolylinesFromFileAnnotationInView(RimPolylinesFromFileAnnotation* sourceAnnotation)
|
||||
: RimPolylinesAnnotationInView(sourceAnnotation)
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "");
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPolylinesAnnotationInView.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmPtrField.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 RimPolylinesFromFileAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylinesFromFileAnnotationInView : public RimPolylinesAnnotationInView
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPolylinesFromFileAnnotationInView();
|
||||
RimPolylinesFromFileAnnotationInView(RimPolylinesFromFileAnnotation* sourceAnnotation);
|
||||
~RimPolylinesFromFileAnnotationInView() override {}
|
||||
};
|
||||
@@ -48,6 +48,8 @@ class RimGridView;
|
||||
//==================================================================================================
|
||||
class RimReachCircleAnnotation : public RimLineBasedAnnotation
|
||||
{
|
||||
friend class RimReachCircleAnnotationInView;
|
||||
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimReachCircleAnnotationInView.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimReachCircleAnnotationInView, "RimReachCircleAnnotationInView");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReachCircleAnnotationInView::RimReachCircleAnnotationInView()
|
||||
{
|
||||
CAF_PDM_InitObject("ReachCircleAnnotationInView", ":/ReachCircle16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_sourceAnnotation, "SourceAnnotation", "Source Annotation", "", "", "");
|
||||
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
m_sourceAnnotation = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReachCircleAnnotationInView::RimReachCircleAnnotationInView(RimReachCircleAnnotation* sourceAnnotation)
|
||||
: RimReachCircleAnnotationInView()
|
||||
{
|
||||
CVF_ASSERT(sourceAnnotation);
|
||||
|
||||
m_isActive = sourceAnnotation->isActive();
|
||||
m_sourceAnnotation = sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimReachCircleAnnotationInView::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReachCircleAnnotationInView::setSourceAnnotation(RimReachCircleAnnotation* annotation)
|
||||
{
|
||||
m_sourceAnnotation = annotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReachCircleAnnotation* RimReachCircleAnnotationInView::sourceAnnotation() const
|
||||
{
|
||||
return m_sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimReachCircleAnnotationInView::isVisible() const
|
||||
{
|
||||
RimAnnotationGroupCollection* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
bool visible = true;
|
||||
if (coll) visible = coll->isVisible();
|
||||
if (visible && m_sourceAnnotation)
|
||||
{
|
||||
visible = m_sourceAnnotation->isVisible();
|
||||
|
||||
if (visible)
|
||||
{
|
||||
RimAnnotationGroupCollection* globalColl;
|
||||
m_sourceAnnotation->firstAncestorOrThisOfType(globalColl);
|
||||
if (globalColl) visible = globalColl->isVisible();
|
||||
}
|
||||
}
|
||||
if (visible) visible = m_isActive;
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReachCircleAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
if (coll) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimReachCircleAnnotationInView::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimReachCircleAnnotationInView::userDescriptionField()
|
||||
{
|
||||
return m_sourceAnnotation ? m_sourceAnnotation->userDescriptionField() : nullptr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmPtrField.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;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimReachCircleAnnotationInView : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimReachCircleAnnotationInView();
|
||||
RimReachCircleAnnotationInView(RimReachCircleAnnotation* sourceAnnotation);
|
||||
~RimReachCircleAnnotationInView() override {}
|
||||
|
||||
bool isActive() const;
|
||||
void setSourceAnnotation(RimReachCircleAnnotation* annotation);
|
||||
RimReachCircleAnnotation* sourceAnnotation() const;
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmPtrField<RimReachCircleAnnotation*> m_sourceAnnotation;
|
||||
};
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "AnnotationCommands/RicTextAnnotation3dEditor.h"
|
||||
|
||||
|
||||
@@ -149,6 +150,20 @@ bool RimTextAnnotation::isActive()
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns true if annotation can be displayed due to all toggles that affect this annotation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimTextAnnotation::isVisible() const
|
||||
{
|
||||
RimAnnotationGroupCollection* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
bool visible = true;
|
||||
if (coll) visible = coll->isVisible();
|
||||
if(visible) visible = m_isActive;
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -45,13 +45,15 @@ class RimGridView;
|
||||
//==================================================================================================
|
||||
class RimTextAnnotation : public caf::PdmObject
|
||||
{
|
||||
friend class RimTextAnnotationInView;
|
||||
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimTextAnnotation();
|
||||
~RimTextAnnotation();
|
||||
~RimTextAnnotation() override;
|
||||
|
||||
Vec3d anchorPoint() const;
|
||||
void setAnchorPoint(const Vec3d & pointXyz) ;
|
||||
@@ -60,6 +62,7 @@ public:
|
||||
void setText(const QString& text);
|
||||
const QString& text() const;
|
||||
bool isActive();
|
||||
bool isVisible() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimTextAnnotationInView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimTextAnnotationInView, "RimTextAnnotationInView");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotationInView::RimTextAnnotationInView()
|
||||
{
|
||||
CAF_PDM_InitObject("TextAnnotationInView", ":/TextAnnotation16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_sourceAnnotation, "SourceAnnotation", "Source Annotation", "", "", "");
|
||||
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
m_sourceAnnotation = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotationInView::RimTextAnnotationInView(RimTextAnnotation* sourceAnnotation)
|
||||
: RimTextAnnotationInView()
|
||||
{
|
||||
CVF_ASSERT(sourceAnnotation);
|
||||
|
||||
m_isActive = sourceAnnotation->isActive();
|
||||
m_sourceAnnotation = sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimTextAnnotationInView::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTextAnnotationInView::setSourceAnnotation(RimTextAnnotation* annotation)
|
||||
{
|
||||
m_sourceAnnotation = annotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotation* RimTextAnnotationInView::sourceAnnotation() const
|
||||
{
|
||||
return m_sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns true if annotation can be displayed due to all toggles that affect this annotation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimTextAnnotationInView::isVisible() const
|
||||
{
|
||||
RimAnnotationGroupCollection* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
bool visible = true;
|
||||
if (coll) visible = coll->isVisible();
|
||||
if (visible && m_sourceAnnotation)
|
||||
{
|
||||
visible = m_sourceAnnotation->isVisible();
|
||||
|
||||
if (visible)
|
||||
{
|
||||
RimAnnotationGroupCollection* globalColl;
|
||||
m_sourceAnnotation->firstAncestorOrThisOfType(globalColl);
|
||||
if (globalColl) visible = globalColl->isVisible();
|
||||
}
|
||||
}
|
||||
if (visible) visible = m_isActive;
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTextAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
if (coll) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimTextAnnotationInView::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimTextAnnotationInView::userDescriptionField()
|
||||
{
|
||||
return m_sourceAnnotation ? m_sourceAnnotation->userDescriptionField() : nullptr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmPtrField.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 RimTextAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimTextAnnotationInView : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimTextAnnotationInView();
|
||||
RimTextAnnotationInView(RimTextAnnotation* sourceAnnotation);
|
||||
~RimTextAnnotationInView() override {}
|
||||
|
||||
bool isActive() const;
|
||||
void setSourceAnnotation(RimTextAnnotation* annotation);
|
||||
RimTextAnnotation* sourceAnnotation() const;
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmPtrField<RimTextAnnotation*> m_sourceAnnotation;
|
||||
};
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
class RimUserDefinedPolylinesAnnotation : public RimPolylinesAnnotation
|
||||
{
|
||||
friend class RimUserDefinedPolylinesAnnotationInView;
|
||||
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimUserDefinedPolylinesAnnotationInView, "RimUserDefinedPolylinesAnnotationInView");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedPolylinesAnnotationInView::RimUserDefinedPolylinesAnnotationInView()
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLinesAnnotationInView", ":/WellCollection.png", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedPolylinesAnnotationInView::RimUserDefinedPolylinesAnnotationInView(RimUserDefinedPolylinesAnnotation* sourceAnnotation)
|
||||
: RimPolylinesAnnotationInView(sourceAnnotation)
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLinesAnnotationInView", ":/WellCollection.png", "", "");
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPolylinesAnnotationInView.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmPtrField.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 RimUserDefinedPolylinesAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimUserDefinedPolylinesAnnotationInView : public RimPolylinesAnnotationInView
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimUserDefinedPolylinesAnnotationInView();
|
||||
RimUserDefinedPolylinesAnnotationInView(RimUserDefinedPolylinesAnnotation* sourceAnnotation);
|
||||
~RimUserDefinedPolylinesAnnotationInView() override {}
|
||||
};
|
||||
Reference in New Issue
Block a user