This commit is contained in:
Martin Pernollet 2012-10-04 22:19:46 +02:00
parent b39b3e1880
commit dc21e40a55
10 changed files with 24 additions and 49 deletions

View File

@ -9,7 +9,8 @@ import javax.media.opengl.GLCapabilities;
import org.jzy3d.chart.controllers.camera.AbstractCameraController;
import org.jzy3d.chart.controllers.keyboard.camera.ICameraKeyController;
import org.jzy3d.chart.controllers.keyboard.camera.IScreenshotKeyController;
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController;
import org.jzy3d.chart.controllers.mouse.camera.CameraMouseController;
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
import org.jzy3d.chart.factories.ChartComponentFactory;
import org.jzy3d.chart.factories.IChartComponentFactory;
@ -129,12 +130,12 @@ public class Chart{
* the chart thus just unregisters the controllers, but does not handle
* stopping and disposing controllers.
*/
public void addController(AbstractCameraController controller){
public void addController(CameraMouseController controller){
controller.register(this);
controllers.add(controller);
}
public void removeController(AbstractCameraController controller){
public void removeController(CameraMouseController controller){
controller.unregister(this);
controllers.remove(controller);
}

View File

@ -1,11 +1,8 @@
package org.jzy3d.chart.controllers.camera;
import java.awt.event.MouseEvent;
import org.jzy3d.chart.Chart;
import org.jzy3d.chart.controllers.AbstractController;
import org.jzy3d.chart.controllers.ControllerType;
import org.jzy3d.chart.controllers.mouse.MouseUtilities;
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
import org.jzy3d.chart.controllers.thread.camera.CameraThreadController;
import org.jzy3d.maths.Coord2d;

View File

@ -1,4 +1,4 @@
package org.jzy3d.chart.controllers.keyboard.camera;
package org.jzy3d.chart.controllers.keyboard.screenshot;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.jzy3d.chart.controllers.keyboard.camera;
package org.jzy3d.chart.controllers.keyboard.screenshot;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

View File

@ -1,4 +1,4 @@
package org.jzy3d.chart.controllers.keyboard.camera;
package org.jzy3d.chart.controllers.keyboard.screenshot;
import java.io.File;
import java.io.IOException;

View File

@ -24,22 +24,6 @@ public class CameraMouseController extends AbstractCameraController implements M
addSlaveThreadController(new CameraThreadController(chart));
}
public void register(Chart chart){
super.register(chart);
chart.getCanvas().addMouseListener(this);
chart.getCanvas().addMouseMotionListener(this);
chart.getCanvas().addMouseWheelListener(this);
}
public void dispose(){
for(Chart c: targets){
c.getCanvas().removeMouseListener(this);
c.getCanvas().removeMouseMotionListener(this);
c.getCanvas().removeMouseWheelListener(this);
}
super.dispose();
}
/** Handles toggle between mouse rotation/auto rotation: double-click starts the animated
* rotation, while simple click stops it.*/
public void mousePressed(MouseEvent e) {
@ -51,19 +35,7 @@ public class CameraMouseController extends AbstractCameraController implements M
prevMouse.y = e.getY();
}
public boolean handleSlaveThread(MouseEvent e) {
if(MouseUtilities.isDoubleClick(e)){
if(threadController!=null){
threadController.start();
return true;
}
}
if(threadController!=null)
threadController.stop();
return false;
}
/** Compute shift or rotate*/
/** Compute shift or rotate*/
public void mouseDragged(MouseEvent e) {
Coord2d mouse = new Coord2d(e.getX(),e.getY());
@ -94,7 +66,15 @@ public class CameraMouseController extends AbstractCameraController implements M
public void mouseReleased(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {}
/*********************************************************/
//protected Chart chart;
public boolean handleSlaveThread(MouseEvent e) {
if(MouseUtilities.isDoubleClick(e)){
if(threadController!=null){
threadController.start();
return true;
}
}
if(threadController!=null)
threadController.stop();
return false;
}
}

View File

@ -16,10 +16,10 @@ import org.jzy3d.chart.ChartView;
import org.jzy3d.chart.controllers.keyboard.camera.CameraKeyController;
import org.jzy3d.chart.controllers.keyboard.camera.CameraKeyControllerNewt;
import org.jzy3d.chart.controllers.keyboard.camera.ICameraKeyController;
import org.jzy3d.chart.controllers.keyboard.camera.IScreenshotKeyController;
import org.jzy3d.chart.controllers.keyboard.camera.IScreenshotKeyController.IScreenshotEventListener;
import org.jzy3d.chart.controllers.keyboard.camera.ScreenshotKeyController;
import org.jzy3d.chart.controllers.keyboard.camera.ScreenshotKeyControllerNewt;
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController;
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController.IScreenshotEventListener;
import org.jzy3d.chart.controllers.keyboard.screenshot.ScreenshotKeyController;
import org.jzy3d.chart.controllers.keyboard.screenshot.ScreenshotKeyControllerNewt;
import org.jzy3d.chart.controllers.mouse.camera.CameraMouseController;
import org.jzy3d.chart.controllers.mouse.camera.CameraMouseControllerNewt;
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;

View File

@ -7,7 +7,7 @@ import javax.media.opengl.GLCapabilities;
import org.jzy3d.chart.Chart;
import org.jzy3d.chart.ChartScene;
import org.jzy3d.chart.controllers.keyboard.camera.ICameraKeyController;
import org.jzy3d.chart.controllers.keyboard.camera.IScreenshotKeyController;
import org.jzy3d.chart.controllers.keyboard.screenshot.IScreenshotKeyController;
import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController;
import org.jzy3d.maths.BoundingBox3d;
import org.jzy3d.maths.Coord3d;

View File

@ -1,9 +1,7 @@
package org.jzy3d.chart.graphs;
import org.jzy3d.chart.Chart;
import org.jzy3d.plot3d.rendering.canvas.ICanvas;
import org.jzy3d.plot3d.rendering.canvas.Quality;
import org.jzy3d.plot3d.rendering.scene.Scene;
public class GraphChart extends Chart{
public GraphChart() {

View File

@ -19,7 +19,6 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
/** Experimental Newt canvas.
* Mouse & key listener wont work with it.
*/
public class CanvasNewt extends Panel implements IScreenCanvas{
public CanvasNewt(IChartComponentFactory factory, Scene scene, Quality quality, GLCapabilitiesImmutable glci){