|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.miso.client.SceneBlock
public class SceneBlock
Contains the base and object tile information on a particular rectangular region of a scene.
| Field Summary | |
|---|---|
protected BaseTile[] |
_base
Our base tiles. |
protected Rectangle |
_bounds
The bounds of (in tile coordinates) of this block. |
protected boolean[] |
_covered
Indicates whether our tiles are covered by an object. |
protected TileSet |
_defset
Used to return a tile where we have none. |
protected Polygon |
_footprint
A polygon bounding the footprint of this block. |
protected BaseTile[] |
_fringe
Our fringe tiles. |
protected MisoSceneMetrics |
_metrics
|
protected MisoSceneModel |
_model
|
protected SceneBlock[] |
_neighbors
Our neighbors in the eight cardinal directions. |
protected SceneObject[] |
_objects
Info on our objects. |
protected Rectangle |
_obounds
The bounds (in screen coords) of all objects rendered by this block. |
protected MisoScenePanel |
_panel
The panel for which we contain a block or null if we aren't backed by a panel. |
protected Rectangle |
_sbounds
The bounds (in screen coords) of all images rendered by this block. |
protected TileManager |
_tileMgr
|
protected boolean |
_visi
A debug flag indicating whether we were visible at creation. |
protected boolean |
_wasAbandoned
If we discovered we were no longer needed in our last call to resolve. |
protected static int[] |
DX
|
protected static int[] |
DY
|
| Constructor Summary | |
|---|---|
SceneBlock(MisoSceneModel model,
MisoSceneMetrics metrics,
TileManager tileMgr,
int tx,
int ty,
int width,
int height)
|
|
SceneBlock(MisoScenePanel panel,
int tx,
int ty,
int width,
int height)
Creates a scene block belonging to panel in preparation for its later resolution. |
|
| Method Summary | |
|---|---|
boolean |
addObject(ObjectInfo info)
Adds the supplied object to this block. |
protected int |
blockKey(int tx,
int ty)
Computes the key for the block that holds the specified tile. |
boolean |
canTraverse(Object traverser,
int tx,
int ty)
Returns true if the specified traverser can traverse the specified tile (which is assumed to be in the bounds of this scene block). |
protected BaseTile |
computeFringeTile(int tx,
int ty)
Computes the fringe tile for the specified coordinate. |
void |
computeMemoryUsage(Map<Tile.Key,BaseTile> bases,
Set<BaseTile> fringes,
Map<Tile.Key,ObjectTile> objects,
long[] usage)
Computes the memory usage of the base and object tiles in this scene block; registering counted tiles in the hash map so that other blocks can be sure not to double count them. |
boolean |
deleteObject(ObjectInfo info)
Removes the specified object from this block. |
BaseTile |
getBaseTile(int tx,
int ty)
Returns the base tile at the specified coordinates or null if there's no tile at said coordinates. |
Rectangle |
getBounds()
Returns the bounds of this block, in tile coordinates. |
Polygon |
getFootprint()
Returns the screen-coordinate polygon bounding the footprint of this block. |
BaseTile |
getFringeTile(int tx,
int ty)
Returns the fringe tile at the specified coordinates or null if there's no tile at said coordinates. |
Rectangle |
getObjectBounds()
Returns the bounds of the screen coordinate rectangle that contains all pixels that are drawn on by all objects (but not base tiles) in this block. |
SceneObject[] |
getObjects()
Returns an array of all resolved scene objects in this block. |
Rectangle |
getScreenBounds()
Returns the bounds of the screen coordinate rectangle that contains all pixels that are drawn on by all tiles and objects in this block. |
protected int |
index(int tx,
int ty)
Returns the index into our arrays of the specified tile. |
boolean |
isResolved()
Returns true if this block has been resolved, false if not. |
protected SceneObject |
makeSceneObject(ObjectInfo info)
|
protected int |
neighborKey(int dx,
int dy)
Computes the key of our neighbor. |
boolean |
resolve()
This method is called by the SceneBlockResolver on the
block resolution thread to allow us to load up our image data
without blocking the AWT thread. |
protected void |
setCovered(int tx,
int ty)
Indicates that this tile is covered by an object footprint. |
protected void |
setCovered(Map<Integer,SceneBlock> blocks,
SceneObject scobj)
Sets the footprint of this object tile |
void |
setVisiBlock(boolean visi)
Makes a note that this block was considered to be visible at the time it was created. |
String |
toString()
|
protected void |
update(Map<Integer,SceneBlock> blocks)
Links this block to its neighbors; informs neighboring blocks of object coverage. |
void |
updateBaseTile(int fqTileId,
int tx,
int ty)
Informs this scene block that the specified base tile has been changed. |
void |
updateFringe(int tx,
int ty)
Instructs this block to recompute its fringe at the specified location. |
protected void |
wasResolved()
This is called by the SceneBlockResolver on the AWT thread when our resolution has
completed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected MisoScenePanel _panel
protected MisoSceneMetrics _metrics
protected MisoSceneModel _model
protected TileManager _tileMgr
protected Rectangle _bounds
protected Rectangle _sbounds
protected Rectangle _obounds
protected Polygon _footprint
protected TileSet _defset
protected BaseTile[] _base
protected BaseTile[] _fringe
protected boolean[] _covered
protected SceneObject[] _objects
protected SceneBlock[] _neighbors
protected boolean _visi
protected boolean _wasAbandoned
protected static final int[] DX
protected static final int[] DY
| Constructor Detail |
|---|
public SceneBlock(MisoScenePanel panel,
int tx,
int ty,
int width,
int height)
public SceneBlock(MisoSceneModel model,
MisoSceneMetrics metrics,
TileManager tileMgr,
int tx,
int ty,
int width,
int height)
| Method Detail |
|---|
public void setVisiBlock(boolean visi)
public boolean resolve()
SceneBlockResolver on the
block resolution thread to allow us to load up our image data
without blocking the AWT thread.
protected SceneObject makeSceneObject(ObjectInfo info)
protected BaseTile computeFringeTile(int tx,
int ty)
protected void wasResolved()
SceneBlockResolver on the AWT thread when our resolution has
completed. We inform our containing panel.
public boolean isResolved()
public Rectangle getBounds()
public Rectangle getScreenBounds()
public Rectangle getObjectBounds()
null if
the block has no objects.
public Polygon getFootprint()
public SceneObject[] getObjects()
public BaseTile getBaseTile(int tx,
int ty)
public BaseTile getFringeTile(int tx,
int ty)
public void updateBaseTile(int fqTileId,
int tx,
int ty)
public void updateFringe(int tx,
int ty)
public boolean addObject(ObjectInfo info)
update(java.util.Map) will be
needed.
public boolean deleteObject(ObjectInfo info)
update(java.util.Map) will be needed.
public boolean canTraverse(Object traverser,
int tx,
int ty)
public void computeMemoryUsage(Map<Tile.Key,BaseTile> bases,
Set<BaseTile> fringes,
Map<Tile.Key,ObjectTile> objects,
long[] usage)
public String toString()
toString in class Object
protected final int index(int tx,
int ty)
protected void update(Map<Integer,SceneBlock> blocks)
protected final int neighborKey(int dx,
int dy)
protected final int blockKey(int tx,
int ty)
protected void setCovered(Map<Integer,SceneBlock> blocks,
SceneObject scobj)
protected void setCovered(int tx,
int ty)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||