Class RateLimiterAdaptsToRenderTime

java.lang.Object
org.jzy3d.chart.controllers.RateLimiterByMilisecond
org.jzy3d.chart.controllers.RateLimiterAdaptsToRenderTime
All Implemented Interfaces:
RateLimiter

public class RateLimiterAdaptsToRenderTime extends RateLimiterByMilisecond implements RateLimiter
This rate limiter keeps an history of past rendering time to auto configure the rate limit and ensure we stick to actual rendering time before doing an action. This rate limiter is useful to ensure a controller such as mouse or thread won't ask more rendering than possible. The time limit is computed as follow
  • Compute the maximum rendering time in the list of the 10 last rendering time
  • Adds a 20ms margin
This allows adapting the rate limit if the rendering capabilities changes, which may happen according to a changing canvas size, changing screen, changing HiDPI settings, changing content of chart.
  • Field Details

    • canvas

      protected ICanvas canvas
  • Constructor Details

    • RateLimiterAdaptsToRenderTime

      public RateLimiterAdaptsToRenderTime(ICanvas canvas)
    • RateLimiterAdaptsToRenderTime

      public RateLimiterAdaptsToRenderTime()
  • Method Details

    • rateLimitCheck

      public boolean rateLimitCheck()
      Returns true if the canvas is NOT rendering
      Specified by:
      rateLimitCheck in interface RateLimiter
      Overrides:
      rateLimitCheck in class RateLimiterByMilisecond
      Returns:
    • adaptRateLimitToRenderTimeHistory

      protected void adaptRateLimitToRenderTimeHistory()
    • getLastRenderingTimeFromCanvas

      protected double getLastRenderingTimeFromCanvas()
    • max

      protected double max(Queue<Double> renderingTimeHistory)
    • getCanvas

      public ICanvas getCanvas()
    • setCanvas

      public void setCanvas(ICanvas canvas)