diff --git a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/GLPlot.java b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/GLPlot.java index d722dca2..6509618e 100644 --- a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/GLPlot.java +++ b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/GLPlot.java @@ -117,6 +117,7 @@ public class GLPlot extends Plot { protected float dpiScale; //DPI scale factor protected boolean orthographic; protected float distance; + protected float fieldOfView; protected GLAutoDrawable drawable; protected Map renderMap = new HashMap<>(); @@ -151,6 +152,7 @@ public class GLPlot extends Plot { this.dpiScale = 1; this.orthographic = true; this.distance = 5.f; + this.fieldOfView = 45.f; this.initAngles(); this.graphicExtent = new Extent3D(); Extent3D extent3D = new Extent3D(-1, 1, -1, 1, -1, 1); @@ -1016,6 +1018,22 @@ public class GLPlot extends Plot { this.distance = value; } + /** + * Get field of view angle for perspective projection + * @return Field of view angle in degrees + */ + public float getFieldOfView() { + return this.fieldOfView; + } + + /** + * Set field of view angle for perspective projection + * @param value Field of view angle in degrees + */ + public void setFieldOfView(float value) { + this.fieldOfView = value; + } + // // /** @@ -4426,13 +4444,14 @@ public class GLPlot extends Plot { float far = 1000.0f; switch (this.aspectType) { case EQUAL: - glu.gluPerspective(45.0f, h, near, far); + glu.gluPerspective(fieldOfView, h, near, far); break; default: - glu.gluPerspective(45.0f, 1.0f, near, far); + glu.gluPerspective(fieldOfView, 1.0f, near, far); break; } - glu.gluLookAt(0.0f, 0.0f, distance, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); + float z = distance * 45.f / fieldOfView; + glu.gluLookAt(0.0f, 0.0f, z, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); } gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); diff --git a/meteoinfo-common/src/main/java/org/meteoinfo/common/util/GlobalUtil.java b/meteoinfo-common/src/main/java/org/meteoinfo/common/util/GlobalUtil.java index a684a15f..43031850 100644 --- a/meteoinfo-common/src/main/java/org/meteoinfo/common/util/GlobalUtil.java +++ b/meteoinfo-common/src/main/java/org/meteoinfo/common/util/GlobalUtil.java @@ -67,7 +67,7 @@ import java.util.zip.ZipInputStream; public static String getVersion(){ String version = GlobalUtil.class.getPackage().getImplementationVersion(); if (version == null || version.equals("")) { - version = "3.5.12"; + version = "3.6.0-beta1"; } return version; } diff --git a/meteoinfo-lab/milconfig.xml b/meteoinfo-lab/milconfig.xml index 44aba2f3..37277d0b 100644 --- a/meteoinfo-lab/milconfig.xml +++ b/meteoinfo-lab/milconfig.xml @@ -1,9 +1,6 @@ - - - - + @@ -16,19 +13,20 @@ + + + - - + - - + diff --git a/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl$py.class b/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl$py.class index 9bee0bf3..48b75b4c 100644 Binary files a/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl$py.class and b/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl$py.class differ diff --git a/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl.py b/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl.py index a688e858..bb719bda 100644 --- a/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl.py +++ b/meteoinfo-lab/pylib/mipylib/plotlib/_axes3dgl.py @@ -265,6 +265,25 @@ class Axes3DGL(Axes3D): """ self._axes.setDistance(dis) + def get_fov(self): + """ + Get field of view angles in degrees for perspective projection. + + :return: (*float*) Field of view angles in degrees. + """ + return self._axes.getFieldOfView() + + def set_fov(self, fov): + """ + Set field of view angles in degrees for perspective projection. + + :param fov: (*float*) Field of view angles in degrees. + """ + if fov <= 0 or fov >= 180: + warnings.warn('Field of view angles should be in the range of (0, 180)') + else: + self._axes.setFieldOfView(fov) + def set_lighting(self, enable=True, **kwargs): """ Set lighting.