mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
LGR Export. Export files for selected well paths
This commit is contained in:
@@ -196,7 +196,7 @@ bool RicExportLgrFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicExportLgrFeature::onActionTriggered(bool isChecked)
|
void RicExportLgrFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
||||||
CVF_ASSERT(wellPaths.size() > 0);
|
CVF_ASSERT(wellPaths.size() > 0);
|
||||||
|
|
||||||
std::vector<RimSimWellInView*> simWells;
|
std::vector<RimSimWellInView*> simWells;
|
||||||
@@ -274,63 +274,19 @@ void RicExportLgrFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimWellPath*> RicExportLgrFeature::visibleWellPaths()
|
std::vector<RimWellPath*> RicExportLgrFeature::selectedWellPaths()
|
||||||
{
|
{
|
||||||
|
std::vector<RimWellPathCompletions*> selectedCompletions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
|
||||||
std::vector<RimWellPath*> wellPaths;
|
std::vector<RimWellPath*> wellPaths;
|
||||||
|
|
||||||
|
for (auto completion : selectedCompletions)
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
RimWellPath* parentWellPath;
|
||||||
caf::SelectionManager::instance()->objectsByType(&wellPathCollections);
|
completion->firstAncestorOrThisOfType(parentWellPath);
|
||||||
|
|
||||||
if (wellPathCollections.empty())
|
if (parentWellPath) wellPaths.push_back(parentWellPath);
|
||||||
{
|
|
||||||
std::vector<RimWellPath*> selectedWellPaths;
|
|
||||||
caf::SelectionManager::instance()->objectsByType(&selectedWellPaths);
|
|
||||||
|
|
||||||
if (!selectedWellPaths.empty())
|
|
||||||
{
|
|
||||||
RimWellPathCollection* parent = nullptr;
|
|
||||||
selectedWellPaths[0]->firstAncestorOrThisOfType(parent);
|
|
||||||
if (parent)
|
|
||||||
{
|
|
||||||
wellPathCollections.push_back(parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wellPathCollections.empty())
|
|
||||||
{
|
|
||||||
for (auto wellPathCollection : wellPathCollections)
|
|
||||||
{
|
|
||||||
for (const auto& wellPath : wellPathCollection->wellPaths())
|
|
||||||
{
|
|
||||||
if (wellPath->showWellPath())
|
|
||||||
{
|
|
||||||
wellPaths.push_back(wellPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No well path or well path collection selected
|
|
||||||
|
|
||||||
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
|
|
||||||
for (const auto& w : allWellPaths)
|
|
||||||
{
|
|
||||||
if (w->showWellPath())
|
|
||||||
{
|
|
||||||
wellPaths.push_back(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<RimWellPath*> uniqueWellPaths(wellPaths.begin(), wellPaths.end());
|
|
||||||
wellPaths.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
|
|
||||||
|
|
||||||
return wellPaths;
|
return wellPaths;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,5 @@ protected:
|
|||||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static std::vector<RimWellPath*> selectedWellPaths();
|
||||||
public:
|
|
||||||
static std::vector<RimWellPath*> visibleWellPaths();
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user