#3778 Annotations. Move z plane settings to in-view collection

This commit is contained in:
Bjørn Erik Jensen
2018-11-29 10:13:19 +01:00
parent b5f0459843
commit 9dc1e8d063
12 changed files with 81 additions and 139 deletions

View File

@@ -24,41 +24,12 @@
#include "RiaApplication.h"
#include "RigActiveCellInfo.h"
#include "RigCell.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigSimWellData.h"
#include "RimTextAnnotation.h"
#include "RimReachCircleAnnotation.h"
#include "RimPolylinesAnnotation.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "Rim3dView.h"
#include "RimProject.h"
#include "RimSimWellInViewCollection.h"
#include "RimSimWellInView.h"
#include "RivTextAnnotationPartMgr.h"
#include "RivReachCircleAnnotationPartMgr.h"
#include "RivPolylineAnnotationPartMgr.h"
#include "RivPipeGeometryGenerator.h"
#include "RivPartPriority.h"
#include "RivSimWellPipeSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cvfArrowGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
#include "RivSectionFlattner.h"
//--------------------------------------------------------------------------------------------------
@@ -115,7 +86,7 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
{
for (auto annotation : textAnnotations)
{
auto* apm = new RivTextAnnotationPartMgr(annotation);
auto* apm = new RivTextAnnotationPartMgr(m_rimView, annotation);
m_textAnnotationPartMgrs.push_back(apm);
//m_mapFromViewToIndex[wellPath] = wppm;
}
@@ -124,7 +95,7 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
{
for (auto annotation : reachCircleAnnotations)
{
auto* apm = new RivReachCircleAnnotationPartMgr(annotation);
auto* apm = new RivReachCircleAnnotationPartMgr(m_rimView, annotation);
m_reachCircleAnnotationPartMgrs.push_back(apm);
// m_mapFromViewToIndex[wellPath] = wppm;
}
@@ -133,7 +104,7 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
{
for (auto annotation : polylineAnnotations)
{
auto* apm = new RivPolylineAnnotationPartMgr(annotation);
auto* apm = new RivPolylineAnnotationPartMgr(m_rimView, annotation);
m_polylineAnnotationPartMgrs.push_back(apm);
// m_mapFromViewToIndex[wellPath] = wppm;
}

View File

@@ -52,29 +52,16 @@ public:
~RivAnnotationsPartMgr() override;
void appendGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform);
//void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
// size_t frameIndex,
// const caf::DisplayCoordTransform * displayXf);
//void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
// size_t frameIndex,
// const caf::DisplayCoordTransform * displayXf,
// double xOffset);
const caf::DisplayCoordTransform* displayCoordTransform);
void clearGeometryCache();
private:
void createAnnotationPartManagers();
//void buildWellHeadParts(size_t frameIndex,
// const caf::DisplayCoordTransform * displayXf,
// bool doFlatten,
// double xOffset);
void createAnnotationPartManagers();
private:
caf::PdmPointer<Rim3dView> m_rimView;
caf::PdmPointer<Rim3dView> m_rimView;
cvf::Collection<RivTextAnnotationPartMgr> m_textAnnotationPartMgrs;
cvf::Collection<RivReachCircleAnnotationPartMgr> m_reachCircleAnnotationPartMgrs;
cvf::Collection<RivPolylineAnnotationPartMgr> m_polylineAnnotationPartMgrs;

View File

@@ -18,6 +18,7 @@
#include "RivPolylineAnnotationPartMgr.h"
#include "Rim3dView.h"
#include "RimAnnotationCollection.h"
#include "RimPolylinesAnnotation.h"
#include "RimAnnotationInViewCollection.h"
@@ -42,8 +43,8 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(RimPolylinesAnnotation* annotation)
: m_rimAnnotation(annotation)
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotation* annotation)
: m_rimView(view), m_rimAnnotation(annotation)
{
}
@@ -70,7 +71,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
auto lineThickness = m_rimAnnotation->appearance()->thickness();
auto linesInDisplayCoords = pointsInDomain->polyLines();
auto* collection = dynamic_cast<RimAnnotationCollection*>(annotationCollection());
auto* collection = annotationCollection();
for (auto& line : linesInDisplayCoords)
{
@@ -115,11 +116,11 @@ void RivPolylineAnnotationPartMgr::clearAllGeometry()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollectionBase* RivPolylineAnnotationPartMgr::annotationCollection() const
RimAnnotationInViewCollection* RivPolylineAnnotationPartMgr::annotationCollection() const
{
RimAnnotationCollectionBase* coll;
m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
std::vector<RimAnnotationInViewCollection*> colls;
m_rimView->descendantsIncludingThisOfType(colls);
return !colls.empty() ? colls.front() : nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -37,13 +37,13 @@ namespace caf
class Rim3dView;
class RimPolylinesAnnotation;
class RimAnnotationCollectionBase;
class RimAnnotationInViewCollection;
class RivPolylineAnnotationPartMgr : public cvf::Object
{
public:
RivPolylineAnnotationPartMgr( RimPolylinesAnnotation* annotation);
RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotation* annotation);
~RivPolylineAnnotationPartMgr() override;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
@@ -52,8 +52,9 @@ private:
void buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf);
void clearAllGeometry();
RimAnnotationCollectionBase* annotationCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
caf::PdmPointer<Rim3dView> m_rimView;
caf::PdmPointer<RimPolylinesAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_part;
};

