Show ternary range on overlay item

This commit is contained in:
Magne Sjaastad
2014-05-06 23:29:41 +02:00
parent cc4e9eb505
commit bed902d005
3 changed files with 58 additions and 3 deletions

View File

@@ -121,9 +121,15 @@ void RivTernarySaturationOverlayItem::render(cvf::OpenGLContext* oglContext, con
cvf::TextDrawer textDrawer(m_font.p());
textDrawer.setTextColor(m_textColor);
textDrawer.addText("SWAT", cvf::Vec2f(0.0, 0.0));
textDrawer.addText("SOIL", cvf::Vec2f(static_cast<float>(size.x() - 28), 0.0));
textDrawer.addText("SWAT", cvf::Vec2f(0.0, 10.0));
textDrawer.addText(m_swatRange, cvf::Vec2f(0.0, 0.0));
textDrawer.addText("SOIL", cvf::Vec2f(static_cast<float>(size.x() - 40), 10.0));
textDrawer.addText(m_soilRange, cvf::Vec2f(static_cast<float>(size.x() - 40), 0.0));
textDrawer.addText("SGAS", cvf::Vec2f(static_cast<float>( (size.x() / 2) - 17 ), static_cast<float>(size.y() - 10)));
textDrawer.addText(m_sgasRange, cvf::Vec2f(static_cast<float>( (size.x() / 2) - 17 ), static_cast<float>(size.y() - 20)));
textDrawer.renderSoftware(oglContext, camera);
renderAxisImmediateMode(oglContext);
@@ -197,4 +203,14 @@ void RivTernarySaturationOverlayItem::renderAxisImmediateMode(cvf::OpenGLContext
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTernarySaturationOverlayItem::setRangeText(const cvf::String& soilRange, const cvf::String& sgasRange, const cvf::String& swatRange)
{
m_soilRange = soilRange;
m_sgasRange = sgasRange;
m_swatRange = swatRange;
}

View File

@@ -40,6 +40,8 @@ public:
RivTernarySaturationOverlayItem(cvf::Font* font);
~RivTernarySaturationOverlayItem();
void setRangeText(const cvf::String& soilRange, const cvf::String& sgasRange, const cvf::String& swatRange);
virtual cvf::Vec2ui sizeHint();
virtual void render(cvf::OpenGLContext* oglContext, const cvf::Vec2i& position, const cvf::Vec2ui& size);
@@ -56,6 +58,10 @@ private:
private:
cvf::Color3f m_textColor; // Text color
cvf::ref<cvf::Font> m_font;
cvf::String m_soilRange;
cvf::String m_sgasRange;
cvf::String m_swatRange;
cvf::Vec2ui m_size; // Pixel size of draw area
};