mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5832 Add color legend data with import from LYR file.
This commit is contained in:
committed by
Kristian Bendiksen
parent
3e5c77e79e
commit
6cb86d4792
@@ -66,6 +66,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifWellMeasurementReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaDateStringParser-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigHexGradientTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifRoffReader-Test.cpp
|
||||
)
|
||||
|
||||
|
||||
85
ApplicationCode/UnitTests/RifColorLegendData-Test.cpp
Normal file
85
ApplicationCode/UnitTests/RifColorLegendData-Test.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RifColorLegendData.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "QDir"
|
||||
#include "RiaTestDataDirectory.h"
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
TEST( RifColorLegendData, ReadLYRFileWithoutColor )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
const QString filename( "RifColorLegendData/Norne_ATW2013.lyr" );
|
||||
const QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
QString errormessage;
|
||||
|
||||
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
|
||||
EXPECT_TRUE( errormessage.isEmpty() );
|
||||
|
||||
QString formationName_K1 = fm->formationNameFromKLayerIdx( 0 );
|
||||
int formationIndex = fm->formationIndexFromKLayerIdx( 1 );
|
||||
|
||||
EXPECT_TRUE( formationName_K1 == "Garn 3" );
|
||||
EXPECT_EQ( 1, formationIndex );
|
||||
}
|
||||
|
||||
TEST( RifColorLegendData, ReadLYRFileWithColorName )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
const QString filename( "RifColorLegendData/Norne_ATW2013ColorName.lyr" );
|
||||
const QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
QString errormessage;
|
||||
|
||||
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
|
||||
EXPECT_TRUE( errormessage.isEmpty() );
|
||||
|
||||
QString formationName_K1 = fm->formationNameFromKLayerIdx( 1 );
|
||||
int formationIndex = fm->formationIndexFromKLayerIdx( 1 );
|
||||
|
||||
cvf::Color3f formationColor;
|
||||
bool colorPresent = fm->formationColorFromKLayerIdx( 1, &formationColor );
|
||||
EXPECT_TRUE( colorPresent );
|
||||
|
||||
EXPECT_TRUE( formationName_K1 == "Garn 2" );
|
||||
EXPECT_EQ( 1, formationIndex );
|
||||
EXPECT_EQ( 1.0f, formationColor.r() );
|
||||
EXPECT_EQ( 0.0f, formationColor.g() );
|
||||
EXPECT_EQ( 0.0f, formationColor.b() );
|
||||
}
|
||||
|
||||
TEST( RifColorLegendData, ReadLYRFileWithColorHTML )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
const QString filename( "RifColorLegendData/Norne_ATW2013ColorHTML.lyr" );
|
||||
const QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
QString errormessage;
|
||||
|
||||
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
|
||||
EXPECT_TRUE( errormessage.isEmpty() );
|
||||
|
||||
QString formationName_K1 = fm->formationNameFromKLayerIdx( 1 );
|
||||
int formationIndex = fm->formationIndexFromKLayerIdx( 1 );
|
||||
|
||||
cvf::Color3f formationColor;
|
||||
bool colorPresent = fm->formationColorFromKLayerIdx( 1, &formationColor );
|
||||
EXPECT_TRUE( colorPresent );
|
||||
|
||||
EXPECT_TRUE( formationName_K1 == "Garn 2" );
|
||||
EXPECT_EQ( 1, formationIndex );
|
||||
EXPECT_EQ( 1.0f, formationColor.r() );
|
||||
EXPECT_EQ( 0.0f, formationColor.g() );
|
||||
EXPECT_EQ( 0.0f, formationColor.b() );
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Formations - Norne FFM ATW2013
|
||||
'Garn 3' 1 - 1
|
||||
'Garn 2' 2 - 2
|
||||
'Garn 1' 3 - 3
|
||||
'Not' 4 - 4
|
||||
'Ile 2.2' 5 - 5
|
||||
'Ile 2.1.3' 6 - 6
|
||||
'Ile 2.1.2' 7 - 7
|
||||
'Ile 2.1.1' 8 - 8
|
||||
'Ile 1.3' 9 - 9
|
||||
'Ile 1.2' 10 - 10
|
||||
'Ile 1.1' 11 - 11
|
||||
'Tofte 2.2' 12 - 12
|
||||
'Tofte 2.1.3' 13 - 13
|
||||
'Tofte 2.1.2' 14 - 14
|
||||
'Tofte 2.1.1' 15 - 15
|
||||
'Tofte 1.2.2' 16 - 16
|
||||
'Tofte 1.2.1' 17 - 17
|
||||
'Tofte 1.1' 18 - 18
|
||||
'Tilje 4' 19 - 19
|
||||
'Tilje 3' 20 - 20
|
||||
'Tilje 2' 21 - 21
|
||||
'Tilje 1' 22 - 22
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Formations - Norne FFM ATW2013
|
||||
'Garn 3' 1 - 1 #000000
|
||||
'Garn 2' 2 - 2 #FF0000
|
||||
'Garn 1' 3 - 3 #00FF00
|
||||
'Not' 4 - 4 #0000FF
|
||||
'Ile 2.2' 5 - 5 #000000
|
||||
'Ile 2.1.3' 6 - 6 #FF0000
|
||||
'Ile 2.1.2' 7 - 7 #00FF00
|
||||
'Ile 2.1.1' 8 - 8 #0000FF
|
||||
'Ile 1.3' 9 - 9 #000000
|
||||
'Ile 1.2' 10 - 10 #FF0000
|
||||
'Ile 1.1' 11 - 11 #00FF00
|
||||
'Tofte 2.2' 12 - 12 #0000FF
|
||||
'Tofte 2.1.3' 13 - 13 #000000
|
||||
'Tofte 2.1.2' 14 - 14 #FF0000
|
||||
'Tofte 2.1.1' 15 - 15 #00FF00
|
||||
'Tofte 1.2.2' 16 - 16 #0000FF
|
||||
'Tofte 1.2.1' 17 - 17 #000000
|
||||
'Tofte 1.1' 18 - 18 #FF0000
|
||||
'Tilje 4' 19 - 19 #00FF00
|
||||
'Tilje 3' 20 - 20 #0000FF
|
||||
'Tilje 2' 21 - 21 #000000
|
||||
'Tilje 1' 22 - 22 #FF0000
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Formations - Norne FFM ATW2013
|
||||
'Garn 3' 1 - 1 black
|
||||
'Garn 2' 2 - 2 red
|
||||
'Garn 1' 3 - 3 green
|
||||
'Not' 4 - 4 black
|
||||
'Ile 2.2' 5 - 5 red
|
||||
'Ile 2.1.3' 6 - 6 green
|
||||
'Ile 2.1.2' 7 - 7 black
|
||||
'Ile 2.1.1' 8 - 8 red
|
||||
'Ile 1.3' 9 - 9 green
|
||||
'Ile 1.2' 10 - 10 black
|
||||
'Ile 1.1' 11 - 11 red
|
||||
'Tofte 2.2' 12 - 12 green
|
||||
'Tofte 2.1.3' 13 - 13 black
|
||||
'Tofte 2.1.2' 14 - 14 red
|
||||
'Tofte 2.1.1' 15 - 15 green
|
||||
'Tofte 1.2.2' 16 - 16 black
|
||||
'Tofte 1.2.1' 17 - 17 red
|
||||
'Tofte 1.1' 18 - 18 green
|
||||
'Tilje 4' 19 - 19 black
|
||||
'Tilje 3' 20 - 20 red
|
||||
'Tilje 2' 21 - 21 green
|
||||
'Tilje 1' 22 - 22 red
|
||||
Reference in New Issue
Block a user