From: <ps...@us...> - 2009-09-03 21:37:08
|
Revision: 791 http://tuningforkvp.svn.sourceforge.net/tuningforkvp/?rev=791&view=rev Author: pscheng Date: 2009-09-03 21:36:56 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Use the new graphics features added on the previous check-in. Modified Paths: -------------- tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/Block.java tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/BlockDescriptor.java Modified: tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/Block.java =================================================================== --- tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/Block.java 2009-09-03 21:35:19 UTC (rev 790) +++ tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/Block.java 2009-09-03 21:36:56 UTC (rev 791) @@ -5,6 +5,7 @@ package com.ibm.tuningfork.block; +import java.util.*; import com.ibm.tuningfork.core.FeedGroupManager; import com.ibm.tuningfork.core.bookmarks.BookmarkManager; import com.ibm.tuningfork.core.configuration.FigureConfiguration; @@ -16,12 +17,7 @@ import com.ibm.tuningfork.core.figure.action.IHoverableFigure; import com.ibm.tuningfork.core.figure.action.IPlayableFigure; import com.ibm.tuningfork.core.figure.action.ISavePDFFigureAction; -import com.ibm.tuningfork.core.graphics.AnnotationPainter; -import com.ibm.tuningfork.core.graphics.Area; -import com.ibm.tuningfork.core.graphics.Coord; -import com.ibm.tuningfork.core.graphics.Graphics; -import com.ibm.tuningfork.core.graphics.TimeCodeFormatter; -import com.ibm.tuningfork.core.graphics.TextStyle; +import com.ibm.tuningfork.core.graphics.*; import com.ibm.tuningfork.core.player.Player; import com.ibm.tuningfork.infra.Logging; import com.ibm.tuningfork.infra.data.TimeInterval; @@ -41,7 +37,7 @@ return descriptor; } - protected SampleStream stream; + protected Stream stream; protected StreamBundleFreshnessIndicator freshnessIndicator; protected FigureConfiguration config; @@ -60,7 +56,7 @@ public Block(String mode, FeedGroup group, StreamBundle streams) { super(group); - this.stream = (SampleStream) streams.getStream(0); + this.stream = (Stream) streams.getStream(0); freshnessIndicator = new StreamBundleFreshnessIndicator(new StreamBundle(this.stream)); config = FigureConfiguration.getConfiguration(mode, this, stream); @@ -96,17 +92,105 @@ return stream.getTimeRange(); } + private void drawMerger4Module(Graphics g, Area area) { + + Area box1 = area.subArea(new DCoord(0.1, 0.1), new DCoord(0.45, 0.45)); + Area box2 = area.subArea(new DCoord(0.1, 0.55), new DCoord(0.45, 0.90)); + Area box3 = area.subArea(new DCoord(0.55, 0.25), new DCoord(0.9, 0.75)); + + g.fillRectangle(g.pink,box1); + g.fillRectangle(g.lightBlue, box2); + g.fillRectangle(g.lightGray, box3); + + Path q1 = new Path(new Coord[] { box1.rightEdge(0.5), box3.leftEdge(0.25) }); + Path q2 = new Path(new Coord[] { box2.rightEdge(0.5), box3.leftEdge(0.75) }); + g.strokePath(g.black, ArrowStyle.Destination, q1); + g.strokePath(g.black, ArrowStyle.Destination, q2); + Path p1 = new Path(new Coord[] { box3.rightEdge(0.25), area.interpolate(0.95, 0.1), area.interpolate(0.90, 0.0), area.interpolate(-0.2, 0.0), box1.leftEdge(0.25) }); + Path p2 = new Path(new Coord[] { box3.rightEdge(0.75), area.interpolate(0.95, 0.9), area.interpolate(0.90, 1.0), area.interpolate(-0.2, 1.0), box2.leftEdge(0.75) }); + BezierCurve c1 = new BezierCurve(p1); + BezierCurve c2 = new BezierCurve(p2); + g.strokePath(g.red, ArrowStyle.Destination, c1, 30); + g.strokePath(g.red, ArrowStyle.Destination, c2, 30); + + String state1 = "size = " + (int) (8 * Math.random()); + String state2 = "size = " + (int) (8 * Math.random()); + String state3 = "size = " + (int) (20 * Math.random()); + TextStyle textStyle = TextStyle.norm().beCentered(); + g.drawString(textStyle, state1, box1.center()); + g.drawString(textStyle, state2, box2.center()); + g.drawString(textStyle, state3, box3.center()); + + String edge1 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + String edge2 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + String edge3 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + String edge4 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + g.drawString(textStyle, edge1, q1.pointAlong(0.5)); + g.drawString(textStyle, edge2, q2.pointAlong(0.5)); + g.drawString(textStyle, edge3, p1.pointAlong(0.5)); + g.drawString(textStyle, edge4, p2.pointAlong(0.5)); + + + } + public void paintFigure(Graphics g, Area area) { player.setTimeRange(getTimeRange()); + Area area1 = new Area(50, 50, 300, 300); + Area area2 = new Area(400, 50, 300, 300); + Area area3 = new Area(50, 400, 300, 300); + Area area4 = new Area(400, 400, 300, 300); + drawMerger4Module(g, area1); + drawMerger4Module(g, area2); + drawMerger4Module(g, area3); + drawMerger4Module(g, area4); + + if (true) return; + long time = getCurrentTime(); + Area box1 = new Area(100, 100, 100, 100); + Area box2 = new Area(100, 300, 100, 100); + Area box3 = new Area(300, 200, 100, 100); + + g.fillRectangle(g.pink,box1); + g.fillRectangle(g.lightBlue, box2); + g.fillRectangle(g.lightGray, box3); + g.drawLine(g.black, ArrowStyle.Destination, box1.rightEdge(0.5), box3.leftEdge(0.25)); + g.drawLine(g.black, ArrowStyle.Destination, box2.rightEdge(0.5), box3.leftEdge(0.75)); + Path p1 = new Path(new Coord[] { box3.rightEdge(0.25), new Coord(450, 175), new Coord(450, 25), new Coord(0, 25), box1.leftEdge(0.25) }); + Path p2 = new Path(new Coord[] { box3.rightEdge(0.75), new Coord(450, 325), new Coord(450, 475), new Coord(0, 475), box2.leftEdge(0.75) }); + g.strokePath(g.black, ArrowStyle.Destination, p1); + g.strokePath(g.black, ArrowStyle.Destination, p2); + final long displayTime = player.getTimeRange().getEnd() <= time ? stream.getTimeRange().getEnd() : time; String timeLabel = timeFormatter.getTimeString(displayTime); - - g.fillRectangle(g.pink, new Area(100, 100, 300, 300)); - g.drawString(TextStyle.large(), "This is the block view at " + timeLabel, new Coord(100, 200)); + g.drawString(TextStyle.large(), "This is the block view at " + timeLabel, new Coord(100, 650)); + + String state1 = "size = " + (int) (8 * Math.random()); + String state2 = "size = " + (int) (8 * Math.random()); + String state3 = "size = " + (int) (20 * Math.random()); + TextStyle largeCenter = TextStyle.large().beCentered(); + g.drawString(largeCenter, state1, box1.center()); + g.drawString(largeCenter, state2, box2.center()); + g.drawString(largeCenter, state3, box3.center()); + + String edge1 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + String edge2 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + String edge3 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + String edge4 = (Math.floor(10 * Math.random()) / 10) + " MB/s"; + g.drawString(largeCenter, edge1, new Coord(250, 190)); + g.drawString(largeCenter, edge2, new Coord(250, 310)); + g.drawString(largeCenter, edge3, new Coord(250, 50)); + g.drawString(largeCenter, edge4, new Coord(250, 450)); + + + BezierCurve c1 = new BezierCurve(p1); + BezierCurve c2 = new BezierCurve(p2); + g.strokePath(g.red, ArrowStyle.Destination, c1, 30); + g.strokePath(g.red, ArrowStyle.Destination, c2, 30); + } Modified: tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/BlockDescriptor.java =================================================================== --- tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/BlockDescriptor.java 2009-09-03 21:35:19 UTC (rev 790) +++ tfroot/trunk/Experimental/com.ibm.tuningfork.block/src/com/ibm/tuningfork/block/BlockDescriptor.java 2009-09-03 21:36:56 UTC (rev 791) @@ -32,6 +32,6 @@ } public boolean canCreate(StreamBundle streams) { - return oneStreamOfType(streams, SampleStream.class); + return oneStreamOfType(streams, Stream.class); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |