/** * Constructs a transcaler with specified coordinate mapping. * @param x1u the user x-coordinate corresponding to x1d. * @param y1u the user y-coordinate corresponding to y1d. * @param x2u the user x-coordinate corresponding to x2d. * @param y2u the user y-coordinate corresponding to y2d. * @param x1d the device x-coordinate corresponding to x1u. * @param y1d the device y-coordinate corresponding to y1u. * @param x2d the device x-coordinate corresponding to x2u. * @param y2d the device y-coordinate corresponding to y2u. */ public Transcaler( double x1u, double y1u, double x2u, double y2u, int x1d, int y1d, int x2d, int y2d) { setMapping(x1u,y1u,x2u,y2u,x1d,y1d,x2d,y2d); } /**
/** * Constructs a transcaler with specified coordinate mapping * and specified Scales. This should only be used with the * combineWith() method when receiving projectors that * may be LOG scale. It is not the intention to be able * to create arbitrary LOG scaled Transcalers. * @param x1u the user x-coordinate corresponding to x1d. * @param y1u the user y-coordinate corresponding to y1d. * @param x2u the user x-coordinate corresponding to x2d. * @param y2u the user y-coordinate corresponding to y2d. * @param x1d the device x-coordinate corresponding to x1u. * @param y1d the device y-coordinate corresponding to y1u. * @param x2d the device x-coordinate corresponding to x2u. * @param y2d the device y-coordinate corresponding to y2u. * @param hscale the horizontal projector Scale * @param vscale the vertical projector Scale */ private Transcaler( double x1u, double y1u, double x2u, double y2u, int x1d, int y1d, int x2d, int y2d, AxisScale hscale, AxisScale vscale) { _xpScale = hscale; _ypScale = vscale; setMapping(x1u,y1u,x2u,y2u,x1d,y1d,x2d,y2d); } }
public void setBounds(int x, int y, int width, int height) { super.setBounds(x,y,width,height); _ts.setMapping(width,height); }
/** * Called by this tile's mosaic. */ void setViewRect(DRectangle vr) { if (_vr.x!=vr.x || _vr.y!=vr.y || _vr.width!=vr.width || _vr.height!=vr.height) { _vr = new DRectangle(vr); _vr.x = max(0.0,min(1.0,_vr.x)); _vr.y = max(0.0,min(1.0,_vr.y)); _vr.width = max(0.0,min(1.0-_vr.x,_vr.width)); _vr.height = max(0.0,min(1.0-_vr.y,_vr.height)); _ts.setMapping(_vr.x,_vr.y,_vr.x+_vr.width,_vr.y+_vr.height); repaint(); } }
/** * Sets the device-coordinate width and height. Maps the current user * coordinates (x1u,y1u) to device coordinates (0,0) and user coordinates * (x2u,y2u) to device coordinates (width-1,height-1). * @param width device-coordinate width. * @param height device-coordinate height. */ public void setMapping(int width, int height) { Check.argument(width>0,"width>0"); Check.argument(height>0,"height>0"); setMapping(0,0,width-1,height-1); }