add axes_zoom argument in axes3d function

This commit is contained in:
wyq 2022-06-09 16:34:15 +08:00
parent 29e493680c
commit bf187e103a
7 changed files with 181 additions and 131 deletions

View File

@ -128,8 +128,8 @@ public class EarthPlot3D extends Plot3DGL {
if (!ex.is3D()) { if (!ex.is3D()) {
ex = ex.to3D(); ex = ex.to3D();
} }
this.extent = (Extent3D) ex; this.graphicExtent = (Extent3D) ex;
this.setDrawExtent((Extent3D) this.extent.clone()); this.setDrawExtent((Extent3D) this.graphicExtent.clone());
} }
/** /**

View File

@ -793,7 +793,7 @@ public class GLChartPanel extends GLJPanel implements IChartPanel {
*/ */
@Override @Override
public void onUndoZoomClick() { public void onUndoZoomClick() {
this.plot3DGL.setDrawExtent(this.plot3DGL.getExtent()); this.plot3DGL.setDrawExtent(this.plot3DGL.getGraphicExtent());
this.plot3DGL.initAngles(); this.plot3DGL.initAngles();
this.repaint(); this.repaint();
} }

View File

@ -82,8 +82,9 @@ public class Plot3DGL extends Plot implements GLEventListener {
protected final GLUT glut = new GLUT(); protected final GLUT glut = new GLUT();
protected int startList = 2; protected int startList = 2;
protected GraphicCollection3D graphics; protected GraphicCollection3D graphics;
protected Extent3D extent; protected Extent3D graphicExtent;
protected Extent3D drawExtent; protected Extent3D drawExtent;
protected Extent3D axesExtent;
protected boolean fixExtent; protected boolean fixExtent;
protected ChartText title; protected ChartText title;
protected GridLine gridLine; protected GridLine gridLine;
@ -96,6 +97,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
protected float ymax = 1.0f, zmin, zmax = 1.0f; protected float ymax = 1.0f, zmin, zmax = 1.0f;
protected Transform transform = new Transform(); protected Transform transform = new Transform();
protected boolean clipPlane = true; protected boolean clipPlane = true;
protected boolean axesZoom = false;
protected Color boxColor = Color.getHSBColor(0f, 0f, 0.95f); protected Color boxColor = Color.getHSBColor(0f, 0f, 0.95f);
//protected Color lineBoxColor = new Color(220, 220, 220); //protected Color lineBoxColor = new Color(220, 220, 220);
@ -137,7 +139,6 @@ public class Plot3DGL extends Plot implements GLEventListener {
this.projInfo = null; this.projInfo = null;
this.doScreenShot = false; this.doScreenShot = false;
this.legends = new ArrayList<>(); this.legends = new ArrayList<>();
this.fixExtent = false;
this.xAxis = new Axis(); this.xAxis = new Axis();
this.xAxis.setTickLength(8); this.xAxis.setTickLength(8);
this.yAxis = new Axis(); this.yAxis = new Axis();
@ -145,6 +146,10 @@ public class Plot3DGL extends Plot implements GLEventListener {
this.zAxis = new Axis(); this.zAxis = new Axis();
this.zAxis.setTickLength(8); this.zAxis.setTickLength(8);
this.zAxisLocations = new ArrayList<>(); this.zAxisLocations = new ArrayList<>();
this.graphicExtent = new Extent3D();
Extent3D extent3D = new Extent3D(-1, 1, -1, 1, -1, 1);
this.setDrawExtent((Extent3D) extent3D.clone());
this.fixExtent = false;
this.graphics = new GraphicCollection3D(); this.graphics = new GraphicCollection3D();
this.hideOnDrag = false; this.hideOnDrag = false;
this.boxed = true; this.boxed = true;
@ -284,16 +289,12 @@ public class Plot3DGL extends Plot implements GLEventListener {
return this.screenImage; return this.screenImage;
} }
public Extent3D getExtent() {
return this.extent;
}
/** /**
* Set extent * Get extent of all graphics
* @param value Extent * @return Extent of all graphics
*/ */
public void setExtent(Extent3D value) { public Extent3D getGraphicExtent() {
this.extent = value; return this.graphicExtent;
} }
/** /**
@ -332,11 +333,30 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
this.drawExtent = new Extent3D(xmin, xmax, ymin, ymax, zmin, zmax); this.drawExtent = new Extent3D(xmin, xmax, ymin, ymax, zmin, zmax);
xAxis.setMinMaxValue(xmin, xmax);
yAxis.setMinMaxValue(ymin, ymax);
zAxis.setMinMaxValue(zmin, zmax);
this.transform.setExtent(this.drawExtent); this.transform.setExtent(this.drawExtent);
if (!this.axesZoom) {
setAxesExtent((Extent3D) drawExtent.clone());
}
}
/**
* Get axes extent (axes boundary extent)
* @return Axes extent
*/
public Extent3D getAxesExtent() {
return this.axesExtent;
}
/**
* Set axes extent
* @param value Axes extent
*/
public void setAxesExtent(Extent3D value) {
this.axesExtent = value;
xAxis.setMinMaxValue(axesExtent.minX, axesExtent.maxX);
yAxis.setMinMaxValue(axesExtent.minY, axesExtent.maxY);
zAxis.setMinMaxValue(axesExtent.minZ, axesExtent.maxZ);
} }
/** /**
@ -356,11 +376,38 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
/** /**
* Get the extent of all graphics * Get if clip plane
* @return The extent of all graphics * @return Boolean
*/ */
public Extent3D getGraphicExtent() { public boolean isClipPlane() {
return (Extent3D) this.graphics.getExtent(); return this.clipPlane;
}
/**
* Set if clip plane
* @param value Boolean
*/
public void setClipPlane(boolean value) {
this.clipPlane = value;
}
/**
* Get whether zooming axes (boundary - axis, base, bounding box, grid)
* @return Whether zooming axes
*/
public boolean isAxesZoom() {
return this.axesZoom;
}
/**
* Set whether zooming axes (boundary - axis, base, bounding box, grid)
* @param value Whether zooming axes
*/
public void setAxesZoom(boolean value) {
this.axesZoom = value;
if (this.axesZoom) {
this.clipPlane = false;
}
} }
/** /**
@ -999,8 +1046,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
protected void updateExtent() { protected void updateExtent() {
this.extent = new Extent3D(xmin, xmax, ymin, ymax, zmin, zmax); this.drawExtent = new Extent3D(xmin, xmax, ymin, ymax, zmin, zmax);
this.drawExtent = (Extent3D) this.extent.clone();
this.transform.setExtent(this.drawExtent); this.transform.setExtent(this.drawExtent);
} }
@ -1026,9 +1072,10 @@ public class Plot3DGL extends Plot implements GLEventListener {
if (!ex.is3D()) { if (!ex.is3D()) {
ex = ex.to3D(); ex = ex.to3D();
} }
this.extent = (Extent3D) ex; this.graphicExtent = (Extent3D) ex;
this.setAxesExtent((Extent3D) graphicExtent.clone());
if (!fixExtent) { if (!fixExtent) {
this.setDrawExtent((Extent3D) this.extent.clone()); this.setDrawExtent((Extent3D) this.graphicExtent.clone());
} }
} }
@ -1244,12 +1291,12 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
private void enableClipPlane(GL2 gl) { private void enableClipPlane(GL2 gl) {
float xMin = this.transform.transform_x(this.xmin); float xMin = this.transform.transform_x((float) axesExtent.minX);
float xMax = this.transform.transform_x(this.xmax) + 0.01f; float xMax = this.transform.transform_x((float) axesExtent.maxX) + 0.01f;
float yMin = this.transform.transform_y(this.ymin); float yMin = this.transform.transform_y((float) axesExtent.minY);
float yMax = this.transform.transform_y(this.ymax) + 0.01f; float yMax = this.transform.transform_y((float) axesExtent.maxY) + 0.01f;
float zMin = this.transform.transform_z(this.zmin); float zMin = this.transform.transform_z((float) axesExtent.minZ);
float zMax = this.transform.transform_z(this.zmax) + 0.01f; float zMax = this.transform.transform_z((float) axesExtent.maxZ) + 0.01f;
float s = 1.01f; float s = 1.01f;
gl.glClipPlane(GL2.GL_CLIP_PLANE0, new double[]{1, 0, 0, xMax}, 0); gl.glClipPlane(GL2.GL_CLIP_PLANE0, new double[]{1, 0, 0, xMax}, 0);
gl.glEnable(GL2.GL_CLIP_PLANE0); gl.glEnable(GL2.GL_CLIP_PLANE0);
@ -1303,22 +1350,6 @@ public class Plot3DGL extends Plot implements GLEventListener {
gl.glLoadIdentity(); gl.glLoadIdentity();
} }
/**
* Get if clip plane
* @return Boolean
*/
public boolean isClipPlane() {
return this.clipPlane;
}
/**
* Set if clip plane
* @param value Boolean
*/
public void setClipPlane(boolean value) {
this.clipPlane = value;
}
/** /**
* Draws the base plane. The base plane is the x-y plane. * Draws the base plane. The base plane is the x-y plane.
* *
@ -1327,25 +1358,22 @@ public class Plot3DGL extends Plot implements GLEventListener {
* @param y used to retrieve y coordinates of drawn plane from this method. * @param y used to retrieve y coordinates of drawn plane from this method.
*/ */
protected void drawBase(GL2 gl) { protected void drawBase(GL2 gl) {
float xMin, xMax, yMin, yMax, zMin;
xMin = this.transform.transform_x((float) axesExtent.minX);
xMax = this.transform.transform_x((float) axesExtent.maxX);
yMin = this.transform.transform_y((float) axesExtent.minY);
yMax = this.transform.transform_y((float) axesExtent.maxY);
zMin = this.transform.transform_z((float) axesExtent.minZ);
float[] rgba = this.gridLine.getColor().getRGBComponents(null); float[] rgba = this.gridLine.getColor().getRGBComponents(null);
gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]); gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale); gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
gl.glBegin(GL2.GL_LINE_STRIP); gl.glBegin(GL2.GL_LINE_STRIP);
float xMin = this.transform.transform_x(this.xmin);
float xMax = this.transform.transform_x(this.xmax);
float yMin = this.transform.transform_y(this.ymin);
float yMax = this.transform.transform_y(this.ymax);
float zMin = this.transform.transform_z(this.zmin);
gl.glVertex3f(xMin, yMax, zMin); gl.glVertex3f(xMin, yMax, zMin);
gl.glVertex3f(xMin, yMin, zMin); gl.glVertex3f(xMin, yMin, zMin);
gl.glVertex3f(xMax, yMin, zMin); gl.glVertex3f(xMax, yMin, zMin);
gl.glVertex3f(xMax, yMax, zMin); gl.glVertex3f(xMax, yMax, zMin);
gl.glVertex3f(xMin, yMax, zMin); gl.glVertex3f(xMin, yMax, zMin);
/*gl.glVertex3f(-1.0f, 1.0f, -1.0f);
gl.glVertex3f(-1.0f, -1.0f, -1.0f);
gl.glVertex3f(1.0f, -1.0f, -1.0f);
gl.glVertex3f(1.0f, 1.0f, -1.0f);
gl.glVertex3f(-1.0f, 1.0f, -1.0f);*/
gl.glEnd(); gl.glEnd();
} }
@ -1485,12 +1513,14 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
protected void drawBox(GL2 gl) { protected void drawBox(GL2 gl) {
float xMin = this.transform.transform_x(this.xmin); float xMin, xMax, yMin, yMax, zMin, zMax;
float xMax = this.transform.transform_x(this.xmax); xMin = this.transform.transform_x((float) axesExtent.minX);
float yMin = this.transform.transform_y(this.ymin); xMax = this.transform.transform_x((float) axesExtent.maxX);
float yMax = this.transform.transform_y(this.ymax); yMin = this.transform.transform_y((float) axesExtent.minY);
float zMin = this.transform.transform_z(this.zmin); yMax = this.transform.transform_y((float) axesExtent.maxY);
float zMax = this.transform.transform_z(this.zmax); zMin = this.transform.transform_z((float) axesExtent.minZ);
zMax = this.transform.transform_z((float) axesExtent.maxZ);
float[] rgba = this.gridLine.getColor().getRGBComponents(null); float[] rgba = this.gridLine.getColor().getRGBComponents(null);
gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]); gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale); gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
@ -1531,12 +1561,14 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
protected void drawBoundingBox(GL2 gl) { protected void drawBoundingBox(GL2 gl) {
float xMin = this.transform.transform_x(this.xmin); float xMin, xMax, yMin, yMax, zMin, zMax;
float xMax = this.transform.transform_x(this.xmax); xMin = this.transform.transform_x((float) axesExtent.minX);
float yMin = this.transform.transform_y(this.ymin); xMax = this.transform.transform_x((float) axesExtent.maxX);
float yMax = this.transform.transform_y(this.ymax); yMin = this.transform.transform_y((float) axesExtent.minY);
float zMin = this.transform.transform_z(this.zmin); yMax = this.transform.transform_y((float) axesExtent.maxY);
float zMax = this.transform.transform_z(this.zmax); zMin = this.transform.transform_z((float) axesExtent.minZ);
zMax = this.transform.transform_z((float) axesExtent.maxZ);
float[] rgba = this.gridLine.getColor().getRGBComponents(null); float[] rgba = this.gridLine.getColor().getRGBComponents(null);
gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]); gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale); gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
@ -1577,14 +1609,16 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
protected void drawXYGridLine(GL2 gl) { protected void drawXYGridLine(GL2 gl) {
float xMin = this.transform.transform_x(this.xmin); float xMin, xMax, yMin, yMax, zMin, zMax;
float xMax = this.transform.transform_x(this.xmax); xMin = this.transform.transform_x((float) axesExtent.minX);
float yMin = this.transform.transform_y(this.ymin); xMax = this.transform.transform_x((float) axesExtent.maxX);
float yMax = this.transform.transform_y(this.ymax); yMin = this.transform.transform_y((float) axesExtent.minY);
float zMin = this.transform.transform_z(this.zmin); yMax = this.transform.transform_y((float) axesExtent.maxY);
float zMax = this.transform.transform_z(this.zmax); zMin = this.transform.transform_z((float) axesExtent.minZ);
zMax = this.transform.transform_z((float) axesExtent.maxZ);
float[] rgba; float[] rgba;
float x, y, v; float x, y, x1, y1, v;
int skip; int skip;
XAlign xAlign; XAlign xAlign;
YAlign yAlign; YAlign yAlign;
@ -1593,8 +1627,10 @@ public class Plot3DGL extends Plot implements GLEventListener {
if (this.displayXY) { if (this.displayXY) {
if (this.angleY >= 90 && this.angleY < 270) { if (this.angleY >= 90 && this.angleY < 270) {
y = yMax; y = yMax;
y1 = yMin;
} else { } else {
y = yMin; y = yMin;
y1 = yMax;
} }
this.xAxis.updateTickLabels(); this.xAxis.updateTickLabels();
@ -1603,7 +1639,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
skip = getLabelGap(this.xAxis.getTickLabelFont(), tlabs, axisLen); skip = getLabelGap(this.xAxis.getTickLabelFont(), tlabs, axisLen);
for (int i = 0; i < this.xAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.xAxis.getTickValues().length; i += skip) {
v = (float) this.xAxis.getTickValues()[i]; v = (float) this.xAxis.getTickValues()[i];
if (v < xmin || v > xmax) { if (v < axesExtent.minX || v > axesExtent.maxX) {
continue; continue;
} }
v = this.transform.transform_x(v); v = this.transform.transform_x(v);
@ -1618,12 +1654,12 @@ public class Plot3DGL extends Plot implements GLEventListener {
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale); gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
gl.glBegin(GL2.GL_LINES); gl.glBegin(GL2.GL_LINES);
gl.glVertex3f(v, y, zMin); gl.glVertex3f(v, y, zMin);
gl.glVertex3f(v, -y, zMin); gl.glVertex3f(v, y1, zMin);
gl.glEnd(); gl.glEnd();
if (this.displayZ && this.boxed) { if (this.displayZ && this.boxed) {
gl.glBegin(GL2.GL_LINES); gl.glBegin(GL2.GL_LINES);
gl.glVertex3f(v, -y, zMin); gl.glVertex3f(v, y1, zMin);
gl.glVertex3f(v, -y, zMax); gl.glVertex3f(v, y1, zMax);
gl.glEnd(); gl.glEnd();
} }
} }
@ -1633,8 +1669,10 @@ public class Plot3DGL extends Plot implements GLEventListener {
//y grid line //y grid line
if (this.angleY >= 180 && this.angleY < 360) { if (this.angleY >= 180 && this.angleY < 360) {
x = xMax; x = xMax;
x1 = xMin;
} else { } else {
x = xMin; x = xMin;
x1 = xMax;
} }
this.yAxis.updateTickLabels(); this.yAxis.updateTickLabels();
@ -1643,7 +1681,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
skip = getLabelGap(this.yAxis.getTickLabelFont(), tlabs, axisLen); skip = getLabelGap(this.yAxis.getTickLabelFont(), tlabs, axisLen);
for (int i = 0; i < this.yAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.yAxis.getTickValues().length; i += skip) {
v = (float) this.yAxis.getTickValues()[i]; v = (float) this.yAxis.getTickValues()[i];
if (v < ymin || v > ymax) { if (v < axesExtent.minY || v > axesExtent.maxY) {
continue; continue;
} }
v = this.transform.transform_y(v); v = this.transform.transform_y(v);
@ -1658,12 +1696,12 @@ public class Plot3DGL extends Plot implements GLEventListener {
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale); gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
gl.glBegin(GL2.GL_LINES); gl.glBegin(GL2.GL_LINES);
gl.glVertex3f(x, v, zMin); gl.glVertex3f(x, v, zMin);
gl.glVertex3f(-x, v, zMin); gl.glVertex3f(x1, v, zMin);
gl.glEnd(); gl.glEnd();
if (this.displayZ && this.boxed) { if (this.displayZ && this.boxed) {
gl.glBegin(GL2.GL_LINES); gl.glBegin(GL2.GL_LINES);
gl.glVertex3f(-x, v, zMin); gl.glVertex3f(x1, v, zMin);
gl.glVertex3f(-x, v, zMax); gl.glVertex3f(x1, v, zMax);
gl.glEnd(); gl.glEnd();
} }
} }
@ -1672,14 +1710,16 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
protected void drawZGridLine(GL2 gl) { protected void drawZGridLine(GL2 gl) {
float xMin = this.transform.transform_x(this.xmin); float xMin, xMax, yMin, yMax, zMin, zMax;
float xMax = this.transform.transform_x(this.xmax); xMin = this.transform.transform_x((float) axesExtent.minX);
float yMin = this.transform.transform_y(this.ymin); xMax = this.transform.transform_x((float) axesExtent.maxX);
float yMax = this.transform.transform_y(this.ymax); yMin = this.transform.transform_y((float) axesExtent.minY);
float zMin = this.transform.transform_z(this.zmin); yMax = this.transform.transform_y((float) axesExtent.maxY);
float zMax = this.transform.transform_z(this.zmax); zMin = this.transform.transform_z((float) axesExtent.minZ);
zMax = this.transform.transform_z((float) axesExtent.maxZ);
float[] rgba; float[] rgba;
float x, y, v; float x, y, x1, y1, v;
int skip; int skip;
XAlign xAlign; XAlign xAlign;
YAlign yAlign; YAlign yAlign;
@ -1688,16 +1728,24 @@ public class Plot3DGL extends Plot implements GLEventListener {
//z axis line //z axis line
if (this.angleY < 90) { if (this.angleY < 90) {
x = xMin; x = xMin;
x1 = xMax;
y = yMax; y = yMax;
y1 = yMin;
} else if (this.angleY < 180) { } else if (this.angleY < 180) {
x = xMax; x = xMax;
x1 = xMin;
y = yMax; y = yMax;
y1 = yMin;
} else if (this.angleY < 270) { } else if (this.angleY < 270) {
x = xMax; x = xMax;
x1 = xMin;
y = yMin; y = yMin;
y1 = yMax;
} else { } else {
x = xMin; x = xMin;
x1 = xMax;
y = yMin; y = yMin;
y1 = yMax;
} }
this.zAxis.updateTickLabels(); this.zAxis.updateTickLabels();
@ -1706,7 +1754,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
skip = getLabelGap(this.zAxis.getTickLabelFont(), tlabs, axisLen); skip = getLabelGap(this.zAxis.getTickLabelFont(), tlabs, axisLen);
for (int i = 0; i < this.zAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.zAxis.getTickValues().length; i += skip) {
v = (float) this.zAxis.getTickValues()[i]; v = (float) this.zAxis.getTickValues()[i];
if (v < zmin || v > zmax) { if (v < axesExtent.minZ || v > axesExtent.maxZ) {
continue; continue;
} }
v = this.transform.transform_z(v); v = this.transform.transform_z(v);
@ -1723,19 +1771,19 @@ public class Plot3DGL extends Plot implements GLEventListener {
gl.glVertex3f(x, y, v); gl.glVertex3f(x, y, v);
if (x < 0) { if (x < 0) {
if (y > 0) { if (y > 0) {
gl.glVertex3f(-x, y, v); gl.glVertex3f(x1, y, v);
gl.glVertex3f(-x, -y, v); gl.glVertex3f(x1, y1, v);
} else { } else {
gl.glVertex3f(x, -y, v); gl.glVertex3f(x, y1, v);
gl.glVertex3f(-x, -y, v); gl.glVertex3f(x1, y1, v);
} }
} else { } else {
if (y > 0) { if (y > 0) {
gl.glVertex3f(x, -y, v); gl.glVertex3f(x, y1, v);
gl.glVertex3f(-x, -y, v); gl.glVertex3f(x1, y1, v);
} else { } else {
gl.glVertex3f(-x, y, v); gl.glVertex3f(x1, y, v);
gl.glVertex3f(-x, -y, v); gl.glVertex3f(x1, y1, v);
} }
} }
gl.glEnd(); gl.glEnd();
@ -1771,12 +1819,13 @@ public class Plot3DGL extends Plot implements GLEventListener {
} }
protected void drawAxis(GL2 gl) { protected void drawAxis(GL2 gl) {
float xMin = this.transform.transform_x(this.xmin); float xMin, xMax, yMin, yMax, zMin, zMax;
float xMax = this.transform.transform_x(this.xmax); xMin = this.transform.transform_x((float) axesExtent.minX);
float yMin = this.transform.transform_y(this.ymin); xMax = this.transform.transform_x((float) axesExtent.maxX);
float yMax = this.transform.transform_y(this.ymax); yMin = this.transform.transform_y((float) axesExtent.minY);
float zMin = this.transform.transform_z(this.zmin); yMax = this.transform.transform_y((float) axesExtent.maxY);
float zMax = this.transform.transform_z(this.zmax); zMin = this.transform.transform_z((float) axesExtent.minZ);
zMax = this.transform.transform_z((float) axesExtent.maxZ);
gl.glDepthFunc(GL.GL_ALWAYS); gl.glDepthFunc(GL.GL_ALWAYS);
@ -1825,7 +1874,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
strHeight = 0.0f; strHeight = 0.0f;
for (int i = 0; i < this.xAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.xAxis.getTickValues().length; i += skip) {
v = (float) this.xAxis.getTickValues()[i]; v = (float) this.xAxis.getTickValues()[i];
if (v < xmin || v > xmax) { if (v < axesExtent.minX || v > axesExtent.maxX) {
continue; continue;
} }
v = this.transform.transform_x(v); v = this.transform.transform_x(v);
@ -1901,7 +1950,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
strHeight = 0.0f; strHeight = 0.0f;
for (int i = 0; i < this.yAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.yAxis.getTickValues().length; i += skip) {
v = (float) this.yAxis.getTickValues()[i]; v = (float) this.yAxis.getTickValues()[i];
if (v < ymin || v > ymax) { if (v < axesExtent.minY || v > axesExtent.maxY) {
continue; continue;
} }
v = this.transform.transform_y(v); v = this.transform.transform_y(v);
@ -1946,13 +1995,13 @@ public class Plot3DGL extends Plot implements GLEventListener {
if (this.displayZ) { if (this.displayZ) {
PointF loc = new PointF(); PointF loc = new PointF();
if (this.angleY < 90) { if (this.angleY < 90) {
loc = new PointF(this.xmin, this.ymax); loc = new PointF((float) axesExtent.minX, (float) axesExtent.maxY);
} else if (this.angleY < 180) { } else if (this.angleY < 180) {
loc = new PointF(this.xmax, this.ymax); loc = new PointF((float) axesExtent.maxX, (float) axesExtent.maxY);
} else if (this.angleY < 270) { } else if (this.angleY < 270) {
loc = new PointF(this.xmax, this.ymin); loc = new PointF((float) axesExtent.maxX, (float) axesExtent.minY);
} else { } else {
loc = new PointF(this.xmin, this.ymin); loc = new PointF((float) axesExtent.minX, (float) axesExtent.minY);
} }
drawZAxis(gl, loc); drawZAxis(gl, loc);
} }
@ -1970,8 +2019,8 @@ public class Plot3DGL extends Plot implements GLEventListener {
x = this.transform.transform_x(loc.X); x = this.transform.transform_x(loc.X);
y = this.transform.transform_y(loc.Y); y = this.transform.transform_y(loc.Y);
float zMin = this.transform.transform_z(this.zmin); float zMin = this.transform.transform_z((float) axesExtent.minZ);
float zMax = this.transform.transform_z(this.zmax); float zMax = this.transform.transform_z((float) axesExtent.maxZ);
//z axis line //z axis line
rgba = this.zAxis.getLineColor().getRGBComponents(null); rgba = this.zAxis.getLineColor().getRGBComponents(null);
@ -2008,7 +2057,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
strWidth = 0.0f; strWidth = 0.0f;
for (int i = 0; i < this.zAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.zAxis.getTickValues().length; i += skip) {
v = (float) this.zAxis.getTickValues()[i]; v = (float) this.zAxis.getTickValues()[i];
if (v < zmin || v > zmax) { if (v < axesExtent.minZ || v > axesExtent.maxZ) {
continue; continue;
} }
v = this.transform.transform_z(v); v = this.transform.transform_z(v);
@ -2057,8 +2106,8 @@ public class Plot3DGL extends Plot implements GLEventListener {
x = this.transform.transform_x(loc.X); x = this.transform.transform_x(loc.X);
y = this.transform.transform_y(loc.Y); y = this.transform.transform_y(loc.Y);
float zMin = this.transform.transform_z(this.zmin); float zMin = this.transform.transform_z((float) axesExtent.minZ);
float zMax = this.transform.transform_z(this.zmax); float zMax = this.transform.transform_z((float) axesExtent.maxZ);
/*gl.glTranslatef(x, y, 0); /*gl.glTranslatef(x, y, 0);
x = y = 0; x = y = 0;
@ -2089,7 +2138,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
strWidth = 0.0f; strWidth = 0.0f;
for (int i = 0; i < this.zAxis.getTickValues().length; i += skip) { for (int i = 0; i < this.zAxis.getTickValues().length; i += skip) {
v = (float) this.zAxis.getTickValues()[i]; v = (float) this.zAxis.getTickValues()[i];
if (v < zmin || v > zmax) { if (v < axesExtent.minZ || v > axesExtent.maxZ) {
continue; continue;
} }
v = this.transform.transform_z(v); v = this.transform.transform_z(v);
@ -4405,7 +4454,7 @@ public class Plot3DGL extends Plot implements GLEventListener {
* @return Extent scale * @return Extent scale
*/ */
public float getScale() { public float getScale() {
return (float) (this.extent.getWidth() / this.drawExtent.getWidth()); return (float) (this.graphicExtent.getWidth() / this.drawExtent.getWidth());
} }
@Override @Override

View File

@ -291,7 +291,7 @@ public class VolumeRender extends JOGLGraphicRender {
gl.glBindTexture(GL_TEXTURE_3D, this.normalsTexture); gl.glBindTexture(GL_TEXTURE_3D, this.normalsTexture);
} }
//gl.glDisable(GL_DEPTH_TEST); gl.glDisable(GL_DEPTH_TEST);
gl.glDrawArrays(GL_TRIANGLES, 0, vertexBufferData.length / 3); // Starting from vertex 0; 3 vertices total -> 1 triangle gl.glDrawArrays(GL_TRIANGLES, 0, vertexBufferData.length / 3); // Starting from vertex 0; 3 vertices total -> 1 triangle
@ -302,7 +302,7 @@ public class VolumeRender extends JOGLGraphicRender {
gl.glBindTexture(GL_TEXTURE_3D, 0); gl.glBindTexture(GL_TEXTURE_3D, 0);
//Program.destroyAllPrograms(gl); //Program.destroyAllPrograms(gl);
gl.glUseProgram(0); gl.glUseProgram(0);
//gl.glEnable(GL_DEPTH_TEST); gl.glEnable(GL_DEPTH_TEST);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile"> <MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh"> <Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\slice"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\slice"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
@ -16,19 +14,19 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\calipso"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\calipso"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
</Path> </Path>
<File> <File>
<OpenedFiles> <OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface\isosurface_2.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface\isosurface_2.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_1.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_boundary_zoom.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\mesh_1.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_2.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\wireframe_color.py"/>
</OpenedFiles> </OpenedFiles>
<RecentFiles> <RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface\isosurface_2.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface\isosurface_2.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_1.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_boundary_zoom.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\mesh_1.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_2.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\wireframe_color.py"/>
</RecentFiles> </RecentFiles>
</File> </File>
<Font> <Font>
@ -36,5 +34,5 @@
</Font> </Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/> <LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/> <Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,0" MainFormSize="1374,812"/> <Startup MainFormLocation="-7,0" MainFormSize="1380,844"/>
</MeteoInfo> </MeteoInfo>

View File

@ -100,6 +100,9 @@ class Axes3DGL(Axes3D):
clip_plane = kwargs.pop('clip_plane', None) clip_plane = kwargs.pop('clip_plane', None)
if not clip_plane is None: if not clip_plane is None:
self.axes.setClipPlane(clip_plane) self.axes.setClipPlane(clip_plane)
axes_zoom = kwargs.pop('axes_zoom', None)
if not axes_zoom is None:
self.axes.setAxesZoom(axes_zoom)
aspect = kwargs.pop('aspect', None) aspect = kwargs.pop('aspect', None)
if not aspect is None: if not aspect is None:
self.axes.setAspectType(AspectType.valueOf(aspect.upper())) self.axes.setAspectType(AspectType.valueOf(aspect.upper()))