mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 12:10:57 -06:00
Almost right
This commit is contained in:
parent
362dcb4dd1
commit
19a8aece0e
@ -45,7 +45,7 @@ bool RicNewOptionItemFeature::isCommandEnabled()
|
||||
void RicNewOptionItemFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Option Item" );
|
||||
// actionToSetup->setIcon(QIcon(":/Well.png"));
|
||||
// actionToSetup->setIcon(QIcon(":/Well.svg"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -75,5 +75,5 @@ void RicMoveWellLogFilesFeature::onActionTriggered( bool isChecked )
|
||||
void RicMoveWellLogFilesFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Move Well Log File(s)" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
|
||||
}
|
||||
|
@ -65,5 +65,5 @@ void RicImportGroupedWellPaths::onActionTriggered( bool isChecked )
|
||||
void RicImportGroupedWellPaths::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Import &Grouped Well Paths from File" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/WellPathGroup.svg" ) );
|
||||
}
|
||||
|
@ -243,5 +243,5 @@ void RicImportWellPaths::onActionTriggered( bool isChecked )
|
||||
void RicImportWellPaths::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Import &Well Paths from File" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
|
||||
}
|
||||
|
@ -99,5 +99,5 @@ void RicNewEditableWellPathFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewEditableWellPathFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Create Well Path" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
|
||||
}
|
||||
|
@ -166,5 +166,5 @@ void RicNewPolylineTargetFeature::onActionTriggered( bool isChecked )
|
||||
void RicNewPolylineTargetFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Target" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathGroup.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@ -36,7 +37,7 @@ RICF_SOURCE_INIT( RicToggleWellPathGrouping, "RicToggleWellPathGroupingFeature",
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicToggleWellPathGrouping::RicToggleWellPathGrouping()
|
||||
{
|
||||
CAF_PDM_InitScriptableField( &m_groupeWellPaths, "group", false, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_groupWellPaths, "group", false, "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPaths, "wellPaths", "", "", "", "" );
|
||||
}
|
||||
|
||||
@ -62,7 +63,7 @@ caf::PdmScriptResponse RicToggleWellPathGrouping::execute()
|
||||
|
||||
if ( oilField )
|
||||
{
|
||||
if ( m_groupeWellPaths() )
|
||||
if ( m_groupWellPaths() )
|
||||
{
|
||||
oilField->wellPathCollection->groupWellPaths( wellPaths );
|
||||
return caf::PdmScriptResponse();
|
||||
@ -83,7 +84,16 @@ caf::PdmScriptResponse RicToggleWellPathGrouping::execute()
|
||||
bool RicToggleWellPathGrouping::isCommandEnabled()
|
||||
{
|
||||
auto wellPaths = selectedWellPaths();
|
||||
return wellPaths.size() > 1u && containsUngroupedWellPathsWithCommonGeometry( wellPaths );
|
||||
if ( wellPaths.size() > 1u && containsUngroupedWellPathsWithCommonGeometry( wellPaths ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( !wellPaths.empty() && containsGroupedWellPaths( wellPaths ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -95,11 +105,11 @@ void RicToggleWellPathGrouping::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( containsUngroupedWellPathsWithCommonGeometry( wellPaths ) )
|
||||
{
|
||||
m_groupeWellPaths = true;
|
||||
m_groupWellPaths = true;
|
||||
}
|
||||
else if ( containsGroupedWellPaths( wellPaths ) )
|
||||
{
|
||||
m_groupeWellPaths = false;
|
||||
m_groupWellPaths = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -119,12 +129,12 @@ void RicToggleWellPathGrouping::setupActionLook( QAction* actionToSetup )
|
||||
if ( containsUngroupedWellPathsWithCommonGeometry( wellPaths ) )
|
||||
{
|
||||
actionToSetup->setText( "Group the selected well paths into a Well Tree" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/WellPathGroup.svg" ) );
|
||||
}
|
||||
else if ( containsGroupedWellPaths( wellPaths ) )
|
||||
{
|
||||
actionToSetup->setText( "Ungroup the selected well paths" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,8 +153,11 @@ std::vector<RimWellPath*> RicToggleWellPathGrouping::selectedWellPaths()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleWellPathGrouping::containsGroupedWellPaths( const std::vector<RimWellPath*>& wellPaths )
|
||||
{
|
||||
// TODO: add real check
|
||||
return std::any_of( wellPaths.begin(), wellPaths.end(), []( RimWellPath* wellPath ) { return true; } );
|
||||
return std::any_of( wellPaths.begin(), wellPaths.end(), []( RimWellPath* wellPath ) {
|
||||
RimWellPathGroup* group = nullptr;
|
||||
wellPath->firstAncestorOrThisOfType( group );
|
||||
return group != nullptr;
|
||||
} );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -152,12 +165,18 @@ bool RicToggleWellPathGrouping::containsGroupedWellPaths( const std::vector<RimW
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleWellPathGrouping::containsUngroupedWellPathsWithCommonGeometry( const std::vector<RimWellPath*>& wellPaths )
|
||||
{
|
||||
// TODO: add check for whether the well paths are grouped.
|
||||
std::vector<const RigWellPath*> geometries;
|
||||
for ( auto wellPath : wellPaths )
|
||||
{
|
||||
geometries.push_back( wellPath->wellPathGeometry() );
|
||||
RimWellPathGroup* group = nullptr;
|
||||
wellPath->firstAncestorOrThisOfType( group );
|
||||
if ( !group )
|
||||
{
|
||||
geometries.push_back( wellPath->wellPathGeometry() );
|
||||
}
|
||||
}
|
||||
RigWellPath commonGeometry = RigWellPath::commonGeometry( geometries );
|
||||
return !commonGeometry.wellPathPoints().empty();
|
||||
if ( geometries.empty() ) return false;
|
||||
|
||||
cvf::ref<RigWellPath> commonGeometry = RigWellPath::commonGeometry( geometries );
|
||||
return commonGeometry.notNull() && !commonGeometry->wellPathPoints().empty();
|
||||
}
|
||||
|
@ -50,6 +50,6 @@ protected:
|
||||
static bool containsUngroupedWellPathsWithCommonGeometry( const std::vector<RimWellPath*>& wellPaths );
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_groupeWellPaths;
|
||||
caf::PdmField<bool> m_groupWellPaths;
|
||||
caf::PdmPtrArrayField<RimWellPath*> m_wellPaths;
|
||||
};
|
||||
|
@ -711,7 +711,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
std::set<QString> sortedWellNames = this->findSortedWellNames();
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( const QString& wname : sortedWellNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
|
||||
|
@ -511,7 +511,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimAdvancedSnapshotExportDefinition, "MultiSnapshotDefiniti
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAdvancedSnapshotExportDefinition::RimAdvancedSnapshotExportDefinition()
|
||||
{
|
||||
// CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.png", "", "");
|
||||
// CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.svg", "", "");
|
||||
CAF_PDM_InitObject( "MultiSnapshotDefinition", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &isActive, "IsActive", true, "Active", "", "", "" );
|
||||
|
@ -348,7 +348,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
caf::PdmChildArrayField<RimSimWellInView*>& simWells = coll->wells;
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( RimSimWellInView* eclWell : simWells )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( eclWell->name(), eclWell, false, simWellIcon ) );
|
||||
|
@ -16,7 +16,7 @@ CAF_PDM_SOURCE_INIT( RimFileWellPath, "WellPath" );
|
||||
RimFileWellPath::RimFileWellPath()
|
||||
{
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "File Well Path",
|
||||
":/Well.png",
|
||||
":/Well.svg",
|
||||
"",
|
||||
"",
|
||||
"FileWellPath",
|
||||
|
@ -65,7 +65,7 @@ CAF_PDM_SOURCE_INIT( RimSimWellInView, "Well" );
|
||||
RimSimWellInView::RimSimWellInView()
|
||||
{
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "Simulation Well",
|
||||
":/Well.png",
|
||||
":/Well.svg",
|
||||
"",
|
||||
"",
|
||||
"SimulationWell",
|
||||
|
@ -242,7 +242,7 @@ void RimTools::wellPathOptionItems( QList<caf::PdmOptionItemInfo>* options )
|
||||
auto wellPathColl = RimTools::wellPathCollection();
|
||||
if ( wellPathColl )
|
||||
{
|
||||
caf::IconProvider wellIcon( ":/Well.png" );
|
||||
caf::IconProvider wellIcon( ":/Well.svg" );
|
||||
for ( auto wellPath : wellPathColl->allWellPaths() )
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath, false, wellIcon ) );
|
||||
@ -261,7 +261,7 @@ void RimTools::wellPathWithFormationsOptionItems( QList<caf::PdmOptionItemInfo>*
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
RimTools::wellPathWithFormations( &wellPaths );
|
||||
|
||||
caf::IconProvider wellIcon( ":/Well.png" );
|
||||
caf::IconProvider wellIcon( ":/Well.svg" );
|
||||
for ( auto wellPath : wellPaths )
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath, false, wellIcon ) );
|
||||
|
@ -845,7 +845,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
std::set<QString> sortedWellNames = eclipseCase->sortedSimWellNames();
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( const QString& wname : sortedWellNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
|
||||
|
@ -676,7 +676,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
std::set<QString> sortedWellNames = this->sortedSimWellNames();
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( const QString& wname : sortedWellNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
|
||||
|
@ -605,7 +605,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions( const c
|
||||
std::set<QString> wellNames = reader->wellNames();
|
||||
for ( const QString& name : wellNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, false, caf::IconProvider( ":/Well.png" ) ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, false, caf::IconProvider( ":/Well.svg" ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void RimWellLogTrack::simWellOptionItems( QList<caf::PdmOptionItemInfo>* options
|
||||
sortedWellNames = eclipseCase->eclipseCaseData()->findSortedWellNames();
|
||||
}
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.png" );
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( const QString& wname : sortedWellNames )
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
|
||||
|
@ -72,8 +72,9 @@ const char RimWellPath::SIM_WELL_NONE_UI_TEXT[] = "None";
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath::RimWellPath()
|
||||
: nameChanged( this )
|
||||
{
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "WellPath", ":/Well.png", "", "", "WellPath", "A ResInsight Well Path" );
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "WellPath", ":/Well.svg", "", "", "WellPath", "A ResInsight Well Path" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
|
||||
m_name.registerKeywordAlias( "WellPathName" );
|
||||
@ -471,6 +472,7 @@ void RimWellPath::setNameNoUpdateOfExportName( const QString& name )
|
||||
{
|
||||
m_name = name;
|
||||
tryAssociateWithSimulationWell();
|
||||
nameChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -69,6 +69,9 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface
|
||||
|
||||
static const char SIM_WELL_NONE_UI_TEXT[];
|
||||
|
||||
public:
|
||||
caf::Signal<> nameChanged;
|
||||
|
||||
public:
|
||||
RimWellPath();
|
||||
~RimWellPath() override;
|
||||
|
@ -134,6 +134,51 @@ void RimWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
scheduleRedrawAffectedViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RimWellPathCollection::detachWellPaths( const std::vector<RimWellPath*> wellPathsToDetach )
|
||||
{
|
||||
std::set<RimWellPath*> regularWellPathsToDetach;
|
||||
std::set<RimWellPathGroup*> wellPathGroupsToRemove;
|
||||
|
||||
for ( auto wellPath : wellPathsToDetach )
|
||||
{
|
||||
std::vector<RimWellPath*> descendants;
|
||||
wellPath->descendantsIncludingThisOfType( descendants );
|
||||
for ( auto descendant : descendants )
|
||||
{
|
||||
auto group = dynamic_cast<RimWellPathGroup*>( descendant );
|
||||
if ( group )
|
||||
{
|
||||
wellPathGroupsToRemove.insert( group );
|
||||
}
|
||||
else
|
||||
{
|
||||
regularWellPathsToDetach.insert( descendant );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> detachedWellPaths;
|
||||
for ( auto wellPath : regularWellPathsToDetach )
|
||||
{
|
||||
removeWellPath( wellPath );
|
||||
detachedWellPaths.push_back( wellPath );
|
||||
}
|
||||
|
||||
for ( auto group : wellPathGroupsToRemove )
|
||||
{
|
||||
removeWellPath( group );
|
||||
}
|
||||
|
||||
for ( auto group : wellPathGroupsToRemove )
|
||||
{
|
||||
delete group;
|
||||
}
|
||||
return detachedWellPaths;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read files containing well path data, or create geometry based on the targets
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -199,7 +244,6 @@ void RimWellPathCollection::loadDataAndUpdate()
|
||||
{
|
||||
group->createWellPathGeometry();
|
||||
}
|
||||
this->checkAndFixBranchNames();
|
||||
this->sortWellsByName();
|
||||
}
|
||||
|
||||
@ -277,13 +321,13 @@ std::vector<RimWellPath*>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::addWellPath( gsl::not_null<RimWellPath*> wellPath, bool importGrouped )
|
||||
{
|
||||
RimWellPathGroup* wellPathGroup = nullptr;
|
||||
RimWellPathGroup* parentWellPathGroup = nullptr;
|
||||
if ( importGrouped )
|
||||
{
|
||||
wellPathGroup = findOrCreateWellPathGroup( wellPath );
|
||||
parentWellPathGroup = findOrCreateWellPathGroup( wellPath );
|
||||
}
|
||||
|
||||
if ( !wellPathGroup )
|
||||
if ( !parentWellPathGroup )
|
||||
{
|
||||
m_wellPaths.push_back( wellPath );
|
||||
}
|
||||
@ -346,24 +390,9 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
||||
progress.incrementProgress();
|
||||
}
|
||||
wellPathArray.clear(); // This should not be used again. We may have deleted items
|
||||
this->checkAndFixBranchNames();
|
||||
this->sortWellsByName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::checkAndFixBranchNames()
|
||||
{
|
||||
for ( auto wellPath : m_wellPaths )
|
||||
{
|
||||
if ( auto group = dynamic_cast<RimWellPathGroup*>( wellPath.p() ); group )
|
||||
{
|
||||
group->fixBranchNames();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -373,7 +402,6 @@ void RimWellPathCollection::addWellPaths( const std::vector<RimWellPath*> incomi
|
||||
{
|
||||
addWellPath( wellPath, importGrouped );
|
||||
}
|
||||
this->checkAndFixBranchNames();
|
||||
this->sortWellsByName();
|
||||
|
||||
updateAllRequiredEditors();
|
||||
@ -410,7 +438,6 @@ std::vector<RimWellLogFile*> RimWellPathCollection::addWellLogs( const QStringLi
|
||||
}
|
||||
}
|
||||
|
||||
this->checkAndFixBranchNames();
|
||||
this->sortWellsByName();
|
||||
updateAllRequiredEditors();
|
||||
|
||||
@ -463,7 +490,6 @@ void RimWellPathCollection::addWellPathFormations( const QStringList& filePaths
|
||||
RiaLogging::errorInMessageBox( Riu3DMainWindowTools::mainWindowWidget(), "Well Picks Import", outputMessage );
|
||||
}
|
||||
|
||||
this->checkAndFixBranchNames();
|
||||
this->sortWellsByName();
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
@ -600,17 +626,30 @@ void RimWellPathCollection::deleteAllWellPaths()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::groupWellPaths( const std::vector<RimWellPath*> wellPaths )
|
||||
void RimWellPathCollection::groupWellPaths( const std::vector<RimWellPath*>& wellPaths )
|
||||
{
|
||||
// TODO: implement
|
||||
auto detachedWellPaths = detachWellPaths( wellPaths );
|
||||
for ( auto wellPath : detachedWellPaths )
|
||||
{
|
||||
addWellPath( wellPath, true );
|
||||
}
|
||||
this->sortWellsByName();
|
||||
this->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::ungroupWellPaths( const std::vector<RimWellPath*> wellPaths )
|
||||
void RimWellPathCollection::ungroupWellPaths( const std::vector<RimWellPath*>& wellPaths )
|
||||
{
|
||||
// TODO: implement
|
||||
auto detachedWellPaths = detachWellPaths( wellPaths );
|
||||
for ( auto wellPath : detachedWellPaths )
|
||||
{
|
||||
addWellPath( wellPath, false );
|
||||
}
|
||||
|
||||
this->sortWellsByName();
|
||||
this->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -664,8 +703,13 @@ void RimWellPathCollection::reloadAllWellPathFormations()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
|
||||
void RimWellPathCollection::removeWellPath( gsl::not_null<RimWellPath*> wellPath )
|
||||
{
|
||||
if ( auto group = dynamic_cast<RimWellPathGroup*>( wellPath.get() ); group )
|
||||
{
|
||||
group->removeAllChildWellPaths();
|
||||
}
|
||||
|
||||
bool removed = false;
|
||||
if ( m_wellPaths.count( wellPath ) != 0u )
|
||||
{
|
||||
@ -687,10 +731,9 @@ void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
|
||||
}
|
||||
}
|
||||
}
|
||||
CAF_ASSERT( removed );
|
||||
if ( !removed ) return;
|
||||
|
||||
RimFileWellPath* fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath );
|
||||
RimFileWellPath* fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath.get() );
|
||||
if ( fileWellPath )
|
||||
{
|
||||
bool isFilePathUsed = false;
|
||||
|
@ -96,10 +96,11 @@ public:
|
||||
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, bool importGrouped, QStringList* errorMessages );
|
||||
std::vector<RimWellPath*> topLevelWellPaths() const;
|
||||
std::vector<RimWellPath*> allWellPaths() const;
|
||||
void removeWellPath( RimWellPath* wellPath );
|
||||
void deleteAllWellPaths();
|
||||
void groupWellPaths( const std::vector<RimWellPath*> wellPaths );
|
||||
void ungroupWellPaths( const std::vector<RimWellPath*> wellPaths );
|
||||
void removeWellPath( gsl::not_null<RimWellPath*> wellPath );
|
||||
|
||||
void deleteAllWellPaths();
|
||||
void groupWellPaths( const std::vector<RimWellPath*>& wellPaths );
|
||||
void ungroupWellPaths( const std::vector<RimWellPath*>& wellPaths );
|
||||
|
||||
RimWellPath* mostRecentlyUpdatedWellPath();
|
||||
|
||||
@ -129,13 +130,14 @@ public:
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
std::vector<RimWellPath*> detachWellPaths( const std::vector<RimWellPath*> wellPathsToDetach );
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void checkAndFixBranchNames();
|
||||
void readAndAddWellPaths( std::vector<RimFileWellPath*>& wellPathArray, bool importGrouped );
|
||||
void sortWellsByName();
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "RiaTextStringTools.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include <QStringList>
|
||||
@ -32,9 +34,15 @@ CAF_PDM_SOURCE_INIT( RimWellPathGroup, "WellPathGroup" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathGroup::RimWellPathGroup()
|
||||
: wellPathAddedOrRemoved( this )
|
||||
{
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "Well Path Group", ":/Well.png", "", "", "WellPathGroup", "A Group of Well Paths" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths", "", "", "" );
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "Well Path Group",
|
||||
":/WellPathGroup.svg",
|
||||
"",
|
||||
"",
|
||||
"WellPathGroup",
|
||||
"A Group of Well Paths" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths", "", "", "" );
|
||||
setWellPathGeometry( new RigWellPath );
|
||||
}
|
||||
|
||||
@ -56,6 +64,8 @@ void RimWellPathGroup::addChildWellPath( RimWellPath* wellPath )
|
||||
setWellPathGeometry( geometryCopy.p() );
|
||||
m_childWellPaths.push_back( wellPath );
|
||||
}
|
||||
wellPath->nameChanged.connect( this, &RimWellPathGroup::onChildNameChanged );
|
||||
|
||||
updateWellPathName();
|
||||
}
|
||||
|
||||
@ -115,6 +125,8 @@ void RimWellPathGroup::createWellPathGeometry()
|
||||
group->createWellPathGeometry();
|
||||
}
|
||||
}
|
||||
if ( wellPathGeometries().empty() ) return;
|
||||
|
||||
auto commonGeometry = RigWellPath::commonGeometry( wellPathGeometries() );
|
||||
for ( auto wellPath : m_childWellPaths )
|
||||
{
|
||||
@ -126,33 +138,6 @@ void RimWellPathGroup::createWellPathGeometry()
|
||||
setWellPathGeometry( commonGeometry.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGroup::fixBranchNames()
|
||||
{
|
||||
const auto& measuredDepths = this->wellPathGeometry()->measuredDepths();
|
||||
|
||||
int index = 1;
|
||||
for ( auto wellPath : m_childWellPaths )
|
||||
{
|
||||
auto group = dynamic_cast<RimWellPathGroup*>( wellPath.p() );
|
||||
if ( group )
|
||||
{
|
||||
group->fixBranchNames();
|
||||
if ( group->name() == this->name() )
|
||||
{
|
||||
QString groupName = QString( "%1 branch #%2" ).arg( this->name() ).arg( index++ );
|
||||
if ( !measuredDepths.empty() )
|
||||
{
|
||||
groupName += QString( " at md=%1" ).arg( measuredDepths.back() );
|
||||
}
|
||||
group->setName( groupName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -195,15 +180,41 @@ void RimWellPathGroup::updateWellPathName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPathGroup::createWellPathName() const
|
||||
{
|
||||
QStringList allNames;
|
||||
for ( auto wellPath : m_childWellPaths )
|
||||
QStringList allNames;
|
||||
std::vector<RimWellPath*> descendantWellPaths;
|
||||
this->descendantsOfType( descendantWellPaths );
|
||||
for ( auto wellPath : descendantWellPaths )
|
||||
{
|
||||
allNames.push_back( wellPath->name() );
|
||||
if ( !dynamic_cast<RimWellPathGroup*>( wellPath ) )
|
||||
{
|
||||
allNames.push_back( wellPath->name() );
|
||||
}
|
||||
}
|
||||
|
||||
QString commonName = RiaTextStringTools::commonRoot( allNames );
|
||||
QString trimmedCommonName = RiaTextStringTools::trimNonAlphaNumericCharacters( commonName );
|
||||
return trimmedCommonName;
|
||||
QString commonName = RiaTextStringTools::commonRoot( allNames );
|
||||
QString trimmedCommonName = RiaTextStringTools::trimNonAlphaNumericCharacters( commonName );
|
||||
QStringList branchNames;
|
||||
for ( auto& name : allNames )
|
||||
{
|
||||
name.remove( commonName );
|
||||
name = RiaTextStringTools::trimNonAlphaNumericCharacters( name );
|
||||
name = name.simplified();
|
||||
if ( !name.isEmpty() ) branchNames.push_back( name );
|
||||
}
|
||||
QString fullName = trimmedCommonName;
|
||||
if ( !branchNames.isEmpty() )
|
||||
{
|
||||
fullName += QString( "(%1)" ).arg( branchNames.join( ", " ) );
|
||||
}
|
||||
return fullName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGroup::onChildNameChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateWellPathName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -24,6 +24,7 @@
|
||||
class RimWellPathGroup : public RimWellPath
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
caf::Signal<> wellPathAddedOrRemoved;
|
||||
|
||||
public:
|
||||
RimWellPathGroup();
|
||||
@ -37,7 +38,6 @@ public:
|
||||
|
||||
void createWellPathGeometry();
|
||||
void updateWellPathName();
|
||||
void fixBranchNames();
|
||||
void makeMoreLevelsIfNecessary();
|
||||
|
||||
protected:
|
||||
@ -47,6 +47,8 @@ private:
|
||||
std::vector<const RigWellPath*> wellPathGeometries() const;
|
||||
QString createWellPathName() const;
|
||||
|
||||
void onChildNameChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimWellPath*> m_childWellPaths;
|
||||
};
|
||||
};
|
||||
|
@ -155,7 +155,7 @@
|
||||
<file>ToggleOnOthersOff16x16.png</file>
|
||||
<file>UnLinkView.svg</file>
|
||||
<file>UpView.svg</file>
|
||||
<file>Well.png</file>
|
||||
<file>Well.svg</file>
|
||||
<file>WellAllocLegend16x16.png</file>
|
||||
<file>WellAllocPie16x16.png</file>
|
||||
<file>WellAllocPlot16x16.png</file>
|
||||
@ -169,6 +169,7 @@
|
||||
<file>WellLogPlots16x16.png</file>
|
||||
<file>WellLogTrack16x16.png</file>
|
||||
<file>WellMeasurement16x16.png</file>
|
||||
<file>WellPathGroup.svg</file>
|
||||
<file>WellTargetPoint16x16.png</file>
|
||||
<file>WellTargetPointTangent16x16.png</file>
|
||||
<file>WellTargets.png</file>
|
||||
|
4
ApplicationCode/Resources/Well.svg
Normal file
4
ApplicationCode/Resources/Well.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg viewBox="0 0 16 16" width="16px" height="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path style="fill: none; stroke: rgb(137, 209, 133); stroke-width: 1.25px;" d="M 1.334 0.702 C 1.37 1.806 2.386 9.777 4.739 12.365 C 5.442 13.138 7.018 14.181 8.474 13.85 C 9.668 13.578 10.544 12.159 11.895 12.131 C 13.246 12.103 14.805 14.275 15.277 15"/>
|
||||
</svg>
|
After Width: | Height: | Size: 392 B |
7
ApplicationCode/Resources/WellPathGroup.svg
Normal file
7
ApplicationCode/Resources/WellPathGroup.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path style="fill: none; stroke: rgb(251, 176, 0); stroke-width: 1.25px;" d="M 1.269 2.77 C 1.448 3.606 4.283 4.717 5.43 5.121 C 6.97 5.664 8.912 5.5 11.049 5.226"/>
|
||||
<path style="fill: none; stroke: rgb(174, 78, 151); stroke-width: 1.25px;" d="M 2.605 8.863 C 3.629 10.594 9.091 10.327 11.549 9.529"/>
|
||||
<path style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-width: 1.25px;" d="M 7.339 7.765"/>
|
||||
<path style="fill: none; stroke: rgb(137, 209, 133); stroke-width: 1.25px;" d="M 1.028 0.851 C 1.064 1.955 2.08 9.926 4.433 12.514 C 5.136 13.287 6.712 14.33 8.168 13.999 C 9.362 13.727 10.238 12.308 11.589 12.28 C 12.94 12.252 14.499 14.424 14.971 15.149"/>
|
||||
</svg>
|
After Width: | Height: | Size: 779 B |
@ -451,7 +451,7 @@ void RiuMainWindow::createMenus()
|
||||
#endif
|
||||
|
||||
importMenu->addSeparator();
|
||||
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.png" ), "Well Data" );
|
||||
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportGroupedWellPathsFeature" ) );
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportSsihubFeature" ) );
|
||||
|
@ -265,7 +265,7 @@ void RiuPlotMainWindow::createMenus()
|
||||
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleFeature" ) );
|
||||
|
||||
importMenu->addSeparator();
|
||||
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.png" ), "Well Data" );
|
||||
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportSsihubFeature" ) );
|
||||
|
Loading…
Reference in New Issue
Block a user