[Libreoffice-commits] core.git: chart2/source
xukai
xukai at multicorewareinc.com
Tue Sep 23 07:55:59 PDT 2014
chart2/source/view/charttypes/GL3DBarChart.cxx | 45 ++++++++++++++++---------
chart2/source/view/inc/GL3DBarChart.hxx | 2 -
2 files changed, 31 insertions(+), 16 deletions(-)
New commits:
commit b8c442f2b924b03533c7029af3ad10b79e8a89c3
Author: xukai <xukai at multicorewareinc.com>
Date: Mon Sep 22 16:38:41 2014 +0800
add 50 histories for histroy rendering
Change-Id: I26ff4655d682960ef397be27d5a9fc894502cf8a
Reviewed-on: https://gerrit.libreoffice.org/11579
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
Tested-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 6581392..8215158 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -29,7 +29,8 @@
#define DATA_UPDATE_TIME 15
#define FPS_TIME 500
#define DATAUPDATE_FPS_TIME 1000
-#define HISTORY_NUM 5
+#define HISTORY_NUM 51
+#define COLUMNSIZE 25
#define SHOW_VALUE_COUNT 15
#define SHOW_SCROLL_TEXT_DISTANCE 1000
#define FLY_THRESHOLD 20
@@ -1067,7 +1068,7 @@ void GL3DBarChart::updateRenderFPS()
osl_getSystemTime(&maFPSRenderStartTime);
}
osl_getSystemTime(&maFPSRenderEndTime);
- addScreenTextShape(maFPS, glm::vec2(-0.99f, 0.99f), 0.06f, true,
+ 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));
}
@@ -1113,8 +1114,7 @@ void GL3DBarChart::updateDataUpdateFPS()
osl_getSystemTime(&maDataUpdateStartTime);
}
osl_getSystemTime(&maDataUpdateEndTime);
- addScreenTextShape(maDataUpdateFPS, glm::vec2(-0.99f, 0.93f), 0.06f, true,
- glm::vec3(0.0f, 0.0f, 0.0f), glm::vec4(0.0f, 1.0f, 1.0f, 1.0f));
+ addScreenTextShape(maDataUpdateFPS, glm::vec2(-0.99f, 0.92f), 0.07f);
}
void GL3DBarChart::recordBarHistory(sal_uInt32 &nBarID, float &nVal)
@@ -1130,20 +1130,29 @@ void GL3DBarChart::updateClickEvent()
if (maRenderEvent == EVENT_CLICK || maRenderEvent == EVENT_AUTO_FLY || maRenderEvent == EVENT_SHOW_SELECT)
{
std::list<float>& aList = maBarHistory[mnSelectBarId];
- sal_uInt32 aIdex = 0;
+ sal_uInt32 nIdex = 0;
OUString aTitle;
OUString aBarValue;
+ float nXCoordStart;
+ float nYCoordStart;
//write title
if (aList.size() > 1)
{
aTitle = OUString("Time ");
- addScreenTextShape(aTitle, glm::vec2(0.8f, 0.99f), 0.1f, false);
+ addScreenTextShape(aTitle, glm::vec2(0.875f, 0.99f), 0.07f, false);
aTitle = OUString(" Value");
- addScreenTextShape(aTitle, glm::vec2(0.8f, 0.99f), 0.1f);
+ addScreenTextShape(aTitle, glm::vec2(0.875f, 0.99f), 0.07f);
+ }
+ if (aList.size() > COLUMNSIZE)
+ {
+ aTitle = OUString("Time ");
+ addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f, false);
+ aTitle = OUString(" Value");
+ addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f);
}
for (std::list<float>::iterator it = aList.begin();it != aList.end();++it)
{
- if (aIdex + 1 == aList.size())
+ 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));
@@ -1159,20 +1168,26 @@ void GL3DBarChart::updateClickEvent()
}
else
{
- aTitle = OUString("[Time:") + OUString::number((maHistoryCounter - aList.size() + aIdex)) + "]: ";
- if (aIdex == 0)
+ aTitle = OUString("[Time:") + OUString::number((maHistoryCounter - aList.size() + nIdex)) + "]: ";
+ if (nIdex == 0)
{
aTitle = OUString("Most Recent") + aTitle;
}
- else if ((aIdex + 2) == aList.size())
+ if (aList.size() < COLUMNSIZE)
+ {
+ nXCoordStart = 0.875f;
+ nYCoordStart = (nIdex + 1) * 0.07f;
+ }
+ else
{
- aTitle = OUString("Least Recent") + aTitle;
+ nXCoordStart = nIdex < COLUMNSIZE ? 0.55f : 0.875f;
+ nYCoordStart = nIdex < COLUMNSIZE ? (nIdex + 1) * 0.07f : (nIdex - 24) * 0.07f;
}
- addScreenTextShape(aTitle, glm::vec2(0.8f, 0.99f - ((aIdex + 1) * 0.1f)), 0.1f, false);
+ addScreenTextShape(aTitle, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, false);
aBarValue = OUString::number(*it);
- addScreenTextShape(aBarValue, glm::vec2(0.8f, 0.99f - ((aIdex + 1) * 0.1f)), 0.1f);
+ addScreenTextShape(aBarValue, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f);
}
- aIdex++;
+ nIdex++;
}
}
}
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 6e6d3c4..b4fd709 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -104,7 +104,7 @@ private:
int calcTimeInterval(TimeValue &startTime, TimeValue &endTime);
void addScreenTextShape(OUString &nStr, glm::vec2 rLeftOrRightTop, float nTextHeight, bool bLeftTopFlag = true,
const glm::vec3& rPos = glm::vec3(0.0f, 0.0f, 0.0f),
- const glm::vec4& rColor = glm::vec4(0.0f, 0.0f, 1.0f, 1.0f),
+ const glm::vec4& rColor = glm::vec4(0.0f, 1.0f, 1.0f, 1.0f),
sal_uInt32 nEvent = 0);
void recordBarHistory(sal_uInt32 &nBarID, float &nVal);
void updateClickEvent();
More information about the Libreoffice-commits
mailing list