mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Remove old polygon annotations. (#11404)
* Remove old polygon annotations from GUI. * Upgrade old annotation objects to new polygon objects on load.
This commit is contained in:
parent
4617bcc673
commit
2e4ca390c7
@ -720,8 +720,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
||||
sumCaseGroup->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
oilField->annotationCollection()->loadDataAndUpdate();
|
||||
|
||||
for ( auto well : oilField->wellPathCollection()->allWellPaths() )
|
||||
{
|
||||
for ( auto stimPlan : well->stimPlanModelCollection()->allStimPlanModels() )
|
||||
|
@ -1,18 +1,14 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationIn3dViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationIn3dViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.cpp
|
||||
)
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicCreateUserDefinedPolylinesAnnotationFeature.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled() const
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
return selObjs.size() == 1 || ( selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::USED_DEFINED_POLYLINE_ANNOTATION_UI_NAME );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f( coll->lineBasedAnnotationsCount() );
|
||||
newAnnotation->appearance()->setColor( newColor );
|
||||
newAnnotation->appearance()->setSphereColor( newColor );
|
||||
newAnnotation->enablePicking( true );
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/Plus.png" ) );
|
||||
actionToSetup->setText( "Create User Defined Polyline Annotation" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RimProject::current();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimAnnotationCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateUserDefinedPolylinesAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimAnnotationCollection* annotationCollection() const;
|
||||
};
|
@ -1,100 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicImportPolylinesAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuFileDialogTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportPolylinesAnnotationFeature, "RicImportPolylinesAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportPolylinesAnnotationFeature::isCommandEnabled() const
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
return selObjs.size() == 1 || ( selGroupColl.size() == 1 && selGroupColl.front()->uiCapability()->uiName() ==
|
||||
RimAnnotationGroupCollection::POLYLINE_FROM_FILE_ANNOTATION_UI_NAME );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportPolylinesAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "BINARY_GRID" );
|
||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Poly Lines Annotation",
|
||||
defaultDir,
|
||||
"Text Files (*.txt);;Polylines (*.dat);;All Files (*.*)" );
|
||||
|
||||
if ( fileNames.isEmpty() ) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( fileNames.last() ).absolutePath() );
|
||||
|
||||
// Find or create the AnnotationsCollection
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection();
|
||||
|
||||
if ( !annotColl )
|
||||
{
|
||||
annotColl = new RimAnnotationCollection;
|
||||
proj->activeOilField()->annotationCollection = annotColl;
|
||||
}
|
||||
|
||||
// For each file,
|
||||
|
||||
RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile( fileNames );
|
||||
|
||||
proj->activeOilField()->updateConnectedEditors();
|
||||
|
||||
if ( lastCreatedOrUpdated )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||
}
|
||||
|
||||
annotColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportPolylinesAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
|
||||
actionToSetup->setText( "Import Poly Lines Annotation" );
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportPolylinesAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -1,78 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil 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 "RicCreateUserDefinedPolylinesAnnotationFeature.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
return selObjs.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/Plus.png" ) );
|
||||
actionToSetup->setText( "Create User Defined Polyline Annotation" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RimProject::current();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
@ -24,10 +24,6 @@
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
|
||||
#include "RivPolylinePartMgr.h"
|
||||
#include "RivReachCircleAnnotationPartMgr.h"
|
||||
#include "RivTextAnnotationPartMgr.h"
|
||||
|
||||
@ -65,10 +61,6 @@ void RivAnnotationsPartMgr::appendGeometryPartsToModel( cvf::ModelBasicList*
|
||||
{
|
||||
partMgr->appendDynamicGeometryPartsToModel( model, displayCoordTransform, boundingBox );
|
||||
}
|
||||
for ( auto& partMgr : m_polylineAnnotationPartMgrs )
|
||||
{
|
||||
partMgr->appendDynamicGeometryPartsToModel( model, displayCoordTransform, boundingBox );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -81,11 +73,9 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
|
||||
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();
|
||||
auto localTextAnnotations = coll->textAnnotations();
|
||||
auto textAnnotations = coll->globalTextAnnotations();
|
||||
auto reachCircleAnnotations = coll->globalReachCircleAnnotations();
|
||||
|
||||
clearGeometryCache();
|
||||
|
||||
@ -110,19 +100,6 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
|
||||
m_reachCircleAnnotationPartMgrs.push_back( apm );
|
||||
}
|
||||
}
|
||||
if ( m_polylineAnnotationPartMgrs.size() != userDefinedPolylineAnnotations.size() + polylineFromFileAnnotations.size() )
|
||||
{
|
||||
for ( auto annotation : userDefinedPolylineAnnotations )
|
||||
{
|
||||
auto* apm = new RivPolylinePartMgr( m_rimView, annotation, coll );
|
||||
m_polylineAnnotationPartMgrs.push_back( apm );
|
||||
}
|
||||
for ( auto annotation : polylineFromFileAnnotations )
|
||||
{
|
||||
auto* apm = new RivPolylinePartMgr( m_rimView, annotation, coll );
|
||||
m_polylineAnnotationPartMgrs.push_back( apm );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -132,5 +109,4 @@ void RivAnnotationsPartMgr::clearGeometryCache()
|
||||
{
|
||||
m_textAnnotationPartMgrs.clear();
|
||||
m_reachCircleAnnotationPartMgrs.clear();
|
||||
m_polylineAnnotationPartMgrs.clear();
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ class DisplayCoordTransform;
|
||||
class Rim3dView;
|
||||
class RivTextAnnotationPartMgr;
|
||||
class RivReachCircleAnnotationPartMgr;
|
||||
class RivPolylinePartMgr;
|
||||
|
||||
class RivAnnotationsPartMgr : public cvf::Object
|
||||
{
|
||||
@ -60,5 +59,4 @@ private:
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
cvf::Collection<RivTextAnnotationPartMgr> m_textAnnotationPartMgrs;
|
||||
cvf::Collection<RivReachCircleAnnotationPartMgr> m_reachCircleAnnotationPartMgrs;
|
||||
cvf::Collection<RivPolylinePartMgr> m_polylineAnnotationPartMgrs;
|
||||
};
|
||||
|
@ -9,9 +9,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationTextAppearance.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
|
||||
@ -29,9 +26,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationTextAppearance.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
|
||||
|
@ -22,15 +22,20 @@
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "Polygons/RimPolygon.h"
|
||||
#include "Polygons/RimPolygonCollection.h"
|
||||
#include "Polygons/RimPolygonFile.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
@ -44,20 +49,22 @@ RimAnnotationCollection::RimAnnotationCollection()
|
||||
CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png" );
|
||||
|
||||
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 = new RimAnnotationGroupCollection();
|
||||
m_userDefinedPolylineAnnotations = new RimAnnotationGroupCollection();
|
||||
m_polylineFromFileAnnotations = new RimAnnotationGroupCollection();
|
||||
|
||||
m_reachCircleAnnotations = new RimAnnotationGroupCollection();
|
||||
m_reachCircleAnnotations->uiCapability()->setUiName( RimAnnotationGroupCollection::REACH_CIRCLE_ANNOTATION_UI_NAME );
|
||||
m_userDefinedPolylineAnnotations->uiCapability()->setUiName( RimAnnotationGroupCollection::USED_DEFINED_POLYLINE_ANNOTATION_UI_NAME );
|
||||
m_polylineFromFileAnnotations->uiCapability()->setUiName( RimAnnotationGroupCollection::POLYLINE_FROM_FILE_ANNOTATION_UI_NAME );
|
||||
|
||||
m_reachCircleAnnotations->uiCapability()->setUiIconFromResourceString( ":/ReachCircle16x16.png" );
|
||||
m_userDefinedPolylineAnnotations->uiCapability()->setUiIconFromResourceString( ":/PolylinesFromFile16x16.png" );
|
||||
m_polylineFromFileAnnotations->uiCapability()->setUiIconFromResourceString( ":/PolylinesFromFile16x16.png" );
|
||||
|
||||
// obsolete things
|
||||
CAF_PDM_InitFieldNoDefault( &m_userDefinedPolylineAnnotations_OBSOLETE,
|
||||
"UserDefinedPolylineAnnotations",
|
||||
"User Defined Polyline Annotations" );
|
||||
m_userDefinedPolylineAnnotations_OBSOLETE = new RimAnnotationGroupCollection();
|
||||
m_userDefinedPolylineAnnotations_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
m_userDefinedPolylineAnnotations_OBSOLETE->uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_polylineFromFileAnnotations_OBSOLETE, "PolylineFromFileAnnotations", "Polylines From File" );
|
||||
m_polylineFromFileAnnotations_OBSOLETE = new RimAnnotationGroupCollection();
|
||||
m_polylineFromFileAnnotations_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
m_polylineFromFileAnnotations_OBSOLETE->uiCapability()->setUiTreeHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -67,6 +74,53 @@ RimAnnotationCollection::~RimAnnotationCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::initAfterRead()
|
||||
{
|
||||
auto polycoll = RimProject::current()->activeOilField()->polygonCollection();
|
||||
|
||||
for ( auto oldPolyObj : m_userDefinedPolylineAnnotations_OBSOLETE->annotations() )
|
||||
{
|
||||
auto oldPoly = dynamic_cast<RimUserDefinedPolylinesAnnotation*>( oldPolyObj );
|
||||
if ( oldPoly == nullptr ) continue;
|
||||
|
||||
RimPolygon* newPoly = new RimPolygon();
|
||||
newPoly->setName( oldPoly->uiName() );
|
||||
newPoly->setIsClosed( oldPoly->closePolyline() );
|
||||
|
||||
std::vector<cvf::Vec3d> points;
|
||||
|
||||
for ( auto target : oldPoly->activeTargets() )
|
||||
{
|
||||
points.push_back( target->targetPointXYZ() );
|
||||
}
|
||||
|
||||
newPoly->setPointsInDomainCoords( points );
|
||||
newPoly->setColor( oldPoly->appearance()->color() );
|
||||
|
||||
polycoll->addUserDefinedPolygon( newPoly );
|
||||
}
|
||||
|
||||
for ( auto oldPolyObj : m_polylineFromFileAnnotations_OBSOLETE->annotations() )
|
||||
{
|
||||
auto oldPoly = dynamic_cast<RimPolylinesFromFileAnnotation*>( oldPolyObj );
|
||||
if ( oldPoly == nullptr ) continue;
|
||||
|
||||
RimPolygonFile* newPoly = new RimPolygonFile();
|
||||
newPoly->setName( oldPoly->uiName() );
|
||||
|
||||
QString fileName = RimProject::current()->updatedFilePathFromPathId( oldPoly->fileName() );
|
||||
newPoly->setFileName( fileName );
|
||||
|
||||
polycoll->addPolygonFile( newPoly );
|
||||
}
|
||||
|
||||
m_userDefinedPolylineAnnotations_OBSOLETE.children().clear();
|
||||
m_polylineFromFileAnnotations_OBSOLETE.children().clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -76,24 +130,6 @@ void RimAnnotationCollection::addAnnotation( RimReachCircleAnnotation* annotatio
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation( RimUserDefinedPolylinesAnnotation* annotation )
|
||||
{
|
||||
m_userDefinedPolylineAnnotations->addAnnotation( annotation );
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation( RimPolylinesFromFileAnnotation* annotation )
|
||||
{
|
||||
m_polylineFromFileAnnotations->addAnnotation( annotation );
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -107,94 +143,12 @@ std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnot
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> RimAnnotationCollection::userDefinedPolylineAnnotations() const
|
||||
{
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> annotations;
|
||||
for ( auto& a : m_userDefinedPolylineAnnotations->annotations() )
|
||||
{
|
||||
annotations.push_back( dynamic_cast<RimUserDefinedPolylinesAnnotation*>( a ) );
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylinesFromFileAnnotation*> RimAnnotationCollection::polylinesFromFileAnnotations() const
|
||||
{
|
||||
std::vector<RimPolylinesFromFileAnnotation*> annotations;
|
||||
for ( auto& a : m_polylineFromFileAnnotations->annotations() )
|
||||
{
|
||||
annotations.push_back( dynamic_cast<RimPolylinesFromFileAnnotation*>( a ) );
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylinesFromFile( const QStringList& fileNames )
|
||||
{
|
||||
QStringList newFileNames;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polyLinesObjsToReload;
|
||||
|
||||
for ( const QString& newFileName : fileNames )
|
||||
{
|
||||
bool isFound = false;
|
||||
for ( RimPolylinesFromFileAnnotation* polyLinesAnnot : polylinesFromFileAnnotations() )
|
||||
{
|
||||
if ( polyLinesAnnot->fileName() == newFileName )
|
||||
{
|
||||
polyLinesObjsToReload.push_back( polyLinesAnnot );
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isFound )
|
||||
{
|
||||
newFileNames.push_back( newFileName );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const QString& newFileName : newFileNames )
|
||||
{
|
||||
RimPolylinesFromFileAnnotation* newPolyLinesAnnot = new RimPolylinesFromFileAnnotation;
|
||||
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f( lineBasedAnnotationsCount() );
|
||||
|
||||
newPolyLinesAnnot->setFileName( newFileName );
|
||||
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||
newPolyLinesAnnot->appearance()->setColor( newColor );
|
||||
|
||||
m_polylineFromFileAnnotations->addAnnotation( newPolyLinesAnnot );
|
||||
polyLinesObjsToReload.push_back( newPolyLinesAnnot );
|
||||
}
|
||||
|
||||
updateViewAnnotationCollections();
|
||||
|
||||
reloadPolylinesFromFile( polyLinesObjsToReload );
|
||||
|
||||
if ( !newFileNames.empty() )
|
||||
{
|
||||
return polylinesFromFileAnnotations().back();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimAnnotationCollection::lineBasedAnnotationsCount() const
|
||||
{
|
||||
return m_reachCircleAnnotations->annotations().size() + m_userDefinedPolylineAnnotations->annotations().size() +
|
||||
m_polylineFromFileAnnotations->annotations().size();
|
||||
return m_reachCircleAnnotations->annotations().size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -230,43 +184,9 @@ 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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::reloadPolylinesFromFile( const std::vector<RimPolylinesFromFileAnnotation*>& polyLinesObjsToReload )
|
||||
{
|
||||
QString totalErrorMessage;
|
||||
|
||||
for ( RimPolylinesFromFileAnnotation* polyLinesAnnot : polyLinesObjsToReload )
|
||||
{
|
||||
QString errormessage;
|
||||
|
||||
polyLinesAnnot->readPolyLinesFile( &errormessage );
|
||||
if ( !errormessage.isEmpty() )
|
||||
{
|
||||
totalErrorMessage += "\nError in: " + polyLinesAnnot->fileName() + "\n\t" + errormessage;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !totalErrorMessage.isEmpty() )
|
||||
{
|
||||
RiaLogging::errorInMessageBox( nullptr, "Import Polylines", totalErrorMessage );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::loadDataAndUpdate()
|
||||
{
|
||||
reloadPolylinesFromFile( polylinesFromFileAnnotations() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,8 +30,6 @@ class QString;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimReachCircleAnnotation;
|
||||
class RimUserDefinedPolylinesAnnotation;
|
||||
class RimPolylinesFromFileAnnotation;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
@ -46,17 +44,9 @@ public:
|
||||
RimAnnotationCollection();
|
||||
~RimAnnotationCollection() override;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void addAnnotation( RimReachCircleAnnotation* annotation );
|
||||
void addAnnotation( RimUserDefinedPolylinesAnnotation* annotation );
|
||||
void addAnnotation( RimPolylinesFromFileAnnotation* annotation );
|
||||
|
||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> userDefinedPolylineAnnotations() const;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
|
||||
|
||||
RimPolylinesFromFileAnnotation* importOrUpdatePolylinesFromFile( const QStringList& fileNames );
|
||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||
|
||||
size_t lineBasedAnnotationsCount() const;
|
||||
|
||||
@ -68,10 +58,12 @@ public:
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
private:
|
||||
void reloadPolylinesFromFile( const std::vector<RimPolylinesFromFileAnnotation*>& polyLinesObjsToReload );
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_reachCircleAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_userDefinedPolylineAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_polylineFromFileAnnotations;
|
||||
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_userDefinedPolylineAnnotations_OBSOLETE;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_polylineFromFileAnnotations_OBSOLETE;
|
||||
};
|
||||
|
@ -26,14 +26,12 @@
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimReachCircleAnnotationInView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
|
||||
#include <cvfBoundingBox.h>
|
||||
|
||||
@ -56,18 +54,6 @@ caf::PdmObject* sourcePdmAnnotation( const caf::PdmObject* annotationInView )
|
||||
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;
|
||||
}
|
||||
|
||||
@ -88,29 +74,16 @@ RimAnnotationInViewCollection::RimAnnotationInViewCollection()
|
||||
|
||||
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" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_annotationFontSize, "AnnotationFontSize", "Default Font Size" );
|
||||
|
||||
m_globalTextAnnotations = new RimAnnotationGroupCollection();
|
||||
m_globalReachCircleAnnotations = new RimAnnotationGroupCollection();
|
||||
m_globalUserDefinedPolylineAnnotations = new RimAnnotationGroupCollection();
|
||||
m_globalPolylineFromFileAnnotations = new RimAnnotationGroupCollection();
|
||||
m_globalTextAnnotations = new RimAnnotationGroupCollection();
|
||||
m_globalReachCircleAnnotations = new RimAnnotationGroupCollection();
|
||||
|
||||
m_globalTextAnnotations->uiCapability()->setUiName( "Global Text Annotations" );
|
||||
m_globalReachCircleAnnotations->uiCapability()->setUiName( "Global Reach Circle Annotations" );
|
||||
m_globalUserDefinedPolylineAnnotations->uiCapability()->setUiName( "Global User Defined Polylines Annotations" );
|
||||
m_globalPolylineFromFileAnnotations->uiCapability()->setUiName( "Global Polylines From File Annotations" );
|
||||
|
||||
m_globalTextAnnotations->uiCapability()->setUiIconFromResourceString( ":/TextAnnotation16x16.png" );
|
||||
m_globalReachCircleAnnotations->uiCapability()->setUiIconFromResourceString( ":/ReachCircle16x16.png" );
|
||||
m_globalUserDefinedPolylineAnnotations->uiCapability()->setUiIconFromResourceString( ":/PolylinesFromFile16x16.png" );
|
||||
m_globalPolylineFromFileAnnotations->uiCapability()->setUiIconFromResourceString( ":/PolylinesFromFile16x16.png" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -162,32 +135,6 @@ std::vector<RimReachCircleAnnotationInView*> RimAnnotationInViewCollection::glob
|
||||
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
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -305,10 +252,6 @@ std::vector<caf::PdmObject*> RimAnnotationInViewCollection::allGlobalPdmAnnotati
|
||||
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;
|
||||
}
|
||||
|
||||
@ -330,20 +273,6 @@ void RimAnnotationInViewCollection::addGlobalAnnotation( caf::PdmObject* annotat
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -368,24 +297,6 @@ void RimAnnotationInViewCollection::deleteGlobalAnnotation( const caf::PdmObject
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -52,10 +52,8 @@ public:
|
||||
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;
|
||||
std::vector<RimTextAnnotationInView*> globalTextAnnotations() const;
|
||||
std::vector<RimReachCircleAnnotationInView*> globalReachCircleAnnotations() const;
|
||||
|
||||
void onGlobalCollectionChanged( const RimAnnotationCollection* globalCollection );
|
||||
|
||||
@ -80,6 +78,4 @@ private:
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_annotationFontSize;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalTextAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalReachCircleAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalUserDefinedPolylineAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalPolylineFromFileAnnotations;
|
||||
};
|
||||
|
@ -1,138 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimAnnotationCollectionBase.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RigPolyLinesData.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.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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotation* RimPolylinesAnnotationInView::sourceAnnotation() const
|
||||
{
|
||||
return m_sourceAnnotation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotationInView::isVisible() const
|
||||
{
|
||||
auto coll = firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
|
||||
|
||||
bool visible = true;
|
||||
if ( coll ) visible = coll->isVisible();
|
||||
if ( visible && m_sourceAnnotation )
|
||||
{
|
||||
visible = m_sourceAnnotation->isVisible();
|
||||
|
||||
if ( visible )
|
||||
{
|
||||
auto globalColl = m_sourceAnnotation->firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
|
||||
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 )
|
||||
{
|
||||
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
|
||||
if ( coll ) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPolylinesAnnotationInView::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPolylinesAnnotationInView::userDescriptionField()
|
||||
{
|
||||
return m_sourceAnnotation ? m_sourceAnnotation->userDescriptionField() : nullptr;
|
||||
}
|
||||
|
||||
cvf::ref<RigPolyLinesData> RimPolylinesAnnotationInView::polyLinesData() const
|
||||
{
|
||||
auto retval = m_sourceAnnotation->polyLinesData();
|
||||
if ( !isVisible() )
|
||||
{
|
||||
retval->setVisibility( false, false );
|
||||
}
|
||||
|
||||
auto coll = firstAncestorOrThisOfType<RimAnnotationInViewCollection>();
|
||||
if ( coll )
|
||||
{
|
||||
retval->setZPlaneLock( coll->snapAnnotations(), coll->annotationPlaneZ() );
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPolylinesDataInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class QString;
|
||||
class RimGridView;
|
||||
class RimPolylinesAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylinesAnnotationInView : public caf::PdmObject, public RimPolylinesDataInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPolylinesAnnotationInView();
|
||||
RimPolylinesAnnotationInView( RimPolylinesAnnotation* sourceAnnotation );
|
||||
~RimPolylinesAnnotationInView() override {}
|
||||
|
||||
bool isActive() const;
|
||||
RimPolylinesAnnotation* sourceAnnotation() const;
|
||||
|
||||
bool isVisible() const;
|
||||
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmPtrField<RimPolylinesAnnotation*> m_sourceAnnotation;
|
||||
};
|
@ -1,39 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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" );
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmFieldCvfColor.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 {}
|
||||
};
|
@ -1,39 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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" );
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmFieldCvfColor.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 {}
|
||||
};
|
@ -87,7 +87,7 @@ void RimPolygonFile::loadData()
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::info( QString( "Imported %1 polygons from file: " ).arg( polygonsFromFile.size() ) + m_fileName().path() );
|
||||
RiaLogging::info( QString( "Imported %1 polygon(s) from file: " ).arg( polygonsFromFile.size() ) + m_fileName().path() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1083,8 +1083,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicCreateTextAnnotationFeature";
|
||||
menuBuilder << "RicCreateReachCircleAnnotationFeature";
|
||||
menuBuilder << "RicCreateUserDefinedPolylinesAnnotationFeature";
|
||||
menuBuilder << "RicImportPolylinesAnnotationFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimAnnotationInViewCollection*>( firstUiItem ) )
|
||||
{
|
||||
|
@ -1207,28 +1207,6 @@ std::vector<RimReachCircleAnnotation*> RimProject::reachCircleAnnotations() cons
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylinesAnnotation*> RimProject::polylineAnnotations() const
|
||||
{
|
||||
std::vector<RimPolylinesAnnotation*> annotations;
|
||||
for ( const auto& oilField : oilFields() )
|
||||
{
|
||||
auto annotationColl = oilField->annotationCollection();
|
||||
for ( const auto& annotation : annotationColl->userDefinedPolylineAnnotations() )
|
||||
{
|
||||
annotations.push_back( annotation );
|
||||
}
|
||||
|
||||
for ( const auto& annotation : annotationColl->polylinesFromFileAnnotations() )
|
||||
{
|
||||
annotations.push_back( annotation );
|
||||
}
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1593,6 +1571,36 @@ void RimProject::transferPathsToGlobalPathList()
|
||||
m_globalPathList = variableMapper.variableTableAsText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimProject::updatedFilePathFromPathId( QString filePath, RiaVariableMapper* pathListMapper /*=nullptr*/ ) const
|
||||
{
|
||||
std::unique_ptr<RiaVariableMapper> internalMapper;
|
||||
|
||||
if ( pathListMapper == nullptr )
|
||||
{
|
||||
internalMapper.reset( new RiaVariableMapper( m_globalPathList ) );
|
||||
pathListMapper = internalMapper.get();
|
||||
}
|
||||
|
||||
QString returnValue = filePath;
|
||||
QString pathIdCandidate = filePath.trimmed();
|
||||
QStringList pathIdComponents = pathIdCandidate.split( RiaVariableMapper::variableToken() );
|
||||
|
||||
if ( pathIdComponents.size() == 3 && pathIdComponents[0].size() == 0 && pathIdComponents[1].size() > 0 && pathIdComponents[2].size() == 0 )
|
||||
{
|
||||
bool isFound = false;
|
||||
QString path = pathListMapper->valueForVariable( pathIdCandidate, &isFound );
|
||||
if ( isFound )
|
||||
{
|
||||
returnValue = path;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1602,19 +1610,7 @@ void RimProject::distributePathsFromGlobalPathList()
|
||||
|
||||
for ( caf::FilePath* filePath : allFilePaths() )
|
||||
{
|
||||
QString pathIdCandidate = filePath->path().trimmed();
|
||||
QStringList pathIdComponents = pathIdCandidate.split( RiaVariableMapper::variableToken() );
|
||||
|
||||
if ( pathIdComponents.size() == 3 && pathIdComponents[0].size() == 0 && pathIdComponents[1].size() > 0 &&
|
||||
pathIdComponents[2].size() == 0 )
|
||||
{
|
||||
bool isFound = false;
|
||||
QString path = pathListMapper.valueForVariable( pathIdCandidate, &isFound );
|
||||
if ( isFound )
|
||||
{
|
||||
filePath->setPath( path );
|
||||
}
|
||||
}
|
||||
filePath->setPath( updatedFilePathFromPathId( filePath->path(), &pathListMapper ) );
|
||||
}
|
||||
|
||||
for ( auto summaryCase : allSummaryCases() )
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RiaVariableMapper;
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RigGridManager;
|
||||
class RigMainGrid;
|
||||
@ -177,7 +179,6 @@ public:
|
||||
std::vector<RimWellPath*> allWellPaths() const;
|
||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
|
||||
|
||||
std::vector<RimGeoMechCase*> geoMechCases() const;
|
||||
|
||||
@ -193,6 +194,7 @@ public:
|
||||
RimPlotTemplateFolderItem* rootPlotTemplateItem() const;
|
||||
|
||||
std::vector<caf::FilePath*> allFilePaths() const;
|
||||
QString updatedFilePathFromPathId( QString filePath, RiaVariableMapper* pathListMapper = nullptr ) const;
|
||||
|
||||
protected:
|
||||
void beforeInitAfterRead() override;
|
||||
|
Loading…
Reference in New Issue
Block a user