## 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.

### Viewer Methods

getCurrentTime
getCurrentTickTime
getPreferences
registerErrorAndWarningReceiver
startModel
stopModel
tick()
tick(timeToUse)

####

getCurrentTime

Viewer Interface

Returns the number of seconds since startModel was invoked.

public abstract double getCurrentTime( );

##### Return Values

Returns a double floating-point number.

####

getCurrentTickTime

Viewer Interface

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

Viewer Interface

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

Viewer Interface

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

Viewer Interface

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

Viewer Interface

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

Viewer Interface

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

Viewer Interface

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.