mirror of https://github.com/rusefi/jzy3d-api.git
tested and working AWTChartComponentFactory
This commit is contained in:
parent
6fdd815f69
commit
493d073f28
|
@ -1,20 +1,56 @@
|
||||||
package org.jzy3d.chart.factories;
|
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.maths.BoundingBox3d;
|
||||||
import org.jzy3d.plot3d.primitives.axeTransformablePrimitive.axeTransformableAxes.AxeTransformableAxeBox;
|
import org.jzy3d.plot3d.primitives.axeTransformablePrimitive.axeTransformableAxes.AxeTransformableAxeBox;
|
||||||
import org.jzy3d.plot3d.primitives.axeTransformablePrimitive.axeTransformers.AxeTransformer;
|
import org.jzy3d.plot3d.primitives.axeTransformablePrimitive.axeTransformers.AxeTransformer;
|
||||||
import org.jzy3d.plot3d.primitives.axes.AxeBox;
|
import org.jzy3d.plot3d.primitives.axes.AxeBox;
|
||||||
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||||
import org.jzy3d.plot3d.rendering.view.View;
|
import org.jzy3d.plot3d.rendering.view.View;
|
||||||
|
|
||||||
public class AxeTransformableAWTChartComponentFactory extends AWTChartComponentFactory{
|
public class AxeTransformableAWTChartComponentFactory extends AWTChartComponentFactory{
|
||||||
|
|
||||||
AxeTransformer transformerX; //transformation on x axis
|
AxeTransformer transformerX;
|
||||||
AxeTransformer transformerY; //transformation on y axis
|
AxeTransformer transformerY;
|
||||||
AxeTransformer transformerZ; //transformation on z axis
|
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) {
|
public IAxe newAxe(BoundingBox3d box, View view) {
|
||||||
AxeTransformableAxeBox axe = new AxeTransformableAxeBox(box,transformerX,transformerY,transformerZ);
|
AxeTransformableAxeBox axe = new AxeTransformableAxeBox(box,transformerX,transformerY,transformerZ);
|
||||||
axe.setView(view);
|
axe.setView(view);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class AxeTransformableAxeBox extends AxeBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** reset to identity and apply scaling */
|
/** reset to identity and apply scaling */
|
||||||
public void doTransform(GL gl) {
|
/* public void doTransform(GL gl) {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glLoadIdentity();
|
gl.getGL2().glLoadIdentity();
|
||||||
gl.getGL2().glScalef(scale.x, scale.y, scale.z);
|
gl.getGL2().glScalef(scale.x, scale.y, scale.z);
|
||||||
|
@ -52,7 +52,7 @@ public class AxeTransformableAxeBox extends AxeBox {
|
||||||
GLES2CompatUtils.glLoadIdentity();
|
GLES2CompatUtils.glLoadIdentity();
|
||||||
GLES2CompatUtils.glScalef(scale.x, scale.y, scale.z);
|
GLES2CompatUtils.glScalef(scale.x, scale.y, scale.z);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ public class AxeTransformableAxeBox extends AxeBox {
|
||||||
gl.getGL2().glPassThrough((float) q);
|
gl.getGL2().glPassThrough((float) q);
|
||||||
gl.getGL2().glBegin(GL2.GL_QUADS);
|
gl.getGL2().glBegin(GL2.GL_QUADS);
|
||||||
for (int v = 0; v < 4; v++) {
|
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);
|
GlVertexExecutor.Vertex(gl, c3d, transformerX, transformerY, transformerZ);
|
||||||
}
|
}
|
||||||
gl.getGL2().glEnd();
|
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<AxeAnnotation> annotations = new ArrayList<AxeAnnotation>();
|
|
||||||
protected AxeTransformer transformerX;
|
protected AxeTransformer transformerX;
|
||||||
protected AxeTransformer transformerY;
|
protected AxeTransformer transformerY;
|
||||||
protected AxeTransformer transformerZ;
|
protected AxeTransformer transformerZ;
|
||||||
|
|
Loading…
Reference in New Issue