mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#659) Sort well paths when downloading from SSI-hub
This commit is contained in:
parent
f07f9cba3e
commit
50cd9250c4
@ -890,6 +890,8 @@ void WellSelectionPage::buildWellTreeView()
|
||||
|
||||
fieldGroup->objects.push_back(wellPathCopy);
|
||||
}
|
||||
|
||||
sortObjectsByDescription(fieldGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -956,7 +958,42 @@ void WellSelectionPage::selectedWellPathEntries(std::vector<DownloadEntity>& dow
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool lessByDescription(const caf::PdmPointer<caf::PdmObjectHandle>& obj1, const caf::PdmPointer<caf::PdmObjectHandle>& obj2)
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle1 = NULL;
|
||||
caf::PdmUiFieldHandle* uiFieldHandle2 = NULL;
|
||||
|
||||
if (obj1.notNull() && obj1->uiCapability() && obj1->uiCapability()->userDescriptionField())
|
||||
{
|
||||
uiFieldHandle1 = obj1->uiCapability()->userDescriptionField()->uiCapability();
|
||||
}
|
||||
|
||||
if (obj2.notNull() && obj2->uiCapability() && obj2->uiCapability()->userDescriptionField())
|
||||
{
|
||||
uiFieldHandle2 = obj2->uiCapability()->userDescriptionField()->uiCapability();
|
||||
}
|
||||
|
||||
if (uiFieldHandle1 && uiFieldHandle2)
|
||||
{
|
||||
QString string1 = uiFieldHandle1->uiValue().toString();
|
||||
QString string2 = uiFieldHandle2->uiValue().toString();
|
||||
|
||||
return string1 < string2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void WellSelectionPage::sortObjectsByDescription(caf::PdmObjectCollection* objects)
|
||||
{
|
||||
std::sort(objects->objects.begin(), objects->objects.end(), lessByDescription);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -131,15 +131,16 @@ public:
|
||||
~WellSelectionPage();
|
||||
|
||||
virtual void initializePage();
|
||||
void buildWellTreeView();
|
||||
void buildWellTreeView();
|
||||
|
||||
|
||||
void selectedWellPathEntries(std::vector<DownloadEntity>& downloadEntities, caf::PdmObjectHandle* objHandle);
|
||||
void selectedWellPathEntries(std::vector<DownloadEntity>& downloadEntities, caf::PdmObjectHandle* objHandle);
|
||||
private:
|
||||
void sortObjectsByDescription(caf::PdmObjectCollection* objects);
|
||||
|
||||
private:
|
||||
ObjectGroupWithHeaders* m_regionsWithVisibleWells;
|
||||
RimWellPathImport* m_wellPathImportObject;
|
||||
caf::PdmUiTreeView* m_wellSelectionTreeView;
|
||||
ObjectGroupWithHeaders* m_regionsWithVisibleWells;
|
||||
RimWellPathImport* m_wellPathImportObject;
|
||||
caf::PdmUiTreeView* m_wellSelectionTreeView;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user