|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.io.SimpleStreamableObject
com.threerings.miso.data.MisoSceneModel
com.threerings.miso.data.SparseMisoSceneModel
public class SparseMisoSceneModel
Contains miso scene data that is broken up into NxN tile sections.
| Nested Class Summary | |
|---|---|
static interface |
SparseMisoSceneModel.ObjectVisitor
An interface that allows external entities to "visit" and inspect every object in this scene. |
static class |
SparseMisoSceneModel.Section
Contains information on a section of this scene. |
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
com.threerings.io.Streamable.Closure |
| Field Summary | |
|---|---|
protected StreamableHashMap<Integer,SparseMisoSceneModel.Section> |
_sections
Contains our sections in row major order. |
int |
defTileSet
The tileset to use when we have no tile data. |
short |
sheight
The dimensions of a section of our scene. |
short |
swidth
The dimensions of a section of our scene. |
| Constructor Summary | |
|---|---|
SparseMisoSceneModel()
Creates a blank model suitable for unserialization. |
|
SparseMisoSceneModel(int swidth,
int sheight)
Creates a scene model with the specified bounds. |
|
| Method Summary | |
|---|---|
boolean |
addObject(ObjectInfo info)
Adds an object to this scene. |
SparseMisoSceneModel |
clone()
|
void |
getAllObjects(ArrayList<ObjectInfo> list)
Adds all ObjectInfo records in this scene to the supplied list. |
int |
getBaseTileId(int col,
int row)
Returns the fully qualified tile id of the base tile at the specified coordinates. |
int |
getDefaultBaseTileSet()
Scene models can return a default tileset to be used when no base tile data exists for a particular tile. |
void |
getInterestingObjects(ArrayList<ObjectInfo> list)
Adds all interesting ObjectInfo records in this scene to
the supplied list. |
void |
getObjects(Rectangle region,
ObjectSet set)
Populates the supplied object set with info on all objects whose origin falls in the requested region. |
protected SparseMisoSceneModel.Section |
getSection(int x,
int y,
boolean create)
Returns the section for the specified tile coordinate. |
Iterator<SparseMisoSceneModel.Section> |
getSections()
Don't call this method! |
protected int |
key(int x,
int y)
Returns the key for the specified section. |
boolean |
removeObject(ObjectInfo info)
Removes the specified object from the scene. |
boolean |
setBaseTile(int fqBaseTileId,
int col,
int row)
Updates the tile at the specified location in the base layer. |
void |
setDefaultBaseTileSet(int tileSetId)
Updates the default base tileset id for this scene. |
void |
setSection(SparseMisoSceneModel.Section section)
Don't call this method! |
protected void |
toString(StringBuilder buf)
|
void |
updateObject(ObjectInfo info)
Updates an object in this scene. |
void |
visitObjects(SparseMisoSceneModel.ObjectVisitor visitor)
Informs the supplied visitor of each object in this scene. |
void |
visitObjects(SparseMisoSceneModel.ObjectVisitor visitor,
boolean interestingOnly)
Informs the supplied visitor of each object in this scene. |
| Methods inherited from class com.threerings.io.SimpleStreamableObject |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public short swidth
public short sheight
public int defTileSet
protected StreamableHashMap<Integer,SparseMisoSceneModel.Section> _sections
| Constructor Detail |
|---|
public SparseMisoSceneModel(int swidth,
int sheight)
swidth - the width of a single section (in tiles).sheight - the height of a single section (in tiles).public SparseMisoSceneModel()
| Method Detail |
|---|
public void getInterestingObjects(ArrayList<ObjectInfo> list)
ObjectInfo records in this scene to
the supplied list.
public void getAllObjects(ArrayList<ObjectInfo> list)
ObjectInfo records in this scene to the supplied list.
public void visitObjects(SparseMisoSceneModel.ObjectVisitor visitor)
public void visitObjects(SparseMisoSceneModel.ObjectVisitor visitor,
boolean interestingOnly)
interestingOnly - if true, only the interesting objects will
be visited.
public int getBaseTileId(int col,
int row)
MisoSceneModel-1 will be returned if there is
no tile at the specified coordinate.
getBaseTileId in class MisoSceneModel
public boolean setBaseTile(int fqBaseTileId,
int col,
int row)
MisoSceneModelNote that if there are fringe tiles associated with this scene, calling this method may result in the surrounding fringe tiles being cleared and subsequently recalculated. This should not be called on a displaying scene unless you know what you are doing.
setBaseTile in class MisoSceneModelfqBaseTileId - the fully-qualified tile id (@see
TileUtil#getFQTileId}) of the tile to set.col - the x-coordinate of the tile to set.row - the y-coordinate of the tile to set.
public void setDefaultBaseTileSet(int tileSetId)
MisoSceneModel
setDefaultBaseTileSet in class MisoSceneModelpublic int getDefaultBaseTileSet()
MisoSceneModel
getDefaultBaseTileSet in class MisoSceneModel
public void getObjects(Rectangle region,
ObjectSet set)
MisoSceneModel
getObjects in class MisoSceneModelpublic boolean addObject(ObjectInfo info)
MisoSceneModel
addObject in class MisoSceneModelpublic void updateObject(ObjectInfo info)
MisoSceneModel
updateObject in class MisoSceneModelpublic boolean removeObject(ObjectInfo info)
MisoSceneModel
removeObject in class MisoSceneModelpublic void setSection(SparseMisoSceneModel.Section section)
public Iterator<SparseMisoSceneModel.Section> getSections()
protected void toString(StringBuilder buf)
toString in class com.threerings.io.SimpleStreamableObject
protected final int key(int x,
int y)
protected final SparseMisoSceneModel.Section getSection(int x,
int y,
boolean create)
public SparseMisoSceneModel clone()
clone in class MisoSceneModel
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||