/** * @param axisLength the axisLength to set */ public void setAxisLength( final double axisLength ) { this.axisLength = axisLength; this.precalc(); }
/** * {@inheritDoc} * @see org.openimaj.vis.DataUnitsTransformer#calculateUnitsAt(java.lang.Object) */ @Override public Double calculateUnitsAt( final double[] position ) { if( this.transform == null ) this.precalc( ); final Point2d p = new Point2dImpl( (float)position[0], (float)position[1] ); final Point2d p2 = p.transform( this.transform.inverse() ); return new Double(p2.getX()); }
/** * {@inheritDoc} * @see org.openimaj.vis.DataUnitsTransformer#calculatePosition(java.lang.Object) */ @Override public double[] calculatePosition( final Double units ) { if( this.transform == null ) this.precalc(); final Point2d p = new Point2dImpl( units.floatValue(), 0f ); final Point2d p2 = p.transform( this.transform ); return new double[] {p2.getX(), p2.getY()}; }
/** * {@inheritDoc} * @see org.openimaj.vis.general.AxisRenderer#drawAxis(org.openimaj.vis.general.AxisConfig) */ @Override public void drawAxis( final AxisConfig<Q> config ) { if( this.axisLine == null ) this.precalc( ); this.image.drawLine( this.axisLine, (int)config.getRenderingConfig().getThickness(), config.getRenderingConfig().getColour() ); }
/** * {@inheritDoc} * @see org.openimaj.vis.general.AxisRenderer#drawMajorTickGridline(double, org.openimaj.vis.general.AxisConfig) */ @Override public void drawMajorTickGridline( final double location, final AxisConfig<Q> config ) { if( this.transform == null ) this.precalc( ); final float x = (float)location; final float y = this.image.getHeight()*2; Line2d l = new Line2d( x, -y, x, y ); l = l.transform( this.transform ); this.image.drawLine( l, (int)config.getRenderingConfig().getMajorGridThickness(), config.getRenderingConfig().getMajorGridColour() ); }
/** * {@inheritDoc} * @see org.openimaj.vis.general.AxisRenderer#drawMinorTickGridline(double, org.openimaj.vis.general.AxisConfig) */ @Override public void drawMinorTickGridline( final double location, final AxisConfig<Q> config ) { if( this.transform == null ) this.precalc( ); final float x = (float)location; final float y = this.image.getHeight()*2; Line2d l = new Line2d( x, -y, x, y ); l = l.transform( this.transform ); this.image.drawLine( l, (int)config.getRenderingConfig().getMinorGridThickness(), config.getRenderingConfig().getMinorGridColour() ); }
/** * {@inheritDoc} * @see org.openimaj.vis.general.AxisRenderer#drawMajorTick(double, org.openimaj.vis.general.AxisConfig) */ @Override public void drawMajorTick( final double location, final AxisConfig<Q> config ) { if( this.transform == null ) this.precalc( ); final float x = (float)location; final float y = (float)config.getRenderingConfig().getMajorTickLength(); Line2d l = new Line2d( x, -y, x, y ); l = l.transform( this.transform ); this.image.drawLine( l, (int)config.getRenderingConfig().getMajorTickThickness(), config.getRenderingConfig().getMajorTickColour() ); }
/** * {@inheritDoc} * @see org.openimaj.vis.general.AxisRenderer#drawMinorTick(double, org.openimaj.vis.general.AxisConfig) */ @Override public void drawMinorTick( final double location, final AxisConfig<Q> config ) { if( this.transform == null ) this.precalc( ); final float x = (float)location; final float y = (float)config.getRenderingConfig().getMinorTickLength(); Line2d l = new Line2d( x, -y, x, y ); l = l.transform( this.transform ); this.image.drawLine( l, (int)config.getRenderingConfig().getMinorTickThickness(), config.getRenderingConfig().getMinorTickColour() ); }