Switch to new unified direction constants.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@818 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
//
|
||||
// $Id: DirectionalEdge.java,v 1.3 2001/08/24 22:13:10 shaper Exp $
|
||||
// $Id: DirectionalEdge.java,v 1.4 2001/12/17 03:34:04 mdb Exp $
|
||||
|
||||
package com.threerings.nodemap.direction;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import com.threerings.nodemap.*;
|
||||
import com.threerings.util.DirectionCodes;
|
||||
|
||||
import com.threerings.nodemap.Edge;
|
||||
import com.threerings.nodemap.Node;
|
||||
|
||||
/**
|
||||
* A directional edge extends the {@link Edge} object to allow
|
||||
* associating a direction with the edge and rendering the edge to the
|
||||
* screen. The edge direction must be one of the directional
|
||||
* constants detailed in the {@link Directions} object.
|
||||
* A directional edge extends the {@link Edge} object to allow associating
|
||||
* a direction with the edge and rendering the edge to the screen. The
|
||||
* edge direction must be one of the directional constants detailed in the
|
||||
* {@link DirectionCodes} class.
|
||||
*/
|
||||
public class DirectionalEdge extends Edge
|
||||
{
|
||||
/** The edge direction as a {@link Directions} constant. */
|
||||
/** The edge direction as a {@link DirectionCodes} constant. */
|
||||
public int dir;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
//
|
||||
// $Id: DirectionalLayoutManager.java,v 1.3 2001/09/28 00:46:54 shaper Exp $
|
||||
// $Id: DirectionalLayoutManager.java,v 1.4 2001/12/17 03:34:04 mdb Exp $
|
||||
|
||||
package com.threerings.nodemap.direction;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.threerings.nodemap.*;
|
||||
import com.threerings.util.DirectionCodes;
|
||||
|
||||
import com.threerings.nodemap.Node;
|
||||
import com.threerings.nodemap.LayoutManager;
|
||||
|
||||
/**
|
||||
* The directional layout manager lays nodes out according to the
|
||||
* eight cardinal directions as specified in the {@link Directions}
|
||||
* class. The nodes must be fully connected in both directions with
|
||||
* {@link DirectionalEdge} edges.
|
||||
* The directional layout manager lays nodes out according to the eight
|
||||
* cardinal directions as specified in the {@link DirectionCodes} class.
|
||||
* The nodes must be fully connected in both directions with {@link
|
||||
* DirectionalEdge} edges.
|
||||
*/
|
||||
public class DirectionalLayoutManager implements LayoutManager
|
||||
public class DirectionalLayoutManager
|
||||
implements LayoutManager, DirectionCodes
|
||||
{
|
||||
/**
|
||||
* Construct a directional layout manager that lays out nodes
|
||||
@@ -57,39 +63,39 @@ public class DirectionalLayoutManager implements LayoutManager
|
||||
|
||||
// shift the node in the appropriate direction
|
||||
switch (e.dir) {
|
||||
case Directions.NORTH:
|
||||
case NORTH:
|
||||
tx -= (_edgelen + wid);
|
||||
ty -= (_edgelen + hei);
|
||||
break;
|
||||
|
||||
case Directions.NORTHEAST:
|
||||
case NORTHEAST:
|
||||
ty -= (_edgelen + hei);
|
||||
break;
|
||||
|
||||
case Directions.EAST:
|
||||
case EAST:
|
||||
tx += (_edgelen + wid);
|
||||
ty -= (_edgelen + hei);
|
||||
break;
|
||||
|
||||
case Directions.SOUTHEAST:
|
||||
case SOUTHEAST:
|
||||
tx += (_edgelen + wid);
|
||||
break;
|
||||
|
||||
case Directions.SOUTH:
|
||||
case SOUTH:
|
||||
tx += (_edgelen + wid);
|
||||
ty += (_edgelen + hei);
|
||||
break;
|
||||
|
||||
case Directions.SOUTHWEST:
|
||||
case SOUTHWEST:
|
||||
ty += (_edgelen + hei);
|
||||
break;
|
||||
|
||||
case Directions.WEST:
|
||||
case WEST:
|
||||
tx -= (_edgelen + wid);
|
||||
ty += (_edgelen + hei);
|
||||
break;
|
||||
|
||||
case Directions.NORTHWEST:
|
||||
case NORTHWEST:
|
||||
tx -= (_edgelen + wid);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// $Id: Directions.java,v 1.1 2001/08/20 22:56:55 shaper Exp $
|
||||
|
||||
package com.threerings.nodemap.direction;
|
||||
|
||||
/**
|
||||
* This class provides a holding place for constants referenced by the
|
||||
* classes that support and make use of directional node maps.
|
||||
*/
|
||||
public class Directions
|
||||
{
|
||||
/** Constants for the eight cardinal compass-point directions. */
|
||||
public static final int NORTH = 0;
|
||||
public static final int NORTHEAST = 1;
|
||||
public static final int EAST = 2;
|
||||
public static final int SOUTHEAST = 3;
|
||||
public static final int SOUTH = 4;
|
||||
public static final int SOUTHWEST = 5;
|
||||
public static final int WEST = 6;
|
||||
public static final int NORTHWEST = 7;
|
||||
|
||||
/** The number of directions. */
|
||||
public static final int NUM_DIRECTIONS = 8;
|
||||
}
|
||||
Reference in New Issue
Block a user