/** * {@inheritDoc} * @see org.openimaj.vis.general.DiversityAxis#bandSizeKnown(int) */ @Override public void bandSizeKnown( final int bandSize ) { this.plotter.setBandSize( bandSize ); super.bandSizeKnown( bandSize ); }
/** * Default constructor that takes the width and height of the visualisation * * @param w The width of the axis visualisation * @param h The height of the axis visualisation * @param plotter The plotter to use for items */ public DiversityAxis( final int w, final int h, final ItemPlotter<O,Float[],MBFImage> plotter ) { super( w, h, plotter ); this.init(); }
/** * Default constructor * @param w Width of the visualisation * @param h Height of the visualisation */ public Timeline( final int w, final int h ) { super( w, h, null ); super.setItemPlotter( this.plotter ); this.init(); }
dv.setDiversityAxisName( "Opinion" ); dv.addObject( groupCount, opinionValue, img ); dv.repaint(); dv.showWindow( "Opinion VisualisationImpl" );
count++; da.addObject( band, (Math.random()-0.5)*2, img ); da.updateVis(); da.showWindow( "Diversity" );
/** * Add an object to a track. * * @param tt The track to add the object to * @param obj The timeline objec to add * @return The timeline track */ public TimelineTrack addTimelineObject( final TimelineTrack tt, final TimelineObject obj ) { super.addObject( tt.getTrackNumber(), obj.getStartTimeMilliseconds(), obj ); if( obj instanceof AnimatedVisualisationProvider ) ((AnimatedVisualisationProvider)obj).addAnimatedVisualisationListener( this ); obj.setDataPixelTransformer( this.axesRenderer2D.getRelativePixelTransformer( (int)this.axesRenderer2D.calculatePosition( obj.getStartTimeMilliseconds(), 0 ).getX(), tt.getTrackNumber() ) ); return tt; }
/** * {@inheritDoc} * @see org.openimaj.vis.VisualisationImpl#update() */ @Override public void update() { // Draw the sidebar this.visImage.drawImage( this.sidebarPanel, 0, 0 ); super.update(); // Draw all the timeline markers for( final TimelineMarker m : this.markers ) { final int x = this.getTimePosition( m.time ); m.type.drawMarker( m, this.visImage, x, this.getHeight() ); } }
dv.setDiversityAxisName( "Opinion" ); dv.addObject( groupCount, opinionValue, img ); dv.repaint(); dv.showWindow( "Opinion VisualisationImpl" );
count++; da.addObject( band, (Math.random()-0.5)*2, img ); da.updateVis(); da.showWindow( "Diversity" );
/** * {@inheritDoc} * @see org.openimaj.vis.general.XYPlotVisualisation#beforeAxesRender(org.openimaj.image.MBFImage, org.openimaj.vis.general.AxesRenderer2D) */ @Override public void beforeAxesRender( final MBFImage visImage, final AxesRenderer2D<Float[],MBFImage> renderer ) { int maxBand = 1; for( final XYPlotVisualisation.LocatedObject<O> s : this.data ) maxBand = Math.max( maxBand, (int)s.y ); renderer.setMaxYValue( maxBand ); renderer.setImage( visImage ); renderer.precalc( ); final Float[][] cols = new Float[][]{ {0.4f,0.4f,0.4f}, {0.3f,0.3f,0.3f} }; for( int b = 1; b <= maxBand; b++ ) { final int topOfBand = (int)renderer.calculatePosition( 0, b ).getY(); final int bottomOfBand = (int)renderer.calculatePosition( 0, b-1 ).getY(); visImage.createRenderer().drawShapeFilled( new Rectangle( 0, topOfBand, visImage.getWidth(), bottomOfBand-topOfBand ), cols[b%2] ); if( b == 1 ) this.bandSizeKnown( bottomOfBand - topOfBand ); } }
/** * Default constructor * @param plotter The plotter to use for items */ public DiversityAxis( final ItemPlotter<O,Float[],MBFImage> plotter ) { super( plotter ); this.init(); }