/** ******************* */ protected void zoom(final float factor) { Chart chart = targets.get(0); BoundingBox3d viewBounds = chart.getView().getBounds(); BoundingBox3d newBounds = viewBounds.scale(new Coord3d(factor, factor, 1)); chart.getView().setBoundManual(newBounds); chart.getView().shoot(); fireControllerEvent(ControllerType.ZOOM, factor); }
protected void pan(Coord3d from, Coord3d to) { Chart chart = targets.get(0); BoundingBox3d viewBounds = chart.getView().getBounds(); Coord3d offset = to.sub(from).div(-PAN_FACTOR); BoundingBox3d newBounds = viewBounds.shift(offset); chart.getView().setBoundManual(newBounds); chart.getView().shoot(); fireControllerEvent(ControllerType.PAN, offset); }
@Override public Chart build(final Chart chart, AWTAbstractMouseSelector alternativeMouse) { this.chart = chart; this.mouseSelection = alternativeMouse; // Create and add controllers threadCamera = new CameraThreadController(chart); mouseCamera = new MyCameraMouse(chart); mouseCamera.addSlaveThreadController(threadCamera); chart.getCanvas().addKeyController(buildToggleKeyListener(chart)); releaseCam(); // default mode is selection messageRenderer = buildMessageRenderer(); getAWTChart(chart).addRenderer(messageRenderer); return chart; }
@Override public IFrame newFrame(Chart chart, Rectangle bounds, String title) { Object canvas = chart.getCanvas(); // Use reflexion to access AWT dependant classes // They will not be available for Android if (canvas.getClass().getName().equals("org.jzy3d.plot3d.rendering.canvas.CanvasAWT")) return newFrameAWT(chart, bounds, title, null); // FrameSWT works as // well else if (canvas instanceof CanvasNewtAwt) return newFrameAWT(chart, bounds, title, "[Newt]"); // FrameSWT // works as // well else if (canvas.getClass().getName().equals("org.jzy3d.plot3d.rendering.canvas.CanvasSwing")) return newFrameSwing(chart, bounds, title); else throw new RuntimeException( "No default frame could be found for the given Chart canvas: " + canvas.getClass()); }
public void dispose() { for (Chart chart : targets) { chart.getCanvas().removeMouseController(this); } super.dispose(); }
public void register(Chart chart) { super.register(chart); chart.getCanvas().addMouseController(this); }