Renamed IsoSceneModel to IsoSceneViewModel to reflect reality.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@261 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-08-15 22:16:43 +00:00
parent affc3e82b7
commit cff9a1fbef
4 changed files with 28 additions and 26 deletions
@@ -1,5 +1,5 @@
// //
// $Id: IsoSceneView.java,v 1.47 2001/08/15 22:06:21 shaper Exp $ // $Id: IsoSceneView.java,v 1.48 2001/08/15 22:16:43 shaper Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -32,7 +32,7 @@ public class IsoSceneView implements EditableSceneView
* @param model the data model. * @param model the data model.
*/ */
public IsoSceneView (TileManager tilemgr, SpriteManager spritemgr, public IsoSceneView (TileManager tilemgr, SpriteManager spritemgr,
IsoSceneModel model) IsoSceneViewModel model)
{ {
_tilemgr = tilemgr; _tilemgr = tilemgr;
_spritemgr = spritemgr; _spritemgr = spritemgr;
@@ -540,7 +540,7 @@ public class IsoSceneView implements EditableSceneView
_scene.tiles[tpos.x][tpos.y][lnum] = tile; _scene.tiles[tpos.x][tpos.y][lnum] = tile;
} }
public void setModel (IsoSceneModel model) public void setModel (IsoSceneViewModel model)
{ {
_model = model; _model = model;
_model.precalculate(); _model.precalculate();
@@ -684,8 +684,8 @@ public class IsoSceneView implements EditableSceneView
/** The dirty rectangles that need to be re-painted. */ /** The dirty rectangles that need to be re-painted. */
protected ArrayList _dirtyRects; protected ArrayList _dirtyRects;
/** The scene model data. */ /** The scene view model data. */
protected IsoSceneModel _model; protected IsoSceneViewModel _model;
/** The scene object to be displayed. */ /** The scene object to be displayed. */
protected MisoScene _scene; protected MisoScene _scene;
@@ -1,5 +1,5 @@
// //
// $Id: IsoSceneViewModel.java,v 1.8 2001/08/15 22:06:21 shaper Exp $ // $Id: IsoSceneViewModel.java,v 1.9 2001/08/15 22:16:43 shaper Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -9,16 +9,16 @@ import java.awt.Point;
import com.threerings.miso.Log; import com.threerings.miso.Log;
/** /**
* The IsoSceneModel provides a holding place for the myriad * The <code>IsoSceneViewModel</code> class provides a holding place
* parameters and bits of data that describe the details of an * for the myriad parameters and bits of data that describe the
* isometric view of a scene. * details of an isometric view of a scene.
* *
* <p> The member data are public to facilitate speedy referencing by * <p> The member data are public to facilitate speedy referencing by
* the <code>IsoSceneView</code> class. Those wishing to set up an * the <code>IsoSceneView</code> class. Those wishing to set up an
* IsoSceneModel object should do so solely via the constructor and * IsoSceneViewModel object should do so solely via the constructor and
* accessor methods. * accessor methods.
*/ */
public class IsoSceneModel public class IsoSceneViewModel
{ {
/** Tile dimensions and half-dimensions in the view. */ /** Tile dimensions and half-dimensions in the view. */
public int tilewid, tilehei, tilehwid, tilehhei; public int tilewid, tilehei, tilehwid, tilehhei;
@@ -69,9 +69,10 @@ public class IsoSceneModel
public boolean showPaths; public boolean showPaths;
/** /**
* Construct an IsoSceneModel with reasonable default values. * Construct an <code>IsoSceneViewModel</code> with reasonable
* default values.
*/ */
public IsoSceneModel () public IsoSceneViewModel ()
{ {
setTileDimensions(32, 16); setTileDimensions(32, 16);
setFineGranularity(4); setFineGranularity(4);
@@ -1,5 +1,5 @@
// //
// $Id: SceneViewPanel.java,v 1.6 2001/08/15 01:08:49 mdb Exp $ // $Id: SceneViewPanel.java,v 1.7 2001/08/15 22:16:43 shaper Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -22,7 +22,7 @@ public class SceneViewPanel extends JPanel
public SceneViewPanel (TileManager tilemgr, SpriteManager spritemgr) public SceneViewPanel (TileManager tilemgr, SpriteManager spritemgr)
{ {
// create the data model for the scene view // create the data model for the scene view
_smodel = new IsoSceneModel(); _smodel = new IsoSceneViewModel();
_smodel.setTileDimensions(TWIDTH, THEIGHT); _smodel.setTileDimensions(TWIDTH, THEIGHT);
_smodel.setBounds((HTILES * TWIDTH), (VTILES * THEIGHT)); _smodel.setBounds((HTILES * TWIDTH), (VTILES * THEIGHT));
_smodel.setOrigin(_smodel.bounds.width / 2, VOFFSET); _smodel.setOrigin(_smodel.bounds.width / 2, VOFFSET);
@@ -106,8 +106,8 @@ public class SceneViewPanel extends JPanel
/** The graphics context for the offscreen image. */ /** The graphics context for the offscreen image. */
protected Graphics _offg; protected Graphics _offg;
/** The scene data model. */ /** The scene view data model. */
protected IsoSceneModel _smodel; protected IsoSceneViewModel _smodel;
/** The scene view we're managing. */ /** The scene view we're managing. */
protected SceneView _view; protected SceneView _view;
@@ -1,5 +1,5 @@
// //
// $Id: IsoUtil.java,v 1.4 2001/08/15 03:13:06 shaper Exp $ // $Id: IsoUtil.java,v 1.5 2001/08/15 22:16:43 shaper Exp $
package com.threerings.miso.scene.util; package com.threerings.miso.scene.util;
@@ -32,7 +32,7 @@ public class IsoUtil
* class's direction constants. * class's direction constants.
*/ */
public static int getDirection ( public static int getDirection (
IsoSceneModel model, int ax, int ay, int bx, int by) IsoSceneViewModel model, int ax, int ay, int bx, int by)
{ {
Point afpos = new Point(), bfpos = new Point(); Point afpos = new Point(), bfpos = new Point();
@@ -121,7 +121,7 @@ public class IsoUtil
* @param tpos the point object to place coordinates in. * @param tpos the point object to place coordinates in.
*/ */
public static void screenToTile ( public static void screenToTile (
IsoSceneModel model, int sx, int sy, Point tpos) IsoSceneViewModel model, int sx, int sy, Point tpos)
{ {
// calculate line parallel to the y-axis (from mouse pos to x-axis) // calculate line parallel to the y-axis (from mouse pos to x-axis)
int bY = (int)(sy - (model.slopeY * sx)); int bY = (int)(sy - (model.slopeY * sx));
@@ -151,7 +151,7 @@ public class IsoUtil
* @param spos the point object to place coordinates in. * @param spos the point object to place coordinates in.
*/ */
public static void tileToScreen ( public static void tileToScreen (
IsoSceneModel model, int x, int y, Point spos) IsoSceneViewModel model, int x, int y, Point spos)
{ {
spos.x = model.origin.x + ((x - y - 1) * model.tilehwid); spos.x = model.origin.x + ((x - y - 1) * model.tilehwid);
spos.y = model.origin.y + ((x + y) * model.tilehhei); spos.y = model.origin.y + ((x + y) * model.tilehhei);
@@ -167,7 +167,7 @@ public class IsoUtil
* @param ppos the point object to place coordinates in. * @param ppos the point object to place coordinates in.
*/ */
public static void fineToPixel ( public static void fineToPixel (
IsoSceneModel model, int x, int y, Point ppos) IsoSceneViewModel model, int x, int y, Point ppos)
{ {
ppos.x = model.tilehwid + ((x - y) * model.finehwid); ppos.x = model.tilehwid + ((x - y) * model.finehwid);
ppos.y = (x + y) * model.finehhei; ppos.y = (x + y) * model.finehhei;
@@ -184,7 +184,7 @@ public class IsoUtil
* @param fpos the point object to place coordinates in. * @param fpos the point object to place coordinates in.
*/ */
public static void pixelToFine ( public static void pixelToFine (
IsoSceneModel model, int x, int y, Point fpos) IsoSceneViewModel model, int x, int y, Point fpos)
{ {
// calculate line parallel to the y-axis (from the given // calculate line parallel to the y-axis (from the given
// x/y-pos to the x-axis) // x/y-pos to the x-axis)
@@ -219,7 +219,7 @@ public class IsoUtil
* @param fpos the point object to place coordinates in. * @param fpos the point object to place coordinates in.
*/ */
public static void screenToFull ( public static void screenToFull (
IsoSceneModel model, int sx, int sy, Point fpos) IsoSceneViewModel model, int sx, int sy, Point fpos)
{ {
// get the tile coordinates // get the tile coordinates
Point tpos = new Point(); Point tpos = new Point();
@@ -247,7 +247,7 @@ public class IsoUtil
* @param spos the point object to place coordinates in. * @param spos the point object to place coordinates in.
*/ */
public static void fullToScreen ( public static void fullToScreen (
IsoSceneModel model, int x, int y, Point spos) IsoSceneViewModel model, int x, int y, Point spos)
{ {
// get the tile screen position // get the tile screen position
Point tspos = new Point(); Point tspos = new Point();
@@ -270,7 +270,8 @@ public class IsoUtil
* @param x the tile x-position coordinate. * @param x the tile x-position coordinate.
* @param y the tile y-position coordinate. * @param y the tile y-position coordinate.
*/ */
public static Polygon getTilePolygon (IsoSceneModel model, int x, int y) public static Polygon getTilePolygon (
IsoSceneViewModel model, int x, int y)
{ {
// get the top-left screen coordinate for the tile // get the top-left screen coordinate for the tile
Point spos = new Point(); Point spos = new Point();