public interface Viewer extends java.lang.Object { // Methods public abstract double getCurrentTime(); public abstract double getCurrentTickTime(); public abstract Preferences getPreferences(); public abstract ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w); public abstract void startModel(); public abstract void stopModel(); public abstract void tick(); public abstract void tick(double timeToUse); }
The Viewer interface methods give complete control over a rendering device. Every method needed to view a model is included here. By implementing these abstract methods, it is possible to write custom viewers that can provide unique functionality. Developers can, for instance, control the tick rate of their models.
registerErrorAndWarningReceiver
Returns the number of seconds since startModel was invoked.
public abstract double getCurrentTime( );
Returns a double floating-point number.
Returns the time provided for the most recent call to tick or 0 if tick has not yet been called.
public abstract double getCurrentTickTime( );
Returns the double floating-point number representing the current tick time.
Allows the application to dynamically view the viewer preferences. For more information about preferences, see Preferences.
public abstract Preferences getPreferences( );
Returns the Preferences object.
Allows the application to register an object that will have its methods invoked upon asynchronous errors encountered when DirectAnimation media is controlling the frame loop or when recoverable errors occur when sampling and displaying the model.
public abstract ErrorAndWarningReceiver registerErrorAndWarningReceiver(
ErrorAndWarningReceiver w
);
Returns the ErrorAndWarningReceiver object.
Starts the behaviors associated with the model at global time 0. Also causes the createModel method on the model itself to be invoked.
public abstract void startModel( );
Forces all media to stop immediately. It is not required to call this method, however, without it, some media (such as sounds) will continue playing until the object is released.
public abstract void stopModel( );
Acutally a shorthand way of writing tick(getCurrentTime()). It is the easiest way to explicitly sample and display model and provides a real-time clock for global time.
public abstract void tick( );
Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.
public abstract void tick(
double timeToUse
);
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.