From 5ae63595d09cba3522fc31751aea37aa66100d88 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 19 Apr 2003 23:47:24 +0000 Subject: [PATCH] Added toString() fixed broken getObjects(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2436 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../miso/data/SparseMisoSceneModel.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/miso/data/SparseMisoSceneModel.java b/src/java/com/threerings/miso/data/SparseMisoSceneModel.java index 850db3370..ef3819aec 100644 --- a/src/java/com/threerings/miso/data/SparseMisoSceneModel.java +++ b/src/java/com/threerings/miso/data/SparseMisoSceneModel.java @@ -1,5 +1,5 @@ // -// $Id: SparseMisoSceneModel.java,v 1.1 2003/04/19 22:40:34 mdb Exp $ +// $Id: SparseMisoSceneModel.java,v 1.2 2003/04/19 23:47:24 mdb Exp $ package com.threerings.miso.data; @@ -11,6 +11,7 @@ import com.samskivert.util.ArrayUtil; import com.samskivert.util.HashIntMap; import com.samskivert.util.IntListUtil; import com.samskivert.util.ListUtil; +import com.samskivert.util.StringUtil; import com.threerings.io.SimpleStreamableObject; @@ -240,12 +241,12 @@ public class SparseMisoSceneModel extends MisoSceneModel // documentation inherited public void getObjects (Rectangle region, ObjectSet set) { - int minx = MathUtil.floorDiv(region.x, swidth); - int maxx = MathUtil.floorDiv(region.x+region.width-1, swidth); - int miny = MathUtil.floorDiv(region.y, sheight); - int maxy = MathUtil.floorDiv(region.y+region.height-1, sheight); - for (int yy = miny; yy <= maxy; yy++) { - for (int xx = minx; xx <= maxx; xx++) { + int minx = MathUtil.floorDiv(region.x, swidth)*swidth; + int maxx = MathUtil.floorDiv(region.x+region.width-1, swidth)*swidth; + int miny = MathUtil.floorDiv(region.y, sheight)*sheight; + int maxy = MathUtil.floorDiv(region.y+region.height-1, sheight)*sheight; + for (int yy = miny; yy <= maxy; yy += sheight) { + for (int xx = minx; xx <= maxx; xx += swidth) { Section sec = getSection(xx, yy, false); if (sec != null) { sec.getObjects(region, set); @@ -298,6 +299,14 @@ public class SparseMisoSceneModel extends MisoSceneModel return _sections.values().iterator(); } + // documentation inherited + protected void toString (StringBuffer buf) + { + super.toString(buf); + buf.append(", sections=" + + StringUtil.toString(_sections.values().iterator())); + } + /** * Returns the key for the specified section. */