FrameDisplay.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.vis.items;
00002 
00003 import processing.core.PFont;
00004 import edu.tum.cs.ias.knowrob.vis.AnimatedCanvas;
00005 import edu.tum.cs.ias.knowrob.vis.Canvas;
00006 import edu.tum.cs.ias.knowrob.vis.Drawable;
00007 
00008 public class FrameDisplay implements Drawable {
00009 
00010         protected AnimatedCanvas canvas;
00011         protected int x, y, textAlign;
00012         protected PFont font;
00013         
00022         public FrameDisplay(AnimatedCanvas c, int x, int y, int textAlign, PFont font) {
00023                 this.canvas = c;
00024                 this.x = x;
00025                 this.y = y;
00026                 this.textAlign = textAlign;
00027                 this.font = font;
00028         }
00029         
00030         public void draw(Canvas c) {
00031                 int numSteps = canvas.getMaxAnimationStep()+1;
00032                 if(numSteps == 1) // don't draw frame display if there is only one frame in the sequence
00033                         return;
00034                 if(font != null)
00035                         c.textFont(font);
00036                 c.fill(0xffffffff);
00037                 c.textMode(Canvas.SCREEN);
00038                 c.textAlign(textAlign);
00039                 c.text(String.format("%d/%d", canvas.getAnimationStep()+1, numSteps), x, y);
00040         }
00041 }


mod_vis
Author(s): Moritz Tenorth, Jakob Engel
autogenerated on Mon Oct 6 2014 01:30:00