com.threerings.stage.tools.editor
Class TestTileLoader

java.lang.Object
  extended by com.threerings.stage.tools.editor.TestTileLoader
All Implemented Interfaces:
com.threerings.media.tile.TileSetIDBroker

public class TestTileLoader
extends Object
implements com.threerings.media.tile.TileSetIDBroker

The TestTileLoader handles test tiles. Test tiles are tiles that an artist can load in on-the-fly to see how things look in the scene editor.


Field Summary
protected  int _fakeID
          The value of the next fakeID we'll hand out.
protected  Map<String,Integer> _idmap
          A mapping of pathname -> tileset id.
protected  com.threerings.media.tile.ImageProvider _improv
          Our image provider.
protected  com.threerings.media.tile.tools.xml.XMLTileSetParser _parser
          Our xml parser.
 
Constructor Summary
TestTileLoader()
          Construct the TestTileLoader.
 
Method Summary
 void commit()
          Since we're just testing, we don't save these crazy IDs.
 int getTileSetID(String tileSetPath)
          Generate unique and completely fake tileset IDs that will be stable even after a reload of test tiles.
 HashIntMap<com.threerings.media.tile.TileSet> loadTestTiles()
          Check the specified directory and all its subdirectories for xml files.
protected  void loadTestTilesFromDir(File directory, HashIntMap<com.threerings.media.tile.TileSet> sets)
          Load xml tile sets from a directory.
 boolean tileSetMapped(String tilesetPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_fakeID

protected int _fakeID
The value of the next fakeID we'll hand out.


_idmap

protected Map<String,Integer> _idmap
A mapping of pathname -> tileset id.


_parser

protected com.threerings.media.tile.tools.xml.XMLTileSetParser _parser
Our xml parser.


_improv

protected com.threerings.media.tile.ImageProvider _improv
Our image provider.

Constructor Detail

TestTileLoader

public TestTileLoader()
Construct the TestTileLoader.

Method Detail

loadTestTiles

public HashIntMap<com.threerings.media.tile.TileSet> loadTestTiles()
Check the specified directory and all its subdirectories for xml files. Each directory should contain at most one xml file, each xml file should specify at most one tileset. That tileset specification will be used to create tilesets for all the .png files in the same directory.

Returns:
a HashIntMap containing a TileSetId -> TileSet mapping for all the tilesets we create.

loadTestTilesFromDir

protected void loadTestTilesFromDir(File directory,
                                    HashIntMap<com.threerings.media.tile.TileSet> sets)
Load xml tile sets from a directory.


getTileSetID

public int getTileSetID(String tileSetPath)
Generate unique and completely fake tileset IDs that will be stable even after a reload of test tiles.

Specified by:
getTileSetID in interface com.threerings.media.tile.TileSetIDBroker

tileSetMapped

public boolean tileSetMapped(String tilesetPath)
Specified by:
tileSetMapped in interface com.threerings.media.tile.TileSetIDBroker

commit

public void commit()
Since we're just testing, we don't save these crazy IDs.

Specified by:
commit in interface com.threerings.media.tile.TileSetIDBroker