diff --git a/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java b/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java
index dd9b5ef52..3770cd1e5 100644
--- a/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java
+++ b/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java
@@ -1,5 +1,5 @@
//
-// $Id: DisplayMisoSceneImpl.java,v 1.22 2001/08/10 21:17:07 shaper Exp $
+// $Id: DisplayMisoSceneImpl.java,v 1.23 2001/08/10 23:07:04 shaper Exp $
package com.threerings.miso.scene;
@@ -115,31 +115,45 @@ public class Scene
return ClusterUtil.getClusterIndex(_clusters, loc);
}
- public void updateLocation (int x, int y, int orient, int clusteridx)
+ public void updateLocation (Location loc, int clusteridx)
{
// look the location up in our existing location list
int size = _locations.size();
- Location loc = null;
for (int ii = 0; ii < size; ii++) {
Location tloc = (Location)_locations.get(ii);
- if (tloc.x == x && tloc.y == y) {
- // if we found it, update the location information
- tloc.x = x;
- tloc.y = y;
- tloc.orient = orient;
-
- // and update the cluster contents
+ if (tloc == loc) {
+ // if we found it, just update the cluster contents
ClusterUtil.regroup(_clusters, tloc, clusteridx);
-
return;
}
}
- // else we didn't find a location object, so create one
- _locations.add(loc = new Location(x, y, orient));
+ // else we didn't find it, so hold on to the sucker
+ _locations.add(loc);
+
+ // and update the cluster contents
ClusterUtil.regroup(_clusters, loc, clusteridx);
-}
+ }
+
+ /**
+ * Return the location object at the given full coordinates, or
+ * null if no location is currently present.
+ *
+ * @param x the full x-position coordinate.
+ * @param y the full y-position coordinate.
+ *
+ * @return the location object.
+ */
+ public Location getLocation (int x, int y)
+ {
+ int size = _locations.size();
+ for (int ii = 0; ii < size; ii++) {
+ Location loc = (Location)_locations.get(ii);
+ if (loc.x == x && loc.y == y) return loc;
+ }
+ return null;
+ }
/**
* Return the scene name.
diff --git a/src/java/com/threerings/miso/client/IsoSceneView.java b/src/java/com/threerings/miso/client/IsoSceneView.java
index 148caff64..e53780494 100644
--- a/src/java/com/threerings/miso/client/IsoSceneView.java
+++ b/src/java/com/threerings/miso/client/IsoSceneView.java
@@ -1,5 +1,5 @@
//
-// $Id: IsoSceneView.java,v 1.38 2001/08/10 21:17:07 shaper Exp $
+// $Id: IsoSceneView.java,v 1.39 2001/08/10 23:07:04 shaper Exp $
package com.threerings.miso.scene;
@@ -308,9 +308,9 @@ public class IsoSceneView implements EditableSceneView
}
/**
- * Paint rectangular demarcations at all locations in the scene,
- * with each location's cluster index, if any, along the right
- * side of its rectangle.
+ * Paint demarcations at all locations in the scene, with each
+ * location's cluster index, if any, along the right side of its
+ * rectangle.
*
* @param gfx the graphics context.
*/
@@ -318,6 +318,13 @@ public class IsoSceneView implements EditableSceneView
{
ArrayList locations = _scene.getLocations();
int size = locations.size();
+
+ // create the location triangle
+ Polygon tri = new Polygon();
+ tri.addPoint(-3, -3);
+ tri.addPoint(3, -3);
+ tri.addPoint(0, 3);
+
for (int ii = 0; ii < size; ii++) {
// retrieve the location
@@ -331,16 +338,28 @@ public class IsoSceneView implements EditableSceneView
int cx = spos.x, cy = spos.y;
- // outline the location in multiple colors to make sure
- // it's visible atop the unknown smorgasbord of potential tiles
+ // translate the origin to center on the location
+ gfx.translate(cx, cy);
+
+ // rotate to reflect the location orientation
+ double rot = (Math.PI / 4.0f) * loc.orient;
+ gfx.rotate(rot);
+
+ // draw the triangle
gfx.setColor(Color.yellow);
- gfx.fillRect(cx - 1, cy - 1, 3, 3);
+ gfx.fill(tri);
+ // outline the triangle in black
+ gfx.setColor(Color.black);
+ gfx.draw(tri);
+
+ // draw the rectangle
gfx.setColor(Color.red);
- gfx.drawRect(cx - 2, cy - 2, 4, 4);
+ gfx.fillRect(-1, 2, 3, 3);
- gfx.setColor(Color.green);
- gfx.drawRect(cx - 3, cy - 3, 6, 6);
+ // restore the original transform
+ gfx.rotate(-rot);
+ gfx.translate(-cx, -cy);
if (clusteridx != -1) {
// draw the cluster index number on the right side
@@ -540,9 +559,19 @@ public class IsoSceneView implements EditableSceneView
return path;
}
- public void updateLocation (int x, int y, int orient, int clusteridx)
+ public void updateLocation (Location loc, int clusteridx)
{
- _scene.updateLocation(x, y, orient, clusteridx);
+ _scene.updateLocation(loc, clusteridx);
+ }
+
+ public Location getLocation (int x, int y)
+ {
+ return _scene.getLocation(x, y);
+ }
+
+ public int getClusterIndex (Location loc)
+ {
+ return _scene.getClusterIndex(loc);
}
public int getNumClusters ()
diff --git a/src/java/com/threerings/miso/client/Location.java b/src/java/com/threerings/miso/client/Location.java
index 895695fb2..972a1e482 100644
--- a/src/java/com/threerings/miso/client/Location.java
+++ b/src/java/com/threerings/miso/client/Location.java
@@ -1,8 +1,10 @@
//
-// $Id: Location.java,v 1.2 2001/08/10 00:47:34 shaper Exp $
+// $Id: Location.java,v 1.3 2001/08/10 23:07:04 shaper Exp $
package com.threerings.miso.scene;
+import com.threerings.miso.sprite.Path;
+
/**
* The Location class represents a unique well-defined
* location within the scene at the lowest level of granularity
@@ -33,6 +35,19 @@ public class Location
this.orient = orient;
}
+ /**
+ * Construct a Location object with a default orientation.
+ *
+ * @param x the x-position full coordinate.
+ * @param y the y-position full coordinate.
+ */
+ public Location (int x, int y)
+ {
+ this.x = x;
+ this.y = y;
+ this.orient = Path.DIR_SOUTHWEST;
+ }
+
/**
* Return a String representation of this object.
*/