/// <summary> /// (internal use) draw tick labels /// </summary> /// <param name="p">render properties</param> protected virtual void iDrawTickLabels(ILRenderProperties p) { if (m_visible) { m_labeledTicks.Draw(p, m_clipping.Min[Index], m_clipping.Max[Index]); } }
/// <summary> /// update axis (recalculate number & position of labels in auto mode, recreate vertices) /// </summary> /// <param name="p">render properties</param> /// <remarks>This method is used internally. There should be no need to call it directly.</remarks> internal virtual void Configure(ILRenderProperties p) { if (m_clipping.Min.IsEmtpy() || m_clipping.Max.IsEmtpy()) { return; } if (p.PassCount > 0) { return; } if (m_labeledTicks.Mode == TickMode.Auto) { int tickCount = GetMaxTickCount(p); if (m_labelProvider != null) { string format = String.Format("g{0}", m_labeledTicks.Precision); m_labeledTicks.Replace( m_labelProvider(m_clipping.Min[Index], m_clipping.Max[Index], tickCount)); } else { m_labeledTicks.CreateAuto(m_clipping.Min[Index], m_clipping.Max[Index], tickCount); } } PrepareMeshes(p); PrepareLabels(p); m_invalidated = false; }
/// <summary> /// (internal use) do the drawing of axis' label /// </summary> /// <param name="p">render properties</param> /// <remarks>When this function is called, depends on the DrawAfterBufferSwaped setting /// of the current TextRenderer.</remarks> protected virtual void iDrawLabel(ILRenderProperties p) { if (m_visible) { m_label.Draw(p); } }
/// <summary> /// do rendering after the buffers have been swapped /// </summary> /// <param name="p">render properties</param> public virtual void RenderState3(ILRenderProperties p) { if (m_labeledTicks.Renderer.DrawAfterBufferSwapped) { iDrawTickLabels(p); } if (m_label.Renderer.DrawAfterBufferSwapped) { iDrawLabel(p); } }
/// <summary> /// number of ticks optimally fitting on screen /// </summary> /// <param name="p">render properties</param> /// <returns>optimal number of ticks for this axis</returns> internal int GetMaxTickCount(ILRenderProperties p) { //System.Diagnostics.Debug.Assert(m_labeledTicks.Mode == TickMode.Auto); SizeF rect = m_labeledTicks.Size; Point s = new Point(), e = new Point(); s = m_labeledTicks.m_lineStart; e = m_labeledTicks.m_lineEnd; s.X = (int)(Math.Floor((float)Math.Abs(e.X - s.X) / (float)(rect.Width + m_labeledTicks.Padding))); s.Y = (int)(Math.Floor((float)Math.Abs(e.Y - s.Y) / (float)(rect.Height + m_labeledTicks.Padding))); return((int)Math.Floor(Math.Max((double)s.X, s.Y) + 1)); }
/// <summary> /// draw this axis in the back (behind the graphs) /// </summary> /// <param name="p">render properties</param> /// <remarks>This method is used internally. There should be no need to call it directly.</remarks> internal virtual void RenderState1(ILRenderProperties p) { if (m_invalidated) { Configure(p); p.Canceled = true; } if (!m_labeledTicks.Renderer.DrawAfterBufferSwapped) { iDrawTickLabels(p); } if (!m_label.Renderer.DrawAfterBufferSwapped) { iDrawLabel(p); } iDrawAxis(p, true); }
/// <summary> /// (internally used) draws the plot /// </summary> /// <param name="props"></param> public override void Draw(ILRenderProperties props) { base.Draw(props); m_valLabel.Draw(props); ILPoint3Df labPos = m_quads[QuadIndices.top].Center; labPos.Z = Math.Max(m_quads[QuadIndices.top].Center.Z,m_quads[QuadIndices.bottom].Center.Z); m_topLabel.Draw(props,labPos); }
/// <summary> /// recreate labels /// </summary> /// <param name="p">render properties</param> public virtual void PrepareLabels(ILRenderProperties p) { // prepare textrenderer }
/// <summary> /// recreate vertices /// </summary> /// <param name="p">render properties</param> public abstract void PrepareMeshes(ILRenderProperties p);
/// <summary> /// Do rendering of foreground (before the graphs) /// </summary> /// <param name="p">render properties</param> public virtual void RenderState2(ILRenderProperties p) { //if (m_invalidated) // Configure(p); iDrawAxis(p, false); }
/// <summary> /// this function does the drawing of the axis lines /// </summary> /// <param name="p">render properties</param> /// <param name="background">true: draw background only, false: draw foreground only</param> /// <remarks>This function is called in the general rendering algorithm. I.e. <b>before</b> the surface buffers has been swapped.</remarks> protected abstract void iDrawAxis(ILRenderProperties p, bool background);