Workaround XZ and YZ projections on EmulGL, relates to issue 274
|
@ -319,9 +319,10 @@ public class AxisLabelProcessor {
|
|||
view.getPainter().getTextLengthInPixels(axisLayout.getFont(), verticalAxisLabel);
|
||||
|
||||
// hack the emulgl vertical Y axis case by ignoring pixel scale for text
|
||||
if (isEmulGL)
|
||||
if (isEmulGL) {
|
||||
textLength /= pixelScale.y;
|
||||
|
||||
}
|
||||
|
||||
// move the text next to its anchor point, since it has been rotated
|
||||
// from the text center and not from the anchor point that is on the
|
||||
// right most letter side.
|
||||
|
|
|
@ -329,6 +329,8 @@ public class AxisTickProcessor {
|
|||
drawAxisTickNumericLabel(painter, dimension, color, hAlign, vAlign, ticksTxtBounds, tickLabel,
|
||||
tickLabelPosition);
|
||||
|
||||
//System.out.println(tickLabelPosition);
|
||||
|
||||
// Draw the tick line
|
||||
if (layout.isTickLineDisplayed()) {
|
||||
drawTickLine(painter, color, tickStartPosition, tickLabelPosition);
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.List;
|
|||
import java.util.Vector;
|
||||
import java.util.function.Predicate;
|
||||
import org.jzy3d.colors.Color;
|
||||
import org.jzy3d.maths.Array;
|
||||
import org.jzy3d.maths.BoundingBox2d;
|
||||
import org.jzy3d.maths.Coord2d;
|
||||
import org.jzy3d.maths.Coord3d;
|
||||
import org.jzy3d.maths.PolygonArray;
|
||||
import org.jzy3d.painters.IPainter;
|
||||
|
@ -372,10 +372,19 @@ public class Camera extends AbstractViewportManager {
|
|||
int viewport[] = painter.getViewPortAsInt();
|
||||
float modelView[] = painter.getModelViewAsFloat();
|
||||
float projection[] = painter.getProjectionAsFloat();
|
||||
|
||||
//Array.print("Camera.screenToModel : viewport : ", viewport);
|
||||
//Array.print("Camera.screenToModel : modelView : ", modelView);
|
||||
//Array.print("Camera.screenToModel : projection : ", projection);
|
||||
|
||||
//double modelView[] = painter.getModelViewAsDouble();
|
||||
//double projection[] = painter.getProjectionAsDouble();
|
||||
float worldcoord[] = new float[3];// wx, wy, wz;// returned xyz coords
|
||||
|
||||
boolean s = painter.gluUnProject(screen.x, screen.y, screen.z, modelView, 0, projection, 0,
|
||||
viewport, 0, worldcoord, 0);
|
||||
|
||||
|
||||
if (!s)
|
||||
failedProjection("Could not retrieve screen coordinates in model.");
|
||||
|
||||
|
|
|
@ -992,6 +992,16 @@ public class View {
|
|||
} else
|
||||
throw new RuntimeException("Unsupported ViewMode: " + viewmode);
|
||||
}
|
||||
|
||||
/*protected Coord3d computeCameraEyeXZ_DEBUG(Coord3d viewpoint, Coord3d target) {
|
||||
Coord3d eye = viewpoint;
|
||||
//eye.x = AZIMUTH_FACING_X_DECREASING; // facing X so that value decrease
|
||||
eye.x = AZIMUTH_FACING_X_INCREASING; // facing X so that value increase
|
||||
eye.y = ELEVATION_0 + 0.0001f; // on side
|
||||
eye = eye.cartesian().add(target);
|
||||
return eye;
|
||||
}*/
|
||||
|
||||
|
||||
protected Coord3d computeCameraEyeFree(Coord3d viewpoint, Coord3d target) {
|
||||
return viewpoint.cartesian().add(target);
|
||||
|
@ -1023,6 +1033,13 @@ public class View {
|
|||
//eye.x = AZIMUTH_FACING_Y_DECREASING; // facing Y so that value decrease
|
||||
eye.x = AZIMUTH_FACING_Y_INCREASING; // facing Y so that value decrease
|
||||
eye.y = ELEVATION_0; // on side
|
||||
|
||||
// see https://github.com/jzy3d/jzy3d-api/issues/286
|
||||
if(!canvas.isNative() && JGL_INVERSE_MATRIX_WORKAROUND) {
|
||||
eye.x += 0.01f;
|
||||
eye.y += 0.01f;
|
||||
}
|
||||
|
||||
eye = eye.cartesian().add(target);
|
||||
return eye;
|
||||
}
|
||||
|
@ -1032,9 +1049,17 @@ public class View {
|
|||
//eye.x = AZIMUTH_FACING_X_DECREASING; // facing X so that value decrease
|
||||
eye.x = AZIMUTH_FACING_X_INCREASING; // facing X so that value increase
|
||||
eye.y = ELEVATION_0; // on side
|
||||
|
||||
// see https://github.com/jzy3d/jzy3d-api/issues/286
|
||||
if(!canvas.isNative() && JGL_INVERSE_MATRIX_WORKAROUND) {
|
||||
eye.y += 0.0001f;
|
||||
}
|
||||
|
||||
eye = eye.cartesian().add(target);
|
||||
return eye;
|
||||
}
|
||||
|
||||
protected boolean JGL_INVERSE_MATRIX_WORKAROUND = true;
|
||||
|
||||
|
||||
protected void triggerCameraUpEvents(Coord3d viewpoint) {
|
||||
|
|
|
@ -212,8 +212,6 @@ public class View2DProcessing {
|
|||
marginBottomPx += horizontalAxisDistance;
|
||||
marginBottomPx += axisTextHeight;
|
||||
|
||||
//System.err.println("V2DProc : axisTextHeight : " + axisTextHeight + " tickHeight " + tickTextHeight + " H tick " + horizontalTickDistance + " H axis " + horizontalAxisDistance + " BOTTOM = " + marginBottomPx);
|
||||
//System.err.println("V2DProc : axisTextWidth : " + axisTextWidth + " tickWidth " + tickTextWidth);
|
||||
|
||||
// ---------------------------------------------------
|
||||
// case of a symetric layout requirement
|
||||
|
@ -241,7 +239,6 @@ public class View2DProcessing {
|
|||
for(ILegend legend: legends) {
|
||||
legend.updateMinimumDimension(painter);
|
||||
Dimension minDim = legend.getMinimumDimension();
|
||||
//System.out.println("View2DProcessing minDim " + minDim.width);
|
||||
marginRightPx += minDim.width;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ public class TextRenderer extends AbstractTextRenderer implements ITextRenderer
|
|||
|
||||
// process the aligned position in 3D coordinates
|
||||
Coord3d positionAligned = to3D(painter, screenAligned);
|
||||
|
||||
|
||||
|
||||
// process space stransform if any (log, etc)
|
||||
if (spaceTransformer != null) {
|
||||
positionAligned = spaceTransformer.compute(positionAligned);
|
||||
|
|
|
@ -1016,6 +1016,9 @@ public class EmulGLPainter extends AbstractPainter implements IPainter {
|
|||
double objX[] = new double[1];
|
||||
double objY[] = new double[1];
|
||||
double objZ[] = new double[1];
|
||||
|
||||
//Array.print("EmulGL Painter : ", proj);
|
||||
//Array.print("EmulGL Painter : ", dbl(proj));
|
||||
|
||||
boolean st = glu.gluUnProject(winX, winY, winZ, dbl(model),
|
||||
dbl(proj), view, objX, objY, objZ);
|
||||
|
@ -1027,6 +1030,26 @@ public class EmulGLPainter extends AbstractPainter implements IPainter {
|
|||
return st;
|
||||
}
|
||||
|
||||
//@Override
|
||||
public boolean gluUnProject(float winX, float winY, float winZ, double[] model, int model_offset,
|
||||
double[] proj, int proj_offset, int[] view, int view_offset, float[] objPos,
|
||||
int objPos_offset) {
|
||||
// throw new NotImplementedException();
|
||||
|
||||
double objX[] = new double[1];
|
||||
double objY[] = new double[1];
|
||||
double objZ[] = new double[1];
|
||||
|
||||
boolean st = glu.gluUnProject(winX, winY, winZ, model,
|
||||
proj, view, objX, objY, objZ);
|
||||
|
||||
objPos[0] = (float) objX[0];
|
||||
objPos[1] = (float) objY[0];
|
||||
objPos[2] = (float) objZ[0];
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
protected double[] dbl(float[] values) {
|
||||
double[] dbl = new double[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
|
|
|
@ -121,11 +121,4 @@ public class EmulGLViewAndColorbarsLayout extends ViewAndColorbarsLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*public boolean isFixHiDPI() {
|
||||
return fixHiDPI;
|
||||
}
|
||||
public void setFixHiDPI(boolean fixHiDPI) {
|
||||
this.fixHiDPI = fixHiDPI;
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class GL<ImageType, FontType> {
|
|||
protected List<PixelScaleListener> pixelScaleListeners = new ArrayList<>();
|
||||
|
||||
public GL() {}
|
||||
|
||||
|
||||
public void setThrowExceptionOnGLError(boolean status) {
|
||||
this.CC.setThrowExceptionOnGLError(status);
|
||||
}
|
||||
|
@ -129,12 +129,18 @@ public abstract class GL<ImageType, FontType> {
|
|||
return desiredHeight;
|
||||
}
|
||||
|
||||
/** Return the actual width, which is {@link #getDesiredWidth()} multiplied by {@link #getPixelScaleX()}*/
|
||||
/**
|
||||
* Return the actual width, which is {@link #getDesiredWidth()} multiplied by
|
||||
* {@link #getPixelScaleX()}
|
||||
*/
|
||||
public int getActualWidth() {
|
||||
return actualWidth;
|
||||
}
|
||||
|
||||
/** Return the actual width, which is {@link #getDesiredHeight()} multiplied by {@link #getPixelScaleY()}*/
|
||||
/**
|
||||
* Return the actual width, which is {@link #getDesiredHeight()} multiplied by
|
||||
* {@link #getPixelScaleY()}
|
||||
*/
|
||||
public int getActualHeight() {
|
||||
return actualHeight;
|
||||
}
|
||||
|
@ -142,11 +148,11 @@ public abstract class GL<ImageType, FontType> {
|
|||
/* ******************** PROVIDE IMAGE ********************/
|
||||
|
||||
public void glShadeModel(int mode) {
|
||||
if(CC.Mode != None) {
|
||||
CC.gl_error(GL_INVALID_OPERATION, "glShadeModel");
|
||||
return;
|
||||
}
|
||||
CC.gl_shade_model(mode);
|
||||
if (CC.Mode != None) {
|
||||
CC.gl_error(GL_INVALID_OPERATION, "glShadeModel");
|
||||
return;
|
||||
}
|
||||
CC.gl_shade_model(mode);
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,13 +248,12 @@ public abstract class GL<ImageType, FontType> {
|
|||
return shiftHorizontally;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows shifting the image of the 3d scene and all images that have been append with
|
||||
* {@link #appendImageToDraw(Object)}
|
||||
*
|
||||
* @param shift
|
||||
* to the right if value is positive, to the left if the value is negative.
|
||||
*/
|
||||
/**
|
||||
* Allows shifting the image of the 3d scene and all images that have been append with
|
||||
* {@link #appendImageToDraw(Object)}
|
||||
*
|
||||
* @param shift to the right if value is positive, to the left if the value is negative.
|
||||
*/
|
||||
public void setShiftHorizontally(int shiftHorizontally) {
|
||||
this.shiftHorizontally = shiftHorizontally;
|
||||
}
|
||||
|
@ -271,10 +276,10 @@ public abstract class GL<ImageType, FontType> {
|
|||
return useOSFontRendering;
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, will use the OS for font rendering of all texts that have been append with
|
||||
* {@link #appendTextToDraw(Object, String, int, int)} otherwise use a JVM based font rendering.
|
||||
*/
|
||||
/**
|
||||
* If true, will use the OS for font rendering of all texts that have been append with
|
||||
* {@link #appendTextToDraw(Object, String, int, int)} otherwise use a JVM based font rendering.
|
||||
*/
|
||||
public void setUseOSFontRendering(boolean useOSFontRendering) {
|
||||
this.useOSFontRendering = useOSFontRendering;
|
||||
}
|
||||
|
@ -298,25 +303,24 @@ public abstract class GL<ImageType, FontType> {
|
|||
FOREGROUND, BACKGROUND
|
||||
}
|
||||
|
||||
public void appendImageToDraw(ImageType image) {
|
||||
public void appendImageToDraw(ImageType image) {
|
||||
|
||||
appendImageToDraw(image, 0, 0);
|
||||
}
|
||||
appendImageToDraw(image, 0, 0);
|
||||
}
|
||||
|
||||
public void appendImageToDraw(ImageType image, int x, int y) {
|
||||
public void appendImageToDraw(ImageType image, int x, int y) {
|
||||
appendImageToDraw(image, x, y, ImageLayer.BACKGROUND);
|
||||
}
|
||||
|
||||
appendImageToDraw(image, x, y, ImageLayer.BACKGROUND);
|
||||
}
|
||||
public void appendImageToDraw(ImageType image, int x, int y, ImageLayer layer) {
|
||||
|
||||
public void appendImageToDraw(ImageType image, int x, int y, ImageLayer layer) {
|
||||
synchronized (imageToDraw) {
|
||||
imageToDraw.add(new ImageToDraw<>(x, y, image, layer));
|
||||
// System.out.println(imageToDraw.size() + " images to draw");
|
||||
}
|
||||
}
|
||||
|
||||
synchronized(imageToDraw) {
|
||||
imageToDraw.add(new ImageToDraw<>(x, y, image, layer));
|
||||
// System.out.println(imageToDraw.size() + " images to draw");
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ImageType getRenderedImage();
|
||||
public abstract ImageType getRenderedImage();
|
||||
|
||||
public void clearImagesBuffer() {
|
||||
synchronized (imageToDraw) {
|
||||
|
@ -328,32 +332,34 @@ public abstract class GL<ImageType, FontType> {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* To be called by {@link GLUT#glutBitmapString(Object, String, float, float)} to append text to a
|
||||
* list of text to render at {@link GL#glFlush()} step.
|
||||
*/
|
||||
public void appendTextToDraw(FontType font, String string, int x, int y) {
|
||||
/**
|
||||
* To be called by {@link GLUT#glutBitmapString(Object, String, float, float)} to append text to a
|
||||
* list of text to render at {@link GL#glFlush()} step.
|
||||
*/
|
||||
public void appendTextToDraw(FontType font, String string, int x, int y) {
|
||||
synchronized (textsToDraw) {
|
||||
textsToDraw.add(new TextToDraw<>(font, string, x, y));
|
||||
//System.out.println("GL:appendText : " + x+ " " + y);
|
||||
|
||||
textsToDraw.add(new TextToDraw<>(font, string, x, y));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called by {@link GLUT#glutBitmapString(Object, String, float, float)} to append text to a
|
||||
* list of text to render at {@link GL#glFlush()} step.
|
||||
*/
|
||||
public void appendTextToDraw(FontType font, String string, int x, int y, float r, float g, float b,
|
||||
float rotate) {
|
||||
/**
|
||||
* To be called by {@link GLUT#glutBitmapString(Object, String, float, float)} to append text to a
|
||||
* list of text to render at {@link GL#glFlush()} step.
|
||||
*/
|
||||
public void appendTextToDraw(FontType font, String string, int x, int y, float r, float g,
|
||||
float b, float rotate) {
|
||||
synchronized (textsToDraw) {
|
||||
textsToDraw.add(new TextToDraw<>(font, string, x, y, r, g, b, rotate));
|
||||
textsToDraw.add(new TextToDraw<>(font, string, x, y, r, g, b, rotate));
|
||||
}
|
||||
}
|
||||
|
||||
public void clearTextToDraw() {
|
||||
synchronized (textsToDraw) {
|
||||
textsToDraw.clear(); // empty text buffer
|
||||
}
|
||||
}
|
||||
|
||||
public void clearTextToDraw() {
|
||||
synchronized (textsToDraw) {
|
||||
textsToDraw.clear(); // empty text buffer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -540,8 +546,8 @@ public abstract class GL<ImageType, FontType> {
|
|||
case GL_INT:
|
||||
case GL_UNSIGNED_INT:
|
||||
case GL_4_BYTES:
|
||||
return (lists[n << 2]) << 24 | (lists[(n << 2) | 1]) << 16
|
||||
| (lists[(n << 2) | 2]) << 8 | (lists[(n << 2) | 3]);
|
||||
return (lists[n << 2]) << 24 | (lists[(n << 2) | 1]) << 16 | (lists[(n << 2) | 2]) << 8
|
||||
| (lists[(n << 2) | 3]);
|
||||
case GL_FLOAT:
|
||||
return (int) ((lists[n << 2]) * 16777216.0f + (lists[(n << 2) | 1]) * 65536.0f
|
||||
+ (lists[(n << 2) | 2]) * 256.0f + (lists[(n << 2) | 3]));
|
||||
|
@ -1830,7 +1836,8 @@ public abstract class GL<ImageType, FontType> {
|
|||
/** GLvoid glBegin (GLenum mode) */
|
||||
public void glBegin(int mode) {
|
||||
if (CC.Mode != None) {
|
||||
CC.gl_error(GL_INVALID_OPERATION, "glBegin can not be called as a geometry is already in progress : " + CC.Mode);
|
||||
CC.gl_error(GL_INVALID_OPERATION,
|
||||
"glBegin can not be called as a geometry is already in progress : " + CC.Mode);
|
||||
return;
|
||||
}
|
||||
switch (mode) {
|
||||
|
@ -1850,8 +1857,9 @@ public abstract class GL<ImageType, FontType> {
|
|||
CC.gl_error(GL.GL_INVALID_ENUM, "glBegin(mode)");
|
||||
}
|
||||
}
|
||||
|
||||
static final String NEED_GL_BEGIN = " is called while no geometry was initialized with glBegin(geom).";
|
||||
|
||||
static final String NEED_GL_BEGIN =
|
||||
" is called while no geometry was initialized with glBegin(geom).";
|
||||
|
||||
/** GLvoid glEnd (GLvoid) */
|
||||
public void glEnd() {
|
||||
|
@ -6370,7 +6378,7 @@ public abstract class GL<ImageType, FontType> {
|
|||
public static final int GLX_BAD_CONTEXT = 5;
|
||||
public static final int GLX_BAD_VALUE = 6;
|
||||
public static final int GLX_BAD_ENUM = 7;
|
||||
/* Constant of GLE */
|
||||
public static final int GL_PHONG = GL_SMOOTH + 1;
|
||||
/* Constant of GLE */
|
||||
public static final int GL_PHONG = GL_SMOOTH + 1;
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package jgl.wt.awt;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import java.util.Arrays;
|
||||
import jgl.glu.GLUnurbsObj;
|
||||
import jgl.glu.GLUquadricObj;
|
||||
|
||||
|
@ -203,6 +203,21 @@ public class GLU {
|
|||
- d1 * det33(a2, a3, a4, b2, b3, b4, c2, c3, c4));
|
||||
}
|
||||
|
||||
private double det44_row(double[] m) {
|
||||
return det44(m[0], m[1], m[2], m[3],
|
||||
m[4], m[5], m[6], m[7],
|
||||
m[8], m[9], m[10], m[11],
|
||||
m[12], m[13], m[14], m[15]);
|
||||
}
|
||||
|
||||
private double det44_col(double[] m) {
|
||||
return det44(m[0], m[4], m[8], m[12],
|
||||
m[1], m[5], m[9], m[13],
|
||||
m[2], m[6], m[10], m[14],
|
||||
m[3], m[7], m[11], m[15]);
|
||||
}
|
||||
|
||||
|
||||
private double[] adjoint44(double a[]) {
|
||||
double m[] = new double[16];
|
||||
m[0] = det33(a[5], a[6], a[7], a[9], a[10], a[11], a[13], a[14], a[15]);
|
||||
|
@ -233,12 +248,22 @@ public class GLU {
|
|||
for (int i = 0; i < 4; i++) {
|
||||
out[4 * i + i] = 1;
|
||||
}
|
||||
|
||||
//print("Identity:", out, 4);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
double d = a[4 * i + i];
|
||||
// over rows
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
// diagonal element : (0,0), (1,1), (2,2) or (3,3)
|
||||
double d = a[4 * i + i];
|
||||
|
||||
//System.out.println(" inversing : with d=" + d);
|
||||
|
||||
if (d != 1) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
|
||||
out[4 * i + j] /= d;
|
||||
|
||||
a[4 * i + j] /= d;
|
||||
}
|
||||
}
|
||||
|
@ -250,12 +275,14 @@ public class GLU {
|
|||
for (int k = 0; k < 4; k++) {
|
||||
a[4 * j + k] -= mult * a[4 * i + k];
|
||||
out[4 * j + k] -= mult * out[4 * i + k];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("Inversed:", out, 4);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -271,6 +298,39 @@ public class GLU {
|
|||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static void print(double input[][]) {
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
for (int j = 0; j < input[i].length; j++) {
|
||||
System.out.print(input[i][j] + "\t");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(String info, double input[][]) {
|
||||
System.out.print(info);
|
||||
print(input);
|
||||
}
|
||||
|
||||
public static void print(double input[], int width) {
|
||||
int k=0;
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
System.out.print(input[i] + "\t");
|
||||
k++;
|
||||
if(k%width==0) {
|
||||
System.out.println();
|
||||
}
|
||||
//System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(String info, double input[], int width) {
|
||||
System.out.println(info);
|
||||
print(input, width);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public GL gluGetGL() {
|
||||
return JavaGL;
|
||||
|
@ -384,6 +444,11 @@ public class GLU {
|
|||
A = mulMatrix44(proj, model);
|
||||
m = inverseMatrix44(A);
|
||||
|
||||
// Culprit: this result may contains NaN values
|
||||
// https://github.com/jzy3d/jzy3d-api/issues/286
|
||||
//
|
||||
//print("m = inverse(A)", m, 4);
|
||||
|
||||
out = mulMatrix41(m, in);
|
||||
if (out[3] == 0)
|
||||
return false;
|
||||
|
@ -391,6 +456,7 @@ public class GLU {
|
|||
objx[0] = out[0] / out[3];
|
||||
objy[0] = out[1] / out[3];
|
||||
objz[0] = out[2] / out[3];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ public class GLUT implements Runnable {
|
|||
*/
|
||||
public void glutBitmapString(Font font, String string, float x, float y, float z, float r,
|
||||
float g, float b, float rotate) {
|
||||
//System.out.println("GLUT.glutBimap " + x + " " + y + " " + z);
|
||||
double[] win = modelToScreen(x, y, z);
|
||||
|
||||
double winX = win[0];
|
||||
|
@ -171,10 +172,11 @@ public class GLUT implements Runnable {
|
|||
double winz[] = new double[1];
|
||||
|
||||
if (!JavaGLU.gluProject(x, y, z, getModelViewAsDouble(), getProjectionAsDouble(), viewport,
|
||||
winx, winy, winz))
|
||||
winx, winy, winz)) {
|
||||
System.err.println("GLUT.modelToScreen : Could not retrieve model coordinates in screen for "
|
||||
+ x + ", " + y + ", " + z);
|
||||
|
||||
}
|
||||
|
||||
double[] win = new double[3];
|
||||
win[0] = winx[0];
|
||||
win[1] = winy[0];
|
||||
|
|
|
@ -3,8 +3,8 @@ jzy3d-test-java9-generated
|
|||
This is a summary of existing baseline images for tests, which was generated on
|
||||
* OS Name : mac os x
|
||||
* OS Version : 11.4
|
||||
* Java Version : 17-panama
|
||||
* CPU : x86_64
|
||||
* Java Version : 17.0.1
|
||||
* CPU : aarch64
|
||||
* GPU : AppleM1
|
||||
|
||||
# Surface
|
||||
|
@ -83,7 +83,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td><img src="src/test/resources/macosx_11.4_AppleM1/Text_EmulGL_AWT_HiDPI=OFF_Font=AppleChancery24.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Diff chart:<br><img src="target/error-Text_Native_AWT_HiDPI=ON_Font=AppleChancery24_DIFF.png"><br>Actual chart:<br><img src="target/error-Text_Native_AWT_HiDPI=ON_Font=AppleChancery24_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-Text_Native_AWT_HiDPI=ON_Font=AppleChancery24_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
@ -115,7 +115,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Diff chart:<br><img src="target/error-Text_whenDrawableTextRenderer_EmulGL_AWT_HiDPI=ON_DIFF.png"><br>Actual chart:<br><img src="target/error-Text_whenDrawableTextRenderer_EmulGL_AWT_HiDPI=ON_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-Text_whenDrawableTextRenderer_EmulGL_AWT_HiDPI=ON_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -139,7 +139,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td><img src="src/test/resources/macosx_11.4_AppleM1/AxisLabelRotateLayout_EmulGL_AWT_HiDPI=OFF.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Diff chart:<br><img src="target/error-AxisLabelRotateLayout_Native_AWT_HiDPI=ON_DIFF.png"><br>Actual chart:<br><img src="target/error-AxisLabelRotateLayout_Native_AWT_HiDPI=ON_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-AxisLabelRotateLayout_Native_AWT_HiDPI=ON_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
@ -167,7 +167,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td><img src="src/test/resources/macosx_11.4_AppleM1/Colorbar_IsModifiedByCustomFont_EmulGL_AWT_HiDPI=OFF.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Diff chart:<br><img src="target/error-Colorbar_IsModifiedByCustomFont_Native_AWT_HiDPI=ON_DIFF.png"><br>Actual chart:<br><img src="target/error-Colorbar_IsModifiedByCustomFont_Native_AWT_HiDPI=ON_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-Colorbar_IsModifiedByCustomFont_Native_AWT_HiDPI=ON_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
@ -176,7 +176,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
# 2D_Colorbar
|
||||
# 2D_Colorbar : View=XY
|
||||
<table markdown=1>
|
||||
<tr>
|
||||
<td>Native_AWT HiDPI:ON</td>
|
||||
|
@ -187,12 +187,68 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td>EmulGL_AWT HiDPI:OFF</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_Native_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_Native_AWT_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_Native_Swing_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_Native_Swing_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_EmulGL_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_EmulGL_AWT_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XY_Native_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XY_Native_AWT_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XY_Native_Swing_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XY_Native_Swing_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XY_EmulGL_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XY_EmulGL_AWT_HiDPI=OFF.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# 2D_Colorbar : View=XZ
|
||||
<table markdown=1>
|
||||
<tr>
|
||||
<td>Native_AWT HiDPI:ON</td>
|
||||
<td>Native_AWT HiDPI:OFF</td>
|
||||
<td>Native_Swing HiDPI:ON</td>
|
||||
<td>Native_Swing HiDPI:OFF</td>
|
||||
<td>EmulGL_AWT HiDPI:ON</td>
|
||||
<td>EmulGL_AWT HiDPI:OFF</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XZ_Native_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XZ_Native_AWT_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XZ_Native_Swing_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XZ_Native_Swing_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XZ_EmulGL_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=XZ_EmulGL_AWT_HiDPI=OFF.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# 2D_Colorbar : View=YZ
|
||||
<table markdown=1>
|
||||
<tr>
|
||||
<td>Native_AWT HiDPI:ON</td>
|
||||
<td>Native_AWT HiDPI:OFF</td>
|
||||
<td>Native_Swing HiDPI:ON</td>
|
||||
<td>Native_Swing HiDPI:OFF</td>
|
||||
<td>EmulGL_AWT HiDPI:ON</td>
|
||||
<td>EmulGL_AWT HiDPI:OFF</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=YZ_Native_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=YZ_Native_AWT_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=YZ_Native_Swing_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=YZ_Native_Swing_HiDPI=OFF.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=YZ_EmulGL_AWT_HiDPI=ON.png"></td>
|
||||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_Colorbar_View=YZ_EmulGL_AWT_HiDPI=OFF.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -228,7 +284,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td><img src="src/test/resources/macosx_11.4_AppleM1/2D_when2DLayoutConfig_ThenApplyMargins_EmulGL_AWT_HiDPI=OFF_BorderMargin=0_TickLabel=0_AxisLabel=0_TextAddMargin=true.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Diff chart:<br><img src="target/error-2D_when2DLayoutConfig_ThenApplyMargins_Native_AWT_HiDPI=ON_BorderMargin=0_TickLabel=0_AxisLabel=0_TextAddMargin=true_DIFF.png"><br>Actual chart:<br><img src="target/error-2D_when2DLayoutConfig_ThenApplyMargins_Native_AWT_HiDPI=ON_BorderMargin=0_TickLabel=0_AxisLabel=0_TextAddMargin=true_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-2D_when2DLayoutConfig_ThenApplyMargins_Native_AWT_HiDPI=ON_BorderMargin=0_TickLabel=0_AxisLabel=0_TextAddMargin=true_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
@ -485,7 +541,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Diff chart:<br><img src="target/error-2D_whenAxisRotated_ThenApplyMargins_EmulGL_AWT_HiDPI=ON_yAxisOrientation=VERTICAL_DIFF.png"><br>Actual chart:<br><img src="target/error-2D_whenAxisRotated_ThenApplyMargins_EmulGL_AWT_HiDPI=ON_yAxisOrientation=VERTICAL_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-2D_whenAxisRotated_ThenApplyMargins_EmulGL_AWT_HiDPI=ON_yAxisOrientation=VERTICAL_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -543,7 +599,7 @@ This is a summary of existing baseline images for tests, which was generated on
|
|||
<td><img src="src/test/resources/macosx_11.4_AppleM1/Overlay_EmulGL_AWT_HiDPI=OFF_Corner1=TOP_LEFT_Corner2=TOP_RIGHT.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Diff chart:<br><img src="target/error-Overlay_Native_AWT_HiDPI=ON_Corner1=TOP_LEFT_Corner2=TOP_RIGHT_DIFF.png"><br>Actual chart:<br><img src="target/error-Overlay_Native_AWT_HiDPI=ON_Corner1=TOP_LEFT_Corner2=TOP_RIGHT_ACTUAL.png"><br>Zoom on error:<br><img src="target/error-Overlay_Native_AWT_HiDPI=ON_Corner1=TOP_LEFT_Corner2=TOP_RIGHT_ZOOM.png"><br>Following tests of the same section have been skipped.</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
|
|
@ -109,7 +109,9 @@ public class ITTest {
|
|||
section(sb, "Colorbar", "IsModifiedByCustomFont", null);
|
||||
//section(sb, "Colorbar", "HasMinimumWidth", null);
|
||||
|
||||
section(sb, "2D_Colorbar");
|
||||
section(sb, "2D_Colorbar", "View"+KV+"XY", null);
|
||||
section(sb, "2D_Colorbar", "View"+KV+"XZ", null);
|
||||
section(sb, "2D_Colorbar", "View"+KV+"YZ", null);
|
||||
|
||||
// 2D tests
|
||||
line(sb, "# 2D Layout");
|
||||
|
|
|
@ -14,23 +14,21 @@ import org.jzy3d.plot2d.rendering.AWTGraphicsUtils;
|
|||
import org.jzy3d.plot3d.primitives.SampleGeom;
|
||||
import org.jzy3d.plot3d.primitives.Shape;
|
||||
import org.jzy3d.plot3d.primitives.axis.layout.AxisLayout;
|
||||
import org.jzy3d.plot3d.primitives.axis.layout.LabelOrientation;
|
||||
import org.jzy3d.plot3d.primitives.axis.layout.fonts.HiDPIProportionalFontSizePolicy;
|
||||
import org.jzy3d.plot3d.primitives.axis.layout.providers.RegularTickProvider;
|
||||
import org.jzy3d.plot3d.primitives.axis.layout.renderers.DefaultDecimalTickRenderer;
|
||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||
import org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend;
|
||||
import org.jzy3d.plot3d.rendering.legends.overlay.LegendLayout;
|
||||
import org.jzy3d.plot3d.rendering.view.AWTImageRenderer;
|
||||
import org.jzy3d.plot3d.rendering.view.AWTView;
|
||||
import org.jzy3d.plot3d.rendering.view.HiDPI;
|
||||
import org.jzy3d.plot3d.rendering.view.View2D;
|
||||
import org.jzy3d.plot3d.rendering.view.View2DLayout;
|
||||
import org.jzy3d.plot3d.rendering.view.View2DLayout_Debug;
|
||||
import org.jzy3d.tests.integration.ITTest.WT;
|
||||
|
||||
public class ITTest_2D_Colorbar extends ITTest {
|
||||
public static void main(String[] args) {
|
||||
open(new ITTest_2D_Colorbar().when2DChartWithColorbarAndMargins(WT.EmulGL_AWT, HiDPI.ON));
|
||||
open(new ITTest_2D_Colorbar().when2DChartWithColorbarAndMargins(WT.EmulGL_AWT, HiDPI.ON, View2D.XY));
|
||||
//open(new ITTest_AxisLabelRotateLayout().whenAxisLabelOrientationNotHorizontal(WT.Native_AWT, HiDPI.ON));
|
||||
}
|
||||
|
||||
|
@ -38,49 +36,27 @@ public class ITTest_2D_Colorbar extends ITTest {
|
|||
// ----------------------------------------------------
|
||||
// TEST MULTIPLE AXIS ORIENTATION SETTINGS
|
||||
// ----------------------------------------------------
|
||||
|
||||
//static String caseAxisRotated = "whenAxisRotated_ThenApplyMargins";
|
||||
|
||||
/*protected static LabelOrientation[] yOrientations =
|
||||
{LabelOrientation.VERTICAL, LabelOrientation.HORIZONTAL};
|
||||
|
||||
|
||||
@Test
|
||||
public void whenAxisRotated_ThenApplyMargins() {
|
||||
System.out.println("ITTest : " + caseAxisRotated);
|
||||
|
||||
forEach((toolkit, resolution) -> whenAxisRotated_ThenApplyMargins(toolkit, resolution));
|
||||
}*/
|
||||
View2D[] views = {View2D.XY, View2D.XZ, View2D.YZ};
|
||||
|
||||
@Test
|
||||
public void when2DChartWithColorbarAndMargins() {
|
||||
System.out.println("ITTest : when2DChartWithColorbarAndMargins");
|
||||
|
||||
forEach((toolkit, resolution) -> when2DChartWithColorbarAndMargins(toolkit, resolution));
|
||||
forEach((toolkit, resolution) -> {
|
||||
for(View2D view2d: views) {
|
||||
when2DChartWithColorbarAndMargins(toolkit, resolution, view2d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected Chart when2DChartWithColorbarAndMargins(WT wt, HiDPI hidpi) {
|
||||
protected Chart when2DChartWithColorbarAndMargins(WT wt, HiDPI hidpi, View2D viewMode) {
|
||||
// Given a chart with long Y axis name
|
||||
AWTChart chart = (AWTChart)chart(wt, hidpi);
|
||||
//chart.add(surface());
|
||||
//chart.view2d();
|
||||
|
||||
//AxisLayout axisLayout = chart.getAxisLayout();
|
||||
//axisLayout.setYAxisLabel("Y axis longer than usual");
|
||||
|
||||
/*forEach((yOrientation)->{
|
||||
// When : vertical orientation
|
||||
axisLayout.setYAxisLabelOrientation(yOrientation);
|
||||
|
||||
// Then
|
||||
assertChart(chart, name(ITTest_2D_Colorbar.this, caseAxisRotated, wt, hidpi, properties(yOrientation)));
|
||||
|
||||
});*/
|
||||
|
||||
|
||||
// ---------------------------------------
|
||||
// ---------------------------------------
|
||||
// CHART CONTENT
|
||||
// ---------------------------------------
|
||||
|
||||
|
@ -201,13 +177,13 @@ public class ITTest_2D_Colorbar extends ITTest {
|
|||
|
||||
|
||||
// Enable 2D mode
|
||||
chart.view2d();
|
||||
chart.view2d(viewMode);
|
||||
|
||||
|
||||
|
||||
|
||||
// Then
|
||||
assertChart(chart, name(ITTest_2D_Colorbar.this, null, wt, hidpi));
|
||||
assertChart(chart, name(ITTest_2D_Colorbar.this, "View"+KV+viewMode, wt, hidpi));
|
||||
|
||||
return chart;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 66 KiB |