diff options
Diffstat (limited to 'chart2/source/view/charttypes/GL3DBarChart.cxx')
-rw-r--r-- | chart2/source/view/charttypes/GL3DBarChart.cxx | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 82151585840d..5241aa8eda79 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -360,6 +360,9 @@ void RenderBenchMarkThread::MoveToCorner() void RenderBenchMarkThread::ProcessScroll() { //will add other process later + mpChart->mpRenderer->EndClick(); + mnStep = 0; + mnStepsTotal = STEPS; mpChart->maRenderEvent = EVENT_SHOW_SCROLL; } @@ -1019,7 +1022,7 @@ void GL3DBarChart::scroll(long nDelta) SharedResourceAccess(maCond1, maCond2); osl::MutexGuard aGuard(maMutex); if ((maRenderEvent != EVENT_NONE) && (maRenderEvent != EVENT_SHOW_SCROLL) && - (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent == EVENT_SHOW_SELECT)) + (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent != EVENT_SHOW_SELECT)) return; glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection); maCameraPosition -= (float((nDelta/10)) * maDir); @@ -1042,17 +1045,18 @@ void GL3DBarChart::contextDestroyed() mbValidContext = false; } -void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftOrRightTop, float nTextHeight, bool bLeftTopFlag, - const glm::vec3& rPos, const glm::vec4& rColor, sal_uInt32 nEvent) +float GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 aLeftOrRightTop, float nTextHeight, bool bLeftTopFlag, + const glm::vec4& rColor, const glm::vec3& rPos, sal_uInt32 nEvent) { maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, rColor, nEvent)); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr); float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * nTextHeight / 2.0f; opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back()); if (bLeftTopFlag) - pScreenText->setPosition(rLeftOrRightTop, glm::vec2(rLeftOrRightTop.x + nRectWidth, rLeftOrRightTop.y - nTextHeight), rPos); + pScreenText->setPosition(aLeftOrRightTop, glm::vec2(aLeftOrRightTop.x + nRectWidth, aLeftOrRightTop.y - nTextHeight), rPos); else - pScreenText->setPosition(glm::vec2(rLeftOrRightTop.x - nRectWidth, rLeftOrRightTop.y), glm::vec2(rLeftOrRightTop.x, rLeftOrRightTop.y - nTextHeight), rPos); + pScreenText->setPosition(glm::vec2(aLeftOrRightTop.x - nRectWidth, aLeftOrRightTop.y), glm::vec2(aLeftOrRightTop.x, aLeftOrRightTop.y - nTextHeight), rPos); + return nRectWidth; } void GL3DBarChart::updateRenderFPS() @@ -1069,7 +1073,7 @@ void GL3DBarChart::updateRenderFPS() } osl_getSystemTime(&maFPSRenderEndTime); addScreenTextShape(maFPS, glm::vec2(-0.99f, 0.99f), 0.07f, true, - glm::vec3(0.0f, 0.0f, 0.0f), glm::vec4(1.0f, 0.0f, 0.0f, 1.0f)); + glm::vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f)); } int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime) @@ -1133,29 +1137,32 @@ void GL3DBarChart::updateClickEvent() sal_uInt32 nIdex = 0; OUString aTitle; OUString aBarValue; - float nXCoordStart; - float nYCoordStart; + float nXCoordStart, nYCoordStart, nTextWidth, nMaxXCoord = 0.0f, nMinXCoord = 1.0f, nMaxHight = 0.0f; //write title if (aList.size() > 1) { aTitle = OUString("Time "); - addScreenTextShape(aTitle, glm::vec2(0.875f, 0.99f), 0.07f, false); + nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.875, 0.99f), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f)); + nMinXCoord = std::min(nMinXCoord, 0.875f - nTextWidth); aTitle = OUString(" Value"); - addScreenTextShape(aTitle, glm::vec2(0.875f, 0.99f), 0.07f); + nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.875f, 0.99f), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f)); + nMaxXCoord = std::max(nMaxXCoord, 0.875f + nTextWidth); } if (aList.size() > COLUMNSIZE) { aTitle = OUString("Time "); - addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f, false); + nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f)); + nMinXCoord = std::min(nMinXCoord, 0.55f - nTextWidth); aTitle = OUString(" Value"); - addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f); + nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f)); + nMaxXCoord = std::max(nMaxXCoord, 0.55f + nTextWidth); } for (std::list<float>::iterator it = aList.begin();it != aList.end();++it) { if (nIdex + 1 == aList.size()) { aBarValue = OUString("Value: ") + OUString::number(*it); - maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), CALC_POS_EVENT_ID)); + maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID)); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue); float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.03; std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(mnSelectBarId); @@ -1173,7 +1180,7 @@ void GL3DBarChart::updateClickEvent() { aTitle = OUString("Most Recent") + aTitle; } - if (aList.size() < COLUMNSIZE) + if (aList.size() <= COLUMNSIZE) { nXCoordStart = 0.875f; nYCoordStart = (nIdex + 1) * 0.07f; @@ -1183,12 +1190,20 @@ void GL3DBarChart::updateClickEvent() nXCoordStart = nIdex < COLUMNSIZE ? 0.55f : 0.875f; nYCoordStart = nIdex < COLUMNSIZE ? (nIdex + 1) * 0.07f : (nIdex - 24) * 0.07f; } - addScreenTextShape(aTitle, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, false); + nMaxHight = std::max(nMaxHight, nYCoordStart + 0.07f); + nTextWidth = addScreenTextShape(aTitle, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f)); + nMinXCoord = std::min(nMinXCoord, nXCoordStart - nTextWidth); aBarValue = OUString::number(*it); - addScreenTextShape(aBarValue, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f); + nTextWidth = addScreenTextShape(aBarValue, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f)); + nMaxXCoord = std::max(nMaxXCoord, nXCoordStart + nTextWidth); } nIdex++; } + //add translucent back ground + aTitle = OUString(" "); + maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aTitle, glm::vec4(0.0f, 0.0f, 0.0f, 0.5f), 0)); + opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back()); + pScreenText->setPosition(glm::vec2(nMinXCoord, 0.99f), glm::vec2(nMaxXCoord, 0.99f - nMaxHight)); } } @@ -1312,7 +1327,7 @@ void GL3DBarChart::updateScroll() for(size_t i = 0; i < aBarInfoList.size(); i++) { OUString aBarValue = OUString("Value: ") + OUString::number(aBarInfoList[i].mnVal); - maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), CALC_POS_EVENT_ID)); + maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID)); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue); float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.03; glm::vec3 aTextPos = glm::vec3(aBarInfoList[i].maPos.x + BAR_SIZE_X / 2.0f, |