/** * Convenience method to set both scales the same * @param scale the new scale * @return this TiledView */ public TiledView setScales(AxisScale scale) { return setScales(scale,scale); }
/** * 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()); } }
public static JButton changeHAxisButton(final TiledView tv, final String label) { final JButton b = new JButton(label + " " + tv.getHScale()); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (tv.getHScale() == AxisScale.LOG10) tv.setScales(AxisScale.LINEAR); else tv.setScales(AxisScale.LOG10); b.setText(label + " " + tv.getHScale()); System.out.println(tv + ": " + tv.getHScale()); } }); return b; }
for (; bhp==null && itv>=0; --itv) { TiledView tv = _tvs.get(itv); if(tv.getBestHorizontalProjector()!=null) bhp = new Projector(tv.getBestHorizontalProjector()); bhp.merge(tv.getBestHorizontalProjector()); for (; bvp==null && itv>=0; --itv) { TiledView tv = _tvs.get(itv); if(tv.getBestVerticalProjector()!=null) bvp = new Projector(tv.getBestVerticalProjector()); bvp.merge(tv.getBestVerticalProjector());
/** * Adds the specified tiled view to this tile. If the tiled view is * already in this tile, it is first removed, before adding it again. * @param tv the tiled view. * @return true, if this tile did not already contain the specified * tiled view; false, otherwise. */ public boolean addTiledView(TiledView tv) { boolean removed = _tvs.remove(tv); _tvs.add(tv); tv.setTile(this); alignProjectors(); return !removed; }
public void paintToRect(Graphics2D g2d, int x, int y, int w, int h) { g2d = createGraphics(g2d,x,y,w,h); // Save transcaler for this panel. Transcaler tsPanel = _ts; // Set transcaler for the graphics rectangle. _ts = getTranscaler(w,h); // Paint tiled views. for (TiledView tv : _tvs) { Graphics2D gtv = (Graphics2D)g2d.create(); tv.paint(gtv); gtv.dispose(); } // Restore transcaler for this panel. _ts = tsPanel; g2d.dispose(); }
/** * 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); }
/** * Removes the specified tiled view from this tile. If the tiled view * is not in this tile, this method does nothing. * @param tv the tiled view. * @return true, if this tile contained the specified tiled view; * false, otherwise. */ public boolean removeTiledView(TiledView tv) { if (_tvs.remove(tv)) { tv.setTile(null); alignProjectors(); return true; } return false; }
/** * 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()); }