View File

@@ -22,7 +22,8 @@
#include "RivReachCircleAnnotationPartMgr.h"
#include "RimAnnotationCollection.h"
#include "Rim3dView.h"
#include "RimAnnotationInViewCollection.h"
#include "RimReachCircleAnnotation.h"
#include "RivPolylineGenerator.h"
@@ -41,8 +42,8 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReachCircleAnnotationPartMgr::RivReachCircleAnnotationPartMgr(RimReachCircleAnnotation* annotation)
: m_rimAnnotation(annotation)
RivReachCircleAnnotationPartMgr::RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotation* annotation)
: m_rimView(view), m_rimAnnotation(annotation)
{
}
@@ -66,7 +67,7 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
Vec3d centerPositionInDomain = m_rimAnnotation->centerPoint();
{
auto* collection = dynamic_cast<RimAnnotationCollection*>(annotationCollection());
auto* collection = annotationCollection();
if (collection && collection->snapAnnotations())
{
centerPositionInDomain.z() = collection->annotationPlaneZ();
@@ -172,9 +173,9 @@ bool RivReachCircleAnnotationPartMgr::validateAnnotation(const RimReachCircleAnn
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollectionBase* RivReachCircleAnnotationPartMgr::annotationCollection() const
RimAnnotationInViewCollection* RivReachCircleAnnotationPartMgr::annotationCollection() const
{
RimAnnotationCollectionBase* coll;
m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
std::vector<RimAnnotationInViewCollection*> colls;
m_rimView->descendantsIncludingThisOfType(colls);
return !colls.empty() ? colls.front() : nullptr;
}

View File

@@ -39,14 +39,14 @@ namespace caf
class Rim3dView;
class RimReachCircleAnnotation;
class RimAnnotationCollectionBase;
class RimAnnotationInViewCollection;
class RivReachCircleAnnotationPartMgr : public cvf::Object
{
using Vec3d = cvf::Vec3d;
public:
RivReachCircleAnnotationPartMgr( RimReachCircleAnnotation* annotation);
RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotation* annotation);
~RivReachCircleAnnotationPartMgr() override;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayXf);
@@ -57,8 +57,9 @@ private:
void clearAllGeometry();
bool validateAnnotation(const RimReachCircleAnnotation* annotation) const;
RimAnnotationCollectionBase* annotationCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
caf::PdmPointer<Rim3dView> m_rimView;
caf::PdmPointer<RimReachCircleAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_circlePart;
cvf::ref<cvf::Part> m_centerPointPart;

View File

@@ -26,7 +26,8 @@
#include "RiaColorTools.h"
#include "RiaPreferences.h"
#include "RimAnnotationCollection.h"
#include "Rim3dView.h"
#include "RimAnnotationInViewCollection.h"
#include "RimTextAnnotation.h"
#include "RivPolylineGenerator.h"
@@ -46,8 +47,8 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(RimTextAnnotation* annotation)
: m_rimAnnotation(annotation)
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotation)
: m_rimView(view), m_rimAnnotation(annotation)
{
}
@@ -74,7 +75,7 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
cvf::Vec3d labelPositionInDomain = m_rimAnnotation->labelPoint();
{
auto* collection = dynamic_cast<RimAnnotationCollection*>(annotationCollection());
auto* collection = annotationCollection();
if (collection && collection->snapAnnotations())
{
anchorPositionInDomain.z() = collection->annotationPlaneZ();
@@ -175,9 +176,9 @@ bool RivTextAnnotationPartMgr::validateAnnotation(const RimTextAnnotation* annot
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollectionBase* RivTextAnnotationPartMgr::annotationCollection() const
RimAnnotationInViewCollection* RivTextAnnotationPartMgr::annotationCollection() const
{
RimAnnotationCollectionBase* coll;
m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
std::vector<RimAnnotationInViewCollection*> colls;
m_rimView->descendantsIncludingThisOfType(colls);
return !colls.empty() ? colls.front() : nullptr;
}

View File

@@ -36,7 +36,7 @@ namespace caf
}
class Rim3dView;
class RimAnnotationCollectionBase;
class RimAnnotationInViewCollection;
class RimTextAnnotation;
class RimSimWellInView;
class RimSimWellInViewCollection;
@@ -44,7 +44,7 @@ class RimSimWellInViewCollection;
class RivTextAnnotationPartMgr : public cvf::Object
{
public:
RivTextAnnotationPartMgr( RimTextAnnotation* annotation);
RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotation);
~RivTextAnnotationPartMgr() override;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
@@ -58,8 +58,9 @@ private:
void clearAllGeometry();
bool validateAnnotation(const RimTextAnnotation* annotation) const;
RimAnnotationCollectionBase* annotationCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
caf::PdmPointer<Rim3dView> m_rimView;
caf::PdmPointer<RimTextAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_linePart;
cvf::ref< cvf::Part > m_labelPart;