mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-13 17:05:59 -06:00
#1180 Added color table framework files and color tables
This commit is contained in:
parent
fb85416b73
commit
3c3e0d96ff
404
ApplicationCode/Application/RiaColorTables.cpp
Normal file
404
ApplicationCode/Application/RiaColorTables.cpp
Normal file
@ -0,0 +1,404 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::normalPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors {
|
||||
cvf::Color3ub( 0, 0, 255),
|
||||
cvf::Color3ub( 0, 127, 255),
|
||||
cvf::Color3ub( 0, 255, 255),
|
||||
cvf::Color3ub( 0, 255, 0),
|
||||
cvf::Color3ub(255, 255, 0),
|
||||
cvf::Color3ub(255, 127, 0),
|
||||
cvf::Color3ub(255, 0, 0)
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::normalPaletteOppositeOrderingColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(255, 0, 0),
|
||||
cvf::Color3ub(255, 127, 0),
|
||||
cvf::Color3ub(255, 255, 0),
|
||||
cvf::Color3ub( 0, 255, 0),
|
||||
cvf::Color3ub( 0, 255, 255),
|
||||
cvf::Color3ub( 0, 127, 255),
|
||||
cvf::Color3ub( 0, 0, 255)
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::blackWhitePaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub::BLACK,
|
||||
cvf::Color3ub::WHITE
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::whiteBlackPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub::WHITE,
|
||||
cvf::Color3ub::BLACK
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::pinkWhitePaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub::DEEP_PINK,
|
||||
cvf::Color3ub::WHITE
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::whitePinkPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub::WHITE,
|
||||
cvf::Color3ub::DEEP_PINK
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::blueWhiteRedPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub::BLUE,
|
||||
cvf::Color3ub::WHITE,
|
||||
cvf::Color3ub::RED
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::redWhiteBluePaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub::RED,
|
||||
cvf::Color3ub::WHITE,
|
||||
cvf::Color3ub::BLUE
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::categoryPaletteColors()
|
||||
{
|
||||
// Based on http://stackoverflow.com/questions/470690/how-to-automatically-generate-n-distinct-colors
|
||||
// and Kelly Colors and sorted by hue
|
||||
// See also http://www.w3schools.com/colors/ for palettes etc.
|
||||
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(128, 62, 117), // hwb(310, 24%, 50%) strong_purple
|
||||
cvf::Color3ub(212, 28, 132), // hwb(326, 11%, 17%) strong_purplish_red
|
||||
cvf::Color3ub(246, 118, 142), // hwb(349, 46%, 4%) strong_purplish_pink
|
||||
cvf::Color3ub(193, 0, 32), // hwb(350, 0%, 24%) vivid_red
|
||||
cvf::Color3ub(127, 24, 13), // hwb( 6, 5%, 50%) strong_reddish_brown
|
||||
cvf::Color3ub(241, 58, 19), // hwb( 11, 7%, 5%) vivid_reddish_orange
|
||||
cvf::Color3ub(255, 122, 92), // hwb( 11, 36%, 0%) strong_yellowish_pink
|
||||
cvf::Color3ub(129, 112, 102), // hwb( 22, 40%, 49%) medium_gray
|
||||
cvf::Color3ub(255, 104, 0), // hwb( 24, 0%, 0%) vivid_orange
|
||||
cvf::Color3ub( 89, 51, 21), // hwb( 26, 8%, 65%) deep_yellowish_brown
|
||||
cvf::Color3ub(255, 142, 0), // hwb( 33, 0%, 0%) vivid_orange_yellow
|
||||
cvf::Color3ub(206, 162, 98), // hwb( 36, 38%, 19%) grayish_yellow
|
||||
cvf::Color3ub(244, 200, 0), // hwb( 49, 0%, 4%) vivid_greenish_yellow
|
||||
cvf::Color3ub(147, 170, 0), // hwb( 68, 0%, 33%) vivid_yellowish_green
|
||||
cvf::Color3ub( 59, 84, 23), // hwb( 85, 9%, 67%) dark_olive_green
|
||||
cvf::Color3ub( 0, 125, 52), // hwb(145, 0%, 51%) vivid_green
|
||||
cvf::Color3ub( 54, 125, 123), // hwb(178, 21%, 51%) vivid_blueish_green
|
||||
cvf::Color3ub( 0, 83, 138), // hwb(204, 0%, 46%) strong_blue
|
||||
cvf::Color3ub(166, 189, 215), // hwb(212, 65%, 16%) very_light_blue
|
||||
cvf::Color3ub( 46, 76, 224) // hwb(230, 18%, 12%) medium_blue
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::angularPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(255, 0, 255),
|
||||
cvf::Color3ub(0, 0, 255),
|
||||
cvf::Color3ub(0, 127, 255),
|
||||
cvf::Color3ub(0, 255, 255),
|
||||
cvf::Color3ub(0, 255, 0),
|
||||
cvf::Color3ub(255, 255, 0),
|
||||
cvf::Color3ub(255, 127, 0),
|
||||
cvf::Color3ub(255, 0, 0),
|
||||
cvf::Color3ub(255, 0, 255)
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::faultsPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(101, 132, 96), // Dark green
|
||||
cvf::Color3ub(255, 131, 140), // Old pink
|
||||
cvf::Color3ub(210, 176, 112), // Light Brown
|
||||
cvf::Color3ub(140, 171, 238), // Light gray blue
|
||||
cvf::Color3ub(255, 205, 131), // Peach
|
||||
cvf::Color3ub(220, 212, 166), // Dark off white
|
||||
cvf::Color3ub(130, 255, 120), // Light green
|
||||
cvf::Color3ub(166, 220, 215), // Light gray torquise
|
||||
cvf::Color3ub(168, 220, 166), // Light gray green
|
||||
cvf::Color3ub(255, 64, 236) // Magneta
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::wellsPaletteColors()
|
||||
{
|
||||
return categoryPaletteColors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::summaryCurveDefaultPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub( 0, 112, 136), // Dark Green-Blue
|
||||
cvf::Color3ub(202, 0, 0), // Red
|
||||
cvf::Color3ub( 78, 204, 0), // Clear Green
|
||||
cvf::Color3ub(236, 118, 0), // Orange
|
||||
cvf::Color3ub( 0, 0, 0), // Black
|
||||
cvf::Color3ub( 56, 56, 255), // Vivid Blue
|
||||
cvf::Color3ub(248, 0, 170), // Magenta
|
||||
cvf::Color3ub(169, 2, 240), // Purple
|
||||
cvf::Color3ub( 0, 221, 221), // Turquoise
|
||||
cvf::Color3ub(201, 168, 206), // Light Violet
|
||||
cvf::Color3ub( 0, 205, 68), // Bluish Green
|
||||
cvf::Color3ub(236, 188, 0), // Mid Yellow
|
||||
cvf::Color3ub( 51, 204, 255), // Bluer Turquoise
|
||||
cvf::Color3ub(164, 193, 0), // Mid Yellowish Green
|
||||
cvf::Color3ub( 0, 143, 239) // Dark Light Blue
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::summaryCurveRedPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(202, 0, 0), // Off Red
|
||||
cvf::Color3ub(255, 51, 51), // Bright Red
|
||||
cvf::Color3ub(255, 102, 102) // Light Red
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::summaryCurveGreenPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub( 78, 204, 0), // Clear Green
|
||||
cvf::Color3ub(164, 193, 0), // Mid Yellowish Green
|
||||
cvf::Color3ub( 0, 205, 68) // Bluish Green
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::summaryCurveBluePaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub( 56, 56, 255), // Vivid Blue
|
||||
cvf::Color3ub( 0, 143, 239), // Dark Light Blue
|
||||
cvf::Color3ub(153, 153, 255) // Off Light Blue
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::summaryCurveBrownPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(186, 101, 44),
|
||||
cvf::Color3ub( 99, 53, 23), // Highway Brown
|
||||
cvf::Color3ub(103, 56, 24), // Dark Brown
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::summaryCurveNoneRedGreenBlueBrownPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub(236, 118, 0), // Orange
|
||||
cvf::Color3ub( 0, 0, 0), // Black
|
||||
cvf::Color3ub(248, 0, 170), // Magenta
|
||||
cvf::Color3ub(236, 188, 0), // Mid Yellow
|
||||
cvf::Color3ub(169, 2, 240), // Purple
|
||||
cvf::Color3ub( 0, 221, 221), // Turquoise
|
||||
cvf::Color3ub(201, 168, 206) // Light Violet
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::black)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkBlue)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkRed)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkGreen)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkYellow)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkMagenta)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkCyan)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkGray)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::blue)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::red)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::green)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::yellow)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::magenta)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::cyan)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::gray))
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::selectionPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::magenta)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::cyan)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::blue)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::red)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::green)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::yellow)),
|
||||
caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::gray))
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
51
ApplicationCode/Application/RiaColorTables.h
Normal file
51
ApplicationCode/Application/RiaColorTables.h
Normal file
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafColorTable.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaColorTables
|
||||
{
|
||||
public:
|
||||
static const caf::ColorTable& normalPaletteColors();
|
||||
static const caf::ColorTable& normalPaletteOppositeOrderingColors();
|
||||
static const caf::ColorTable& blackWhitePaletteColors();
|
||||
static const caf::ColorTable& whiteBlackPaletteColors();
|
||||
static const caf::ColorTable& pinkWhitePaletteColors();
|
||||
static const caf::ColorTable& whitePinkPaletteColors();
|
||||
static const caf::ColorTable& blueWhiteRedPaletteColors();
|
||||
static const caf::ColorTable& redWhiteBluePaletteColors();
|
||||
static const caf::ColorTable& categoryPaletteColors();
|
||||
static const caf::ColorTable& angularPaletteColors();
|
||||
static const caf::ColorTable& faultsPaletteColors();
|
||||
static const caf::ColorTable& wellsPaletteColors();
|
||||
static const caf::ColorTable& summaryCurveDefaultPaletteColors();
|
||||
static const caf::ColorTable& summaryCurveRedPaletteColors();
|
||||
static const caf::ColorTable& summaryCurveGreenPaletteColors();
|
||||
static const caf::ColorTable& summaryCurveBluePaletteColors();
|
||||
static const caf::ColorTable& summaryCurveBrownPaletteColors();
|
||||
static const caf::ColorTable& summaryCurveNoneRedGreenBlueBrownPaletteColors();
|
||||
static const caf::ColorTable& wellLogPlotPaletteColors();
|
||||
static const caf::ColorTable& selectionPaletteColors();
|
||||
};
|
@ -79,6 +79,7 @@ set( APPLICATION_FILES
|
||||
Application/RiaImageCompareReporter.cpp
|
||||
Application/RiaProjectModifier.cpp
|
||||
Application/RiaRegressionTest.cpp
|
||||
Application/RiaColorTables.cpp
|
||||
)
|
||||
|
||||
set( SOCKET_INTERFACE_FILES
|
||||
|
@ -1,33 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiuSelectionColors
|
||||
{
|
||||
public:
|
||||
static cvf::Color3f curveColorFromTable();
|
||||
static cvf::Color3f singleCurveColor();
|
||||
};
|
@ -43,7 +43,8 @@ add_library( ${PROJECT_NAME}
|
||||
cvfStructGrid.h
|
||||
cvfCellRange.cpp
|
||||
cvfCellRange.h
|
||||
|
||||
cafColorTable.cpp
|
||||
cafColorTable.h
|
||||
|
||||
cvfStructGridGeometryGenerator.cpp
|
||||
cvfStructGridGeometryGenerator.h
|
||||
|
115
Fwk/AppFwk/CommonCode/cafColorTable.cpp
Normal file
115
Fwk/AppFwk/CommonCode/cafColorTable.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2017 Ceetron Solutions AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
//
|
||||
// GNU General Public License Usage
|
||||
// This library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||
// for more details.
|
||||
//
|
||||
// GNU Lesser General Public License Usage
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#include "cafColorTable.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
|
||||
namespace caf {
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ColorTable::ColorTable(const std::vector<cvf::Color3ub>& colors)
|
||||
: m_colors(colors)
|
||||
{
|
||||
CVF_ASSERT(m_colors.size() > 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f ColorTable::cycledColor3f(size_t itemIndex) const
|
||||
{
|
||||
return cvf::Color3f(cycledColor3ub(itemIndex));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ub ColorTable::cycledColor3ub(size_t itemIndex) const
|
||||
{
|
||||
size_t modIndex = itemIndex % m_colors.size();
|
||||
|
||||
return m_colors[modIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor ColorTable::cycledQColor(size_t itemIndex) const
|
||||
{
|
||||
cvf::Color3ub col = cycledColor3ub(itemIndex);
|
||||
return QColor(col.r(), col.g(), col.b());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ubArray ColorTable::color3ubArray() const
|
||||
{
|
||||
return cvf::Color3ubArray(m_colors);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3fArray ColorTable::color3fArray() const
|
||||
{
|
||||
cvf::Color3fArray col3fArr;
|
||||
|
||||
col3fArr.resize(m_colors.size());
|
||||
for (const auto& c : m_colors)
|
||||
{
|
||||
col3fArr.add(cvf::Color3f(c));
|
||||
}
|
||||
|
||||
return col3fArr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ub ColorTable::fromQColor(const QColor& color)
|
||||
{
|
||||
return cvf::Color3ub(color.red(), color.green(), color.blue());
|
||||
}
|
||||
|
||||
} // namespace caf
|
74
Fwk/AppFwk/CommonCode/cafColorTable.h
Normal file
74
Fwk/AppFwk/CommonCode/cafColorTable.h
Normal file
@ -0,0 +1,74 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2017 Ceetron Solutions AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
//
|
||||
// GNU General Public License Usage
|
||||
// This library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||
// for more details.
|
||||
//
|
||||
// GNU Lesser General Public License Usage
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
class QColor;
|
||||
|
||||
|
||||
namespace caf {
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class ColorTable
|
||||
{
|
||||
public:
|
||||
ColorTable(const std::vector<cvf::Color3ub>& colors);
|
||||
|
||||
cvf::Color3f cycledColor3f(size_t itemIndex) const;
|
||||
cvf::Color3ub cycledColor3ub(size_t itemIndex) const;
|
||||
QColor cycledQColor(size_t itemIndex) const;
|
||||
|
||||
cvf::Color3ubArray color3ubArray() const;
|
||||
cvf::Color3fArray color3fArray() const;
|
||||
|
||||
static cvf::Color3ub fromQColor(const QColor& color);
|
||||
|
||||
private:
|
||||
const std::vector<cvf::Color3ub> m_colors;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user