Kaydet (Commit) addc7e82 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

we need to set text size in woorld coordinates

Change-Id: If77133080851a3b2d700ac54c9722f560e71f26e
üst 705c26a6
......@@ -42,6 +42,17 @@ GL3DBarChart::~GL3DBarChart()
mrWindow.setRenderer(NULL);
}
namespace {
const float TEXT_HEIGHT = 10.0f;
float calculateTextWidth(const OUString& rText)
{
return rText.getLength() * 5.0;
}
}
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
ExplicitCategoriesProvider& rCatProvider)
{
......@@ -88,13 +99,12 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aSeriesName, nId++));
opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
Size aTextSize = p->getSize();
glm::vec3 aTopLeft, aTopRight, aBottomRight;
aTopLeft.x = aTextSize.getWidth() * -1.0;
aTopLeft.x = calculateTextWidth(aSeriesName) * -1.0;
aTopLeft.y = nYPos;
aTopRight.y = nYPos;
aBottomRight = aTopRight;
aBottomRight.y += aTextSize.getHeight();
aBottomRight.y += TEXT_HEIGHT;
p->setPosition(aTopLeft, aTopRight, aBottomRight);
sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
......@@ -164,13 +174,12 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++));
opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
Size aTextSize = p->getSize();
aTopLeft.x = nXPos;
aTopLeft.y = nYPos;
aTopRight = aTopLeft;
aTopRight.x += aTextSize.getWidth();
aTopRight.x += calculateTextWidth(aCats[i]);
aBottomRight = aTopRight;
aBottomRight.y += aTextSize.getHeight();
aBottomRight.y += TEXT_HEIGHT;
p->setPosition(aTopLeft, aTopRight, aBottomRight);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment