|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for drawing the topology.
To save a screenshot of
the topology, you need an implementation of this interface, such as
DefaultTopologyVisualizer
. For example,
private class ScreenshotProvider extends DefaultTopologyVisualizer { public ScreenshotProvider(org.mates.sim.Simulator simulator) { super(); setSimulator(simulator); } public void paint(java.awt.Graphics g) { super.paint(g, false); // we shouldn't double-buffer by default! } } boolean saveTopologyScreenshot(org.mates.sim.Simulator simulator, Java.io.File saveFile) throws java.lang.IllegalArgumentException, java.lang.ClassNotFoundException, java.io.IOException { ScreenshotProvider sp = new ScreenshotProvider(simulator); sp.setSize(new java.awt.Dimension(simulator.getDomainWidth(), simulator.getDomainHeight())); return org.mates.util.Screenshot.saveScreenshot(sp, sp.getWidth(), sp.getHeight(), saveFile); }
Method Summary | |
boolean |
getDrawRadioRanges()
Returns whether or not radio ranges will be drawn. |
java.awt.Component |
getGUI()
Returns the GUI component associated with this visualizer. |
Host |
getHostAt(int x,
int y,
int radius)
Returns true if and only if a host exists within
radius pixels of the coordinate (x ,
y ). |
boolean |
getViewScale()
Returns whether or not a scale is drawn for the topology. |
void |
highlightHost(Host host)
Highlights a host in the topology. |
boolean |
isPainting()
Returns true if and only if the topology is
currently being painted. |
void |
paint(java.awt.Graphics graphics)
Paints the topology, using double-buffering. |
void |
paint(java.awt.Graphics graphics,
boolean double_buffer)
Paints the topology, with optional double-buffering. |
void |
setDrawRadioRanges(boolean draw_radio_ranges)
Sets whether or not radio ranges of hosts are drawn. |
void |
setSimulator(Simulator simulator)
Sets the simulator associated with this visualizer. |
void |
setViewScale(boolean view_scale)
Sets whether or not a scale is drawn for the topology. |
Method Detail |
public void paint(java.awt.Graphics graphics)
paint(graphics, true)
.
public void paint(java.awt.Graphics graphics, boolean double_buffer)
public void setViewScale(boolean view_scale)
public void setDrawRadioRanges(boolean draw_radio_ranges)
public boolean getDrawRadioRanges()
public boolean getViewScale()
public void highlightHost(Host host)
public boolean isPainting()
true
if and only if the topology is
currently being painted.
public void setSimulator(Simulator simulator)
public Host getHostAt(int x, int y, int radius)
true
if and only if a host exists within
radius
pixels of the coordinate (x
,
y
).
public java.awt.Component getGUI()
JFrame
.
|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |