Class CameraThreadControllerWithTime
- java.lang.Object
-
- org.jzy3d.chart.controllers.AbstractController
-
- org.jzy3d.chart.controllers.camera.AbstractCameraController
-
- org.jzy3d.chart.controllers.thread.camera.AbstractCameraThreadController
-
- org.jzy3d.chart.controllers.thread.camera.CameraThreadController
-
- org.jzy3d.chart.controllers.thread.camera.CameraThreadControllerWithTime
-
- All Implemented Interfaces:
Runnable
,ICameraMouseController
public class CameraThreadControllerWithTime extends CameraThreadController implements Runnable
TheCameraThreadControllerWithTime
handle rotation of aCamera
according to a speed given in second, which is the time required to make a complete 360° rotation. If the chart is configured to repaint on demand, then the thread will adapt the amount of rendering request according to the current computer capabilities w.r.t. the configuration constraints (size, HiDPI, etc). The rate limiter may be disabled by#setRateLimiter(RateLimiterAdaptsToRenderTime)
In case the angle steps for the rotation are too high, then one should let the chart work with less demanding processing- Disable HiDPI {@link Quality#setPreserveViewportSize(true)}
- Use smaller canvas size.
- Author:
- Martin Pernollet
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CameraThreadControllerWithTime.Direction
-
Field Summary
Fields Modifier and Type Field Description protected CameraThreadControllerWithTime.Direction
direction
Rotation direction : Direction.LEFT makes negative azimuth increments, while Direction.RIGHT make positive azimuth increments.protected static int
MIN_LOOP_PAUSE_MS
Used in case no rate limiter is usedprotected static int
RATE_CHECK_RATE
The interval between each rate limit verification in MSprotected RateLimiter
rateLimiter
A rate limiter to avoid flooding AWT Event thread.protected double
speed
-
Fields inherited from class org.jzy3d.chart.controllers.thread.camera.CameraThreadController
move, sleep, step
-
Fields inherited from class org.jzy3d.chart.controllers.thread.camera.AbstractCameraThreadController
id, process
-
Fields inherited from class org.jzy3d.chart.controllers.camera.AbstractCameraController
perf, prevMouse, threadController, updateViewDefault
-
Fields inherited from class org.jzy3d.chart.controllers.AbstractController
controllerListeners, targets
-
-
Constructor Summary
Constructors Constructor Description CameraThreadControllerWithTime()
CameraThreadControllerWithTime(Chart chart)
Defaults time to spin to 10CameraThreadControllerWithTime(Chart chart, double secondsToCompleteSpin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doRun()
Will only update screen ifAbstractCameraController.isUpdateViewDefault()
, otherwise the thread only move camera and let theEmulGLAnimator
trigger continuous repaints.CameraThreadControllerWithTime.Direction
getDirection()
RateLimiter
getRateLimiter()
double
getSpeed()
void
setDirection(CameraThreadControllerWithTime.Direction direction)
void
setRateLimiter(RateLimiter rateLimiter)
void
setSpeed(double speed)
-
Methods inherited from class org.jzy3d.chart.controllers.thread.camera.CameraThreadController
getStep, setStep
-
Methods inherited from class org.jzy3d.chart.controllers.thread.camera.AbstractCameraThreadController
dispose, run, start, stop
-
Methods inherited from class org.jzy3d.chart.controllers.camera.AbstractCameraController
addSlaveThreadController, addThread, getLODPerf, getSlaveThreadController, getThread, isUpdateViewDefault, removeSlaveThreadController, rotate, rotate, rotate, setLODPerf, setUpdateViewDefault, shift, shift, startThreadController, stopThreadController, zoomX, zoomX, zoomY, zoomY, zoomZ, zoomZ
-
Methods inherited from class org.jzy3d.chart.controllers.AbstractController
addControllerEventListener, fireControllerEvent, getChart, getCharts, register, removeControllerEventListener, unregister
-
-
-
-
Field Detail
-
speed
protected double speed
-
rateLimiter
protected RateLimiter rateLimiter
A rate limiter to avoid flooding AWT Event thread. It adapts according to rendering time to ensure rate limit is not to high (chart rendering capabilities may change over time due to many parameters (chart size, number of drawable, availability of CPU, etc)
-
MIN_LOOP_PAUSE_MS
protected static final int MIN_LOOP_PAUSE_MS
Used in case no rate limiter is used- See Also:
- Constant Field Values
-
RATE_CHECK_RATE
protected static final int RATE_CHECK_RATE
The interval between each rate limit verification in MS- See Also:
- Constant Field Values
-
direction
protected CameraThreadControllerWithTime.Direction direction
Rotation direction : Direction.LEFT makes negative azimuth increments, while Direction.RIGHT make positive azimuth increments.
-
-
Constructor Detail
-
CameraThreadControllerWithTime
public CameraThreadControllerWithTime()
-
CameraThreadControllerWithTime
public CameraThreadControllerWithTime(Chart chart)
Defaults time to spin to 10- Parameters:
chart
-
-
CameraThreadControllerWithTime
public CameraThreadControllerWithTime(Chart chart, double secondsToCompleteSpin)
- Parameters:
chart
-secondsToCompleteSpin
- time in second to let the chart rotate of 2xPI
-
-
Method Detail
-
doRun
protected void doRun()
Will only update screen ifAbstractCameraController.isUpdateViewDefault()
, otherwise the thread only move camera and let theEmulGLAnimator
trigger continuous repaints.- Overrides:
doRun
in classCameraThreadController
-
getSpeed
public double getSpeed()
-
setSpeed
public void setSpeed(double speed)
-
getDirection
public CameraThreadControllerWithTime.Direction getDirection()
-
setDirection
public void setDirection(CameraThreadControllerWithTime.Direction direction)
-
getRateLimiter
public RateLimiter getRateLimiter()
-
setRateLimiter
public void setRateLimiter(RateLimiter rateLimiter)
-
-