#3758 Annotations. Add appearance settings to line based annotations

This commit is contained in:
Bjørn Erik Jensen
2018-11-27 14:27:02 +01:00
parent 8873cdb1f7
commit d8142e3c75
12 changed files with 485 additions and 12 deletions

View File

@@ -52,13 +52,16 @@ RivPolylineAnnotationPartMgr::~RivPolylineAnnotationPartMgr()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf)
void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf)
{
clearAllGeometry();
if (!m_rimAnnotation->isEmpty())
{
const auto& points = 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();
@@ -75,8 +78,10 @@ void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::Displa
//part->setName("RivAnnotationPartMgr: text " + cvfString);
part->setDrawable(drawableGeo.p());
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::RED);
cvf::ref<cvf::Effect> eff = colorEffgen.generateCachedEffect();
caf::MeshEffectGenerator effgen(lineColor);
effgen.setLineWidth(lineThickness);
if (isDashedLine) effgen.setLineStipple(true);
cvf::ref<cvf::Effect> eff = effgen.generateCachedEffect();
part->setEffect(eff.p());
part->setPriority(RivPartPriority::PartType::MeshLines);
@@ -105,7 +110,7 @@ void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelB
if (m_rimAnnotation.isNull()) return;
if (m_rimAnnotation->isEmpty()) return;
buildPolygonAnnotationParts(displayXf);
buildPolylineAnnotationParts(displayXf);
model->addPart(m_part.p());
}

View File

@@ -51,7 +51,7 @@ public:
const caf::DisplayCoordTransform * displayXf);
private:
void buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf);
void buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf);
void clearAllGeometry();

View File

@@ -64,6 +64,9 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
Vec3d centerPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->centerPoint());
double radius = m_rimAnnotation->radius();
auto lineColor = m_rimAnnotation->appearance()->color();
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
auto lineThickness = m_rimAnnotation->appearance()->thickness();
// Circle part
{
@@ -82,8 +85,10 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(drawableGeo.p());
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::RED);
cvf::ref<cvf::Effect> eff = colorEffgen.generateUnCachedEffect();
caf::MeshEffectGenerator effgen(lineColor);
effgen.setLineWidth(lineThickness);
if (isDashedLine) effgen.setLineStipple(true);
cvf::ref<cvf::Effect> eff = effgen.generateUnCachedEffect();
part->setEffect(eff.p());
part->setPriority(RivPartPriority::PartType::MeshLines);