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:
@@ -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;
|
package com.threerings.nodemap;
|
||||||
|
|
||||||
@@ -12,22 +12,53 @@ import com.samskivert.swing.ToolTipObserver;
|
|||||||
import com.samskivert.swing.ToolTipProvider;
|
import com.samskivert.swing.ToolTipProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The node map panel handles display of a node map and passes Swing
|
* The node map panel handles display of a node map and passes user
|
||||||
* UI events on to the appropriate node map event handling methods.
|
* interface events on to the appropriate node map event handling
|
||||||
|
* methods.
|
||||||
*/
|
*/
|
||||||
public class NodeMapPanel extends JPanel
|
public class NodeMapPanel extends JPanel
|
||||||
implements MouseListener, MouseMotionListener, ToolTipObserver
|
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)
|
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;
|
_map = map;
|
||||||
|
|
||||||
// create the tool tip manager and inform the node map
|
// create the tool tip manager and inform the node map
|
||||||
_map.setToolTipManager(new ToolTipManager(this));
|
_map.setToolTipManager(new ToolTipManager(this));
|
||||||
|
|
||||||
// listen to our mouse events
|
|
||||||
addMouseListener(this);
|
|
||||||
addMouseMotionListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintComponent (Graphics g)
|
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;
|
package com.threerings.nodemap.direction;
|
||||||
|
|
||||||
@@ -10,11 +10,17 @@ import com.threerings.nodemap.*;
|
|||||||
/**
|
/**
|
||||||
* The directional layout manager lays nodes out according to the
|
* The directional layout manager lays nodes out according to the
|
||||||
* eight cardinal directions as specified in the {@link Directions}
|
* eight cardinal directions as specified in the {@link Directions}
|
||||||
* class. The nodes must be connected with {@link DirectionalEdge}
|
* class. The nodes must be fully connected in both directions with
|
||||||
* edges.
|
* {@link DirectionalEdge} edges.
|
||||||
*/
|
*/
|
||||||
public class DirectionalLayoutManager implements LayoutManager
|
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)
|
public DirectionalLayoutManager (int edgelen)
|
||||||
{
|
{
|
||||||
_edgelen = edgelen;
|
_edgelen = edgelen;
|
||||||
|
|||||||
Reference in New Issue
Block a user