Viewer Interface


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.

Methods

bullet1.gifgetCurrentTime

bullet1.gifgetCurrentTickTime

bullet1.gifgetPreferences

bullet1.gifregisterErrorAndWarningReceiver

bullet1.gifstartModel

bullet1.gifstopModel

bullet1.giftick

bullet1.giftick


getCurrentTime

Returns the number of seconds since startModel was invoked.

public abstract double getCurrentTime( );

Return Values

Returns a double floating-point number.


getCurrentTickTime

Returns the time provided for the most recent call to tick or 0 if tick has not yet been called.

public abstract double getCurrentTickTime( );

Return Values

Returns the double floating-point number representing the current tick time.


getPreferences

Allows the application to dynamically view the viewer preferences. For more information about preferences, see Preferences.

public abstract Preferences getPreferences( );

Return Values

Returns the Preferences object.


registerErrorAndWarningReceiver

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
  );

Parameters
w
The ErrorAndWarningReceiver object to be registered.
Return Values

Returns the ErrorAndWarningReceiver object.


startModel

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( );


stopModel

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( );


tick

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( );


tick

Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.

public abstract void tick(
  double timeToUse
  );

Parameters
timeToUseThe global time for the single sampling.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.