#3763 Annotations. Define annotation plane Z for global annotations

This commit is contained in:
Bjørn Erik Jensen
2018-11-28 11:58:38 +01:00
parent 0083618dd2
commit c3dd6a14a7
15 changed files with 292 additions and 145 deletions

View File

@@ -18,6 +18,7 @@
#include "RivPolylineAnnotationPartMgr.h"
#include "RimAnnotationCollection.h"
#include "RimPolylinesAnnotation.h"
#include "RimAnnotationInViewCollection.h"
#include "RivPolylineGenerator.h"
@@ -58,17 +59,22 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
if (!m_rimAnnotation->isEmpty() && m_rimAnnotation->isActive())
{
const auto& points = m_rimAnnotation->polyLinesData();
const auto& pointsInDomain = m_rimAnnotation->polyLinesData();
auto lineColor = m_rimAnnotation->appearance()->color();
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
auto lineThickness = m_rimAnnotation->appearance()->thickness();
auto linesInDisplayCoords = points->polyLines();
auto linesInDisplayCoords = pointsInDomain->polyLines();
auto* collection = dynamic_cast<RimAnnotationCollection*>(annotationCollection());
for (auto& line : linesInDisplayCoords)
{
for ( cvf::Vec3d& point : line)
{
if (collection && collection->snapAnnotations())
{
point.z() = collection->annotationPlaneZ();
}
point = displayXf->transformToDisplayCoord(point);
}
}
@@ -101,6 +107,16 @@ void RivPolylineAnnotationPartMgr::clearAllGeometry()
m_part = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollectionBase* RivPolylineAnnotationPartMgr::annotationCollection() const
{
RimAnnotationCollectionBase* coll;
m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -37,9 +37,8 @@ namespace caf
class Rim3dView;
class RimPolylinesAnnotation;
class RimAnnotationInViewCollection;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RimAnnotationCollectionBase;
class RivPolylineAnnotationPartMgr : public cvf::Object
{
@@ -54,6 +53,7 @@ private:
void buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf);
void clearAllGeometry();
RimAnnotationCollectionBase* annotationCollection() const;
caf::PdmPointer<RimPolylinesAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_part;

View File

@@ -22,6 +22,7 @@
#include "RivReachCircleAnnotationPartMgr.h"
#include "RimAnnotationCollection.h"
#include "RimReachCircleAnnotation.h"
#include "RivPolylineGenerator.h"
@@ -62,7 +63,17 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
cvf::ref<RivReachCircleAnnotationSourceInfo> sourceInfo = new RivReachCircleAnnotationSourceInfo(m_rimAnnotation);
Vec3d centerPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->centerPoint());
Vec3d centerPositionInDomain = m_rimAnnotation->centerPoint();
{
auto* collection = dynamic_cast<RimAnnotationCollection*>(annotationCollection());
if (collection && collection->snapAnnotations())
{
centerPositionInDomain.z() = collection->annotationPlaneZ();
}
}
Vec3d centerPosition = displayXf->transformToDisplayCoord(centerPositionInDomain);
double radius = m_rimAnnotation->radius();
auto lineColor = m_rimAnnotation->appearance()->color();
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
@@ -126,3 +137,13 @@ bool RivReachCircleAnnotationPartMgr::validateAnnotation(const RimReachCircleAnn
{
return m_rimAnnotation->centerPoint() != cvf::Vec3d::ZERO && m_rimAnnotation->radius() > 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollectionBase* RivReachCircleAnnotationPartMgr::annotationCollection() const
{
RimAnnotationCollectionBase* coll;
m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
}

View File

@@ -39,9 +39,7 @@ namespace caf
class Rim3dView;
class RimReachCircleAnnotation;
class RimAnnotationInViewCollection;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RimAnnotationCollectionBase;
class RivReachCircleAnnotationPartMgr : public cvf::Object
{
@@ -59,6 +57,8 @@ private:
void clearAllGeometry();
bool validateAnnotation(const RimReachCircleAnnotation* annotation) const;
RimAnnotationCollectionBase* annotationCollection() const;
caf::PdmPointer<RimReachCircleAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_circlePart;
};

View File

@@ -26,6 +26,7 @@
#include "RiaColorTools.h"
#include "RiaPreferences.h"
#include "RimAnnotationCollection.h"
#include "RimTextAnnotation.h"
#include "RivPolylineGenerator.h"
@@ -69,8 +70,20 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
cvf::ref<RivTextAnnotationSourceInfo> sourceInfo = new RivTextAnnotationSourceInfo(m_rimAnnotation);
cvf::Vec3d anchorPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->anchorPoint());
cvf::Vec3d labelPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->labelPoint());
cvf::Vec3d anchorPositionInDomain = m_rimAnnotation->anchorPoint();
cvf::Vec3d labelPositionInDomain = m_rimAnnotation->labelPoint();
{
auto* collection = dynamic_cast<RimAnnotationCollection*>(annotationCollection());
if (collection && collection->snapAnnotations())
{
anchorPositionInDomain.z() = collection->annotationPlaneZ();
labelPositionInDomain.z() = collection->annotationPlaneZ();
}
}
cvf::Vec3d anchorPosition = displayXf->transformToDisplayCoord(anchorPositionInDomain);
cvf::Vec3d labelPosition = displayXf->transformToDisplayCoord(labelPositionInDomain);
QString text = m_rimAnnotation->text();
// Line part
@@ -157,3 +170,12 @@ bool RivTextAnnotationPartMgr::validateAnnotation(const RimTextAnnotation* annot
return m_rimAnnotation->anchorPoint() != cvf::Vec3d::ZERO && !m_rimAnnotation->text().isEmpty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollectionBase* RivTextAnnotationPartMgr::annotationCollection() const
{
RimAnnotationCollectionBase* coll;
m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
}

View File

@@ -36,8 +36,8 @@ namespace caf
}
class Rim3dView;
class RimAnnotationCollectionBase;
class RimTextAnnotation;
class RimAnnotationInViewCollection;
class RimSimWellInView;
class RimSimWellInViewCollection;
@@ -58,6 +58,8 @@ private:
void clearAllGeometry();
bool validateAnnotation(const RimTextAnnotation* annotation) const;
RimAnnotationCollectionBase* annotationCollection() const;
caf::PdmPointer<RimTextAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_linePart;
cvf::ref< cvf::Part > m_labelPart;