From 493d073f28d3b69cafea8863c131d99dd7eacf0f Mon Sep 17 00:00:00 2001 From: andrea Date: Sat, 8 Nov 2014 17:26:59 +0100 Subject: [PATCH] tested and working AWTChartComponentFactory --- ...TransformableAWTChartComponentFactory.java | 44 ++++++++++++++-- .../AxeTransformableAxeBox.java | 52 ++----------------- 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/jzy3d-api/src/api/org/jzy3d/chart/factories/AxeTransformableAWTChartComponentFactory.java b/jzy3d-api/src/api/org/jzy3d/chart/factories/AxeTransformableAWTChartComponentFactory.java index 1b3adebc..b3688a22 100644 --- a/jzy3d-api/src/api/org/jzy3d/chart/factories/AxeTransformableAWTChartComponentFactory.java +++ b/jzy3d-api/src/api/org/jzy3d/chart/factories/AxeTransformableAWTChartComponentFactory.java @@ -1,20 +1,56 @@ package org.jzy3d.chart.factories; +import org.jzy3d.chart.Chart; +import org.jzy3d.chart.factories.IChartComponentFactory.Toolkit; import org.jzy3d.maths.BoundingBox3d; import org.jzy3d.plot3d.primitives.axeTransformablePrimitive.axeTransformableAxes.AxeTransformableAxeBox; import org.jzy3d.plot3d.primitives.axeTransformablePrimitive.axeTransformers.AxeTransformer; import org.jzy3d.plot3d.primitives.axes.AxeBox; import org.jzy3d.plot3d.primitives.axes.IAxe; +import org.jzy3d.plot3d.rendering.canvas.Quality; import org.jzy3d.plot3d.rendering.view.View; public class AxeTransformableAWTChartComponentFactory extends AWTChartComponentFactory{ - AxeTransformer transformerX; //transformation on x axis - AxeTransformer transformerY; //transformation on y axis - AxeTransformer transformerZ; //transformation on z axis + AxeTransformer transformerX; + AxeTransformer transformerY; + AxeTransformer transformerZ; - @Override + + public AxeTransformableAWTChartComponentFactory( + AxeTransformer transformerX, AxeTransformer transformerY, + AxeTransformer transformerZ) { + this.transformerX = transformerX; + this.transformerY = transformerY; + this.transformerZ = transformerZ; + } + + public static Chart chart() { + return chart(Quality.Intermediate); + } + + public static Chart chart(Quality quality, AxeTransformer transformerX, AxeTransformer transformerY, AxeTransformer transformerZ) { + AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformerX, transformerY, transformerZ); + return f.newChart(quality, Toolkit.newt); + } + + public static Chart chart(String toolkit, AxeTransformer transformerX, AxeTransformer transformerY, AxeTransformer transformerZ) { + AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformerX, transformerY, transformerZ); + return f.newChart(Chart.DEFAULT_QUALITY, toolkit); + } + + public static Chart chart(Quality quality, Toolkit toolkit, AxeTransformer transformerX, AxeTransformer transformerY, AxeTransformer transformerZ) { + AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformerX, transformerY, transformerZ); + return f.newChart(quality, toolkit); + } + + public static Chart chart(Quality quality, String toolkit, AxeTransformer transformerX, AxeTransformer transformerY, AxeTransformer transformerZ) { + AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformerX, transformerY, transformerZ); + return f.newChart(quality, toolkit); + } + + @Override public IAxe newAxe(BoundingBox3d box, View view) { AxeTransformableAxeBox axe = new AxeTransformableAxeBox(box,transformerX,transformerY,transformerZ); axe.setView(view); diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axeTransformablePrimitive/axeTransformableAxes/AxeTransformableAxeBox.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axeTransformablePrimitive/axeTransformableAxes/AxeTransformableAxeBox.java index d8a7bf07..d13ac5c5 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axeTransformablePrimitive/axeTransformableAxes/AxeTransformableAxeBox.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axeTransformablePrimitive/axeTransformableAxes/AxeTransformableAxeBox.java @@ -44,7 +44,7 @@ public class AxeTransformableAxeBox extends AxeBox { } /** reset to identity and apply scaling */ - public void doTransform(GL gl) { + /* public void doTransform(GL gl) { if (gl.isGL2()) { gl.getGL2().glLoadIdentity(); gl.getGL2().glScalef(scale.x, scale.y, scale.z); @@ -52,7 +52,7 @@ public class AxeTransformableAxeBox extends AxeBox { GLES2CompatUtils.glLoadIdentity(); GLES2CompatUtils.glScalef(scale.x, scale.y, scale.z); } - } + }*/ /** @@ -67,7 +67,7 @@ public class AxeTransformableAxeBox extends AxeBox { gl.getGL2().glPassThrough((float) q); gl.getGL2().glBegin(GL2.GL_QUADS); for (int v = 0; v < 4; v++) { - Coord3d c3d = new Coord3d(quadx[q][v], quady[q][v], quadz[q][v]); + Coord3d c3d = new Coord3d(quadx[q][v], quady[q][v], quadz[q][v]); //era qua GlVertexExecutor.Vertex(gl, c3d, transformerX, transformerY, transformerZ); } gl.getGL2().glEnd(); @@ -299,53 +299,7 @@ public class AxeTransformableAxeBox extends AxeBox { } - protected static final int PRECISION = 6; - protected View view; - - // use this text renderer to get occupied volume by text - protected ITextRenderer txt = new TextBitmapRenderer(); - - protected IAxeLayout layout; - - protected BoundingBox3d boxBounds; - protected BoundingBox3d wholeBounds; - protected Coord3d center; - protected Coord3d scale; - - protected float xrange; - protected float yrange; - protected float zrange; - - protected float quadx[][]; - protected float quady[][]; - protected float quadz[][]; - - protected float normx[]; - protected float normy[]; - protected float normz[]; - - protected float axeXx[][]; - protected float axeXy[][]; - protected float axeXz[][]; - protected float axeYx[][]; - protected float axeYy[][]; - protected float axeYz[][]; - protected float axeZx[][]; - protected float axeZy[][]; - protected float axeZz[][]; - - protected int axeXquads[][]; - protected int axeYquads[][]; - protected int axeZquads[][]; - - protected boolean quadIsHidden[]; - - protected static final int AXE_X = 0; - protected static final int AXE_Y = 1; - protected static final int AXE_Z = 2; - - protected List annotations = new ArrayList(); protected AxeTransformer transformerX; protected AxeTransformer transformerY; protected AxeTransformer transformerZ;