* Computes a set of display objects for the portals in this scene.
*/
protected void recomputePortals ()
{
// create scene objects for our portals
UniformTileSet ots = loadPortalTileSet();
_portobjs.clear();
for (Iterator<Portal> iter = _scene.getPortals(); iter.hasNext(); ) {
Portal portal = iter.next();
StageLocation loc = (StageLocation) portal.loc;
Point p = getScreenCoords(loc.x, loc.y);
int tx = MisoUtil.fullToTile(loc.x);
int ty = MisoUtil.fullToTile(loc.y);
Point ts = MisoUtil.tileToScreen(_metrics, tx, ty, new Point());
// log.info("Added portal", "portal", portal, "screen", StringUtil.toString(p), "tile",
// StringUtil.coordsToString(tx, ty), "tscreen", StringUtil.toString(ts));
ObjectInfo info = new ObjectInfo(0, tx, ty);
info.action = "portal:" + portal.portalId;
// TODO: cache me
ObjectTile tile = new PortalObjectTile(
ts.x + _metrics.tilehwid - p.x + (PORTAL_ICON_WIDTH / 2),
ts.y + _metrics.tilehei - p.y + (PORTAL_ICON_HEIGHT / 2));
tile.setImage(ots.getTileMirage(loc.orient));
_portobjs.add(new SceneObject(this, info, tile) {
@Override
public boolean setHovered (boolean hovered) {
((PortalObjectTile)this.tile).hovered = hovered;