Kaydet (Commit) 42d5cfcf authored tarafından weigao's avatar weigao Kaydeden (comit) Markus Mohrhard

modify history data style

Change-Id: I1a86ff55805e88cc559795139c7f8f84d3fb5109
üst ca092a92
...@@ -460,7 +460,8 @@ GL3DBarChart::GL3DBarChart( ...@@ -460,7 +460,8 @@ GL3DBarChart::GL3DBarChart(
miDataUpdateCounter(0), miDataUpdateCounter(0),
mnColorRate(0), mnColorRate(0),
mnAutoFlyBarID(0), mnAutoFlyBarID(0),
mbBenchMarkMode(false) mbBenchMarkMode(false),
maHistoryCounter(0)
{ {
char *aBenchMark = getenv("BENCHMARK_MODE"); char *aBenchMark = getenv("BENCHMARK_MODE");
if (aBenchMark) if (aBenchMark)
...@@ -743,6 +744,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer ...@@ -743,6 +744,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
mpRenderThread->launch(); mpRenderThread->launch();
} }
miDataUpdateCounter++; miDataUpdateCounter++;
maHistoryCounter++;
mbNeedsNewRender = true; mbNeedsNewRender = true;
} }
...@@ -995,13 +997,17 @@ void GL3DBarChart::contextDestroyed() ...@@ -995,13 +997,17 @@ void GL3DBarChart::contextDestroyed()
mbValidContext = false; mbValidContext = false;
} }
void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, const glm::vec3& rPos, const glm::vec4& rColor, sal_uInt32 nEvent) void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftOrRightTop, float nTextHeight, bool bLeftTopFlag,
const glm::vec3& rPos, const glm::vec4& rColor, sal_uInt32 nEvent)
{ {
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, rColor, nEvent)); maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, rColor, nEvent));
const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr);
float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * nTextHeight / 2.0f; float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * nTextHeight / 2.0f;
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back()); opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back());
pScreenText->setPosition(rLeftTop, glm::vec2(rLeftTop.x + nRectWidth, rLeftTop.y - nTextHeight), rPos); if (bLeftTopFlag)
pScreenText->setPosition(rLeftOrRightTop, glm::vec2(rLeftOrRightTop.x + nRectWidth, rLeftOrRightTop.y - nTextHeight), rPos);
else
pScreenText->setPosition(glm::vec2(rLeftOrRightTop.x - nRectWidth, rLeftOrRightTop.y), glm::vec2(rLeftOrRightTop.x, rLeftOrRightTop.y - nTextHeight), rPos);
} }
void GL3DBarChart::updateRenderFPS() void GL3DBarChart::updateRenderFPS()
...@@ -1017,7 +1023,8 @@ void GL3DBarChart::updateRenderFPS() ...@@ -1017,7 +1023,8 @@ void GL3DBarChart::updateRenderFPS()
osl_getSystemTime(&maFPSRenderStartTime); osl_getSystemTime(&maFPSRenderStartTime);
} }
osl_getSystemTime(&maFPSRenderEndTime); osl_getSystemTime(&maFPSRenderEndTime);
addScreenTextShape(maFPS, glm::vec2(-0.99f, 0.99f), 0.06f, glm::vec3(0.0f, 0.0f, 0.0f), glm::vec4(1.0f, 0.0f, 0.0f, 1.0f)); addScreenTextShape(maFPS, glm::vec2(-0.99f, 0.99f), 0.06f, true,
glm::vec3(0.0f, 0.0f, 0.0f), glm::vec4(1.0f, 0.0f, 0.0f, 1.0f));
} }
int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime) int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime)
...@@ -1061,7 +1068,8 @@ void GL3DBarChart::updateDataUpdateFPS() ...@@ -1061,7 +1068,8 @@ void GL3DBarChart::updateDataUpdateFPS()
osl_getSystemTime(&maDataUpdateStartTime); osl_getSystemTime(&maDataUpdateStartTime);
} }
osl_getSystemTime(&maDataUpdateEndTime); osl_getSystemTime(&maDataUpdateEndTime);
addScreenTextShape(maDataUpdateFPS, glm::vec2(-0.99f, 0.93f), 0.06f, 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.93f), 0.06f, true,
glm::vec3(0.0f, 0.0f, 0.0f), glm::vec4(0.0f, 1.0f, 1.0f, 1.0f));
} }
void GL3DBarChart::recordBarHistory(sal_uInt32 &nBarID, float &nVal) void GL3DBarChart::recordBarHistory(sal_uInt32 &nBarID, float &nVal)
...@@ -1078,11 +1086,20 @@ void GL3DBarChart::updateClickEvent() ...@@ -1078,11 +1086,20 @@ void GL3DBarChart::updateClickEvent()
{ {
sal_uInt32 nBarId = maRenderEvent == EVENT_CLICK ? mSelectBarId : mnAutoFlyBarID; sal_uInt32 nBarId = maRenderEvent == EVENT_CLICK ? mSelectBarId : mnAutoFlyBarID;
std::list<float>& aList = maBarHistory[nBarId]; std::list<float>& aList = maBarHistory[nBarId];
sal_uInt32 idex = 0; sal_uInt32 aIdex = 0;
OUString aTitle;
OUString aBarValue;
//write title
if (aList.size() > 1)
{
aTitle = OUString("Time ");
addScreenTextShape(aTitle, glm::vec2(0.8f, 0.99f), 0.1f, false);
aTitle = OUString(" Value");
addScreenTextShape(aTitle, glm::vec2(0.8f, 0.99f), 0.1f);
}
for (std::list<float>::iterator it = aList.begin();it != aList.end();++it) for (std::list<float>::iterator it = aList.begin();it != aList.end();++it)
{ {
OUString aBarValue; if (aIdex + 1 == aList.size())
if (idex + 1 == aList.size())
{ {
aBarValue = OUString("Value: ") + OUString::number(*it); 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, 1.0f), CALC_POS_EVENT_ID));
...@@ -1098,10 +1115,20 @@ void GL3DBarChart::updateClickEvent() ...@@ -1098,10 +1115,20 @@ void GL3DBarChart::updateClickEvent()
} }
else else
{ {
aBarValue = OUString("History_") + OUString::number(idex) + OUString(": ") + OUString::number(*it); aTitle = OUString("[Time:") + OUString::number((maHistoryCounter - aList.size() + aIdex)) + "]: ";
addScreenTextShape(aBarValue, glm::vec2(0.65f, 0.99f - (idex * 0.1f)), 0.1f); if (aIdex == 0)
{
aTitle = OUString("Most Recent") + aTitle;
}
else if ((aIdex + 2) == aList.size())
{
aTitle = OUString("Least Recent") + aTitle;
}
addScreenTextShape(aTitle, glm::vec2(0.8f, 0.99f - ((aIdex + 1) * 0.1f)), 0.1f, false);
aBarValue = OUString::number(*it);
addScreenTextShape(aBarValue, glm::vec2(0.8f, 0.99f - ((aIdex + 1) * 0.1f)), 0.1f);
} }
idex++; aIdex++;
} }
} }
} }
......
...@@ -91,7 +91,7 @@ private: ...@@ -91,7 +91,7 @@ private:
void updateDataUpdateFPS(); void updateDataUpdateFPS();
DECL_LINK(updateTimer, void*); DECL_LINK(updateTimer, void*);
int calcTimeInterval(TimeValue &startTime, TimeValue &endTime); int calcTimeInterval(TimeValue &startTime, TimeValue &endTime);
void addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, 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::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, 0.0f, 1.0f, 1.0f),
sal_uInt32 nEvent = 0); sal_uInt32 nEvent = 0);
...@@ -176,6 +176,7 @@ private: ...@@ -176,6 +176,7 @@ private:
int mnColorRate; int mnColorRate;
sal_uInt32 mnAutoFlyBarID; sal_uInt32 mnAutoFlyBarID;
bool mbBenchMarkMode; bool mbBenchMarkMode;
sal_uInt32 maHistoryCounter;
}; };
} }
......
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