Fixed background color setting for legends and refactored Legend class hierarchy

* Added a new cafTitledOverlayFrame as a base-class for all ResInsight legend classes
  * Inherits cvf::OverlayItem
This commit is contained in:
Gaute Lindkvist committed 2018-04-09 13:14:19 +02:00
1 parent 7a09b9a146
commit 507229f84b
14 files changed
+315 -390

No files matched your search

@@ -19,7 +19,7 @@
#pragma once
#include "cvfOverlayItem.h"
#include "cafTitledOverlayFrame.h"
#include "cvfMatrix4.h"
#include "cvfColor3.h"
#include "cvfColor4.h"
@@ -36,7 +36,7 @@ class Font;
//
//
//==================================================================================================
class RivTernarySaturationOverlayItem : public cvf::OverlayItem
class RivTernarySaturationOverlayItem : public caf::TitledOverlayFrame
{
public:
explicit RivTernarySaturationOverlayItem(cvf::Font* font);
@@ -44,16 +44,9 @@ public:
void setRangeText(const cvf::String& soilRange, const cvf::String& sgasRange, const cvf::String& swatRange);
void setSize(const cvf::Vec2ui& size);
void setAxisLabelsColor(const cvf::Color3f& color);
void setTitle(const cvf::String& title);
void enableBackground(bool enable);
void setBackgroundColor(const cvf::Color4f& backgroundColor);
void setBackgroundFrameColor(const cvf::Color4f& backgroundFrameColor);
private:
cvf::Vec2ui sizeHint() override;
void render(cvf::OpenGLContext* oglContext,
const cvf::Vec2i& position,
const cvf::Vec2ui& size) override;
@@ -68,19 +61,8 @@ private:
void renderAxisImmediateMode(float upperY, float lowerBoundY, float border, cvf::OpenGLContext* oglContext);
private:
cvf::Color3f m_textColor; // Text color
cvf::ref<cvf::Font> m_font;
bool m_isBackgroundEnabled;
cvf::Color4f m_backgroundColor;
cvf::Color4f m_backgroundFrameColor;
cvf::String m_soilRange;
cvf::String m_sgasRange;
cvf::String m_swatRange;
cvf::Vec2ui m_size; // Pixel size of draw area
std::vector<cvf::String> m_titleStrings;
};