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:
@@ -25,8 +25,12 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
|
||||
#include "RivTextAnnotationPartMgr.h"
|
||||
#include "RivReachCircleAnnotationPartMgr.h"
|
||||
#include "RivPolylineAnnotationPartMgr.h"
|
||||
@@ -76,20 +80,31 @@ void RivAnnotationsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivAnnotationsPartMgr::createAnnotationPartManagers()
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
auto textAnnotations = proj->textAnnotations();
|
||||
auto reachCircleAnnotations = proj->reachCircleAnnotations();
|
||||
auto polylineAnnotations = proj->polylineAnnotations();
|
||||
std::vector<RimAnnotationInViewCollection*> colls;
|
||||
m_rimView->descendantsIncludingThisOfType(colls);
|
||||
|
||||
if (colls.empty()) return;
|
||||
auto coll = colls.front();
|
||||
|
||||
auto localTextAnnotations = coll->textAnnotations();
|
||||
auto textAnnotations = coll->globalTextAnnotations();
|
||||
auto reachCircleAnnotations = coll->globalReachCircleAnnotations();
|
||||
auto userDefinedPolylineAnnotations = coll->globalUserDefinedPolylineAnnotations();
|
||||
auto polylineFromFileAnnotations = coll->globalPolylineFromFileAnnotations();
|
||||
|
||||
clearGeometryCache();
|
||||
|
||||
if (m_textAnnotationPartMgrs.size() != textAnnotations.size())
|
||||
if (m_textAnnotationPartMgrs.size() != localTextAnnotations.size() + textAnnotations.size())
|
||||
{
|
||||
for (auto annotation : localTextAnnotations)
|
||||
{
|
||||
auto* apm = new RivTextAnnotationPartMgr(m_rimView, annotation);
|
||||
m_textAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
for (auto annotation : textAnnotations)
|
||||
{
|
||||
auto* apm = new RivTextAnnotationPartMgr(m_rimView, annotation);
|
||||
m_textAnnotationPartMgrs.push_back(apm);
|
||||
//m_mapFromViewToIndex[wellPath] = wppm;
|
||||
}
|
||||
}
|
||||
if (m_reachCircleAnnotationPartMgrs.size() != reachCircleAnnotations.size())
|
||||
@@ -98,16 +113,19 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
|
||||
{
|
||||
auto* apm = new RivReachCircleAnnotationPartMgr(m_rimView, annotation);
|
||||
m_reachCircleAnnotationPartMgrs.push_back(apm);
|
||||
// m_mapFromViewToIndex[wellPath] = wppm;
|
||||
}
|
||||
}
|
||||
if (m_polylineAnnotationPartMgrs.size() != polylineAnnotations.size())
|
||||
if (m_polylineAnnotationPartMgrs.size() != userDefinedPolylineAnnotations.size() + polylineFromFileAnnotations.size())
|
||||
{
|
||||
for (auto annotation : polylineAnnotations)
|
||||
for (auto annotation : userDefinedPolylineAnnotations)
|
||||
{
|
||||
auto* apm = new RivPolylineAnnotationPartMgr(m_rimView, annotation);
|
||||
m_polylineAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
for (auto annotation : polylineFromFileAnnotations)
|
||||
{
|
||||
auto* apm = new RivPolylineAnnotationPartMgr(m_rimView, annotation);
|
||||
m_polylineAnnotationPartMgrs.push_back(apm);
|
||||
// m_mapFromViewToIndex[wellPath] = wppm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimPolylinesAnnotationInView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
|
||||
@@ -45,8 +46,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotation* annotation)
|
||||
: m_rimView(view), m_rimAnnotation(annotation)
|
||||
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotationInView* annotationInView)
|
||||
: m_rimView(view), m_rimAnnotationInView(annotationInView)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,11 +66,12 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
{
|
||||
clearAllGeometry();
|
||||
|
||||
if (!m_rimAnnotation->isEmpty() && m_rimAnnotation->isActive())
|
||||
auto rimAnnotation = m_rimAnnotationInView->sourceAnnotation();
|
||||
if (!rimAnnotation->isEmpty() && rimAnnotation->isActive())
|
||||
{
|
||||
auto lineColor = m_rimAnnotation->appearance()->color();
|
||||
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
|
||||
auto lineThickness = m_rimAnnotation->appearance()->thickness();
|
||||
auto lineColor = rimAnnotation->appearance()->color();
|
||||
auto isDashedLine = rimAnnotation->appearance()->isDashed();
|
||||
auto lineThickness = rimAnnotation->appearance()->thickness();
|
||||
|
||||
auto* collection = annotationCollection();
|
||||
if (!collection) return;
|
||||
@@ -90,7 +92,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(m_rimAnnotation);
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(rimAnnotation);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_part = part;
|
||||
@@ -103,7 +105,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
std::vector<std::vector<RivPolylineAnnotationPartMgr::Vec3d>>
|
||||
RivPolylineAnnotationPartMgr::getPolylinesPointsInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
auto polylines = m_rimAnnotation->polyLinesData()->polyLines();
|
||||
auto polylines = m_rimAnnotationInView->sourceAnnotation()->polyLinesData()->polyLines();
|
||||
if (!snapToPlaneZ) return polylines;
|
||||
|
||||
std::vector<std::vector<Vec3d>> polylinesInDisplay;
|
||||
@@ -186,8 +188,9 @@ void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelB
|
||||
const caf::DisplayCoordTransform * displayXf,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
if (m_rimAnnotation.isNull()) return;
|
||||
if (m_rimAnnotation->isEmpty()) return;
|
||||
auto rimAnnotation = m_rimAnnotationInView->sourceAnnotation();
|
||||
if (rimAnnotation->isEmpty()) return;
|
||||
if (!m_rimAnnotationInView->isVisible()) return;
|
||||
|
||||
// Check bounding box
|
||||
if (!isPolylinesInBoundingBox(boundingBox)) return;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace caf
|
||||
}
|
||||
|
||||
class Rim3dView;
|
||||
class RimPolylinesAnnotation;
|
||||
class RimPolylinesAnnotationInView;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class RivPolylineAnnotationPartMgr : public cvf::Object
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
public:
|
||||
RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotation* annotation);
|
||||
RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotationInView* annotation);
|
||||
~RivPolylineAnnotationPartMgr() override;
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
@@ -69,6 +69,6 @@ private:
|
||||
RimAnnotationInViewCollection* annotationCollection() const;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimPolylinesAnnotation> m_rimAnnotation;
|
||||
caf::PdmPointer<RimPolylinesAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_part;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimReachCircleAnnotationInView.h"
|
||||
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
@@ -44,8 +45,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivReachCircleAnnotationPartMgr::RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotation* annotation)
|
||||
: m_rimView(view), m_rimAnnotation(annotation)
|
||||
RivReachCircleAnnotationPartMgr::RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotationInView* annotationInView)
|
||||
: m_rimView(view), m_rimAnnotationInView(annotationInView)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -62,15 +63,16 @@ RivReachCircleAnnotationPartMgr::~RivReachCircleAnnotationPartMgr()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset)
|
||||
{
|
||||
auto rimAnnotation = m_rimAnnotationInView->sourceAnnotation();
|
||||
clearAllGeometry();
|
||||
|
||||
cvf::ref<RivReachCircleAnnotationSourceInfo> sourceInfo = new RivReachCircleAnnotationSourceInfo(m_rimAnnotation);
|
||||
cvf::ref<RivReachCircleAnnotationSourceInfo> sourceInfo = new RivReachCircleAnnotationSourceInfo(rimAnnotation);
|
||||
|
||||
Vec3d centerPositionInDomain = m_rimAnnotation->centerPoint();
|
||||
Vec3d centerPositionInDomain = rimAnnotation->centerPoint();
|
||||
|
||||
auto lineColor = m_rimAnnotation->appearance()->color();
|
||||
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
|
||||
auto lineThickness = m_rimAnnotation->appearance()->thickness();
|
||||
auto lineColor = rimAnnotation->appearance()->color();
|
||||
auto isDashedLine = rimAnnotation->appearance()->isDashed();
|
||||
auto lineThickness = rimAnnotation->appearance()->thickness();
|
||||
|
||||
// Circle part
|
||||
auto* collection = annotationCollection();
|
||||
@@ -98,7 +100,7 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
|
||||
|
||||
// Center point part
|
||||
{
|
||||
auto centerPos = m_rimAnnotation->centerPoint();
|
||||
auto centerPos = rimAnnotation->centerPoint();
|
||||
double symbolSize = 20;
|
||||
double xMin = centerPos.x() - symbolSize / 2.0;
|
||||
double xMax = xMin + symbolSize;
|
||||
@@ -141,13 +143,13 @@ void RivReachCircleAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::Mod
|
||||
const caf::DisplayCoordTransform* displayXf,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
if (m_rimAnnotation.isNull()) return;
|
||||
if (!m_rimAnnotation->isActive()) return;
|
||||
if (m_rimAnnotationInView.isNull() || !m_rimAnnotationInView->sourceAnnotation()) return;
|
||||
if (!m_rimAnnotationInView->isVisible()) return;
|
||||
|
||||
// Check bounding box
|
||||
if (!isCircleInBoundingBox(boundingBox)) return;
|
||||
|
||||
if (!validateAnnotation(m_rimAnnotation)) return;
|
||||
if (!validateAnnotation(m_rimAnnotationInView->sourceAnnotation())) return;
|
||||
|
||||
buildParts(displayXf, false, 0.0);
|
||||
model->addPart(m_circlePart.p());
|
||||
@@ -159,7 +161,8 @@ void RivReachCircleAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::Mod
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivReachCircleAnnotationPartMgr::validateAnnotation(const RimReachCircleAnnotation* annotation) const
|
||||
{
|
||||
return m_rimAnnotation->centerPoint() != cvf::Vec3d::ZERO && m_rimAnnotation->radius() > 0.0;
|
||||
auto a = m_rimAnnotationInView->sourceAnnotation();
|
||||
return a->centerPoint() != cvf::Vec3d::ZERO && a->radius() > 0.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -185,8 +188,8 @@ bool RivReachCircleAnnotationPartMgr::isCircleInBoundingBox(const cvf::BoundingB
|
||||
std::vector<cvf::Vec3d> RivReachCircleAnnotationPartMgr::computeCirclePointsInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
int numPoints = 36;
|
||||
auto centerPos = m_rimAnnotation->centerPoint();
|
||||
auto radius = m_rimAnnotation->radius();
|
||||
auto centerPos = m_rimAnnotationInView->sourceAnnotation()->centerPoint();
|
||||
auto radius = m_rimAnnotationInView->sourceAnnotation()->radius();
|
||||
|
||||
if (snapToPlaneZ)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace caf
|
||||
|
||||
class Rim3dView;
|
||||
class RimReachCircleAnnotation;
|
||||
class RimReachCircleAnnotationInView;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
class RivReachCircleAnnotationPartMgr : public cvf::Object
|
||||
@@ -49,7 +50,7 @@ class RivReachCircleAnnotationPartMgr : public cvf::Object
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
public:
|
||||
RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotation* annotation);
|
||||
RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotationInView* annotationInView);
|
||||
~RivReachCircleAnnotationPartMgr() override;
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
@@ -70,7 +71,7 @@ private:
|
||||
RimAnnotationInViewCollection* annotationCollection() const;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimReachCircleAnnotation> m_rimAnnotation;
|
||||
caf::PdmPointer<RimReachCircleAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_circlePart;
|
||||
cvf::ref<cvf::Part> m_centerPointPart;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
@@ -48,8 +49,18 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotation)
|
||||
: m_rimView(view), m_rimAnnotation(annotation)
|
||||
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotationLocal)
|
||||
: m_rimView(view), m_rimAnnotationLocal(annotationLocal), m_rimAnnotationInView(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotationInView* annotationInView)
|
||||
: m_rimView(view)
|
||||
, m_rimAnnotationLocal(nullptr)
|
||||
, m_rimAnnotationInView(annotationInView)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -70,7 +81,7 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
{
|
||||
clearAllGeometry();
|
||||
|
||||
cvf::ref<RivTextAnnotationSourceInfo> sourceInfo = new RivTextAnnotationSourceInfo(m_rimAnnotation);
|
||||
cvf::ref<RivTextAnnotationSourceInfo> sourceInfo = new RivTextAnnotationSourceInfo(rimAnnotation());
|
||||
|
||||
auto collection = annotationCollection();
|
||||
if (!collection) return;
|
||||
@@ -80,7 +91,7 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
|
||||
cvf::Vec3d anchorPosition = displayXf->transformToDisplayCoord(anchorPositionInDomain);
|
||||
cvf::Vec3d labelPosition = displayXf->transformToDisplayCoord(labelPositionInDomain);
|
||||
QString text = m_rimAnnotation->text();
|
||||
QString text = rimAnnotation()->text();
|
||||
|
||||
// Line part
|
||||
{
|
||||
@@ -141,7 +152,7 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::Vec3d RivTextAnnotationPartMgr::getAnchorPointInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
auto pt = m_rimAnnotation->anchorPoint();
|
||||
auto pt = rimAnnotation()->anchorPoint();
|
||||
|
||||
if (snapToPlaneZ)
|
||||
{
|
||||
@@ -155,7 +166,7 @@ RivTextAnnotationPartMgr::Vec3d RivTextAnnotationPartMgr::getAnchorPointInDomain
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::Vec3d RivTextAnnotationPartMgr::getLabelPointInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
auto pt = m_rimAnnotation->labelPoint();
|
||||
auto pt = rimAnnotation()->labelPoint();
|
||||
|
||||
if (snapToPlaneZ)
|
||||
{
|
||||
@@ -194,13 +205,12 @@ void RivTextAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
|
||||
const caf::DisplayCoordTransform * displayXf,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
if (m_rimAnnotation.isNull()) return;
|
||||
if (!m_rimAnnotation->isActive()) return;
|
||||
if (!rimAnnotation() || !isAnnotationVisible()) return;
|
||||
|
||||
// Check bounding box
|
||||
if (!isTextInBoundingBox(boundingBox)) return;
|
||||
|
||||
if (!validateAnnotation(m_rimAnnotation)) return;
|
||||
if (!validateAnnotation(rimAnnotation())) return;
|
||||
|
||||
buildParts(displayXf, false, 0.0);
|
||||
model->addPart(m_linePart.p());
|
||||
@@ -212,7 +222,7 @@ void RivTextAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTextAnnotationPartMgr::validateAnnotation(const RimTextAnnotation* annotation) const
|
||||
{
|
||||
return m_rimAnnotation->anchorPoint() != cvf::Vec3d::ZERO && !m_rimAnnotation->text().isEmpty();
|
||||
return rimAnnotation()->anchorPoint() != cvf::Vec3d::ZERO && !rimAnnotation()->text().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -224,3 +234,23 @@ RimAnnotationInViewCollection* RivTextAnnotationPartMgr::annotationCollection()
|
||||
m_rimView->descendantsIncludingThisOfType(colls);
|
||||
return !colls.empty() ? colls.front() : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotation* RivTextAnnotationPartMgr::rimAnnotation() const
|
||||
{
|
||||
return m_rimAnnotationLocal ? m_rimAnnotationLocal : m_rimAnnotationInView->sourceAnnotation();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTextAnnotationPartMgr::isAnnotationVisible() const
|
||||
{
|
||||
if (m_rimAnnotationLocal)
|
||||
return m_rimAnnotationLocal->isVisible();
|
||||
if(m_rimAnnotationInView)
|
||||
return m_rimAnnotationInView->isVisible();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -41,15 +41,15 @@ namespace caf
|
||||
class Rim3dView;
|
||||
class RimAnnotationInViewCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimSimWellInView;
|
||||
class RimSimWellInViewCollection;
|
||||
class RimTextAnnotationInView;
|
||||
|
||||
class RivTextAnnotationPartMgr : public cvf::Object
|
||||
{
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
public:
|
||||
RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotation);
|
||||
RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotationLocal);
|
||||
RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotationInView* annotationInView);
|
||||
~RivTextAnnotationPartMgr() override;
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
@@ -71,8 +71,12 @@ private:
|
||||
|
||||
RimAnnotationInViewCollection* annotationCollection() const;
|
||||
|
||||
RimTextAnnotation* rimAnnotation() const;
|
||||
bool isAnnotationVisible() const;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimTextAnnotation> m_rimAnnotation;
|
||||
caf::PdmPointer<RimTextAnnotation> m_rimAnnotationLocal;
|
||||
caf::PdmPointer<RimTextAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_linePart;
|
||||
cvf::ref< cvf::Part > m_labelPart;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
void updateViewAnnotationCollections() override;
|
||||
void onAnnotationDeleted() override;
|
||||
|
||||
// Used by sync code
|
||||
std::vector<caf::PdmObject*> allPdmAnnotations() const;
|
||||
|
||||
private:
|
||||
void reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload);
|
||||
|
||||
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
|
||||
caf::PdmChildArrayField<RimUserDefinedPolylinesAnnotation*> m_userDefinedPolylineAnnotations;
|
||||
caf::PdmChildArrayField<RimPolylinesFromFileAnnotation*> m_polylineFromFileAnnotations;
|
||||
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