/** * Gets the Vertical axis scaling. * @return the Scale; null, if none. */ public AxisScale getVScale() { return (_bvp!=null)?_bvp.getScale():AxisScale.LINEAR; }
/** * Gets the scale of the best horizontal projector. * @return the scale of the best horizontal projector. */ public AxisScale getHScale() { return (_bhp!=null)?_bhp.getScale():AxisScale.LINEAR; }
/** * Gets the Horizontal axis scaling. * @return the Scale; null, if none. */ public AxisScale getHScale() { return (_bhp!=null)?_bhp.getScale():AxisScale.LINEAR; }
/** * Gets the scale of the best vertical projector. * @return the scale of the best horizontal projector. */ public AxisScale getVScale() { return (_bvp!=null)?_bvp.getScale():AxisScale.LINEAR; }
/** * Convenience method to set the scale of the * best vertical projector. * @param scale the new scale * @return this TiledView */ public TiledView setVScale(AxisScale scale) { return setScales(_bhp.getScale(),scale); }
/** * Convenience method to set the scale of the * best horizontal projector. * @param scale the new scale * @return this TiledView */ public TiledView setHScale(AxisScale scale) { return setScales(scale,_bvp.getScale()); }
/** * Sets the best projectors for this tiled view. Classes that extend * this class call this method when their best projectors change. * @param bhp a horizontal projector. * @param bvp a vertical projector. */ protected void setBestProjectors(Projector bhp, Projector bvp) { if (!equal(_bhp,bhp) || !equal(_bvp,bvp)) { _bhp = (bhp!=null)?new Projector(bhp):null; _bvp = (bvp!=null)?new Projector(bvp):null; // protect against setting unsupported TiledViews to non-linear scales if(setScales(bhp.getScale(),bvp.getScale())==null){ _bhp.setScale(AxisScale.LINEAR); _bvp.setScale(AxisScale.LINEAR); } if (_tile!=null) _tile.alignProjectors(_bhp.getScale(),_bvp.getScale()); } }
private void computeXY( Projector hp, Projector vp, Transcaler ts, int n, float[] x1, float[] x2, int[] x, int[] y) { ts = ts.combineWith(hp,vp); float[] xv = null; float[] yv = null; if (_orientation==Orientation.X1RIGHT_X2UP) { xv = x1; yv = x2; } else if (_orientation==Orientation.X1DOWN_X2RIGHT) { xv = x2; yv = x1; } double hLeft = Math.min(hp.v0(),hp.v1()); double vBot = Math.min(vp.v0(),vp.v1()); for (int i=0; i<n; ++i) { x[i] = ts.x((xv[i]<=0 && hp.getScale()==AxisScale.LOG10)?hLeft:xv[i]); y[i] = ts.y((yv[i]<=0 && vp.getScale()==AxisScale.LOG10)?vBot:yv[i]); } }
public void testAutoLinear() { Projector p = new Projector(0.0, 100, 0.0, 1.0); assertTrue(p.getScale() == AxisScale.LINEAR); }
boolean isLeft = isLeft(); boolean isVerticalRotated = isVerticalRotated(); boolean isLogScale = (p.getScale().isLog());
/** * Returns a new transcaler that combines this transcaler with projectors. * The returned transcaler includes the transforms of the projectors. * Does not change this transcaler. * @param xp the projector for x coordinates. * @param yp the projector for y coordinates. * @return the new transcaler. */ public Transcaler combineWith(Projector xp, Projector yp) { AxisScale xsc = xp.getScale(); AxisScale ysc = yp.getScale(); double x1v = (xsc==AxisScale.LOG10)?log10(xp.v(_x1u)):xp.v(_x1u); double x2v = (xsc==AxisScale.LOG10)?log10(xp.v(_x2u)):xp.v(_x2u); double y1v = (ysc==AxisScale.LOG10)?log10(yp.v(_y1u)):yp.v(_y1u); double y2v = (ysc==AxisScale.LOG10)?log10(yp.v(_y2u)):yp.v(_y2u); return new Transcaler(x1v,y1v,x2v,y2v,_x1d,_y1d,_x2d,_y2d, xsc, ysc); }