diff --git a/jzy3d-api/src/api/org/jzy3d/analysis/AbstractAnalysis.java b/jzy3d-api/src/api/org/jzy3d/analysis/AbstractAnalysis.java index afbfafb5..383f2128 100644 --- a/jzy3d-api/src/api/org/jzy3d/analysis/AbstractAnalysis.java +++ b/jzy3d-api/src/api/org/jzy3d/analysis/AbstractAnalysis.java @@ -2,9 +2,18 @@ package org.jzy3d.analysis; import org.jzy3d.chart.Chart; import org.jzy3d.chart.factories.AWTChartComponentFactory; +import org.jzy3d.chart.factories.IChartComponentFactory; import org.jzy3d.plot3d.rendering.canvas.Quality; public abstract class AbstractAnalysis implements IAnalysis{ + public AbstractAnalysis(){ + factory = new AWTChartComponentFactory(); + } + + public AbstractAnalysis(IChartComponentFactory factory){ + this.factory = factory; + } + @Override public String getName() { return this.getClass().getSimpleName(); @@ -22,8 +31,7 @@ public abstract class AbstractAnalysis implements IAnalysis{ @Override public Chart initializeChart(){ - AWTChartComponentFactory f = new AWTChartComponentFactory(); - return f.newChart(Chart.DEFAULT_QUALITY, getCanvasType()); + return factory.newChart(Chart.DEFAULT_QUALITY, getCanvasType()); } @Override @@ -55,4 +63,5 @@ public abstract class AbstractAnalysis implements IAnalysis{ protected Chart chart; protected String canvasType="awt"; + protected IChartComponentFactory factory; } diff --git a/jzy3d-api/src/api/org/jzy3d/chart/controllers/mouse/camera/NewtCameraMouseController.java b/jzy3d-api/src/api/org/jzy3d/chart/controllers/mouse/camera/NewtCameraMouseController.java index 10969858..627b1882 100644 --- a/jzy3d-api/src/api/org/jzy3d/chart/controllers/mouse/camera/NewtCameraMouseController.java +++ b/jzy3d-api/src/api/org/jzy3d/chart/controllers/mouse/camera/NewtCameraMouseController.java @@ -90,7 +90,6 @@ public class NewtCameraMouseController extends AbstractCameraController implemen } public static boolean isDoubleClick(MouseEvent e){ - //System.out.println(e.getClickCount()); return (e.getClickCount() > 1); } diff --git a/jzy3d-api/src/api/org/jzy3d/chart/factories/ChartComponentFactory.java b/jzy3d-api/src/api/org/jzy3d/chart/factories/ChartComponentFactory.java index e5540ec2..83e0ce0b 100644 --- a/jzy3d-api/src/api/org/jzy3d/chart/factories/ChartComponentFactory.java +++ b/jzy3d-api/src/api/org/jzy3d/chart/factories/ChartComponentFactory.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.log4j.Logger; import org.jzy3d.bridge.IFrame; import org.jzy3d.chart.Chart; import org.jzy3d.chart.ChartScene; @@ -51,6 +52,8 @@ import com.jogamp.opengl.GLCapabilitiesImmutable; * @see AWTChartComponentFactory for a working implementation */ public class ChartComponentFactory implements IChartComponentFactory { + static Logger logger = Logger.getLogger(ChartComponentFactory.class); + public static Chart chart(Quality quality, Toolkit toolkit) { ChartComponentFactory f = new ChartComponentFactory(); return f.newChart(quality, toolkit); @@ -133,11 +136,6 @@ public class ChartComponentFactory implements IChartComponentFactory { @Override public ICameraMouseController newMouseController(Chart chart) { - /*ICameraMouseController mouse = null; - if (!chart.getWindowingToolkit().equals("newt")) - mouse = new AWTCameraMouseController(chart); - else - mouse = new NewtCameraMouseController(chart);*/ return new NewtCameraMouseController(chart); } @@ -147,21 +145,16 @@ public class ChartComponentFactory implements IChartComponentFactory { String file = SCREENSHOT_FOLDER + "capture-" + Utils.dat2str(new Date(), "yyyy-MM-dd-HH-mm-ss") + ".png"; IScreenshotKeyController screenshot; -/* if (!chart.getWindowingToolkit().equals("newt")) - screenshot = new AWTScreenshotKeyController(chart, file); - else*/ - screenshot = new NewtScreenshotKeyController(chart, file); - + screenshot = new NewtScreenshotKeyController(chart, file); screenshot.addListener(new IScreenshotEventListener() { @Override public void failedScreenshot(String file, Exception e) { - System.out.println("Failed to save screenshot:"); - e.printStackTrace(); + logger.error("Failed to save screenshot to '" + file + "'", e); } @Override public void doneScreenshot(String file) { - System.out.println("Screenshot: " + file); + logger.info("Failed screenshot to '" + file + "'"); } }); return screenshot; @@ -172,10 +165,7 @@ public class ChartComponentFactory implements IChartComponentFactory { @Override public ICameraKeyController newKeyController(Chart chart) { ICameraKeyController key = null; - /*if (!chart.getWindowingToolkit().equals("newt")) - key = new AWTCameraKeyController(chart); - else*/ - key = new NewtCameraKeyController(chart); + key = new NewtCameraKeyController(chart); return key; } @@ -190,7 +180,7 @@ public class ChartComponentFactory implements IChartComponentFactory { } /** - * Use reflexion to access AWT dependant classes. + * Use reflexion to access AWT dependant classes. */ @Override public IFrame newFrame(Chart chart, Rectangle bounds, String title) { diff --git a/jzy3d-api/src/api/org/jzy3d/chart/factories/NewtChartComponentFactory.java b/jzy3d-api/src/api/org/jzy3d/chart/factories/NewtChartComponentFactory.java index 972fe88b..ffe1a489 100644 --- a/jzy3d-api/src/api/org/jzy3d/chart/factories/NewtChartComponentFactory.java +++ b/jzy3d-api/src/api/org/jzy3d/chart/factories/NewtChartComponentFactory.java @@ -6,6 +6,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; +import org.apache.log4j.Logger; import org.jzy3d.bridge.IFrame; import org.jzy3d.bridge.awt.FrameAWT; import org.jzy3d.bridge.swing.FrameSwing; @@ -45,7 +46,8 @@ import com.jogamp.opengl.GLCapabilities; * */ public class NewtChartComponentFactory extends ChartComponentFactory { - + static Logger logger = Logger.getLogger(NewtChartComponentFactory.class); + public static Chart chart() { return chart(Quality.Intermediate); } @@ -182,13 +184,12 @@ public class NewtChartComponentFactory extends ChartComponentFactory { screenshot.addListener(new IScreenshotEventListener() { @Override public void failedScreenshot(String file, Exception e) { - System.out.println("Failed to save screenshot:"); - e.printStackTrace(); + logger.error("Failed to save screenshot to '" + file + "'", e); } @Override public void doneScreenshot(String file) { - System.out.println("Screenshot: " + file); + logger.info("Screenshot: " + file); } }); return screenshot; diff --git a/jzy3d-api/src/api/org/jzy3d/chart/graphs/GraphChartComponentFactory.java b/jzy3d-api/src/api/org/jzy3d/chart/graphs/GraphChartComponentFactory.java index b46e344b..e4954e7f 100644 --- a/jzy3d-api/src/api/org/jzy3d/chart/graphs/GraphChartComponentFactory.java +++ b/jzy3d-api/src/api/org/jzy3d/chart/graphs/GraphChartComponentFactory.java @@ -2,6 +2,7 @@ package org.jzy3d.chart.graphs; import java.util.List; +import org.apache.log4j.Logger; import org.jzy3d.chart.Chart; import org.jzy3d.chart.controllers.mouse.camera.ICameraMouseController; import org.jzy3d.chart.controllers.mouse.picking.NewtMousePickingController; @@ -10,6 +11,8 @@ import org.jzy3d.picking.IObjectPickedListener; import org.jzy3d.picking.PickingSupport; public class GraphChartComponentFactory extends ChartComponentFactory{ + static Logger logger = Logger.getLogger(GraphChartComponentFactory.class); + @Override public ICameraMouseController newMouseController(Chart chart){ ICameraMouseController mouse = null; @@ -26,7 +29,7 @@ public class GraphChartComponentFactory extends ChartComponentFactory{ @Override public void objectPicked(List vertices, PickingSupport picking) { for(Object vertex: vertices){ - System.out.println("picked: " + vertex); + logger.info("picked: " + vertex); //dGraph.setVertexHighlighted((String)vertex, true); } chart.render(); diff --git a/jzy3d-api/src/api/org/jzy3d/colors/OrderingStrategyScoreColorMapper.java b/jzy3d-api/src/api/org/jzy3d/colors/OrderingStrategyScoreColorMapper.java index 607bb995..d53376e3 100644 --- a/jzy3d-api/src/api/org/jzy3d/colors/OrderingStrategyScoreColorMapper.java +++ b/jzy3d-api/src/api/org/jzy3d/colors/OrderingStrategyScoreColorMapper.java @@ -2,6 +2,7 @@ package org.jzy3d.colors; import java.util.List; +import org.apache.log4j.Logger; import org.jzy3d.colors.colormaps.IColorMap; import org.jzy3d.maths.Coord3d; import org.jzy3d.maths.Statistics; @@ -26,6 +27,8 @@ import org.jzy3d.plot3d.rendering.scene.Graph; * */ public class OrderingStrategyScoreColorMapper extends ColorMapper{ + static Logger logger = Logger.getLogger(OrderingStrategyScoreColorMapper.class); + public OrderingStrategyScoreColorMapper(IColorMap colormap, IColorMapperUpdatePolicy policy, Graph sceneGraph, Color factor){ super(colormap, factor); this.sceneGraph = sceneGraph; @@ -59,10 +62,8 @@ public class OrderingStrategyScoreColorMapper extends ColorMapper{ max = Statistics.max(scores); if(min==max){ - System.err.println(OrderingStrategyScoreColorMapper.class.getSimpleName() + " !! min = max = "+min); - //Array.print(scores); + logger.warn("min = max = "+min); } - //System.out.println("min="+min+" max="+max); } protected int getNumCoordinates(List drawables, boolean onlyBaryCenter){ diff --git a/jzy3d-api/src/api/org/jzy3d/io/matlab/MatlabDrawableLoader.java b/jzy3d-api/src/api/org/jzy3d/io/matlab/MatlabDrawableLoader.java index 95970edf..a2fde696 100644 --- a/jzy3d-api/src/api/org/jzy3d/io/matlab/MatlabDrawableLoader.java +++ b/jzy3d-api/src/api/org/jzy3d/io/matlab/MatlabDrawableLoader.java @@ -41,7 +41,6 @@ public class MatlabDrawableLoader implements ILoader { MLNumericArray x = (MLNumericArray) mfr.getMLArray("X"); MLNumericArray y = (MLNumericArray) mfr.getMLArray("Y"); MLNumericArray z = (MLNumericArray) mfr.getMLArray("Z"); - // System.out.println("x:" + x); List polygons = new ArrayList(); diff --git a/jzy3d-api/src/api/org/jzy3d/maths/GridLoader.java b/jzy3d-api/src/api/org/jzy3d/maths/GridLoader.java index dfde36d9..4c14a6ca 100644 --- a/jzy3d-api/src/api/org/jzy3d/maths/GridLoader.java +++ b/jzy3d-api/src/api/org/jzy3d/maths/GridLoader.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.List; import java.util.Vector; +import org.apache.log4j.Logger; import org.jzy3d.colors.Color; import org.jzy3d.colors.IColorMappable; import org.jzy3d.colors.colormaps.IColorMap; @@ -49,6 +50,7 @@ import org.jzy3d.plot3d.primitives.Polygon; */ @Deprecated public class GridLoader implements IColorMappable{ + static Logger logger = Logger.getLogger(GridLoader.class); /** Initialize a GridLoader by parsing the square grid directly. * When the grid is parsed, the GridLoader may return either: @@ -145,7 +147,7 @@ public class GridLoader implements IColorMappable{ float last = Float.NaN; for(int i=0; i project(Chart chart){ return project(chart.getView().getCurrentGL(), new GLU(), chart.getView().getCamera(), chart.getScene().getGraph()); } @@ -51,8 +54,8 @@ public class ProjectionUtils { polygons.add( ProjectionUtils.getCoordinatesAsArrayList( (Polygon)d ) ); colors.add( ProjectionUtils.getColorsAsArrayList( (Polygon)d ) ); } - /*else - throw new RuntimeException("Only polygons are supported, not:" + d.getClass());*/ + else + logger.warn("Only polygons are supported. Ignoring :" + d.getClass()); } // project diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformableLineStrip.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformableLineStrip.java index 0be21dda..a8bb8443 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformableLineStrip.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformableLineStrip.java @@ -66,13 +66,11 @@ public class AxeTransformableLineStrip extends LineStrip { for (Point p : points) { gl.getGL2().glColor4f(p.rgb.r, p.rgb.g, p.rgb.b, p.rgb.a); GlVertexExecutor.Vertex(gl, new Coord3d(p.xyz.x, p.xyz.y, p.xyz.z), transformers); - //System.out.println(p.xyz + p.rgb.toString()); } } else { for (Point p : points) { gl.getGL2().glColor4f(wfcolor.r, wfcolor.g, wfcolor.b, wfcolor.a); GlVertexExecutor.Vertex(gl, new Coord3d(p.xyz.x, p.xyz.y, p.xyz.z), transformers); - //System.out.println(p.xyz + wfcolor.toString()); } } gl.getGL2().glEnd(); diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformablePoint.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformablePoint.java index 6faa029c..9f2c52e3 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformablePoint.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/log/AxeTransformablePoint.java @@ -59,10 +59,8 @@ public class AxeTransformablePoint extends Point { bbox.reset(); if(transformers != null) { bbox.add(transformers.compute(this.xyz)); - System.out.println(this.getClass() + "log"); } else { bbox.add(this); - System.out.println(this.getClass() + "nonlog"); } } diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/DrawableTexture.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/DrawableTexture.java index 20d88f3b..47e46b57 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/DrawableTexture.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/DrawableTexture.java @@ -41,6 +41,8 @@ import com.jogamp.opengl.util.texture.TextureCoords; * */ public class DrawableTexture extends AbstractDrawable implements ITranslucent { + static Logger logger = Logger.getLogger(DrawableTexture.class); + public DrawableTexture(SharedTexture resource) { this(resource, PlaneAxis.Z, 0, null, null); } @@ -143,9 +145,9 @@ public class DrawableTexture extends AbstractDrawable implements ITranslucent { } public void debugMapping() { - System.out.println("mapping"); + logger.info("mapping"); for (Coord2d c : mapping) { - System.out.println(c); + logger.info(c); } } diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/TranslucentQuad.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/TranslucentQuad.java index caba2085..cb3ab67d 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/TranslucentQuad.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/textured/TranslucentQuad.java @@ -34,7 +34,6 @@ public class TranslucentQuad extends Quad implements ITranslucent { callWithAlphaFactor(gl, c, alpha); } else callWithAlphaFactor(gl, p.rgb, alpha); - // System.out.println(p.rgb + " alpha factor = " + alpha); gl.getGL2().glVertex3f(p.xyz.x, p.xyz.y, p.xyz.z); } gl.getGL2().glEnd(); @@ -78,7 +77,6 @@ public class TranslucentQuad extends Quad implements ITranslucent { callWithAlphaFactor(gl, c, alpha); } else callWithAlphaFactor(gl, p.rgb, alpha); - // System.out.println(p.rgb + " alpha factor = " + alpha); GLES2CompatUtils.glVertex3f(p.xyz.x, p.xyz.y, p.xyz.z); } GLES2CompatUtils.glEnd(); diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/vbo/builders/VBOBuilder.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/vbo/builders/VBOBuilder.java index 6ccc9a63..6aa62579 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/vbo/builders/VBOBuilder.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/vbo/builders/VBOBuilder.java @@ -5,6 +5,7 @@ import java.nio.IntBuffer; import java.util.Collection; import java.util.List; +import org.apache.log4j.Logger; import org.jzy3d.colors.Color; import org.jzy3d.colors.ColorMapper; import org.jzy3d.io.IGLLoader; @@ -39,7 +40,7 @@ import com.jogamp.opengl.GL; * */ public abstract class VBOBuilder implements IGLLoader { - + static Logger logger = Logger.getLogger(VBOBuilder.class); /* */ @@ -114,7 +115,6 @@ public abstract class VBOBuilder implements IGLLoader { } protected void putPoint(FloatVBO vbo, int id, Color color, Coord3d coord) { - // System.out.println("putPpoint "+ id); vbo.getIndices().put(id); putCoord(vbo, coord); putColor(vbo, color); @@ -161,7 +161,7 @@ public abstract class VBOBuilder implements IGLLoader { int geometrySize = computeGeometrySize(drawable); int verticeBufferSize = computeVerticeBufferSize(drawable.getGeometry(), n, dimension, geometrySize, hasNormal, hasColor); int indexBufferSize = computeIndexBufferSize(n, geometrySize, hasColor); - System.out.println(indexBufferSize + " " + verticeBufferSize); + logger.info(indexBufferSize + " " + verticeBufferSize); FloatVBO vbo = new FloatVBO(verticeBufferSize, indexBufferSize); return vbo; } diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/scene/Graph.java b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/scene/Graph.java index 707c0034..db7d0899 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/scene/Graph.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/scene/Graph.java @@ -278,19 +278,14 @@ public class Graph { else { BoundingBox3d box = new BoundingBox3d(); - // synchronized(components){ for (AbstractDrawable c : components) { if (c != null && c.getBounds() != null) { - // System.out.println(c.getBounds()); BoundingBox3d drawableBounds= c.getBounds(); if(!drawableBounds.isReset()){ box.add(drawableBounds); - //System.out.println("adding bounds : " + drawableBounds); - //System.out.println("got box: " + box); } } } - // } return box; } } diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/textures/SharedTexture.java b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/textures/SharedTexture.java index 9a87e9f3..659c4b9b 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/textures/SharedTexture.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/textures/SharedTexture.java @@ -43,8 +43,6 @@ public class SharedTexture implements IGLBindedResource{ coords = texture.getImageTexCoords(); halfWidth = texture.getWidth() / 2; halfHeight = texture.getHeight() / 2; - // System.out.println("mount texture: " + file + " halfWidth=" + - // halfWidth + " halfHeight=" + halfHeight); } @Override diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java index 1166724a..0115897b 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java @@ -446,38 +446,33 @@ public class Camera extends AbstractViewportManager { } else if (projection == CameraMode.ORTHOGONAL) { if (gl.isGL2()) { - if (ViewportMode.STRETCH_TO_FILL.equals(viewport.getMode())) - gl.getGL2().glOrtho(-radius, +radius, -radius, +radius, near, far); - else if (ViewportMode.RECTANGLE_NO_STRETCH.equals(viewport.getMode())) - gl.getGL2().glOrtho(-radius * viewport.ratio(), +radius * viewport.ratio(), -radius, +radius, near, far); - else if (ViewportMode.SQUARE.equals(viewport.getMode())) - gl.getGL2().glOrtho(-radius, +radius, -radius, +radius, near, far); + projectionOrthoGL2(gl, viewport); } else { - if (ViewportMode.STRETCH_TO_FILL.equals(viewport.getMode())) - GLES2CompatUtils.glOrtho(-radius, +radius, -radius, +radius, near, far); - else if (ViewportMode.RECTANGLE_NO_STRETCH.equals(viewport.getMode())) - GLES2CompatUtils.glOrtho(-radius * viewport.ratio(), +radius * viewport.ratio(), -radius, +radius, near, far); - else if (ViewportMode.SQUARE.equals(viewport.getMode())) - GLES2CompatUtils.glOrtho(-radius, +radius, -radius, +radius, near, far); + projectionOrthoGLES2(viewport); } - - // gl.glOrtho(-radius * viewport.ratio(), +radius * - // viewport.ratio(), -radius / viewport.ratio(), +radius/ - // viewport.ratio(), near, far); - // gl.glOrtho(-radius / viewport.ratio(), +radius / - // viewport.ratio(), -radius, +radius, near, far); - // gl.glOrtho(-radius, +radius, -radius * viewport.ratio(), +radius - // * viewport.ratio(), near, far); - - // gl.glOrtho(-radius, +radius, -radius, +radius, - // Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); } else throw new RuntimeException("Camera.shoot(): unknown projection mode '" + projection + "'"); // Set camera position glu.gluLookAt(eye.x, eye.y, eye.z, target.x, target.y, target.z, up.x, up.y, up.z); + } - // System.out.println("eye:" + eye); + private void projectionOrthoGLES2(ViewportConfiguration viewport) { + if (ViewportMode.STRETCH_TO_FILL.equals(viewport.getMode())) + GLES2CompatUtils.glOrtho(-radius, +radius, -radius, +radius, near, far); + else if (ViewportMode.RECTANGLE_NO_STRETCH.equals(viewport.getMode())) + GLES2CompatUtils.glOrtho(-radius * viewport.ratio(), +radius * viewport.ratio(), -radius, +radius, near, far); + else if (ViewportMode.SQUARE.equals(viewport.getMode())) + GLES2CompatUtils.glOrtho(-radius, +radius, -radius, +radius, near, far); + } + + private void projectionOrthoGL2(GL gl, ViewportConfiguration viewport) { + if (ViewportMode.STRETCH_TO_FILL.equals(viewport.getMode())) + gl.getGL2().glOrtho(-radius, +radius, -radius, +radius, near, far); + else if (ViewportMode.RECTANGLE_NO_STRETCH.equals(viewport.getMode())) + gl.getGL2().glOrtho(-radius * viewport.ratio(), +radius * viewport.ratio(), -radius, +radius, near, far); + else if (ViewportMode.SQUARE.equals(viewport.getMode())) + gl.getGL2().glOrtho(-radius, +radius, -radius, +radius, near, far); } /** diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/View.java b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/View.java index c6a79c5e..c600ff7c 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/View.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/View.java @@ -157,11 +157,8 @@ public class View { eye.x -= move.x; eye.y += move.y; - //Logger.getLogger(this.getClass()).info(eye); - //System.out.println(eye); - setViewPoint(eye, updateView); - // fireControllerEvent(ControllerType.ROTATE, eye); + //fireControllerEvent(ControllerType.ROTATE, eye); } public void shift(final float factor) { diff --git a/jzy3d-api/src/api/org/jzy3d/utils/Version.java b/jzy3d-api/src/api/org/jzy3d/utils/Version.java index c7860696..19c3ae42 100644 --- a/jzy3d-api/src/api/org/jzy3d/utils/Version.java +++ b/jzy3d-api/src/api/org/jzy3d/utils/Version.java @@ -2,9 +2,9 @@ package org.jzy3d.utils; /** The Version provides an integer and string representation of the current library version.*/ public class Version { - public static final int MAJOR = 0; - public static final int MINOR = 9; - public static final int PATCH = 1; + public static final int MAJOR = 1; + public static final int MINOR = 0; + public static final int PATCH = 0; public static final String STR = new String(MAJOR + "." + MINOR + "." + PATCH); public static void main(String[] args){ diff --git a/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/picking/AWTMousePickingController.java b/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/picking/AWTMousePickingController.java index e7803acd..a3ee4875 100644 --- a/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/picking/AWTMousePickingController.java +++ b/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/picking/AWTMousePickingController.java @@ -19,146 +19,139 @@ import org.jzy3d.plot3d.rendering.view.View; import com.jogamp.opengl.GL; import com.jogamp.opengl.glu.GLU; -public class AWTMousePickingController extends AbstractCameraController - implements MouseListener, MouseWheelListener { - public AWTMousePickingController() { - super(); - picking = new PickingSupport(); - } +public class AWTMousePickingController extends AbstractCameraController implements MouseListener, MouseWheelListener { + public AWTMousePickingController() { + super(); + picking = new PickingSupport(); + } - public AWTMousePickingController(Chart chart) { - super(chart); - picking = new PickingSupport(); - } + public AWTMousePickingController(Chart chart) { + super(chart); + picking = new PickingSupport(); + } - public AWTMousePickingController(Chart chart, int brushSize) { - super(chart); - picking = new PickingSupport(brushSize); - } + public AWTMousePickingController(Chart chart, int brushSize) { + super(chart); + picking = new PickingSupport(brushSize); + } - public AWTMousePickingController(Chart chart, int brushSize, int bufferSize) { - super(chart); - picking = new PickingSupport(brushSize, bufferSize); - } + public AWTMousePickingController(Chart chart, int brushSize, int bufferSize) { + super(chart); + picking = new PickingSupport(brushSize, bufferSize); + } - @Override + @Override public void register(Chart chart) { - super.register(chart); - this.chart = chart; - this.prevMouse = Coord2d.ORIGIN; - chart.getCanvas().addMouseController(this); - } + super.register(chart); + this.chart = chart; + this.prevMouse = Coord2d.ORIGIN; + chart.getCanvas().addMouseController(this); + } - @Override + @Override public void dispose() { - for (Chart c : targets) { - c.getCanvas().removeMouseController(this); - } + for (Chart c : targets) { + c.getCanvas().removeMouseController(this); + } - if (threadController != null) - threadController.stop(); + if (threadController != null) + threadController.stop(); - super.dispose(); // i.e. target=null - } + super.dispose(); // i.e. target=null + } - /****************/ + /****************/ - public PickingSupport getPickingSupport() { - return picking; - } + public PickingSupport getPickingSupport() { + return picking; + } - public void setPickingSupport(PickingSupport picking) { - this.picking = picking; - } + public void setPickingSupport(PickingSupport picking) { + this.picking = picking; + } - /****************/ + /****************/ - @Override + @Override public void mouseClicked(MouseEvent e) { - } + } - @Override + @Override public void mouseEntered(MouseEvent e) { - } + } - @Override + @Override public void mouseExited(MouseEvent e) { - } + } - @Override + @Override public void mouseReleased(MouseEvent e) { - } + } - public void mouseDragged(MouseEvent e) { - } + public void mouseDragged(MouseEvent e) { + } - /** Compute zoom */ - @Override + /** Compute zoom */ + @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (threadController != null) - threadController.stop(); - System.out.println(e.getWheelRotation()); - float factor = 1 + (e.getWheelRotation() / 10.0f); - System.out.println(AWTMousePickingController.class.getSimpleName() + "wheel:" + factor * 100); - zoomX(factor); - zoomY(factor); - chart.getView().shoot(); - } - + if (threadController != null) + threadController.stop(); + float factor = 1 + (e.getWheelRotation() / 10.0f); + zoomX(factor); + zoomY(factor); + chart.getView().shoot(); + } - public void mouseMoved(MouseEvent e) { - System.out.println("moved"); - pick(e); - } + public void mouseMoved(MouseEvent e) { + pick(e); + } - @Override + @Override public void mousePressed(MouseEvent e) { - if (handleSlaveThread(e)) - return; - pick(e); - } - + if (handleSlaveThread(e)) + return; + pick(e); + } - public void pick(MouseEvent e) { - int yflip = -e.getY() + targets.get(0).getCanvas().getRendererHeight(); - prevMouse.x = e.getX(); - prevMouse.y = e.getY();// yflip; - View view = targets.get(0).getView(); - prevMouse3d = view.projectMouse(e.getX(), yflip); + public void pick(MouseEvent e) { + int yflip = -e.getY() + targets.get(0).getCanvas().getRendererHeight(); + prevMouse.x = e.getX(); + prevMouse.y = e.getY();// yflip; + View view = targets.get(0).getView(); + prevMouse3d = view.projectMouse(e.getX(), yflip); - GL gl = chart().getView().getCurrentGL(); - Graph graph = chart().getScene().getGraph(); + GL gl = chart().getView().getCurrentGL(); + Graph graph = chart().getScene().getGraph(); - // will trigger vertex selection event to those subscribing to - // PickingSupport. - picking.pickObjects(gl, glu, view, graph, new IntegerCoord2d(e.getX(), - yflip)); - } + // will trigger vertex selection event to those subscribing to + // PickingSupport. + picking.pickObjects(gl, glu, view, graph, new IntegerCoord2d(e.getX(), yflip)); + } - public boolean handleSlaveThread(MouseEvent e) { - if (AWTMouseUtilities.isDoubleClick(e)) { - if (threadController != null) { - threadController.start(); - return true; - } - } - if (threadController != null) - threadController.stop(); - return false; - } + public boolean handleSlaveThread(MouseEvent e) { + if (AWTMouseUtilities.isDoubleClick(e)) { + if (threadController != null) { + threadController.start(); + return true; + } + } + if (threadController != null) + threadController.stop(); + return false; + } - /**********************/ + /**********************/ - protected float factor = 1; - protected float lastInc; - protected Coord3d mouse3d; - protected Coord3d prevMouse3d; - protected PickingSupport picking; - protected GLU glu = new GLU(); + protected float factor = 1; + protected float lastInc; + protected Coord3d mouse3d; + protected Coord3d prevMouse3d; + protected PickingSupport picking; + protected GLU glu = new GLU(); - protected Chart chart; + protected Chart chart; - protected Coord2d prevMouse; - protected CameraThreadController threadController; + protected Coord2d prevMouse; + protected CameraThreadController threadController; } diff --git a/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/selection/AWTAbstractMouseSelector.java b/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/selection/AWTAbstractMouseSelector.java index f1f7a92d..a94ff6de 100644 --- a/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/selection/AWTAbstractMouseSelector.java +++ b/jzy3d-api/src/awt/org/jzy3d/chart/controllers/mouse/selection/AWTAbstractMouseSelector.java @@ -103,22 +103,22 @@ public abstract class AWTAbstractMouseSelector implements MouseListener, MouseMo // 2|1 if (in.y < out.y) { if (in.x < out.x) { - // System.out.println("1"); + // ("1"); if (in.x <= px && px <= out.x && in.y <= flipYProjection && flipYProjection <= out.y) return true; } else { - // System.out.println("2"); + // ("2"); if (out.x <= px && px <= in.x && in.y <= flipYProjection && flipYProjection <= out.y) return true; } } else { if (in.x < out.x) { - // System.out.println("3"); + // ("3"); if (in.x <= px && px <= out.x && out.y <= flipYProjection && flipYProjection <= in.y) return true; } else { - // System.out.println("4"); + // ("4"); if (out.x <= px && px <= in.x && out.y <= flipYProjection && flipYProjection <= in.y) // buggy return true; } diff --git a/jzy3d-api/src/awt/org/jzy3d/chart/factories/AWTChartComponentFactory.java b/jzy3d-api/src/awt/org/jzy3d/chart/factories/AWTChartComponentFactory.java index 8d0e7da5..a098dda2 100644 --- a/jzy3d-api/src/awt/org/jzy3d/chart/factories/AWTChartComponentFactory.java +++ b/jzy3d-api/src/awt/org/jzy3d/chart/factories/AWTChartComponentFactory.java @@ -45,7 +45,8 @@ import org.jzy3d.plot3d.rendering.view.layout.IViewportLayout; import com.jogamp.opengl.GLCapabilities; public class AWTChartComponentFactory extends ChartComponentFactory { - + static Logger logger = Logger.getLogger(AWTChartComponentFactory.class); + public static Chart chart() { return chart(Quality.Intermediate); } @@ -185,17 +186,15 @@ public class AWTChartComponentFactory extends ChartComponentFactory { screenshot = new AWTScreenshotKeyController(chart, file); else screenshot = new NewtScreenshotKeyController(chart, file); - screenshot.addListener(new IScreenshotEventListener() { @Override public void failedScreenshot(String file, Exception e) { - System.out.println("Failed to save screenshot:"); - e.printStackTrace(); + logger.error("Failed to save screenshot to '" + file + "'", e); } @Override public void doneScreenshot(String file) { - System.out.println("Screenshot: " + file); + logger.info("Screenshot save to '" + file + "'"); } }); return screenshot; diff --git a/jzy3d-api/src/awt/org/jzy3d/contour/MapperContourMeshGenerator.java b/jzy3d-api/src/awt/org/jzy3d/contour/MapperContourMeshGenerator.java index 98bb14af..f48f49c3 100644 --- a/jzy3d-api/src/awt/org/jzy3d/contour/MapperContourMeshGenerator.java +++ b/jzy3d-api/src/awt/org/jzy3d/contour/MapperContourMeshGenerator.java @@ -92,12 +92,10 @@ public class MapperContourMeshGenerator extends AbstractContourGenerator impleme int i, int j, double[][] contours, boolean[][] processed, float planeAxe) { LineStrip strip = new LineStrip(100); - // System.out.println("strip"); // add current processed[i][j] = true; strip.add(new Point(map(i, j, planeAxe, contours))); - // System.out.println("["+i+","+j+"]"); int width = 1; IntegerCoord2d next = findNext(i, j, width, contours, processed); while (next != null) { @@ -106,11 +104,9 @@ public class MapperContourMeshGenerator extends AbstractContourGenerator impleme Color color = policy.getColorMapper().getColor( new Coord3d(0, 0, contours[next.x][next.y])); strip.add(new Point(coord, color)); - // System.out.println("["+next.x+","+next.y+"]"); // follow path next = findNext(next.x, next.y, width, contours, processed); } - // System.out.println("length " + strip.size()); return strip; } @@ -130,7 +126,6 @@ public class MapperContourMeshGenerator extends AbstractContourGenerator impleme } } } - // System.out.println("tried " + n); if (width < PIXEL_NEIGHBOUR_THRESHOLD) return findNext(i, j, width + 1, contours, processed); return null; diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/builder/concrete/BufferedImageMapper.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/builder/concrete/BufferedImageMapper.java index f7fa6135..1b16348f 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/builder/concrete/BufferedImageMapper.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/builder/concrete/BufferedImageMapper.java @@ -19,7 +19,6 @@ public class BufferedImageMapper extends Mapper { public BufferedImageMapper(BufferedImage bi) { this.image = bi; - //System.out.println("BufferedImage has dimensions: " + new Rectangle(0, 0, bi.getWidth(), bi.getHeight())); this.maxRow = this.image.getHeight() - 1; this.maxViewPort = new Rectangle(0, 0, bi.getWidth(), bi.getHeight()); } diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/CustomEventQueue.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/CustomEventQueue.java index 38bd7e54..350122ad 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/CustomEventQueue.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/CustomEventQueue.java @@ -7,31 +7,32 @@ import java.awt.event.InvocationEvent; import java.awt.event.MouseEvent; import java.awt.event.PaintEvent; -/** Utility for debugging event queue related to 3d in AWT.*/ +import org.apache.log4j.Logger; +/** Utility for debugging event queue related to 3d in AWT. */ public class CustomEventQueue extends EventQueue { - @Override - protected void dispatchEvent(AWTEvent event){ - if(event instanceof PaintEvent) - ;//System.out.println("Dispatch [PAINT]: "+event); - else if(event instanceof MouseEvent) - ;//System.out.println("Dispatch [MOUSE]: "+event); - else if(event instanceof InvocationEvent){ - ;//System.out.println("Dispatch [INVOC]: "+event); - } - else - System.out.println("Dispatch [UNKNO]: "+event); - - super.dispatchEvent(event); - } - - public static void setCustomEventQueue(){ - if(!customQueueSet) - Toolkit.getDefaultToolkit().getSystemEventQueue().push(new CustomEventQueue()); - } - - - /*********************************************************/ - - private static boolean customQueueSet = false; + static Logger logger = Logger.getLogger(CustomEventQueue.class); + + @Override + protected void dispatchEvent(AWTEvent event) { + if (event instanceof PaintEvent) + ;// System.out.println("Dispatch [PAINT]: "+event); + else if (event instanceof MouseEvent) + ;// System.out.println("Dispatch [MOUSE]: "+event); + else if (event instanceof InvocationEvent) { + ;// System.out.println("Dispatch [INVOC]: "+event); + } else + logger.warn("Dispatch [UNKNO]: " + event); + + super.dispatchEvent(event); + } + + public static void setCustomEventQueue() { + if (!customQueueSet) + Toolkit.getDefaultToolkit().getSystemEventQueue().push(new CustomEventQueue()); + } + + /*********************************************************/ + + private static boolean customQueueSet = false; } diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/GLErrorReader.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/GLErrorReader.java index 3c2aa49f..c6712ffa 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/GLErrorReader.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/pipelines/GLErrorReader.java @@ -1,20 +1,24 @@ package org.jzy3d.plot3d.pipelines; +import org.apache.log4j.Logger; + import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES1; import com.jogamp.opengl.GL2ES2; /** This utility allows checking the GL2 error bit after a call to a * GL2 command. + * * When an error is detected, a textual information is printed out in console. * @author Martin Pernollet */ public class GLErrorReader { + static Logger logger = Logger.getLogger(GLErrorReader.class); /** If an error occured, print it and add an information string * at the following line.*/ public static void getAndPrintError(GL gl, String info){ if(getAndPrintError(gl)) - System.err.println(info); + logger.error(info); } /** If an error occured, print it.*/ @@ -27,22 +31,22 @@ public class GLErrorReader { status = false;//System.out.println("No error has been recorded. The value of this symbolic constant is guaranteed to be zero."); } else if(err==GL.GL_INVALID_ENUM){ - System.err.println("GL_INVALID_ENUM: An unacceptable value is specified for an enumerated argument. The offending command is ignored, having no side effect other than to set the error flag."); + logger.error("GL_INVALID_ENUM: An unacceptable value is specified for an enumerated argument. The offending command is ignored, having no side effect other than to set the error flag."); } else if(err==GL.GL_INVALID_VALUE){ - System.err.println("GL_INVALID_VALUE: A numeric argument is out of range. The offending command is ignored, having no side effect other than to set the error flag."); + logger.error("GL_INVALID_VALUE: A numeric argument is out of range. The offending command is ignored, having no side effect other than to set the error flag."); } else if(err==GL.GL_INVALID_OPERATION){ - System.err.println("GL_INVALID_OPERATION : The specified operation is not allowed in the current state. The offending command is ignored, having no side effect other than to set the error flag."); + logger.error("GL_INVALID_OPERATION : The specified operation is not allowed in the current state. The offending command is ignored, having no side effect other than to set the error flag."); } else if(err==GL2ES1.GL_STACK_OVERFLOW || err==GL2ES2.GL_STACK_OVERFLOW){ - System.err.println("GL_STACK_OVERFLOW: This command would cause a stack overflow. The offending command is ignored, having no side effect other than to set the error flag."); + logger.error("GL_STACK_OVERFLOW: This command would cause a stack overflow. The offending command is ignored, having no side effect other than to set the error flag."); } else if(err==GL2ES1.GL_STACK_UNDERFLOW || err==GL2ES2.GL_STACK_UNDERFLOW){ - System.err.println("GL_STACK_UNDERFLOW: This command would cause a stack underflow. The offending command is ignored, having no side effect other than to set the error flag."); + logger.error("GL_STACK_UNDERFLOW: This command would cause a stack underflow. The offending command is ignored, having no side effect other than to set the error flag."); } else if(err==GL.GL_OUT_OF_MEMORY){ - System.err.println("GL_OUT_OF_MEMORY: There is not enough memory left to execute the command. The state of the GL2 is undefined, except for the state of the error flags, after this error is recorded."); + logger.error("GL_OUT_OF_MEMORY: There is not enough memory left to execute the command. The state of the GL2 is undefined, except for the state of the error flags, after this error is recorded."); } return status; diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/primitives/axes/ContourAxeBox.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/primitives/axes/ContourAxeBox.java index 72568641..b9a578a4 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/primitives/axes/ContourAxeBox.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/primitives/axes/ContourAxeBox.java @@ -4,6 +4,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; +import org.apache.log4j.Logger; import org.jzy3d.colors.Color; import org.jzy3d.maths.BoundingBox3d; import org.jzy3d.maths.Coord2d; @@ -31,6 +32,8 @@ import com.jogamp.opengl.glu.GLU; * @author Martin Pernollet */ public class ContourAxeBox extends AxeBox { + static Logger logger = Logger.getLogger(ContourAxeBox.class); + public ContourAxeBox(BoundingBox3d bbox, IAxeLayout layout) { super(bbox, layout); } @@ -120,7 +123,7 @@ public class ContourAxeBox extends AxeBox { // draw contour lines for (ContourLevel line: mesh.lines.getContourLevels()) { line.draw(gl, glu, camera); - System.out.println(line.getValue() + " has " + line.getLines()); + logger.info("Contour level '" + line.getValue() + "' has " + line.getLines()); } // draw text diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/canvas/CanvasAWT.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/canvas/CanvasAWT.java index d8e40eb8..0f3de8a5 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/canvas/CanvasAWT.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/canvas/CanvasAWT.java @@ -135,18 +135,14 @@ public class CanvasAWT extends GLCanvas implements IScreenCanvas { } public void triggerMouseEvent(java.awt.event.MouseEvent e) { - // System.out.println("trigger mouse " + e); processMouseEvent(e); - } public void triggerMouseMotionEvent(java.awt.event.MouseEvent e) { - // System.out.println("trigger mouse motion " + e); processMouseMotionEvent(e); } public void triggerMouseWheelEvent(java.awt.event.MouseWheelEvent e) { - // System.out.println("trigger mouse wheel " + e); processMouseWheelEvent(e); } diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/textures/BufferedImageTexture.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/textures/BufferedImageTexture.java index 4520cd1b..d3cc6bf3 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/textures/BufferedImageTexture.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/textures/BufferedImageTexture.java @@ -39,8 +39,6 @@ public class BufferedImageTexture extends SharedTexture { coords = texture.getImageTexCoords(); halfWidth = texture.getWidth() / 2; halfHeight = texture.getHeight() / 2; - // System.out.println("mount texture: " + file + " halfWidth=" + - // halfWidth + " halfHeight=" + halfHeight); } protected void load(GL gl, BufferedImage image) throws GLException, IOException { diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/OverlayUtils.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/OverlayUtils.java index ebec168c..8204c3f1 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/OverlayUtils.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/OverlayUtils.java @@ -3,6 +3,7 @@ package org.jzy3d.plot3d.rendering.view; import java.awt.Graphics2D; import java.awt.event.MouseEvent; +import org.apache.log4j.Logger; import org.jzy3d.chart.Chart; import org.jzy3d.maths.IntegerCoord2d; import org.jzy3d.maths.PolygonArray; @@ -12,6 +13,7 @@ import org.jzy3d.maths.Statistics; /** Helps understanding how overlay is actually performed by JOGL2. */ public class OverlayUtils { + static Logger logger = Logger.getLogger(OverlayUtils.class); public void drawSelection(Graphics2D g2d, IntegerCoord2d in, int width, int height) { // shows mouse pointer @@ -29,7 +31,7 @@ public class OverlayUtils { // viewport diagonal badly displayed!! Rectangle r = chart.getView().getSceneViewportRectangle(); drawDiagonal(g2d, java.awt.Color.BLUE, r.width, r.height, false); - System.out.println(" BUT viewport.dim ("+r.width+","+r.height+")"); + logger.info(" BUT viewport.dim ("+r.width+","+r.height+")"); /// chart.getCanvas().getRendererWidth() //g2d.drawRect(r.x, r.y, r.width, r.height); @@ -70,14 +72,14 @@ public class OverlayUtils { float r = ((float)i) / ((float)dmax); int wcur = (int)( r * wmax ); int hcur = (int)( r * hmax ); - //System.out.println(wcur + " " + hcur); + //logger.info(wcur + " " + hcur); drawPixel(g2d, c, wcur, hcur); if(sysout){ if(i==0) - System.out.print(" diagonal from (" + wcur + "," + hcur + ")"); + logger.info(" diagonal from (" + wcur + "," + hcur + ")"); else if(i==(dmax-1)) - System.out.print(" to (" + wcur + "," + hcur + ")"); + logger.info(" to (" + wcur + "," + hcur + ")"); } } } @@ -157,6 +159,6 @@ public class OverlayUtils { min = tmin; } } - System.out.println("xmin=" + min + " xmax=" + max); + logger.info("xmin=" + min + " xmax=" + max); } } diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/layout/ColorbarViewportLayout.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/layout/ColorbarViewportLayout.java index 725088dc..af19fbea 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/layout/ColorbarViewportLayout.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/layout/ColorbarViewportLayout.java @@ -57,7 +57,6 @@ public class ColorbarViewportLayout implements IViewportLayout{ renderLegends(gl, glu, chart); // fix overlay on top of chart - //System.out.println(scenePort); view.renderOverlay(gl, view.getCamera().getLastViewPort()); } diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/text/renderers/jogl/JOGLTextRenderer.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/text/renderers/jogl/JOGLTextRenderer.java index 8dda2a20..f2e2862c 100644 --- a/jzy3d-api/src/awt/org/jzy3d/plot3d/text/renderers/jogl/JOGLTextRenderer.java +++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/text/renderers/jogl/JOGLTextRenderer.java @@ -43,17 +43,11 @@ public class JOGLTextRenderer extends AbstractTextRenderer implements ITextRende renderer.begin3DRendering(); if(LAYOUT){ // work in progress Rectangle2D d = style.getBounds(s, font, renderer.getFontRenderContext()); - //System.out.println(d); Coord3d left2d = cam.modelToScreen(gl, glu, position); Coord2d right2d = new Coord2d(left2d.x+(float)d.getWidth(), left2d.y+(float)d.getHeight()); Coord3d right3d = cam.screenToModel(gl, glu, new Coord3d(right2d,0)); Coord3d offset3d = right3d.sub(position).div(2);//.mul(0.1f); Coord3d real = position.add(sceneOffset).sub(offset3d); - /*System.out.println("real=" + real); - System.out.println("position=" + position); - //System.out.println("left3d=" + left2d); - System.out.println("right3d=" + right3d); - System.out.println("offset3d=" + offset3d);*/ renderer.draw3D(s, real.x, real.y, real.z, 1);//0.005f); } else{ diff --git a/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventRecorder.java b/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventRecorder.java index 6ba5ab90..7f41a00b 100644 --- a/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventRecorder.java +++ b/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventRecorder.java @@ -144,7 +144,6 @@ public class EventRecorder extends Timestamped implements MouseListener, MouseMo } protected int getButton(MouseEvent e) { - // System.out.println(e.getButton()); int button = 0; if (e.getButton() == MouseEvent.BUTTON1) button = InputEvent.BUTTON1_MASK; @@ -152,8 +151,6 @@ public class EventRecorder extends Timestamped implements MouseListener, MouseMo button = InputEvent.BUTTON2_MASK; if (e.getButton() == MouseEvent.BUTTON3) button = InputEvent.BUTTON3_MASK; - // if(e.getButton()==MouseEvent.BUTTON1_DOWN_MASK) - // button = InputEvent.BUTTON1_DOWN_MASK; return button; } @@ -201,8 +198,6 @@ public class EventRecorder extends Timestamped implements MouseListener, MouseMo } } - - @Override public void keyPressed(KeyEvent e) { register(new KeyEventLog(KeyEventType.KEY_PRESS, e.getKeyCode(), since())); diff --git a/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventReplay.java b/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventReplay.java index f0feca07..fba77f8e 100644 --- a/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventReplay.java +++ b/jzy3d-api/src/replay/org/jzy3d/junit/replay/EventReplay.java @@ -15,6 +15,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Iterator; +import org.apache.log4j.Logger; import org.jzy3d.junit.replay.events.IComponentEventLog; import org.jzy3d.junit.replay.events.IComponentEventLog.ComponentEventType; import org.jzy3d.junit.replay.events.IEventLog; @@ -25,6 +26,8 @@ import org.jzy3d.junit.replay.events.IMouseEventLog.MouseEventType; import org.jzy3d.junit.replay.events.IWindowEventLog; public class EventReplay extends Timestamped{ + static Logger logger = Logger.getLogger(EventReplay.class); + protected Component component; protected Frame frame; protected Robot robot; @@ -48,20 +51,20 @@ public class EventReplay extends Timestamped{ @Override public void focusLost(FocusEvent arg0) { mute(); - System.out.println("mute event replay as component lost focus"); + logger.info("mute event replay as component lost focus"); } @Override public void focusGained(FocusEvent arg0) { unmute(); - System.out.println("unmute event replay as component gained focus"); + logger.info("unmute event replay as component gained focus"); } }); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { stop(); - System.out.println("stop replay as window closes"); + logger.info("stop replay as window closes"); } }); } @@ -210,11 +213,11 @@ public class EventReplay extends Timestamped{ } protected void log(IEventLog event){ - System.out.println("replay: " + event); + logger.info("replay: " + event); } protected void log(IEventLog event, String info){ - System.out.println("replay: " + event + " " + info); + logger.info("replay: " + event + " " + info); } public Robot getRobot(){ diff --git a/jzy3d-api/src/replay/org/jzy3d/junit/replay/Scenario.java b/jzy3d-api/src/replay/org/jzy3d/junit/replay/Scenario.java index a5880265..a4235108 100644 --- a/jzy3d-api/src/replay/org/jzy3d/junit/replay/Scenario.java +++ b/jzy3d-api/src/replay/org/jzy3d/junit/replay/Scenario.java @@ -5,11 +5,14 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.apache.log4j.Logger; import org.jzy3d.io.SimpleFile; import org.jzy3d.junit.replay.events.EventParser; import org.jzy3d.junit.replay.events.IEventLog; public class Scenario { + static Logger logger = Logger.getLogger(Scenario.class); + protected List events; protected String name; @@ -19,7 +22,7 @@ public class Scenario { } public void register(IEventLog event){ - System.out.println(event); + logger.info(event); events.add(event); } @@ -56,9 +59,9 @@ public class Scenario { } public void info(String file) { - System.out.println("---------------------------------------------------"); - System.out.println(file); - System.out.println("---------------------------------------------------"); + logger.info("---------------------------------------------------"); + logger.info(file); + logger.info("---------------------------------------------------"); //Logger.getLogger(this.getClass()).info("saved events: " + file); } @@ -83,14 +86,14 @@ public class Scenario { EventParser parser = new EventParser(); for(String s: lines){ - //System.out.println("read : " + s); + //logger.info("read : " + s); IEventLog event = parser.parse(s); if(event!=null){ - System.out.println("parsed : " + event); + logger.info("parsed : " + event); events.add(event); } else - System.err.println("non parsable event : " + s); + logger.error("non parsable event : " + s); } info("parsed " + events.size() + " events from " + file); diff --git a/jzy3d-api/src/replay/org/jzy3d/junit/replay/Timestamped.java b/jzy3d-api/src/replay/org/jzy3d/junit/replay/Timestamped.java index fa04a6ae..812dfa90 100644 --- a/jzy3d-api/src/replay/org/jzy3d/junit/replay/Timestamped.java +++ b/jzy3d-api/src/replay/org/jzy3d/junit/replay/Timestamped.java @@ -1,10 +1,13 @@ package org.jzy3d.junit.replay; +import org.apache.log4j.Logger; import org.jzy3d.junit.replay.events.IEventLog; import org.jzy3d.maths.TicToc; /** To be enhanced (wrapper tictoc)*/ public class Timestamped { + static Logger logger = Logger.getLogger(Timestamped.class); + protected TicToc t = new TicToc(); public Timestamped() { @@ -51,7 +54,7 @@ public class Timestamped { public void debugMs(long time){ long elapsed = elapsedMs(); - System.out.println("-> @[" + time/1000 + " s] (" + time + " ms): elapsed:" + elapsed); - //System.out.println("-> @[" + time/1000 + " s] (" + time + " ms): elapsed:" + elapsed + ", now:" + now + ", start:" + startup()); + logger.info("-> @[" + time/1000 + " s] (" + time + " ms): elapsed:" + elapsed); + //logger.info("-> @[" + time/1000 + " s] (" + time + " ms): elapsed:" + elapsed + ", now:" + now + ", start:" + startup()); } } \ No newline at end of file diff --git a/jzy3d-api/src/swing/org/jzy3d/ui/editors/ColorEditor.java b/jzy3d-api/src/swing/org/jzy3d/ui/editors/ColorEditor.java index 77ff1d61..0346a912 100644 --- a/jzy3d-api/src/swing/org/jzy3d/ui/editors/ColorEditor.java +++ b/jzy3d-api/src/swing/org/jzy3d/ui/editors/ColorEditor.java @@ -27,26 +27,12 @@ public class ColorEditor extends JPanel { protected JSlider createSlider(final String title, int min, int max){ final JSlider slider = new JSlider(); - //slider.setBorder(BorderFactory.createTitledBorder(title)); - - /* - Component[] c = slider.getComponents(); - for(Component ci: c){ - System.out.println(ci); - }*/ slider.setMinimum(min); slider.setMaximum(max); slider.setMajorTickSpacing(20); slider.setMinorTickSpacing(5); slider.setPaintTicks(true); slider.setPaintLabels(true); - /*slider.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - System.out.println(title + ": " + slider.getValue()); - } - - });*/ return slider; } diff --git a/jzy3d-api/src/swing/org/jzy3d/ui/editors/Coord3dEditor.java b/jzy3d-api/src/swing/org/jzy3d/ui/editors/Coord3dEditor.java index b1dd70ea..8f27cc73 100644 --- a/jzy3d-api/src/swing/org/jzy3d/ui/editors/Coord3dEditor.java +++ b/jzy3d-api/src/swing/org/jzy3d/ui/editors/Coord3dEditor.java @@ -31,23 +31,12 @@ public class Coord3dEditor extends JPanel { } final JSlider slider = new JSlider(); - //slider.setBorder(BorderFactory.createTitledBorder(title)); - //Component[] c = slider.getComponents(); slider.setMinimum(min); - //slider.setM slider.setMaximum(max); slider.setMajorTickSpacing((max-min)/5); slider.setMinorTickSpacing((max-min)); - slider.setPaintTicks(true); slider.setPaintLabels(true); - /*slider.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - System.out.println(title + ": " + slider.getValue()); - } - - });*/ return slider; } diff --git a/jzy3d-api/src/swing/org/jzy3d/ui/editors/LightEditor.java b/jzy3d-api/src/swing/org/jzy3d/ui/editors/LightEditor.java index fe1da119..58d0977b 100644 --- a/jzy3d-api/src/swing/org/jzy3d/ui/editors/LightEditor.java +++ b/jzy3d-api/src/swing/org/jzy3d/ui/editors/LightEditor.java @@ -44,7 +44,6 @@ public class LightEditor extends JPanel{ slider0.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - //System.out.println(slider0.getValue()); color.r = getPercent(slider0); chart.render(); } @@ -83,7 +82,6 @@ public class LightEditor extends JPanel{ slider0.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - //System.out.println(slider0.getValue()); coord.x = slider0.getValue(); light.setPosition(coord); chart.render(); diff --git a/jzy3d-api/src/swing/org/jzy3d/ui/editors/MaterialEditor.java b/jzy3d-api/src/swing/org/jzy3d/ui/editors/MaterialEditor.java index b54fa3eb..42201fbe 100644 --- a/jzy3d-api/src/swing/org/jzy3d/ui/editors/MaterialEditor.java +++ b/jzy3d-api/src/swing/org/jzy3d/ui/editors/MaterialEditor.java @@ -38,9 +38,7 @@ public class MaterialEditor extends JPanel{ slider0.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - //System.out.println(slider0.getValue()); color.r = getPercent(slider0); - System.out.println(color); chart.render(); } }); @@ -78,7 +76,6 @@ public class MaterialEditor extends JPanel{ public void setTarget(AbstractEnlightable enlightable){ this.enlightable = enlightable; - System.out.println(enlightable); registerColorControl(ambiantColorControl, enlightable.getMaterialAmbiantReflection()); registerColorControl(diffuseColorControl, enlightable.getMaterialDiffuseReflection()); registerColorControl(specularColorControl, enlightable.getMaterialSpecularReflection()); diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/LogScatterTest.java b/jzy3d-api/src/tests/org/jzy3d/tests/LogScatterTest.java deleted file mode 100644 index 9d0ab7dd..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/LogScatterTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jzy3d.tests; - -import java.util.ArrayList; -import java.util.Random; - -import org.jzy3d.analysis.AbstractAnalysis; -import org.jzy3d.analysis.AnalysisLauncher; -import org.jzy3d.chart.factories.AWTChartComponentFactory; -import org.jzy3d.colors.Color; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.maths.Coord3d; -import org.jzy3d.plot3d.primitives.log.AxeTransformableConcurrentScatterMultiColorList; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.transform.space.SpaceTransformLog; -import org.jzy3d.plot3d.transform.space.SpaceTransformer; - -public class LogScatterTest extends AbstractAnalysis { - public static void main(String[] args) throws Exception { - AnalysisLauncher.open(new LogScatterTest()); - } - - SpaceTransformer spaceTransformer = new SpaceTransformer(null, null, new SpaceTransformLog()); - - public void init() { - int size = 500000; - float x; - float y; - float z; - float a; - - ArrayList points = new ArrayList(); - Color[] colors = new Color[size]; - - Random r = new Random(); - r.setSeed(0); - - for (int i = 0; i < size; i++) { - x = r.nextFloat() + 0.1f; - y = r.nextFloat() + 0.1f; - z = r.nextFloat() + 0.1f; - points.add(new Coord3d(x, y, z)); - a = 0.25f; - colors[i] = new Color(x, y, z, a); - } - - AxeTransformableConcurrentScatterMultiColorList scatter = new AxeTransformableConcurrentScatterMultiColorList(points, new ColorMapper(new ColorMapRainbow(), 0.1, 1.1, new Color(1, 1, 1, .5f)), spaceTransformer); - // chart = AWTLogChartComponentFactory.chart(Quality.Advanced, "awt", - // spaceTransformer); - chart = AWTChartComponentFactory.chart(Quality.Advanced, "awt"); - chart.getView().getAxe().setSpaceTransformer(spaceTransformer); - chart.getView().setSpaceTransformer(spaceTransformer); - chart.getScene().add(scatter); - } -} diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/LogTest.java b/jzy3d-api/src/tests/org/jzy3d/tests/LogTest.java deleted file mode 100644 index 590efbd4..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/LogTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.jzy3d.tests; - -import org.jzy3d.chart.Chart; -import org.jzy3d.chart.ChartLauncher; -import org.jzy3d.chart.factories.AWTChartComponentFactory; -import org.jzy3d.colors.Color; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.maths.Coord3d; -import org.jzy3d.maths.Range; -import org.jzy3d.plot3d.builder.Builder; -import org.jzy3d.plot3d.builder.Mapper; -import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid; -import org.jzy3d.plot3d.primitives.CompileableComposite; -import org.jzy3d.plot3d.primitives.axes.AxeBox; -import org.jzy3d.plot3d.primitives.log.AxeTransformablePoint; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.transform.space.SpaceTransformLog; -import org.jzy3d.plot3d.transform.space.SpaceTransformer; - - -public class LogTest { - - public static void main(String[] args) { - // Define a function to plot - Mapper mapper = new Mapper() { - public double f(double x, double y) { - double value = Math.abs((10 * Math.sin(x) * Math.cos(y) * x) / 10) + 10; - return value; - } - }; - - // Define range and precision for the function to plot - Range range = new Range((float)0.1, 10); - Range range2 = new Range((float)0.1,50); - int steps = 200; - - SpaceTransformer spaceTransformer = new SpaceTransformer(null, null, new SpaceTransformLog()); - - // Create a surface drawing that function - CompileableComposite surface = Builder.buildOrthonormalBigLog(new OrthonormalGrid(range, steps, range2, steps), mapper, spaceTransformer); - surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f))); - surface.setFaceDisplayed(true); - surface.setWireframeDisplayed(false); - surface.setWireframeColor(Color.BLACK); - - /*AxeTransformableCylinder cyl = new AxeTransformableCylinder(transformers); - cyl.setData(new Coord3d(10,10,0), 10, 3, 20, 20, new Color(1, 0, 0));*/ - - /*AxeTransformableFlatLine2d fline = new AxeTransformableFlatLine2d(new float[]{1.f,2.f,5.f}, new float[]{3.f,1.f,0.2f}, 5,transformers); - fline.setWireframeColor(new Color(1,1,1)); - - ArrayList points = new ArrayList(); - points.add(new Coord3d(0,0,0)); - points.add(new Coord3d(1,1,1)); - points.add(new Coord3d(3,3,1)); - - AxeTransformableLineStripInterpolated line = new AxeTransformableLineStripInterpolated(new BernsteinInterpolator(), points, 100, transformers); - line.setWireframeColor(new Color(1,1,1));*/ - - AxeTransformablePoint point1 = new AxeTransformablePoint(spaceTransformer); - point1.setData(new Coord3d(1,1,1)); - point1.setColor(new Color(1, 0, 0)); - point1.setWidth(10); - AxeTransformablePoint point2 = new AxeTransformablePoint(spaceTransformer); - point2.setData(new Coord3d(2,3,3)); - point2.setColor(new Color(0,1,0)); - point2.setWidth(10); - AxeTransformablePoint point3 = new AxeTransformablePoint(spaceTransformer); - point3.setData(new Coord3d(3,4,2)); - point3.setColor(new Color(0,0,1)); - point3.setWidth(10); - - - // Create a chart and add the surface - //Chart chart = AWTLogChartComponentFactory.chart(Quality.Advanced, "awt", transformers); - Chart chart = AWTChartComponentFactory.chart(Quality.Advanced, "awt"); - AxeBox axe = (AxeBox)chart.getView().getAxe(); - axe.setSpaceTransformer(spaceTransformer); - chart.addDrawable(point1); - chart.addDrawable(point2); - chart.addDrawable(point3); - chart.addDrawable(surface); - chart.getView().setSpaceTransformer(spaceTransformer); - ChartLauncher.openChart(chart); - } -} diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/MyComposite.java b/jzy3d-api/src/tests/org/jzy3d/tests/MyComposite.java deleted file mode 100644 index 46c3c886..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/MyComposite.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jzy3d.tests; - -import org.jzy3d.plot3d.primitives.AbstractComposite; - -public class MyComposite extends AbstractComposite { - -} \ No newline at end of file diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/PseudoTestFaceOrdering1.java b/jzy3d-api/src/tests/org/jzy3d/tests/PseudoTestFaceOrdering1.java deleted file mode 100644 index b725ed1a..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/PseudoTestFaceOrdering1.java +++ /dev/null @@ -1,227 +0,0 @@ -package org.jzy3d.tests; - -import java.util.ArrayList; -import java.util.List; - -import org.jzy3d.chart.Chart; -import org.jzy3d.chart.ChartLauncher; -import org.jzy3d.chart.factories.AWTChartComponentFactory; -import org.jzy3d.chart.factories.IChartComponentFactory; -import org.jzy3d.colors.Color; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.CompositeColorMapperUpdatePolicy; -import org.jzy3d.colors.OrderingStrategyScoreColorMapper; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.colors.colormaps.IColorMap; -import org.jzy3d.events.IViewPointChangedListener; -import org.jzy3d.events.ViewPointChangedEvent; -import org.jzy3d.maths.Coord3d; -import org.jzy3d.maths.Range; -import org.jzy3d.plot3d.builder.Builder; -import org.jzy3d.plot3d.builder.Mapper; -import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid; -import org.jzy3d.plot3d.builder.concrete.OrthonormalTessellator; -import org.jzy3d.plot3d.primitives.Point; -import org.jzy3d.plot3d.primitives.Shape; -import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout; -import org.jzy3d.plot3d.primitives.axes.layout.renderers.FixedDecimalTickRenderer; -import org.jzy3d.plot3d.primitives.axes.layout.renderers.ScientificNotationTickRenderer; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend; -import org.jzy3d.plot3d.rendering.scene.Graph; -import org.jzy3d.plot3d.rendering.view.AWTView; -import org.jzy3d.plot3d.rendering.view.View; -import org.jzy3d.plot3d.rendering.view.annotation.CameraEyeOverlayAnnotation; -import org.jzy3d.plot3d.text.drawable.DrawableTextBillboard; - -/** - * Set surface colors according to each point distance to camera: red is near, blue is far. - * - * Changing scale factor to >> 1 shows an erroneous computation of coordinates distances: - *
    - *
  • nearest surface polygons on a surface bump appear more far (more blue) than some actually - * other more far polygons. - *
  • when data has a very large Z range, distance computation becomes very unprecise with points all appearing to min or max distance - *
- * Moreover, scaling the surface shows that the actual camera eye point is scaled with the surface - * and not with the view bounds (axebox). - * - * @author Martin - */ -public class PseudoTestFaceOrdering1 { - static double MAPPER_ZSCALE_FACTOR = 100; - - public static void main(String[] args) throws Exception { - PseudoTestFaceOrdering1 surface = new PseudoTestFaceOrdering1(); - surface.BuildAndLaunch(); - } - - public void BuildAndLaunch() { - IChartComponentFactory factory = getFactory(); - final Chart chart = new Chart(factory, Quality.Advanced, "newt"); - chart.getAxeLayout().setZTickRenderer(new ScientificNotationTickRenderer(1)); - chart.getAxeLayout().setYTickRenderer(new FixedDecimalTickRenderer(1)); - chart.getAxeLayout().setXTickRenderer(new FixedDecimalTickRenderer(1)); - - // allow camera eye transform according to view scaling - //BarycentreOrderingStrategy s = (BarycentreOrderingStrategy)chart.getScene().getGraph().getStrategy(); - //s.setView(chart.getView()); // experimental solution: scale camera eye with current view scaling - - genMapperSurface(chart.getView(), chart.getScene().getGraph(), chart.getAxeLayout()); - ((AWTView)chart.getView()).addRenderer2d(new CameraEyeOverlayAnnotation(chart.getView())); - //chart.getView().getCamera().setUseSquaredDistance(false); - - // Points and Textes - //createPoints(chart); - - // chart.getView().setSquared(false); - ChartLauncher.openChart(chart); - - //chart.getView().getViewPointL - } - - private AWTChartComponentFactory getFactory() { - return new AWTChartComponentFactory(); - } - - public void createPoints(final Chart chart) { - _experiencesPoints = new ArrayList(); - _experiencesLabels = new ArrayList(); - for (int i = 0; i < _expX.length; i++) { - Coord3d coord = new Coord3d(_expX[i], _expY[i], _expZ[i]); - // Points ... - Point point = new Point(coord, Color.BLACK, 5); - _experiencesPoints.add(point); - - // Labels ... - String txt = _expIndex[i]; - DrawableTextBillboard label = new DrawableTextBillboard(txt, coord.add(new Coord3d(0.1, 0.1, 0.1)), Color.BLACK); - _experiencesLabels.add(label); - } - - chart.getScene().getGraph().add(_experiencesLabels); - chart.getScene().getGraph().add(_experiencesPoints); - } - - /** - * Build a mapper based surface - */ - public Shape genMapperSurface(final View view, final Graph graph, final IAxeLayout layout){ - Mapper mapper = new Mapper() { - @Override - public double f(double x, double y) { - return MAPPER_ZSCALE_FACTOR * Math.sin(x / 10) * Math.cos(y / 20) * x; - } - }; - Range range = new Range(-150, 150); - int steps = 50; - - // Create the object to represent the function over the given range - OrthonormalGrid grid = new OrthonormalGrid(range, steps, range, steps); - OrthonormalTessellator tesselator = new OrthonormalTessellator() { - /*protected AbstractDrawable newQuad(Point p[]) { - AbstractDrawable quad = new TesselatedPolygon(p); - return quad; - }*/ - }; - surface = (Shape) tesselator.build(grid.apply(mapper)); - - return createSurface(surface, view, graph, layout); - } - - /** - * Build a delaunay based surface - */ - public Shape genDelaunaySurface(final View view, final Graph graph, final IAxeLayout layout){ - List data = new ArrayList(); - for (int i = 0; i < _x.length; i++) { - data.add(new Coord3d(_x[i], _y[i], _z[i])); - } - surface = Builder.buildDelaunay(data); - return createSurface(surface, view, graph, layout); - } - - /** - * Setup surface coloring policy and change listeners. - */ - public Shape createSurface(final Shape surface, final View view, final Graph graph, final IAxeLayout layout) { - Color factor = new Color(1, 1, 1, 0.75f); - - colormap = new ColorMapRainbow(); - colormap.setDirection(false); - - colormapper = new OrderingStrategyScoreColorMapper(colormap, new CompositeColorMapperUpdatePolicy(), graph, factor); - surface.setColorMapper(colormapper); - surface.setWireframeDisplayed(true); - - colorbar = new AWTColorbarLegend(surface, layout); - surface.setLegend(colorbar); - - view.addViewPointChangedListener(new IViewPointChangedListener(){ - @Override - public void viewPointChanged(ViewPointChangedEvent e) { - //System.out.println("min:" + colormapper.getMin() + " max:" + colormapper.getMax()); - //TicToc t = new TicToc(); - //t.tic(); - updateColorMapperRange(); - //t.toc(); - } - }); - - graph.add(surface); - - return surface; - } - - public void updateColorMapperRange(){ - colormapper.preDraw(surface); - } - - protected IColorMap colormap; - protected ColorMapper colormapper; - protected AWTColorbarLegend colorbar; - protected Shape surface; - - private final double[] _x; - private final double[] _y; - private final double[] _z; - private final double[] _expX; - private final double[] _expY; - private final double[] _expZ; - private final String[] _expIndex; - private ArrayList _experiencesPoints; - private ArrayList _experiencesLabels; - - - /** - * Surface - */ - public PseudoTestFaceOrdering1() { - _expX = new double[] { -1.0, 1.0, 0.0, 0.0, 0.0 }; - _expY = new double[] { 0.0, 0.0, -1.0, 1.0, 0.0 }; - _expZ = new double[] { 1799635.862225038, 2778958.3605334656, 2308941.6737486282, 2791418.430038142, 2778052.031336538 }; - _expIndex = new String[] { "17", "18", " 19", "20", "27" }; - - _y = new double[] { -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, - 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, - 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, - 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, - -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 }; - - _x = new double[] { -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, - -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, - -0.2, -0.2, -0.2, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, - 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, - 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; - - _z = new double[] { 1648446.8, 1691895.4, 1732207.9, 1769384.4, 1803424.9, 1834329.2, 1862097.6, 1886729.9, 1908226.1, 1926586.4, 1941810.5, 1953898.6, 1962850.8, 1968666.8, 1971346.8, 1970890.6, 1967298.5, 1960570.4, 1950706.1, 1937705.9, 1921569.6, 1761433.5, 1805073.4, 1845577.0, 1882944.8, 1917176.2, 1948271.9, 1976231.4, 2001054.9, 2022742.4, 2041293.8, 2056709.1, 2068988.4, 2078131.6, 2084138.9, 2087010.0, 2086745.1, 2083344.1, 2076807.1, 2067134.1, 2054325.1, 2038380.0, 1866066.5, 1909897.5, 1950592.4, 1988151.2, 2022574.0, 2053860.8, 2082011.5, 2107026.2, - 2128904.8, 2147647.2, 2163253.8, 2175724.2, 2185058.8, 2191257.2, 2194319.5, 2194245.8, 2191036.0, 2184690.2, 2175208.2, 2162590.5, 2146836.5, 1962345.9, 2006368.0, 2047254.1, 2085004.1, 2119618.0, 2151096.0, 2179438.0, 2204643.8, 2226713.5, 2245647.2, 2261445.0, 2274106.8, 2283632.2, 2290021.8, 2293275.2, 2293392.8, 2290374.2, 2284219.5, 2274929.0, 2262502.2, 2246939.5, 2050271.5, 2094484.8, 2135562.0, 2173503.2, 2208308.5, 2239977.5, 2268510.5, 2293907.5, 2316168.5, 2335293.5, 2351282.2, 2364135.2, 2373852.0, 2380432.8, 2383877.5, 2384186.0, 2381358.8, - 2375395.2, 2366295.8, 2354060.2, 2338688.5, 2129843.5, 2174248.0, 2215516.2, 2253648.8, 2288645.0, 2320505.2, 2349229.5, 2374817.8, 2397270.0, 2416586.0, 2432766.0, 2445810.0, 2455718.0, 2462490.0, 2466125.8, 2466625.8, 2463989.5, 2458217.2, 2449308.8, 2437264.5, 2422084.0, 2201061.8, 2245657.2, 2287117.0, 2325440.5, 2360628.0, 2392679.5, 2421594.8, 2447374.2, 2470017.5, 2489524.8, 2505896.0, 2519131.2, 2529230.5, 2536193.5, 2540020.5, 2540711.5, 2538266.5, 2532685.5, 2523968.2, 2512115.0, 2497125.8, 2263926.2, 2308713.0, 2350363.8, 2388878.5, 2424257.2, - 2456499.8, 2485606.5, 2511577.0, 2534411.5, 2554110.0, 2570672.2, 2584098.8, 2594389.0, 2601543.2, 2605561.5, 2606443.8, 2604189.8, 2598800.0, 2590274.0, 2578612.0, 2563814.0, 2318437.0, 2363415.0, 2405257.0, 2443962.8, 2479532.8, 2511966.5, 2541264.2, 2567426.0, 2590451.8, 2610341.2, 2627095.0, 2640712.5, 2651194.0, 2658539.5, 2662748.8, 2663822.2, 2661759.5, 2656560.8, 2648226.0, 2636755.2, 2622148.2, 2364594.0, 2409763.2, 2451796.2, 2490693.5, 2526454.5, 2559079.5, 2588568.5, 2614921.2, 2638138.2, 2658219.0, 2675163.8, 2688972.5, 2699645.2, 2707181.8, - 2711582.5, 2712847.0, 2710975.5, 2705968.0, 2697824.2, 2686544.8, 2672129.0, 2402397.5, 2447757.8, 2489982.0, 2529070.5, 2565022.5, 2597838.8, 2627519.0, 2654063.0, 2677471.0, 2697743.0, 2714879.0, 2728879.0, 2739742.8, 2747470.5, 2752062.2, 2753518.0, 2751837.8, 2747021.2, 2739069.0, 2727980.5, 2713756.0, 2431847.0, 2477398.8, 2519814.2, 2559093.5, 2595237.0, 2628244.2, 2658115.8, 2684851.0, 2708450.2, 2728913.2, 2746240.5, 2760431.5, 2771486.5, 2779405.5, 2784188.5, 2785835.5, 2784346.2, 2779721.0, 2771959.8, 2761062.5, 2747029.2, 2452943.0, 2498685.8, - 2541292.5, 2580763.2, 2617097.8, 2650296.2, 2680358.8, 2707285.2, 2731075.5, 2751730.0, 2769248.2, 2783630.5, 2794876.8, 2802986.8, 2807961.0, 2809799.0, 2808501.0, 2804067.0, 2796497.0, 2785791.0, 2771948.8, 2465685.5, 2511619.2, 2554417.2, 2594079.0, 2630604.8, 2663994.5, 2694248.0, 2721365.8, 2745347.2, 2766192.8, 2783902.2, 2798475.8, 2809913.0, 2818214.5, 2823379.8, 2825409.0, 2824302.2, 2820059.2, 2812680.5, 2802165.5, 2788514.5, 2470074.0, 2516199.0, 2559188.0, 2599041.0, 2635758.0, 2669339.0, 2699783.8, 2727092.5, 2751265.2, 2772302.0, 2790202.8, - 2804967.2, 2816595.8, 2825088.2, 2830444.8, 2832665.2, 2831749.8, 2827698.0, 2820510.2, 2810186.5, 2796726.8, 2466108.8, 2512425.0, 2555605.2, 2595649.5, 2632557.5, 2666329.8, 2696965.8, 2724465.8, 2748829.5, 2770057.5, 2788149.2, 2803105.0, 2814924.8, 2823608.5, 2829156.2, 2831567.8, 2830843.2, 2826982.8, 2819986.2, 2809853.8, 2796585.2, 2453790.0, 2500297.5, 2543668.8, 2583904.2, 2621003.5, 2654966.8, 2685794.0, 2713485.0, 2738040.2, 2759459.2, 2777742.2, 2792889.2, 2804900.2, 2813775.0, 2819513.8, 2822116.5, 2821583.2, 2817914.0, 2811108.8, 2801167.2, - 2788089.8, 2433117.5, 2479816.0, 2523378.5, 2563805.2, 2601095.5, 2635250.0, 2666268.5, 2694150.8, 2718897.0, 2740507.2, 2758981.5, 2774319.5, 2786521.8, 2795587.8, 2801517.8, 2804311.8, 2803969.8, 2800491.5, 2793877.2, 2784127.2, 2771241.0, 2404091.2, 2450981.0, 2494734.8, 2535352.5, 2572834.0, 2607179.8, 2638389.2, 2666462.8, 2691400.2, 2713201.8, 2731867.0, 2747396.2, 2759789.5, 2769046.8, 2775168.0, 2778153.2, 2778002.2, 2774715.2, 2768292.2, 2758733.2, 2746038.2, 2366711.2, 2413792.2, 2457737.2, 2498546.0, 2536218.8, 2570755.5, 2602156.2, 2630421.0, - 2655549.8, 2677542.2, 2696398.8, 2712119.2, 2724703.8, 2734152.2, 2740464.5, 2743641.0, 2743681.2, 2740585.5, 2734353.5, 2724985.8, 2712481.8, 2320977.5, 2368249.8, 2412385.8, 2453386.0, 2491249.8, 2525977.8, 2557569.8, 2586025.5, 2611345.5, 2633529.2, 2652577.0, 2668488.8, 2681264.2, 2690903.8, 2697407.5, 2700775.0, 2701006.2, 2698101.8, 2692061.2, 2682884.5, 2670571.8 }; - } -} \ No newline at end of file diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/PseudoTestManualBounds.java b/jzy3d-api/src/tests/org/jzy3d/tests/PseudoTestManualBounds.java deleted file mode 100644 index e363897d..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/PseudoTestManualBounds.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.jzy3d.tests; - - -import org.jzy3d.analysis.AbstractAnalysis; -import org.jzy3d.analysis.AnalysisLauncher; -import org.jzy3d.analysis.IAnalysis; -import org.jzy3d.chart.Chart; -import org.jzy3d.chart.controllers.keyboard.camera.AWTCameraKeyController; -import org.jzy3d.chart.controllers.mouse.camera.NewtCameraMouseController; -import org.jzy3d.colors.Color; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.maths.BoundingBox3d; -import org.jzy3d.maths.Range; -import org.jzy3d.plot3d.builder.Builder; -import org.jzy3d.plot3d.builder.Mapper; -import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid; -import org.jzy3d.plot3d.primitives.Shape; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.rendering.view.modes.ViewBoundMode; - -public class PseudoTestManualBounds extends AbstractAnalysis { - public static void main(String[] args) throws Exception { - IAnalysis d = new PseudoTestManualBounds(); - d.setCanvasType("newt"); - AnalysisLauncher.open(d); - - // calling: - // d.getChart().getView().setBoundManual(new BoundingBox3d(-1,1, -1,1, -1,1)); - // immediatly will fail since frame is probably not open yet, and thus the view - // initialization will reset bounds to the scene graph bounds. - // - // to avoid being erased by the view init, one may either: - // wait a little bit: Thread.sleep(1000); - // or force an initialization bounds as follow - // @since oct 27 2012 - d.getChart().getView().setInitBounds(new BoundingBox3d(-1,1, -1,1, -1,1)); - System.out.println(d.getChart().getView().getBounds()); - } - - @Override - public void init() { - // Define a function to plot - Mapper mapper = new Mapper() { - @Override - public double f(double x, double y) { - return 0;//x * Math.sin(x * y); - } - }; - - // Define range and precision for the function to plot - Range range = new Range(-3, 3); - int steps = 80; - - // Create the object to represent the function over the given range. - final Shape surface = Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper); - surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f))); - surface.setFaceDisplayed(true); - surface.setWireframeDisplayed(false); -System.out.println(getCanvasType()); - // Create a chart - chart = new Chart(Quality.Advanced, getCanvasType()); - chart.getScene().getGraph().add(surface); - chart.addController(new AWTCameraKeyController()); - - chart.getView().setBoundMode(ViewBoundMode.MANUAL); - NewtCameraMouseController c = new NewtCameraMouseController(chart); - } -} diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/RotationTextTest.java b/jzy3d-api/src/tests/org/jzy3d/tests/RotationTextTest.java deleted file mode 100644 index 358f3cc3..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/RotationTextTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.jzy3d.tests; - -import java.util.ArrayList; - -import org.jzy3d.analysis.AbstractAnalysis; -import org.jzy3d.analysis.AnalysisLauncher; -import org.jzy3d.chart.factories.AWTChartComponentFactory; -import org.jzy3d.colors.Color; -import org.jzy3d.maths.Coord3d; -import org.jzy3d.plot3d.primitives.LineStrip; -import org.jzy3d.plot3d.primitives.Point; -import org.jzy3d.plot3d.primitives.pickable.PickablePoint; -import org.jzy3d.plot3d.rendering.canvas.CanvasAWT; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.rendering.view.modes.ViewPositionMode; -import org.jzy3d.plot3d.text.align.Halign; -import org.jzy3d.plot3d.text.drawable.DrawableTextBitmap; -import org.jzy3d.plot3d.transform.Rotate; -import org.jzy3d.plot3d.transform.Transform; - -public class RotationTextTest extends AbstractAnalysis { - //https://github.com/zhivko/jzy3d-api.git - public static RotationTextTest instance; - public MyComposite myComposite; - public ArrayList points; - - public static void main(String[] args) throws Exception { - System.setProperty("java.util.Arrays.useLegacyMergeSort", "true"); - instance = new RotationTextTest(); - AnalysisLauncher.open(instance); - CanvasAWT canvas = (CanvasAWT) instance.chart.getCanvas(); - canvas.setSize(600, 600); - instance.chart.getView().setViewPositionMode(ViewPositionMode.FREE); - - for (int i = 0; i < -1; i++) { - double angle = 4; - Rotate rotate = new Rotate(angle, new Coord3d(0, 0, 1)); - Transform t = new Transform(); - t.add(rotate); - instance.myComposite.applyGeometryTransform(t); - instance.chart.render(); - Thread.currentThread(); - Thread.sleep(300); - //File f = new File("c:\\temp\\pic_" + i + ".jpg"); -// try { -//// instance.chart.screenshot(f); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - } - - - } - - @Override - public void init() { - - System.out.println("Creating chart! Thread: " + Thread.currentThread().getName()); - myComposite = new MyComposite(); - points = new ArrayList(); - chart = AWTChartComponentFactory.chart(Quality.Advanced, getCanvasType()); - - CanvasAWT canvas = (CanvasAWT) chart.getCanvas(); - // canvas.getAnimator().start(); - System.out.println("Animator started?: " + canvas.getAnimator().isStarted()); - PickablePoint mp1 = new PickablePoint(new Coord3d(0, 2, 2), Color.GRAY, 5); - PickablePoint mp2 = new PickablePoint(new Coord3d(2, 2, 2), Color.GRAY, 5); - PickablePoint mp3 = new PickablePoint(new Coord3d(1, 5, 2), Color.GRAY, 5); - PickablePoint mp4 = new PickablePoint(new Coord3d(1, 3, 3), Color.GRAY, 5); - points.add(mp1); - points.add(mp2); - points.add(mp3); - points.add(mp4); - - LineStrip ls = new LineStrip(); - ls.setWireframeColor(Color.GRAY); - ls.add(mp1); - ls.add(mp2); - ls.add(mp3); - ls.add(mp4); - ls.add(mp2); - ls.add(mp4); - ls.add(mp1); - ls.setWireframeWidth(6); - ls.setWidth(6); - - float distance = (float) mp2.xyz.distance(mp1.xyz); - Coord3d delta = mp2.xyz.sub(mp1.xyz).normalizeTo((float) (distance * 0.5)); - Coord3d textPos = mp1.xyz.add(delta); - - DrawableTextBitmap t4 = new DrawableTextBitmap("edge", textPos, Color.BLACK); - t4.setHalign(Halign.LEFT); // TODO: invert - myComposite.add(t4); - myComposite.add(ls); - addAxis(); - - chart.getScene().getGraph().add(myComposite,true); - - } - - public void addAxis() { - LineStrip yAxis = new LineStrip(); - yAxis.setWireframeColor(Color.GREEN); - yAxis.add(new Point(new Coord3d(0, 0, 0))); - yAxis.add(new Point(new Coord3d(0, 1, 0))); - - LineStrip xAxis = new LineStrip(); - xAxis.setWireframeColor(Color.BLUE); - xAxis.add(new Point(new Coord3d(0, 0, 0))); - xAxis.add(new Point(new Coord3d(0.3, 0, 0))); - - LineStrip zAxis = new LineStrip(); - zAxis.setWireframeColor(Color.RED); - zAxis.add(new Point(new Coord3d(0, 0, 0))); - zAxis.add(new Point(new Coord3d(0, 0, 0.3))); - myComposite.add(xAxis); - myComposite.add(zAxis); - myComposite.add(yAxis); - - } - -} \ No newline at end of file diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/TestChartTest.java b/jzy3d-api/src/tests/org/jzy3d/tests/TestChartTest.java deleted file mode 100644 index c03f52f5..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/TestChartTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jzy3d.tests; - -import java.awt.image.BufferedImage; -import java.io.IOException; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.jzy3d.junit.ChartTest; -import org.jzy3d.junit.ChartTestFailed; - -/** - * Testing the test tool! - * - * @author martin - * - */ -public class TestChartTest { - ChartTest test; - - @Before - public void before(){ - test = new ChartTest(); - } - - @Test - public void compareImageWithHerselfSucceed() throws IOException{ - BufferedImage bi = test.loadBufferedImage("data/tests/SimpleChartTest.png"); - try { - test.compare(bi, bi); - } catch (ChartTestFailed e) { - Assert.fail(e.getMessage()); - } - Assert.assertTrue(true); - } - - @Test - public void compareImageWithAnotherFails() throws IOException{ - BufferedImage bi1 = test.loadBufferedImage("data/tests/SimpleChartTest.png"); - BufferedImage bi2 = test.loadBufferedImage("data/tests/SimpleChartTest#ERROR#.png"); - try { - test.compare(bi1, bi2); - } catch (ChartTestFailed e) { - Assert.assertTrue(e.getMessage(), true); - return; - } - Assert.fail("two different image should throw an exception"); - } -} diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/TestColormaps.java b/jzy3d-api/src/tests/org/jzy3d/tests/TestColormaps.java deleted file mode 100644 index 282bab52..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/TestColormaps.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jzy3d.tests; - -import java.awt.image.BufferedImage; -import java.io.IOException; - -import org.junit.Test; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.colormaps.ColorMapGrayscale; -import org.jzy3d.colors.colormaps.ColorMapHotCold; -import org.jzy3d.colors.colormaps.ColorMapRBG; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.colors.colormaps.ColorMapRainbowNoBorder; -import org.jzy3d.colors.colormaps.ColorMapRedAndGreen; -import org.jzy3d.colors.colormaps.ColorMapWhiteBlue; -import org.jzy3d.colors.colormaps.ColorMapWhiteGreen; -import org.jzy3d.colors.colormaps.ColorMapWhiteRed; -import org.jzy3d.colors.colormaps.IColorMap; -import org.jzy3d.junit.ChartTest; -import org.jzy3d.plot2d.primitive.AWTColorbarImageGenerator; -import org.jzy3d.utils.LoggerUtils; - -public class TestColormaps extends ChartTest { - @Test - public void testColormaps() throws IOException { - LoggerUtils.minimal(); - - execute(new ColorMapGrayscale(), true); - execute(new ColorMapHotCold(), true); - execute(new ColorMapRainbow(), true); - execute(new ColorMapRainbowNoBorder(), true); - execute(new ColorMapRBG(), true); - execute(new ColorMapRedAndGreen(), true); - execute(new ColorMapWhiteBlue(), true); - execute(new ColorMapWhiteGreen(), true); - execute(new ColorMapWhiteRed(), true); - - execute(new ColorMapGrayscale(), false); - execute(new ColorMapHotCold(), false); - execute(new ColorMapRainbow(), false); - execute(new ColorMapRainbowNoBorder(), false); - execute(new ColorMapRBG(), false); - execute(new ColorMapRedAndGreen(), false); - execute(new ColorMapWhiteBlue(), false); - execute(new ColorMapWhiteGreen(), false); - execute(new ColorMapWhiteRed(), false); - } - - public void execute(IColorMap colormap, boolean direction) - throws IOException { - String file = "colormaps/" + colormap.getClass().getSimpleName(); - if (!direction) - file += "-inv"; -// execute(makeColormapImage(colormap, direction), -// getTestCaseFileName(file)); - } - - protected BufferedImage makeColormapImage(IColorMap colormap, - boolean direction) throws IOException { - colormap.setDirection(direction); - ColorMapper mapper = new ColorMapper(colormap, 0, 1); - AWTColorbarImageGenerator g = new AWTColorbarImageGenerator(mapper, null, - null); - return g.toImage(20, 300, 19); - } -} diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/Coord3dTest.java b/jzy3d-api/src/tests/org/jzy3d/tests/TestCoord3dRotate.java similarity index 73% rename from jzy3d-api/src/tests/org/jzy3d/tests/Coord3dTest.java rename to jzy3d-api/src/tests/org/jzy3d/tests/TestCoord3dRotate.java index 101cbe50..77839b9c 100644 --- a/jzy3d-api/src/tests/org/jzy3d/tests/Coord3dTest.java +++ b/jzy3d-api/src/tests/org/jzy3d/tests/TestCoord3dRotate.java @@ -1,7 +1,7 @@ package org.jzy3d.tests; -import junit.framework.TestCase; - +import org.junit.Assert; +import org.junit.Test; import org.jzy3d.maths.Coord3d; /** @@ -10,16 +10,10 @@ import org.jzy3d.maths.Coord3d; * @author Florian Enner < florian @ enner.org > * @since 01.01.14 */ -public class Coord3dTest extends TestCase { - +public class TestCoord3dRotate { float delta = 1E-6f; - void assertEqualCoord(Coord3d expected, Coord3d actual) { - assertEquals(expected.x, actual.x, delta); - assertEquals(expected.y, actual.y, delta); - assertEquals(expected.z, actual.z, delta); - } - + @Test public void testCross() throws Exception { Coord3d x = new Coord3d(1, 0, 0); Coord3d y = new Coord3d(0, 1, 0); @@ -27,7 +21,8 @@ public class Coord3dTest extends TestCase { assertEqualCoord(z, x.cross(y)); } - public void testRotateX() throws Exception { + @Test + public void rotateX() throws Exception { Coord3d input = new Coord3d(0, 1, 0); Coord3d axis = new Coord3d(1, 0, 0); float angle = 90f; @@ -35,7 +30,8 @@ public class Coord3dTest extends TestCase { assertEqualCoord(expected, input.rotate(angle, axis)); } - public void testRotateY() throws Exception { + @Test + public void rotateY() throws Exception { Coord3d input = new Coord3d(1, 0, 0); Coord3d axis = new Coord3d(0, 1, 0); float angle = 90f; @@ -43,11 +39,18 @@ public class Coord3dTest extends TestCase { assertEqualCoord(expected, input.rotate(angle, axis)); } - public void testRotateZ() throws Exception { + @Test + public void rotateZ() throws Exception { Coord3d input = new Coord3d(0, 1, 0); Coord3d axis = new Coord3d(0, 0, 1); float angle = 90f; Coord3d expected = new Coord3d(-1, 0, 0); assertEqualCoord(expected, input.rotate(angle, axis)); } + + void assertEqualCoord(Coord3d expected, Coord3d actual) { + Assert.assertEquals(expected.x, actual.x, delta); + Assert.assertEquals(expected.y, actual.y, delta); + Assert.assertEquals(expected.z, actual.z, delta); + } } diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/TestPointOrderingStrategy.java b/jzy3d-api/src/tests/org/jzy3d/tests/TestPointOrderingStrategy.java deleted file mode 100644 index f4ee25e2..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/TestPointOrderingStrategy.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jzy3d.tests; - -import java.util.ArrayList; -import java.util.Random; - -import org.junit.Test; -import org.jzy3d.maths.Coord3d; -import org.jzy3d.plot3d.rendering.ordering.PointOrderingStrategy; -import org.jzy3d.plot3d.rendering.view.Camera; - -public class TestPointOrderingStrategy { - @Test - public void testPointOrdering() throws Exception { - ArrayList points = new ArrayList(); - Random random = new java.util.Random(); - for (int i = 0; i < 10000; i++) { - points.add( new Coord3d( random.nextInt() % 10, random.nextInt() % 10, random.nextInt() % 10 ) ); - } - new PointOrderingStrategy().sort(points, new Camera(new Coord3d(0, 0, 0))); // <-- Here occurs an exception in TimSort@JDK7 when illegal sorting algorithm is used - } -} diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/TrialFaceOrdering.java b/jzy3d-api/src/tests/org/jzy3d/tests/TrialFaceOrdering.java deleted file mode 100644 index fe368c0a..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/TrialFaceOrdering.java +++ /dev/null @@ -1,227 +0,0 @@ -package org.jzy3d.tests; - -import java.util.ArrayList; -import java.util.List; - -import org.jzy3d.chart.Chart; -import org.jzy3d.chart.ChartLauncher; -import org.jzy3d.chart.factories.AWTChartComponentFactory; -import org.jzy3d.chart.factories.IChartComponentFactory; -import org.jzy3d.colors.Color; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.CompositeColorMapperUpdatePolicy; -import org.jzy3d.colors.OrderingStrategyScoreColorMapper; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.colors.colormaps.IColorMap; -import org.jzy3d.events.IViewPointChangedListener; -import org.jzy3d.events.ViewPointChangedEvent; -import org.jzy3d.maths.Coord3d; -import org.jzy3d.maths.Range; -import org.jzy3d.plot3d.builder.Builder; -import org.jzy3d.plot3d.builder.Mapper; -import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid; -import org.jzy3d.plot3d.builder.concrete.OrthonormalTessellator; -import org.jzy3d.plot3d.primitives.Point; -import org.jzy3d.plot3d.primitives.Shape; -import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout; -import org.jzy3d.plot3d.primitives.axes.layout.renderers.FixedDecimalTickRenderer; -import org.jzy3d.plot3d.primitives.axes.layout.renderers.ScientificNotationTickRenderer; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend; -import org.jzy3d.plot3d.rendering.scene.Graph; -import org.jzy3d.plot3d.rendering.view.AWTView; -import org.jzy3d.plot3d.rendering.view.View; -import org.jzy3d.plot3d.rendering.view.annotation.CameraEyeOverlayAnnotation; -import org.jzy3d.plot3d.text.drawable.DrawableTextBillboard; - -/** - * Set surface colors according to each point distance to camera: red is near, blue is far. - * - * Changing scale factor to >> 1 shows an erroneous computation of coordinates distances: - *
    - *
  • nearest surface polygons on a surface bump appear more far (more blue) than some actually - * other more far polygons. - *
  • when data has a very large Z range, distance computation becomes very unprecise with points all appearing to min or max distance - *
- * Moreover, scaling the surface shows that the actual camera eye point is scaled with the surface - * and not with the view bounds (axebox). - * - * @author Martin - */ -public class TrialFaceOrdering { - static double MAPPER_ZSCALE_FACTOR = 100; - - public static void main(String[] args) throws Exception { - TrialFaceOrdering surface = new TrialFaceOrdering(); - surface.BuildAndLaunch(); - } - - public void BuildAndLaunch() { - IChartComponentFactory factory = getFactory(); - final Chart chart = new Chart(factory, Quality.Advanced, "awt"); - chart.getAxeLayout().setZTickRenderer(new ScientificNotationTickRenderer(1)); - chart.getAxeLayout().setYTickRenderer(new FixedDecimalTickRenderer(1)); - chart.getAxeLayout().setXTickRenderer(new FixedDecimalTickRenderer(1)); - - // allow camera eye transform according to view scaling - //BarycentreOrderingStrategy s = (BarycentreOrderingStrategy)chart.getScene().getGraph().getStrategy(); - //s.setView(chart.getView()); // experimental solution: scale camera eye with current view scaling - - genMapperSurface(chart.getView(), chart.getScene().getGraph(), chart.getAxeLayout()); - ((AWTView)chart.getView()).addRenderer2d(new CameraEyeOverlayAnnotation(chart.getView())); - //chart.getView().getCamera().setUseSquaredDistance(false); - - // Points and Textes - //createPoints(chart); - - // chart.getView().setSquared(false); - ChartLauncher.openChart(chart); - - //chart.getView().getViewPointL - } - - private AWTChartComponentFactory getFactory() { - return new AWTChartComponentFactory(); - } - - public void createPoints(final Chart chart) { - _experiencesPoints = new ArrayList(); - _experiencesLabels = new ArrayList(); - for (int i = 0; i < _expX.length; i++) { - Coord3d coord = new Coord3d(_expX[i], _expY[i], _expZ[i]); - // Points ... - Point point = new Point(coord, Color.BLACK, 5); - _experiencesPoints.add(point); - - // Labels ... - String txt = _expIndex[i]; - DrawableTextBillboard label = new DrawableTextBillboard(txt, coord.add(new Coord3d(0.1, 0.1, 0.1)), Color.BLACK); - _experiencesLabels.add(label); - } - - chart.getScene().getGraph().add(_experiencesLabels); - chart.getScene().getGraph().add(_experiencesPoints); - } - - /** - * Build a mapper based surface - */ - public Shape genMapperSurface(final View view, final Graph graph, final IAxeLayout layout){ - Mapper mapper = new Mapper() { - @Override - public double f(double x, double y) { - return MAPPER_ZSCALE_FACTOR * Math.sin(x / 10) * Math.cos(y / 20) * x; - } - }; - Range range = new Range(-150, 150); - int steps = 50; - - // Create the object to represent the function over the given range - OrthonormalGrid grid = new OrthonormalGrid(range, steps, range, steps); - OrthonormalTessellator tesselator = new OrthonormalTessellator() { - /*protected AbstractDrawable newQuad(Point p[]) { - AbstractDrawable quad = new TesselatedPolygon(p); - return quad; - }*/ - }; - surface = (Shape) tesselator.build(grid.apply(mapper)); - - return createSurface(surface, view, graph, layout); - } - - /** - * Build a delaunay based surface - */ - public Shape genDelaunaySurface(final View view, final Graph graph, final IAxeLayout layout){ - List data = new ArrayList(); - for (int i = 0; i < _x.length; i++) { - data.add(new Coord3d(_x[i], _y[i], _z[i])); - } - surface = Builder.buildDelaunay(data); - return createSurface(surface, view, graph, layout); - } - - /** - * Setup surface coloring policy and change listeners. - */ - public Shape createSurface(final Shape surface, final View view, final Graph graph, final IAxeLayout layout) { - Color factor = new Color(1, 1, 1, 0.75f); - - colormap = new ColorMapRainbow(); - colormap.setDirection(false); - - colormapper = new OrderingStrategyScoreColorMapper(colormap, new CompositeColorMapperUpdatePolicy(), graph, factor); - surface.setColorMapper(colormapper); - surface.setWireframeDisplayed(true); - - colorbar = new AWTColorbarLegend(surface, layout); - surface.setLegend(colorbar); - - view.addViewPointChangedListener(new IViewPointChangedListener(){ - @Override - public void viewPointChanged(ViewPointChangedEvent e) { - //System.out.println("min:" + colormapper.getMin() + " max:" + colormapper.getMax()); - //TicToc t = new TicToc(); - //t.tic(); - updateColorMapperRange(); - //t.toc(); - } - }); - - graph.add(surface); - - return surface; - } - - public void updateColorMapperRange(){ - colormapper.preDraw(surface); - } - - protected IColorMap colormap; - protected ColorMapper colormapper; - protected AWTColorbarLegend colorbar; - protected Shape surface; - - private final double[] _x; - private final double[] _y; - private final double[] _z; - private final double[] _expX; - private final double[] _expY; - private final double[] _expZ; - private final String[] _expIndex; - private ArrayList _experiencesPoints; - private ArrayList _experiencesLabels; - - - /** - * Surface - */ - public TrialFaceOrdering() { - _expX = new double[] { -1.0, 1.0, 0.0, 0.0, 0.0 }; - _expY = new double[] { 0.0, 0.0, -1.0, 1.0, 0.0 }; - _expZ = new double[] { 1799635.862225038, 2778958.3605334656, 2308941.6737486282, 2791418.430038142, 2778052.031336538 }; - _expIndex = new String[] { "17", "18", " 19", "20", "27" }; - - _y = new double[] { -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, - 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, - 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, - 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, - -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 }; - - _x = new double[] { -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, - -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.3, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, - -0.2, -0.2, -0.2, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, - 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, - 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; - - _z = new double[] { 1648446.8, 1691895.4, 1732207.9, 1769384.4, 1803424.9, 1834329.2, 1862097.6, 1886729.9, 1908226.1, 1926586.4, 1941810.5, 1953898.6, 1962850.8, 1968666.8, 1971346.8, 1970890.6, 1967298.5, 1960570.4, 1950706.1, 1937705.9, 1921569.6, 1761433.5, 1805073.4, 1845577.0, 1882944.8, 1917176.2, 1948271.9, 1976231.4, 2001054.9, 2022742.4, 2041293.8, 2056709.1, 2068988.4, 2078131.6, 2084138.9, 2087010.0, 2086745.1, 2083344.1, 2076807.1, 2067134.1, 2054325.1, 2038380.0, 1866066.5, 1909897.5, 1950592.4, 1988151.2, 2022574.0, 2053860.8, 2082011.5, 2107026.2, - 2128904.8, 2147647.2, 2163253.8, 2175724.2, 2185058.8, 2191257.2, 2194319.5, 2194245.8, 2191036.0, 2184690.2, 2175208.2, 2162590.5, 2146836.5, 1962345.9, 2006368.0, 2047254.1, 2085004.1, 2119618.0, 2151096.0, 2179438.0, 2204643.8, 2226713.5, 2245647.2, 2261445.0, 2274106.8, 2283632.2, 2290021.8, 2293275.2, 2293392.8, 2290374.2, 2284219.5, 2274929.0, 2262502.2, 2246939.5, 2050271.5, 2094484.8, 2135562.0, 2173503.2, 2208308.5, 2239977.5, 2268510.5, 2293907.5, 2316168.5, 2335293.5, 2351282.2, 2364135.2, 2373852.0, 2380432.8, 2383877.5, 2384186.0, 2381358.8, - 2375395.2, 2366295.8, 2354060.2, 2338688.5, 2129843.5, 2174248.0, 2215516.2, 2253648.8, 2288645.0, 2320505.2, 2349229.5, 2374817.8, 2397270.0, 2416586.0, 2432766.0, 2445810.0, 2455718.0, 2462490.0, 2466125.8, 2466625.8, 2463989.5, 2458217.2, 2449308.8, 2437264.5, 2422084.0, 2201061.8, 2245657.2, 2287117.0, 2325440.5, 2360628.0, 2392679.5, 2421594.8, 2447374.2, 2470017.5, 2489524.8, 2505896.0, 2519131.2, 2529230.5, 2536193.5, 2540020.5, 2540711.5, 2538266.5, 2532685.5, 2523968.2, 2512115.0, 2497125.8, 2263926.2, 2308713.0, 2350363.8, 2388878.5, 2424257.2, - 2456499.8, 2485606.5, 2511577.0, 2534411.5, 2554110.0, 2570672.2, 2584098.8, 2594389.0, 2601543.2, 2605561.5, 2606443.8, 2604189.8, 2598800.0, 2590274.0, 2578612.0, 2563814.0, 2318437.0, 2363415.0, 2405257.0, 2443962.8, 2479532.8, 2511966.5, 2541264.2, 2567426.0, 2590451.8, 2610341.2, 2627095.0, 2640712.5, 2651194.0, 2658539.5, 2662748.8, 2663822.2, 2661759.5, 2656560.8, 2648226.0, 2636755.2, 2622148.2, 2364594.0, 2409763.2, 2451796.2, 2490693.5, 2526454.5, 2559079.5, 2588568.5, 2614921.2, 2638138.2, 2658219.0, 2675163.8, 2688972.5, 2699645.2, 2707181.8, - 2711582.5, 2712847.0, 2710975.5, 2705968.0, 2697824.2, 2686544.8, 2672129.0, 2402397.5, 2447757.8, 2489982.0, 2529070.5, 2565022.5, 2597838.8, 2627519.0, 2654063.0, 2677471.0, 2697743.0, 2714879.0, 2728879.0, 2739742.8, 2747470.5, 2752062.2, 2753518.0, 2751837.8, 2747021.2, 2739069.0, 2727980.5, 2713756.0, 2431847.0, 2477398.8, 2519814.2, 2559093.5, 2595237.0, 2628244.2, 2658115.8, 2684851.0, 2708450.2, 2728913.2, 2746240.5, 2760431.5, 2771486.5, 2779405.5, 2784188.5, 2785835.5, 2784346.2, 2779721.0, 2771959.8, 2761062.5, 2747029.2, 2452943.0, 2498685.8, - 2541292.5, 2580763.2, 2617097.8, 2650296.2, 2680358.8, 2707285.2, 2731075.5, 2751730.0, 2769248.2, 2783630.5, 2794876.8, 2802986.8, 2807961.0, 2809799.0, 2808501.0, 2804067.0, 2796497.0, 2785791.0, 2771948.8, 2465685.5, 2511619.2, 2554417.2, 2594079.0, 2630604.8, 2663994.5, 2694248.0, 2721365.8, 2745347.2, 2766192.8, 2783902.2, 2798475.8, 2809913.0, 2818214.5, 2823379.8, 2825409.0, 2824302.2, 2820059.2, 2812680.5, 2802165.5, 2788514.5, 2470074.0, 2516199.0, 2559188.0, 2599041.0, 2635758.0, 2669339.0, 2699783.8, 2727092.5, 2751265.2, 2772302.0, 2790202.8, - 2804967.2, 2816595.8, 2825088.2, 2830444.8, 2832665.2, 2831749.8, 2827698.0, 2820510.2, 2810186.5, 2796726.8, 2466108.8, 2512425.0, 2555605.2, 2595649.5, 2632557.5, 2666329.8, 2696965.8, 2724465.8, 2748829.5, 2770057.5, 2788149.2, 2803105.0, 2814924.8, 2823608.5, 2829156.2, 2831567.8, 2830843.2, 2826982.8, 2819986.2, 2809853.8, 2796585.2, 2453790.0, 2500297.5, 2543668.8, 2583904.2, 2621003.5, 2654966.8, 2685794.0, 2713485.0, 2738040.2, 2759459.2, 2777742.2, 2792889.2, 2804900.2, 2813775.0, 2819513.8, 2822116.5, 2821583.2, 2817914.0, 2811108.8, 2801167.2, - 2788089.8, 2433117.5, 2479816.0, 2523378.5, 2563805.2, 2601095.5, 2635250.0, 2666268.5, 2694150.8, 2718897.0, 2740507.2, 2758981.5, 2774319.5, 2786521.8, 2795587.8, 2801517.8, 2804311.8, 2803969.8, 2800491.5, 2793877.2, 2784127.2, 2771241.0, 2404091.2, 2450981.0, 2494734.8, 2535352.5, 2572834.0, 2607179.8, 2638389.2, 2666462.8, 2691400.2, 2713201.8, 2731867.0, 2747396.2, 2759789.5, 2769046.8, 2775168.0, 2778153.2, 2778002.2, 2774715.2, 2768292.2, 2758733.2, 2746038.2, 2366711.2, 2413792.2, 2457737.2, 2498546.0, 2536218.8, 2570755.5, 2602156.2, 2630421.0, - 2655549.8, 2677542.2, 2696398.8, 2712119.2, 2724703.8, 2734152.2, 2740464.5, 2743641.0, 2743681.2, 2740585.5, 2734353.5, 2724985.8, 2712481.8, 2320977.5, 2368249.8, 2412385.8, 2453386.0, 2491249.8, 2525977.8, 2557569.8, 2586025.5, 2611345.5, 2633529.2, 2652577.0, 2668488.8, 2681264.2, 2690903.8, 2697407.5, 2700775.0, 2701006.2, 2698101.8, 2692061.2, 2682884.5, 2670571.8 }; - } -} \ No newline at end of file diff --git a/jzy3d-api/src/tests/org/jzy3d/tests/TrialManualBounds.java b/jzy3d-api/src/tests/org/jzy3d/tests/TrialManualBounds.java deleted file mode 100644 index 26ab703e..00000000 --- a/jzy3d-api/src/tests/org/jzy3d/tests/TrialManualBounds.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jzy3d.tests; - - - -import org.jzy3d.analysis.AbstractAnalysis; -import org.jzy3d.analysis.AnalysisLauncher; -import org.jzy3d.analysis.IAnalysis; -import org.jzy3d.chart.Chart; -import org.jzy3d.chart.controllers.keyboard.camera.AWTCameraKeyController; -import org.jzy3d.chart.controllers.mouse.camera.NewtCameraMouseController; -import org.jzy3d.colors.Color; -import org.jzy3d.colors.ColorMapper; -import org.jzy3d.colors.colormaps.ColorMapRainbow; -import org.jzy3d.maths.BoundingBox3d; -import org.jzy3d.maths.Range; -import org.jzy3d.plot3d.builder.Builder; -import org.jzy3d.plot3d.builder.Mapper; -import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid; -import org.jzy3d.plot3d.primitives.Shape; -import org.jzy3d.plot3d.rendering.canvas.Quality; -import org.jzy3d.plot3d.rendering.view.modes.ViewBoundMode; - -public class TrialManualBounds extends AbstractAnalysis { - public static void main(String[] args) throws Exception { - IAnalysis d = new TrialManualBounds(); - d.setCanvasType("newt"); - AnalysisLauncher.open(d); - - // calling: - // d.getChart().getView().setBoundManual(new BoundingBox3d(-1,1, -1,1, -1,1)); - // immediatly will fail since frame is probably not open yet, and thus the view - // initialization will reset bounds to the scene graph bounds. - // - // to avoid being erased by the view init, one may either: - // wait a little bit: Thread.sleep(1000); - // or force an initialization bounds as follow - // @since oct 27 2012 - d.getChart().getView().setInitBounds(new BoundingBox3d(-1,1, -1,1, -1,1)); - System.out.println(d.getChart().getView().getBounds()); - } - - @Override - public void init() { - // Define a function to plot - Mapper mapper = new Mapper() { - @Override - public double f(double x, double y) { - return 0;//x * Math.sin(x * y); - } - }; - - // Define range and precision for the function to plot - Range range = new Range(-3, 3); - int steps = 80; - - // Create the object to represent the function over the given range. - final Shape surface = Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper); - surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f))); - surface.setFaceDisplayed(true); - surface.setWireframeDisplayed(false); -System.out.println(getCanvasType()); - // Create a chart - chart = new Chart(Quality.Advanced, getCanvasType()); - chart.getScene().getGraph().add(surface); - chart.addController(new AWTCameraKeyController()); - - chart.getView().setBoundMode(ViewBoundMode.MANUAL); - NewtCameraMouseController c = new NewtCameraMouseController(chart); - } -}