internal override int GetNumberOfVerticesToDraw()
{
if (GuiManagerDrawn)
{
int numVertices = base.GetNumberOfVerticesToDraw(); // takes care of the base window and the position bar which is a button
numVertices += 6; // the horizontal bar
double incrementsPassed = mStart / mVerticalBarIncrement;
if (incrementsPassed != (int)mStart / mVerticalBarIncrement)
incrementsPassed = (int)incrementsPassed + 1;
double xPosOfVerticalBar = incrementsPassed * mVerticalBarIncrement;
// now that we know where the first xPosOfVerticalBar is, we can calculate how many large increment lines/values we'll have.
float offset = (float)((incrementsPassed * mVerticalBarIncrement) - mStart);
if (mLargeIncrementValues.Length != 1 + (int)((mValueWidth - offset) / mVerticalBarIncrement))
mLargeIncrementValues = new float[1 + (int)((mValueWidth - offset) / mVerticalBarIncrement)];
int i = 0;
while (xPosOfVerticalBar <= mStart + mValueWidth && i < mLargeIncrementValues.Length)
{
numVertices += 6;
switch (this.mTimeUnitDisplayed)
{
case TimeUnit.Millisecond:
mLargeIncrementValues[i] = (float)(xPosOfVerticalBar) * 1000;
break;
case TimeUnit.Second:
mLargeIncrementValues[i] = (float)(xPosOfVerticalBar);
break;
}
i++;
xPosOfVerticalBar += mVerticalBarIncrement;
}
incrementsPassed = mStart / mSmallVerticalBarIncrement;
if (incrementsPassed != (int)mStart / mSmallVerticalBarIncrement)
incrementsPassed = (int)incrementsPassed + 1;
xPosOfVerticalBar = incrementsPassed * mSmallVerticalBarIncrement;
while (xPosOfVerticalBar <= mStart + mValueWidth)
{
numVertices += 6;
xPosOfVerticalBar += mSmallVerticalBarIncrement;
}
#region Include the number of text objects to write
if (HasChangedSinceLastCache)
{
UpdateIncrementValueCache(mLargeIncrementValues);
}
if (mShowValues)
{
for (i = 0; i < mCachedIncrementValues.Count; i++)
{
numVertices += 6 * mCachedIncrementValues[i].Length;
}
}
#endregion
return numVertices;
}
else
return 0;
}