com.threerings.stage.data

## Class StageScene

- java.lang.Object
- - com.threerings.whirled.data.SceneImpl
  - - com.threerings.stage.data.StageScene

All Implemented Interfaces:
  Scene, SpotScene, Cloneable

    public class StageScene
    extends SceneImpl
    implements SpotScene, Cloneable

The implementation of the Stage scene interface.

### Constructor Summary

Constructors
Constructor and Description
`StageScene(StageSceneModel model, com.threerings.crowd.data.PlaceConfig config)` Creates an instance that will obtain data from the supplied scene model and place config.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addObject(com.threerings.miso.data.ObjectInfo info)` Adds a new object to this scene.
`void` `addPortal(Portal portal)` Adds a portal to this scene, immediately making the requisite modifications to the underlying scene model.
`StageScene` `clone()`
`Iterator<com.threerings.miso.data.ObjectInfo>` `enumerateObjects()` Iterates over all of the interesting objects in this scene.
`int` `getDefaultColor(int classId)` Get the default color id to use for the specified colorization class, or -1 if no default is set.
`Portal` `getDefaultEntrance()` Returns the portal that represents the default entrance to this scene.
`short` `getNextPortalId()` Returns the portal id that should be assigned to the next portal added to this scene.
`Portal` `getPortal(int portalId)` Returns a `Portal` object for the portal with the specified id or null if no portal exists with that id.
`int` `getPortalCount()` Returns the number of portals in this scene.
`Iterator<Portal>` `getPortals()` Returns an iterator over the portals in this scene.
`String` `getType()` Returns the scene type (e.g.
`int` `getZoneId()` Returns the zone id to which this scene belongs.
`boolean` `removeObject(com.threerings.miso.data.ObjectInfo info)` Removes an object from this scene.
`void` `removePortal(Portal portal)` Removes the specified portal from the scene.
`void` `setDefaultColor(int classId, int colorId)` Set the default color to use for the specified colorization class id.
`void` `setDefaultEntrance(Portal portal)` Sets the default entrance in this scene, immediately making the requisite modifications to the underlying scene model.
`void` `setType(String type)` Sets the type of this scene.
`void` `updateReceived(SceneUpdate update)` Called to inform the scene that an update has been received while the scene was resolved and active.

### Methods inherited from class com.threerings.whirled.data.SceneImpl

`getId, getName, getPlaceConfig, getSceneModel, getVersion, setId, setName, setVersion, toString`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### StageScene

    public StageScene(StageSceneModel model,
                      com.threerings.crowd.data.PlaceConfig config)

Creates an instance that will obtain data from the supplied scene model and place config.

### Method Detail

#### getType

    public String getType()

Returns the scene type (e.g. "world", "port", "bank", etc.).

#### getZoneId

    public int getZoneId()

Returns the zone id to which this scene belongs.

#### setType

    public void setType(String type)

Sets the type of this scene.

#### getDefaultColor

    public int getDefaultColor(int classId)

Get the default color id to use for the specified colorization class, or -1 if no default is set.

#### setDefaultColor

    public void setDefaultColor(int classId,
                                int colorId)

Set the default color to use for the specified colorization class id. Setting the colorId to -1 disables the default.

#### enumerateObjects

    public Iterator<com.threerings.miso.data.ObjectInfo> enumerateObjects()

Iterates over all of the interesting objects in this scene.

#### addObject

    public void addObject(com.threerings.miso.data.ObjectInfo info)

Adds a new object to this scene.

#### removeObject

    public boolean removeObject(com.threerings.miso.data.ObjectInfo info)

Removes an object from this scene.

#### updateReceived

    public void updateReceived(SceneUpdate update)

Description copied from interface: `Scene`
Called to inform the scene that an update has been received while the scene was resolved and active. The update should be applied to the underlying scene model and any derivative data should be appropriately updated.

Specified by:
  `updateReceived` in interface `Scene`
Overrides:
  `updateReceived` in class `SceneImpl`

#### clone

    public StageScene clone()
                     throws CloneNotSupportedException

Overrides:
  `clone` in class `Object`
Throws:
  `CloneNotSupportedException`

#### getPortal

    public Portal getPortal(int portalId)

Description copied from interface: `SpotScene`
Returns a `Portal` object for the portal with the specified id or null if no portal exists with that id.

Specified by:
  `getPortal` in interface `SpotScene`

#### getPortalCount

    public int getPortalCount()

Description copied from interface: `SpotScene`
Returns the number of portals in this scene.

Specified by:
  `getPortalCount` in interface `SpotScene`

#### getPortals

    public Iterator<Portal> getPortals()

Description copied from interface: `SpotScene`
Returns an iterator over the portals in this scene.

Specified by:
  `getPortals` in interface `SpotScene`

#### getNextPortalId

    public short getNextPortalId()

Description copied from interface: `SpotScene`
Returns the portal id that should be assigned to the next portal added to this scene.

Specified by:
  `getNextPortalId` in interface `SpotScene`

#### getDefaultEntrance

    public Portal getDefaultEntrance()

Description copied from interface: `SpotScene`
Returns the portal that represents the default entrance to this scene. If a body enters the scene at logon time rather than entering from some other scene, this is the portal at which they would appear.

Specified by:
  `getDefaultEntrance` in interface `SpotScene`

#### addPortal

    public void addPortal(Portal portal)

Description copied from interface: `SpotScene`
Adds a portal to this scene, immediately making the requisite modifications to the underlying scene model. The portal id should have already been assigned using the value obtained from `SpotScene.getNextPortalId()`.

Specified by:
  `addPortal` in interface `SpotScene`

#### removePortal

    public void removePortal(Portal portal)

Description copied from interface: `SpotScene`
Removes the specified portal from the scene.

Specified by:
  `removePortal` in interface `SpotScene`

#### setDefaultEntrance

    public void setDefaultEntrance(Portal portal)

Description copied from interface: `SpotScene`
Sets the default entrance in this scene, immediately making the requisite modifications to the underlying scene model.

Specified by:
  `setDefaultEntrance` in interface `SpotScene`