mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
Refactor RigFormationNames
- Rename RifColorLegendData to RifFormationNamesReader to better reflect the class purpose of reading formation names from .lyr files. - Remove inheritance of cvf::Object - Improve const correctness
This commit is contained in:
1 parent
2bf6d1c099
commit
601a3bbb78
25 files changed
+106
-76
No files matched your search
+12
-3
@@ -19,6 +19,7 @@
|
||||
#include "RicImportColorCategoriesFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigFormationNames.h"
|
||||
#include "RimColorLegend.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#include "RimColorLegendItem.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RifColorLegendData.h"
|
||||
#include "RifFormationNamesReader.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuFileDialogTools.h"
|
||||
@@ -36,6 +37,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportColorCategoriesFeature, "RicImportColorCategoriesFeature" );
|
||||
|
||||
@@ -65,8 +67,15 @@ void RicImportColorCategoriesFeature::onActionTriggered( bool isChecked )
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( fileName ).absolutePath() );
|
||||
|
||||
QString errormessage;
|
||||
cvf::ref<RigFormationNames> formations = RifColorLegendData::readFormationNamesFile( fileName, &errormessage );
|
||||
QString errormessage;
|
||||
auto formations = RifFormationNamesReader::readFormationNamesFile( fileName, &errormessage );
|
||||
if ( !formations || !errormessage.isEmpty() )
|
||||
{
|
||||
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Formation File Failed",
|
||||
errormessage.isEmpty() ? "Unknown error reading formation file." : errormessage );
|
||||
return;
|
||||
}
|
||||
|
||||
const std::vector<QString>& formationNames = formations->formationNames();
|
||||
const std::vector<cvf::Color3f>& formationColors = formations->formationColors();
|
||||
|
||||
@@ -169,7 +169,7 @@ std::vector<QString> RicElasticPropertiesImportTools::getFormationNames()
|
||||
{
|
||||
if ( formationNames && formationNames->formationNamesData() )
|
||||
{
|
||||
RigFormationNames* rigFormationNames = formationNames->formationNamesData();
|
||||
auto rigFormationNames = formationNames->formationNamesData();
|
||||
if ( rigFormationNames ) return rigFormationNames->formationNames();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimStimPlanModelTemplate.h"
|
||||
|
||||
#include "RifColorLegendData.h"
|
||||
#include "RifFormationNamesReader.h"
|
||||
#include "RifRoffReader.h"
|
||||
|
||||
#include "cafColorTable.h"
|
||||
|
||||
@@ -53,7 +53,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifInputPropertyLoader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceImporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRoffReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFormationNamesReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelExporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelGeologicalFrkExporter.h
|
||||
@@ -168,7 +168,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifInputPropertyLoader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceImporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRoffReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFormationNamesReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelExporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelGeologicalFrkExporter.cpp
|
||||
|
||||
+13
-13
@@ -16,11 +16,13 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifColorLegendData.h"
|
||||
#include "RifFormationNamesReader.h"
|
||||
|
||||
#include "RiaTextStringTools.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "cafAssert.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
@@ -32,35 +34,34 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigFormationNames> RifColorLegendData::readFormationNamesFile( const QString& fileName, QString* errorMessage )
|
||||
std::unique_ptr<RigFormationNames> RifFormationNamesReader::readFormationNamesFile( const QString& fileName, QString* errorMessage )
|
||||
{
|
||||
QFileInfo fileInfo( fileName );
|
||||
|
||||
if ( fileInfo.fileName() == "layer_zone_table.txt" )
|
||||
{
|
||||
return RifColorLegendData::readFmuFormationNameFile( fileName, errorMessage );
|
||||
return RifFormationNamesReader::readFmuFormationNameFile( fileName, errorMessage );
|
||||
}
|
||||
else
|
||||
{
|
||||
return RifColorLegendData::readLyrFormationNameFile( fileName, errorMessage );
|
||||
return RifFormationNamesReader::readLyrFormationNameFile( fileName, errorMessage );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const QString& fileName, QString* errorMessage )
|
||||
std::unique_ptr<RigFormationNames> RifFormationNamesReader::readLyrFormationNameFile( const QString& fileName, QString* errorMessage )
|
||||
{
|
||||
cvf::ref<RigFormationNames> formationNames = new RigFormationNames;
|
||||
|
||||
QFile dataFile( fileName );
|
||||
|
||||
if ( !dataFile.open( QFile::ReadOnly ) )
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) += "Could not open file: " + fileName + "\n";
|
||||
return formationNames;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto formationNames = std::make_unique<RigFormationNames>();
|
||||
QTextStream stream( &dataFile );
|
||||
|
||||
int lineNumber = 1;
|
||||
@@ -160,18 +161,17 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigFormationNames> RifColorLegendData::readFmuFormationNameFile( const QString& fileName, QString* errorMessage )
|
||||
std::unique_ptr<RigFormationNames> RifFormationNamesReader::readFmuFormationNameFile( const QString& fileName, QString* errorMessage )
|
||||
{
|
||||
cvf::ref<RigFormationNames> formationNames = new RigFormationNames;
|
||||
|
||||
QFile dataFile( fileName );
|
||||
|
||||
if ( !dataFile.open( QFile::ReadOnly ) )
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) += "Could not open file: " + fileName + "\n";
|
||||
return formationNames;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto formationNames = std::make_unique<RigFormationNames>();
|
||||
QTextStream stream( &dataFile );
|
||||
|
||||
int lineNumber = 1;
|
||||
@@ -242,7 +242,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readFmuFormationNameFile( const
|
||||
/// SVG color keyword names, c.f. https://www.w3.org/TR/SVG11/types.html#ColorKeywords,
|
||||
/// or #RRGGBB used on a LYR formation data file.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifColorLegendData::convertStringToColor( const QString& word, cvf::Color3f* color )
|
||||
bool RifFormationNamesReader::convertStringToColor( const QString& word, cvf::Color3f* color )
|
||||
{
|
||||
if ( word.isEmpty() ) return false;
|
||||
|
||||
+6
-5
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RigFormationNames;
|
||||
class QString;
|
||||
@@ -32,14 +33,14 @@ class Color3f;
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifColorLegendData
|
||||
class RifFormationNamesReader
|
||||
{
|
||||
public:
|
||||
static cvf::ref<RigFormationNames> readFormationNamesFile( const QString& fileName, QString* errorMessage );
|
||||
[[nodiscard]] static std::unique_ptr<RigFormationNames> readFormationNamesFile( const QString& fileName, QString* errorMessage );
|
||||
|
||||
private:
|
||||
static cvf::ref<RigFormationNames> readLyrFormationNameFile( const QString& fileName, QString* errorMessage );
|
||||
static cvf::ref<RigFormationNames> readFmuFormationNameFile( const QString& fileName, QString* errorMessage );
|
||||
static std::unique_ptr<RigFormationNames> readLyrFormationNameFile( const QString& fileName, QString* errorMessage );
|
||||
static std::unique_ptr<RigFormationNames> readFmuFormationNameFile( const QString& fileName, QString* errorMessage );
|
||||
|
||||
static bool convertStringToColor( const QString& word, cvf::Color3f* color );
|
||||
};
|
||||
@@ -213,7 +213,7 @@ RigFemPartResultsCollection::~RigFemPartResultsCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::setActiveFormationNames( RigFormationNames* activeFormationNames )
|
||||
void RigFemPartResultsCollection::setActiveFormationNames( const RigFormationNames* activeFormationNames )
|
||||
{
|
||||
m_activeFormationNamesData = activeFormationNames;
|
||||
|
||||
@@ -238,7 +238,7 @@ std::vector<QString> RigFemPartResultsCollection::formationNames() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFormationNames* RigFemPartResultsCollection::activeFormationNames() const
|
||||
{
|
||||
return m_activeFormationNamesData.p();
|
||||
return m_activeFormationNamesData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
const RigFemPartCollection* femPartCollection );
|
||||
~RigFemPartResultsCollection() override;
|
||||
|
||||
void setActiveFormationNames( RigFormationNames* activeFormationNames );
|
||||
void setActiveFormationNames( const RigFormationNames* activeFormationNames );
|
||||
std::vector<QString> formationNames() const;
|
||||
|
||||
void addElementPropertyFiles( const std::vector<QString>& filenames );
|
||||
@@ -205,7 +205,7 @@ private:
|
||||
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
||||
cvf::ref<RifElementPropertyReader> m_elementPropertyReader;
|
||||
cvf::cref<RigFemPartCollection> m_femParts;
|
||||
cvf::cref<RigFormationNames> m_activeFormationNamesData;
|
||||
const RigFormationNames* m_activeFormationNamesData = nullptr;
|
||||
|
||||
double m_cohesion;
|
||||
double m_frictionAngleRad;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "RimFormationNames.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RifColorLegendData.h"
|
||||
#include "RifFormationNamesReader.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
@@ -111,6 +111,14 @@ QString RimFormationNames::shortName()
|
||||
return fnameFileInfo.baseName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFormationNames* RimFormationNames::formationNamesData() const
|
||||
{
|
||||
return m_formationNamesData.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -143,7 +151,7 @@ void RimFormationNames::updateConnectedViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFormationNames::readFormationNamesFile( QString* errorMessage )
|
||||
{
|
||||
m_formationNamesData = RifColorLegendData::readFormationNamesFile( m_formationNamesFileName().path(), errorMessage );
|
||||
m_formationNamesData = RifFormationNamesReader::readFormationNamesFile( m_formationNamesFileName().path(), errorMessage );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RigFormationNames;
|
||||
|
||||
@@ -40,8 +41,9 @@ public:
|
||||
QString fileName();
|
||||
QString shortName();
|
||||
|
||||
RigFormationNames* formationNamesData() { return m_formationNamesData.p(); }
|
||||
void updateConnectedViews();
|
||||
const RigFormationNames* formationNamesData() const;
|
||||
|
||||
void updateConnectedViews();
|
||||
|
||||
void readFormationNamesFile( QString* errorMessage );
|
||||
|
||||
@@ -58,5 +60,5 @@ private:
|
||||
private:
|
||||
caf::PdmField<caf::FilePath> m_formationNamesFileName;
|
||||
|
||||
cvf::ref<RigFormationNames> m_formationNamesData;
|
||||
std::unique_ptr<RigFormationNames> m_formationNamesData;
|
||||
};
|
||||
@@ -216,7 +216,7 @@ void RimColorLegendCollection::createColorLegendFromFormationNames( RimFormation
|
||||
{
|
||||
if ( !rimFormationNames ) return;
|
||||
|
||||
RigFormationNames* rigFormationNames = rimFormationNames->formationNamesData();
|
||||
auto rigFormationNames = rimFormationNames->formationNamesData();
|
||||
if ( !rigFormationNames ) return;
|
||||
|
||||
const std::vector<QString>& formationNames = rigFormationNames->formationNames();
|
||||
|
||||
@@ -1241,7 +1241,7 @@ cvf::ref<RigWellPathFormations> RimEnsembleWellLogCurveSet::createWellPathFormat
|
||||
RimFormationNames* rimFormationNames = formationNamesCollection->formationNamesList()[0];
|
||||
if ( !rimFormationNames ) return nullptr;
|
||||
|
||||
RigFormationNames* formationNames = rimFormationNames->formationNamesData();
|
||||
auto formationNames = rimFormationNames->formationNamesData();
|
||||
if ( !formationNames ) return nullptr;
|
||||
|
||||
std::vector<RigWellPathFormation> wellPathFormationItems;
|
||||
|
||||
@@ -2881,7 +2881,7 @@ void RigCaseCellResultsData::setHdf5Filename( const QString& hdf5SourSimFilename
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeFormationNames )
|
||||
void RigCaseCellResultsData::setActiveFormationNames( const RigFormationNames* activeFormationNames )
|
||||
{
|
||||
m_activeFormationNamesData = activeFormationNames;
|
||||
|
||||
@@ -2899,7 +2899,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
RiaResultNames::activeFormationNamesResultName() ),
|
||||
0 );
|
||||
|
||||
if ( m_activeFormationNamesData.isNull() )
|
||||
if ( !m_activeFormationNamesData )
|
||||
{
|
||||
for ( size_t cIdx = 0; cIdx < totalGlobCellCount; ++cIdx )
|
||||
{
|
||||
@@ -2957,7 +2957,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFormationNames* RigCaseCellResultsData::activeFormationNames() const
|
||||
{
|
||||
return m_activeFormationNamesData.p();
|
||||
return m_activeFormationNamesData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void setReaderInterface( RifReaderInterface* readerInterface );
|
||||
const RifReaderInterface* readerInterface() const;
|
||||
void setHdf5Filename( const QString& hdf5SourSimFilename );
|
||||
void setActiveFormationNames( RigFormationNames* activeFormationNames );
|
||||
void setActiveFormationNames( const RigFormationNames* activeFormationNames );
|
||||
const RigFormationNames* activeFormationNames() const;
|
||||
RigAllanDiagramData* allanDiagramData();
|
||||
|
||||
@@ -221,7 +221,6 @@ private:
|
||||
|
||||
private:
|
||||
cvf::ref<RifReaderInterface> m_readerInterface;
|
||||
cvf::cref<RigFormationNames> m_activeFormationNamesData;
|
||||
cvf::ref<RigAllanDiagramData> m_allanDiagramData;
|
||||
|
||||
std::vector<std::vector<std::vector<double>>> m_cellScalarResults; ///< Scalar results on the complete reservoir for
|
||||
@@ -236,4 +235,5 @@ private:
|
||||
RigEclipseCaseData* m_ownerCaseData;
|
||||
RigActiveCellInfo* m_activeCellInfo;
|
||||
RiaDefines::PorosityModelType m_porosityModel;
|
||||
const RigFormationNames* m_activeFormationNamesData = nullptr;
|
||||
};
|
||||
@@ -780,7 +780,7 @@ void RigEclipseCaseData::computeActiveCellsGeometryBoundingBoxOptimized()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigEclipseCaseData::setActiveFormationNames( RigFormationNames* activeFormationNames )
|
||||
void RigEclipseCaseData::setActiveFormationNames( const RigFormationNames* activeFormationNames )
|
||||
{
|
||||
m_matrixModelResults->setActiveFormationNames( activeFormationNames );
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
|
||||
bool hasFractureResults() const;
|
||||
|
||||
void setActiveFormationNames( RigFormationNames* activeFormationNames );
|
||||
void setActiveFormationNames( const RigFormationNames* activeFormationNames );
|
||||
const std::vector<QString> formationNames() const;
|
||||
RigAllanDiagramData* allanDiagramData();
|
||||
|
||||
|
||||
@@ -30,14 +30,16 @@ RigFormationNames::RigFormationNames()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFormationNames::~RigFormationNames()
|
||||
int RigFormationNames::formationIndexFromKLayerIdx( size_t Kidx ) const
|
||||
{
|
||||
if ( Kidx >= m_nameIndexPrKLayer.size() ) return -1;
|
||||
return m_nameIndexPrKLayer[Kidx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigFormationNames::formationNameFromKLayerIdx( size_t Kidx )
|
||||
QString RigFormationNames::formationNameFromKLayerIdx( size_t Kidx ) const
|
||||
{
|
||||
int idx = formationIndexFromKLayerIdx( Kidx );
|
||||
if ( idx >= static_cast<int>( m_formationNames.size() ) ) return "";
|
||||
@@ -49,7 +51,7 @@ QString RigFormationNames::formationNameFromKLayerIdx( size_t Kidx )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigFormationNames::formationColorFromKLayerIdx( size_t Kidx, cvf::Color3f* formationColor )
|
||||
bool RigFormationNames::formationColorFromKLayerIdx( size_t Kidx, cvf::Color3f* formationColor ) const
|
||||
{
|
||||
int idx = formationIndexFromKLayerIdx( Kidx );
|
||||
|
||||
@@ -64,6 +66,22 @@ bool RigFormationNames::formationColorFromKLayerIdx( size_t Kidx, cvf::Color3f*
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RigFormationNames::formationNames() const
|
||||
{
|
||||
return m_formationNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Color3f> RigFormationNames::formationColors() const
|
||||
{
|
||||
return m_formationColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -143,7 +161,7 @@ void RigFormationNames::appendFormationRangeWithColor( const QString& name, cvf:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<int> RigFormationNames::findKLayers( std::vector<QString> formationNames )
|
||||
std::set<int> RigFormationNames::findKLayers( std::vector<QString> formationNames ) const
|
||||
{
|
||||
std::set<int> foundK;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include <QString>
|
||||
|
||||
#include <set>
|
||||
@@ -26,24 +25,17 @@
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
class RigFormationNames : public cvf::Object
|
||||
class RigFormationNames
|
||||
{
|
||||
public:
|
||||
RigFormationNames();
|
||||
~RigFormationNames() override;
|
||||
|
||||
int formationIndexFromKLayerIdx( size_t Kidx ) const
|
||||
{
|
||||
if ( Kidx >= m_nameIndexPrKLayer.size() ) return -1;
|
||||
return m_nameIndexPrKLayer[Kidx];
|
||||
}
|
||||
int formationIndexFromKLayerIdx( size_t Kidx ) const;
|
||||
QString formationNameFromKLayerIdx( size_t Kidx ) const;
|
||||
bool formationColorFromKLayerIdx( size_t Kidx, cvf::Color3f* formationColor ) const;
|
||||
|
||||
QString formationNameFromKLayerIdx( size_t Kidx );
|
||||
|
||||
bool formationColorFromKLayerIdx( size_t Kidx, cvf::Color3f* formationColor );
|
||||
|
||||
const std::vector<QString>& formationNames() const { return m_formationNames; }
|
||||
const std::vector<cvf::Color3f>& formationColors() const { return m_formationColors; }
|
||||
std::vector<QString> formationNames() const;
|
||||
std::vector<cvf::Color3f> formationColors() const;
|
||||
|
||||
void appendFormationRange( const QString& name, int kStartIdx, int kEndIdx );
|
||||
void appendFormationRangeHeight( const QString& name, int kLayerCount );
|
||||
@@ -51,7 +43,7 @@ public:
|
||||
void appendFormationRange( const QString& name, cvf::Color3f color, int kStartIdx, int kEndIdx );
|
||||
void appendFormationRangeHeight( const QString& name, cvf::Color3f color, int kLayerCount );
|
||||
|
||||
std::set<int> findKLayers( std::vector<QString> formationNames );
|
||||
std::set<int> findKLayers( std::vector<QString> formationNames ) const;
|
||||
|
||||
private:
|
||||
static cvf::Color3f undefinedColor();
|
||||
|
||||
@@ -77,7 +77,7 @@ set(SOURCE_UNITTEST_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaDateStringParser-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigHexGradientTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceImporter-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFormationNamesReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRoffReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigStatisticsTools-Test.cpp
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RiaTestDataDirectory.h"
|
||||
#include "RifColorLegendData.h"
|
||||
#include "RifFormationNamesReader.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
@@ -10,17 +10,17 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
TEST( RifColorLegendData, ReadLYRFileWithoutColor )
|
||||
TEST( RifFormationNamesReader, ReadLYRFileWithoutColor )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
const QString filename( "RifColorLegendData/Norne_ATW2013.lyr" );
|
||||
const QString filename( "RifFormationNamesReader/Norne_ATW2013.lyr" );
|
||||
const QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
QString errormessage;
|
||||
|
||||
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
|
||||
auto fm = RifFormationNamesReader::readFormationNamesFile( filePath, &errormessage );
|
||||
EXPECT_TRUE( errormessage.isEmpty() );
|
||||
|
||||
QString formationName_K1 = fm->formationNameFromKLayerIdx( 0 );
|
||||
@@ -30,17 +30,17 @@ TEST( RifColorLegendData, ReadLYRFileWithoutColor )
|
||||
EXPECT_EQ( 1, formationIndex );
|
||||
}
|
||||
|
||||
TEST( RifColorLegendData, ReadLYRFileWithColorName )
|
||||
TEST( RifFormationNamesReader, ReadLYRFileWithColorName )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
const QString filename( "RifColorLegendData/Norne_ATW2013ColorName.lyr" );
|
||||
const QString filename( "RifFormationNamesReader/Norne_ATW2013ColorName.lyr" );
|
||||
const QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
QString errormessage;
|
||||
|
||||
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
|
||||
auto fm = RifFormationNamesReader::readFormationNamesFile( filePath, &errormessage );
|
||||
EXPECT_TRUE( errormessage.isEmpty() );
|
||||
|
||||
QString formationName_K1 = fm->formationNameFromKLayerIdx( 1 );
|
||||
@@ -57,17 +57,17 @@ TEST( RifColorLegendData, ReadLYRFileWithColorName )
|
||||
EXPECT_EQ( 0.0f, formationColor.b() );
|
||||
}
|
||||
|
||||
TEST( RifColorLegendData, ReadLYRFileWithColorHTML )
|
||||
TEST( RifFormationNamesReader, ReadLYRFileWithColorHTML )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
const QString filename( "RifColorLegendData/Norne_ATW2013ColorHTML.lyr" );
|
||||
const QString filename( "RifFormationNamesReader/Norne_ATW2013ColorHTML.lyr" );
|
||||
const QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
QString errormessage;
|
||||
|
||||
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
|
||||
auto fm = RifFormationNamesReader::readFormationNamesFile( filePath, &errormessage );
|
||||
EXPECT_TRUE( errormessage.isEmpty() );
|
||||
|
||||
QString formationName_K1 = fm->formationNameFromKLayerIdx( 1 );
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -232,7 +232,7 @@ QString RiuFemResultTextBuilder::formationDetails()
|
||||
{
|
||||
if ( rimCase->activeFormationNames() && rimCase->activeFormationNames()->formationNamesData() )
|
||||
{
|
||||
RigFormationNames* formNames = rimCase->activeFormationNames()->formationNamesData();
|
||||
auto formNames = rimCase->activeFormationNames()->formationNamesData();
|
||||
|
||||
size_t k = cvf::UNDEFINED_SIZE_T;
|
||||
{
|
||||
|
||||
@@ -449,7 +449,7 @@ QString RiuResultTextBuilder::formationDetails()
|
||||
{
|
||||
if ( rimCase->activeFormationNames() && rimCase->activeFormationNames()->formationNamesData() )
|
||||
{
|
||||
RigFormationNames* formNames = rimCase->activeFormationNames()->formationNamesData();
|
||||
auto formNames = rimCase->activeFormationNames()->formationNamesData();
|
||||
|
||||
size_t k = cvf::UNDEFINED_SIZE_T;
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user