[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SigBio] Map Visualizer class is constructed.
- To: "Cyborg mayhem / SigBio" <sigbio-l@xxxxxxxxxxxx>
- Subject: [SigBio] Map Visualizer class is constructed.
- From: "Takaoki Ueda" <tueda2@xxxxxxxx>
- Date: Sun, 4 Mar 2007 14:19:53 -0600
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=IHZyAb70K6D0DZUibaVz3RXs1F4g0xaa4VxFLsD1iN2CbyE88Dx7b2tJRXF1mWYsmQaL5tks+VL0k74yN91GpiKY1Nqbywj2lORtVXI2QCOSmblWMGFlmn99qOf1l0evZqfbFKZrTw2vTYhDR4UecIS4CmiNcLu3xlMt00XrbEs=
- Reply-to: Cyborg mayhem / SigBio <sigbio-l@xxxxxxxxxxxx>
- Sender: tueda2@xxxxxxxxx
Right now, I committed MapPanelVisualizer.java
This class contains minimum feature to draw all cells and update each steps.
The usage is:
Constructor:
MapPanelVisualizer()
this makes 300*200 size of panel
MapPanelVisualizer(width, height)
this makes width*height size of panel
setBackColor(Color)
this changes the background color of this panel
drawMap(List<Shape> newShapes, Hashtable<Shape,Color> colors)
this is the main feature of this class.
newShapes contains the list of all cells as the "Shape"
"Shape" contains x and y coordinate information and the size of the shape.
(Shape is in the Java standard API)
for example, Shape s1 = new Ellipse2D.Double(10.0, 20.0, 30.0, 30.0);
s1 is the one of the cell which has a shape of 30 pix circle with coordinate (10,20)
(I don't know which cell has what shape and color)
colors contains the each "Color" of "Shape". This is the example code.
MapPanelVisualizer mpv = new MapPanelVisualizer();
List<Shape> ls = new LinkedList<Shape>();
Hashtable<Shape,Color> colors = new Hashtable<Shape,Color>();
Shape s1 = new Ellipse2D.Double(10.0, 20.0, 30.0, 30.0);
ls.add(s1);
colors.put(s1, Color.BLUE);
mpv.drawMap(ls, colors);
this draws 30pix circle on (10,20).
If you want to update for the next steps. Just make Shape list and color hashtable.
For example, the cell(BLUE, 10,20, size 30) which is drawn in previous step moves to the (30,50) with changing color to Red.
List<Shape> ls = new LinkedList<Shape>();
Hashtable<Shape,Color> colors = new Hashtable<Shape,Color>();
Shape s1 = new Ellipse2D.Double(30.0, 40.0, 30.0, 30.0);
ls.add(s1);
colors.put(s1, Color.RED);
mpv.drawMap(ls, colors);
This erases previous cell, and draws the cell with new position and new color.
Takaoki Ueda