Implemented and/or cleaned up the XML scene writers.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@675 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-11-29 06:36:29 +00:00
parent f3eeae834a
commit 6bbce232b4
3 changed files with 123 additions and 6 deletions
@@ -1,11 +1,12 @@
//
// $Id: MisoSceneWriter.java,v 1.2 2001/11/20 04:15:44 mdb Exp $
// $Id: MisoSceneWriter.java,v 1.3 2001/11/29 06:36:28 mdb Exp $
package com.threerings.miso.tools.scene.xml;
import org.xml.sax.SAXException;
import com.megginson.sax.DataWriter;
import com.samskivert.util.StringUtil;
import com.threerings.miso.scene.MisoSceneModel;
/**
@@ -24,11 +25,24 @@ public class MisoSceneWriter
throws SAXException
{
writer.startElement("miso");
writer.dataElement("width", Integer.toString(model.width));
writer.dataElement("height", Integer.toString(model.height));
writer.dataElement("base", StringUtil.toString(model.baseTileIds));
writer.dataElement("fringe", StringUtil.toString(model.fringeTileIds));
writer.dataElement("object", StringUtil.toString(model.objectTileIds));
writeSceneData(model, writer);
writer.endElement("miso");
}
/**
* Writes just the scene data which is handy for derived classes which
* may wish to add their own scene data to the scene output.
*/
protected void writeSceneData (MisoSceneModel model, DataWriter writer)
throws SAXException
{
writer.dataElement("width", Integer.toString(model.width));
writer.dataElement("height", Integer.toString(model.height));
writer.dataElement("base",
StringUtil.toString(model.baseTileIds, "", ""));
writer.dataElement("fringe",
StringUtil.toString(model.fringeTileIds, "", ""));
writer.dataElement("object",
StringUtil.toString(model.objectTileIds, "", ""));
}
}