(#655) Sort the wells in the Wells folder by name

This commit is contained in:
Jacob Støren 2015-11-30 14:32:34 +01:00
parent 707e8c68ab
commit d637248ae9
2 changed files with 22 additions and 1 deletions

View File

@ -164,6 +164,8 @@ void RimWellPathCollection::readWellPathFiles()
progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name));
progress.incrementProgress();
}
this->sortWellsByName();
}
@ -258,6 +260,8 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellP
progress.incrementProgress();
}
this->sortWellsByName();
}
@ -282,6 +286,8 @@ void RimWellPathCollection::addWellLogs(const QStringList& filePaths)
wellPath->setLogFileInfo(logFileInfo);
}
}
this->sortWellsByName();
}
//--------------------------------------------------------------------------------------------------
@ -381,6 +387,19 @@ void RimWellPathCollection::removeWellPath(RimWellPath* wellPath)
}
}
bool lessWellPath(const caf::PdmPointer<RimWellPath>& w1, const caf::PdmPointer<RimWellPath>& w2)
{
return (w1->name() < w2->name());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::sortWellsByName()
{
std::sort(wellPaths.begin(), wellPaths.end(), lessWellPath);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -89,16 +89,18 @@ public:
RimWellPath* wellPathByName(const QString& wellPathName) const;
void addWellLogs(const QStringList& filePaths);
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
void scheduleGeometryRegenAndRedrawViews();
void updateFilePathsFromProjectPath();
protected:
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
private:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
virtual caf::PdmFieldHandle* objectToggleField();
void readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray);
void sortWellsByName();
caf::PdmPointer<RimProject> m_project;
cvf::ref<RivWellPathCollectionPartMgr> m_wellPathCollectionPartManager;