Revamped node map and scene node map to share a single scene map

manager and obtain building information from the config object.
Separated test code from base scene node map code.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@351 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-09-28 00:46:54 +00:00
parent da1484a019
commit 2c98b8ce10
2 changed files with 47 additions and 10 deletions
@@ -1,5 +1,5 @@
//
// $Id: NodeMapPanel.java,v 1.3 2001/08/28 23:50:45 shaper Exp $
// $Id: NodeMapPanel.java,v 1.4 2001/09/28 00:46:54 shaper Exp $
package com.threerings.nodemap;
@@ -12,22 +12,53 @@ import com.samskivert.swing.ToolTipObserver;
import com.samskivert.swing.ToolTipProvider;
/**
* The node map panel handles display of a node map and passes Swing
* UI events on to the appropriate node map event handling methods.
* The node map panel handles display of a node map and passes user
* interface events on to the appropriate node map event handling
* methods.
*/
public class NodeMapPanel extends JPanel
implements MouseListener, MouseMotionListener, ToolTipObserver
{
/**
* Construct a node map panel.
*/
public NodeMapPanel ()
{
init();
}
/**
* Construct a node map panel that displays the given node map.
*
* @param map the node map to display.
*/
public NodeMapPanel (NodeMap map)
{
init();
setNodeMap(map);
}
/**
* Initialize the node map panel.
*/
protected void init ()
{
// listen to our mouse events
addMouseListener(this);
addMouseMotionListener(this);
}
/**
* Set the node map displayed by this panel.
*
* @param map the node map to display.
*/
public void setNodeMap (NodeMap map)
{
_map = map;
// create the tool tip manager and inform the node map
_map.setToolTipManager(new ToolTipManager(this));
// listen to our mouse events
addMouseListener(this);
addMouseMotionListener(this);
}
public void paintComponent (Graphics g)
@@ -1,5 +1,5 @@
//
// $Id: DirectionalLayoutManager.java,v 1.2 2001/08/23 23:44:12 shaper Exp $
// $Id: DirectionalLayoutManager.java,v 1.3 2001/09/28 00:46:54 shaper Exp $
package com.threerings.nodemap.direction;
@@ -10,11 +10,17 @@ import com.threerings.nodemap.*;
/**
* The directional layout manager lays nodes out according to the
* eight cardinal directions as specified in the {@link Directions}
* class. The nodes must be connected with {@link DirectionalEdge}
* edges.
* class. The nodes must be fully connected in both directions with
* {@link DirectionalEdge} edges.
*/
public class DirectionalLayoutManager implements LayoutManager
{
/**
* Construct a directional layout manager that lays out nodes
* connected by edges that are <code>edgelen</code> pixels long.
*
* @param edgelen the length of the edges in pixels.
*/
public DirectionalLayoutManager (int edgelen)
{
_edgelen = edgelen;