Added code to parse gapSize and offsetPos.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@651 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
//
|
||||
// $Id: SwissArmyTileSetRuleSet.java,v 1.4 2001/11/21 02:42:15 mdb Exp $
|
||||
// $Id: SwissArmyTileSetRuleSet.java,v 1.5 2001/11/27 22:06:19 mdb Exp $
|
||||
|
||||
package com.threerings.media.tools.tile.xml;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
@@ -70,6 +71,28 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
((SwissArmyTileSet)target).setTileCounts(tileCounts);
|
||||
}
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/offsetPos",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] values = StringUtil.parseIntArray(bodyText);
|
||||
SwissArmyTileSet starget = (SwissArmyTileSet)target;
|
||||
starget.setOffsetPos(new Point(values[0], values[1]));
|
||||
}
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/gapSize",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] values = StringUtil.parseIntArray(bodyText);
|
||||
SwissArmyTileSet starget = (SwissArmyTileSet)target;
|
||||
starget.setGapSize(new Dimension(values[0], values[1]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -77,18 +100,4 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
{
|
||||
return SwissArmyTileSet.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string containing values as (x, y) into the
|
||||
* corresponding integer values and populates the given point
|
||||
* object.
|
||||
*
|
||||
* @param str the point values in string format.
|
||||
* @param point the point object to populate.
|
||||
*/
|
||||
protected void parsePoint (String str, Point point)
|
||||
{
|
||||
int vals[] = StringUtil.parseIntArray(str);
|
||||
point.setLocation(vals[0], vals[1]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user