/** * {@inheritDoc} * @see org.openimaj.vis.general.DiversityAxis#bandSizeKnown(int) */ @Override public void bandSizeKnown( final int bandSize ) { this.plotter.setBandSize( bandSize ); super.bandSizeKnown( bandSize ); }
/** * {@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 ); } }