#3788 Annotations. Mirror global annotations into view annotation collection. Not thorougly testet yet

This commit is contained in:
Bjørn Erik Jensen
2018-12-03 13:14:04 +01:00
parent 918efd3a27
commit 11e2fe29d4
33 changed files with 1605 additions and 104 deletions

View File

@@ -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;
}
}