public class SoTimerSensor extends SoTimerQueueSensor
SbTime.getTimeOfDay()
. For example, a timer might be set up to call its function every second on the second by setting the base time to SbTime
(0.0) and the interval to SbTime
(1.0) . Timers are guaranteed to be triggered only once when the timer queue is processed, so if the application only processes the timer queue once every 5 seconds (because it is busy doing something else) the once-a-second sensor's function will only be called once every 5 seconds.
If no base time is set, then the function will be rescheduled from the present time using the interval value.
When a base time has been specified, SoTimers always schedule themselves to be triggered the next multiple of the interval time after the base time. For example, if the once-a-second sensor is triggered at time 2.9 (because the application way busy doing something at time 2.0 and didn't get around to processing the sensor queue for a while) it will reschedule itself to go off at time 3.0, not at time 3.9. On the other hand, if the base time had never been set, then the sensor would be scheduled for time 3.9.
See also:
Inventor.ConstructorCommand
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoTimerSensor()
Default constructor.
|
SoTimerSensor(java.lang.Runnable task)
Build a new timer sensor with the task to be executed when the sensor
is triggered.
|
Modifier and Type | Method and Description |
---|---|
SbTime |
getBaseTime()
Gets the base time.
|
SbTime |
getInterval()
Gets the interval.
|
long |
getMsecInterval()
Deprecated.
As of Open Inventor 9.5, use
getInterval() instead. |
SbTime |
getTriggerTime()
Returns the time at which this sensor is scheduled to be triggered.
|
boolean |
isScheduled()
Returns true if this sensor has been scheduled and is waiting in a sensor queue to be triggered.
|
void |
schedule() |
void |
setBaseTime(SbTime base)
Sets the base time.
|
void |
setDelay(long millisec)
Deprecated.
As of Open Inventor 9.5, use
setBaseTime(com.openinventor.inventor.SbTime) instead. |
void |
setInterval(SbTime intvl)
Sets the interval.
|
void |
setMsecInterval(long millisec)
Deprecated.
As of Open Inventor 9.5, use
setInterval(com.openinventor.inventor.SbTime) instead. |
void |
unschedule() |
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public SoTimerSensor()
public SoTimerSensor(java.lang.Runnable task)
@Deprecated public void setDelay(long millisec)
setBaseTime(com.openinventor.inventor.SbTime)
instead.setDelay
in class SoTimerQueueSensor
@Deprecated public void setMsecInterval(long millisec)
setInterval(com.openinventor.inventor.SbTime)
instead.@Deprecated public long getMsecInterval()
getInterval()
instead.public void unschedule()
unschedule
in class SoSensor
public boolean isScheduled()
SoSensor
isScheduled
in class SoSensor
public SbTime getTriggerTime()
SoTimerQueueSensor
getTriggerTime
in class SoTimerQueueSensor
public SbTime getBaseTime()
public void setInterval(SbTime intvl)
public void setBaseTime(SbTime base)
public SbTime getInterval()
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com