Combined display/runtime/editable scenes.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2269 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-02-12 05:41:12 +00:00
parent 89e6252169
commit 38f11ca4c4
2 changed files with 0 additions and 82 deletions
@@ -1,26 +0,0 @@
//
// $Id: RuntimeMisoScene.java,v 1.3 2003/02/04 17:24:56 mdb Exp $
package com.threerings.miso.server;
import java.util.Iterator;
import com.threerings.miso.data.ObjectInfo;
/**
* The Miso scene interface used by the server to deal with scenes.
*/
public interface RuntimeMisoScene
{
/**
* Iterates over the {@link ObjectInfo} instances representing all
* "interesting" objects in the scene.
*/
public Iterator enumerateObjects ();
/**
* Adds the supplied object to this scene and immediately updates the
* underlying scene model.
*/
public void addObject (ObjectInfo info);
}
@@ -1,56 +0,0 @@
//
// $Id: RuntimeMisoSceneImpl.java,v 1.3 2003/02/04 17:24:56 mdb Exp $
package com.threerings.miso.server;
import java.util.ArrayList;
import java.util.Iterator;
import com.threerings.miso.data.MisoSceneModel;
import com.threerings.miso.data.ObjectInfo;
/**
* A basic implementation of the {@link RuntimeMisoScene} interface which
* is used by default if no extended implementation is desired.
*/
public class RuntimeMisoSceneImpl
implements RuntimeMisoScene
{
/**
* Creates an instance that will obtain data from the supplied scene
* model.
*/
public RuntimeMisoSceneImpl (MisoSceneModel model)
{
// stick all of the interesting scene objects into an array list
for (int ii = 0, ll = model.objectInfo.length; ii < ll; ii++) {
_objects.add(model.objectInfo[ii]);
}
}
// documentation inherited
public Iterator enumerateObjects ()
{
return _objects.iterator();
}
// documentation inherited from interface
public void addObject (ObjectInfo info)
{
// slap it on our list
_objects.add(info);
// slip it into the interesting array
int ocount = _model.objectInfo.length;
ObjectInfo[] objectInfo = new ObjectInfo[ocount+1];
System.arraycopy(_model.objectInfo, 0, objectInfo, 0, ocount);
objectInfo[ocount] = info;
_model.objectInfo = objectInfo;
}
/** Our scene model. */
protected MisoSceneModel _model;
/** The object info records. */
protected ArrayList _objects = new ArrayList();
}