mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
bugfix for QuiverRender drawing function
This commit is contained in:
parent
5627ec2a36
commit
ddc187b92e
@ -467,6 +467,7 @@ public class GraphicFactory {
|
||||
fixZ = true;
|
||||
z = zdata.getDouble(0);
|
||||
}
|
||||
System.out.println(cb.getColor().getAlpha());
|
||||
if (xdata.getRank() == 1) {
|
||||
while (xIter.hasNext()) {
|
||||
x = xIter.getDoubleNext();
|
||||
@ -685,7 +686,6 @@ public class GraphicFactory {
|
||||
}
|
||||
m = mIter.getDoubleNext();
|
||||
cb = ls.findLegendBreak(m);
|
||||
System.out.println(cb.getColor().getAlpha());
|
||||
if (Double.isNaN(y) || Double.isNaN(x)) {
|
||||
if (points.isEmpty()) {
|
||||
continue;
|
||||
|
||||
@ -192,8 +192,10 @@ public class LineRender extends JOGLGraphicRender {
|
||||
if (i % interval == 0) {
|
||||
PointZ p2 = ps.get(i);
|
||||
PointZ p1 = ps.get(i - 1);
|
||||
v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
//v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
//v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
v1 = new Vector3f((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = new Vector3f((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
slb = (StreamlineBreak) cbc.get(i);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
@ -231,8 +233,10 @@ public class LineRender extends JOGLGraphicRender {
|
||||
if (i % interval == 0) {
|
||||
PointZ p2 = ps.get(i);
|
||||
PointZ p1 = ps.get(i - 1);
|
||||
v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
//v1 = transform.transform((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
//v2 = transform.transform((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
v1 = new Vector3f((float) p1.X, (float) p1.Y, (float) p1.Z);
|
||||
v2 = new Vector3f((float) p2.X, (float) p2.Y, (float) p2.Z);
|
||||
if (cylinder == null) {
|
||||
cylinder = new Cylinder(slb.getArrowHeadWidth() * 0.02f,
|
||||
0, slb.getArrowHeadLength() * 0.02f, 8, 1, true);
|
||||
@ -318,7 +322,8 @@ public class LineRender extends JOGLGraphicRender {
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if (this.streamline) {
|
||||
this.updateConeVertex();
|
||||
if (this.coneVertexPosition == null)
|
||||
this.updateConeVertex();
|
||||
|
||||
FloatBuffer coneVertexBuffer = GLBuffers.newDirectFloatBuffer(coneVertexPosition);
|
||||
sizeConePosition = coneVertexBuffer.capacity() * Float.BYTES;
|
||||
@ -340,7 +345,7 @@ public class LineRender extends JOGLGraphicRender {
|
||||
|
||||
IntBuffer coneIndexBuffer = GLBuffers.newDirectIntBuffer(coneVertexIndices);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, vboCone.get(1));
|
||||
gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, coneIndexBuffer.capacity() * Integer.BYTES,
|
||||
gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, (long) coneIndexBuffer.capacity() * Integer.BYTES,
|
||||
coneIndexBuffer, GL.GL_STATIC_DRAW);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@ -387,9 +392,9 @@ public class LineRender extends JOGLGraphicRender {
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if (this.streamline) {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
//gl.glPushMatrix();
|
||||
//FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
//gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboCone.get(0));
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, vboCone.get(1));
|
||||
@ -411,7 +416,7 @@ public class LineRender extends JOGLGraphicRender {
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
gl.glPopMatrix();
|
||||
//gl.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
this.quiverNumber = graphics.getNumGraphics();
|
||||
PointBreak pb = (PointBreak) graphics.getGraphicN(0).getLegend();
|
||||
this.lineWidth = pb.getOutlineSize();
|
||||
updateVertexArrays();
|
||||
}
|
||||
|
||||
private void updateVertexArrays() {
|
||||
@ -90,8 +91,8 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
PointZ sp = (PointZ) shape.getPoint();
|
||||
PointZ ep = (PointZ) shape.getEndPoint();
|
||||
|
||||
Vector3f v1 = transform.transform((float) sp.X, (float) sp.Y, (float) sp.Z);
|
||||
Vector3f v2 = transform.transform((float) ep.X, (float) ep.Y, (float) ep.Z);
|
||||
Vector3f v1 = new Vector3f((float) sp.X, (float) sp.Y, (float) sp.Z);
|
||||
Vector3f v2 = new Vector3f((float) ep.X, (float) ep.Y, (float) ep.Z);
|
||||
float[] color = pb.getColor().getRGBComponents(null);
|
||||
vertexPosition[pi] = v1.x;
|
||||
vertexPosition[pi + 1] = v1.y;
|
||||
@ -171,8 +172,6 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
super.setTransform((Transform) transform.clone());
|
||||
|
||||
if (updateBuffer) {
|
||||
this.updateVertexArrays();
|
||||
|
||||
FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexPosition);
|
||||
sizePosition = vertexBuffer.capacity() * Float.BYTES;
|
||||
|
||||
@ -220,11 +219,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
gl.glPushMatrix();
|
||||
FloatBuffer fb = Buffers.newDirectFloatBuffer(16);
|
||||
gl.glLoadMatrixf(this.modelViewMatrixR.get(fb));
|
||||
|
||||
if (useShader) { // not working now
|
||||
if (useShader) { // not working now
|
||||
program.use(gl);
|
||||
setUniforms();
|
||||
|
||||
@ -243,7 +238,7 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
this.lighting.stop(gl);
|
||||
}
|
||||
gl.glLineWidth(this.lineWidth * this.dpiScale);
|
||||
gl.glDrawArrays(GL.GL_LINES, 0, quiverNumber);
|
||||
gl.glDrawArrays(GL.GL_LINES, 0, quiverNumber * 2);
|
||||
if (lightEnabled) {
|
||||
this.lighting.start(gl);
|
||||
}
|
||||
@ -274,7 +269,5 @@ public class QuiverRender extends JOGLGraphicRender {
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
gl.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1168,6 +1168,9 @@ public class MIMath {
|
||||
if (max == 0) {
|
||||
maxE = minE + 2;
|
||||
}
|
||||
if (maxE == minE) {
|
||||
maxE = minE + 1;
|
||||
}
|
||||
|
||||
List<Double> values = new ArrayList<>();
|
||||
double v;
|
||||
@ -1175,7 +1178,7 @@ public class MIMath {
|
||||
v = Math.pow(10, i);
|
||||
if (v < min) {
|
||||
continue;
|
||||
} else if (v > max) {
|
||||
} else if (v > max && values.size() > 1) {
|
||||
break;
|
||||
} else {
|
||||
values.add(v);
|
||||
|
||||
@ -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.7.3";
|
||||
version = "3.7.4";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\traj">
|
||||
<RecentFolder Folder="D:\Temp\test\test"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\geoshow"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamslice"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\text"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\model"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\scatter"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\scatter"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\topology"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\interpolate"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\axis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\no_opengl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_cma_base_grid_3d.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\plot3_multi_color_alpha.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver\quiver3_2.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_cma_base_grid_3d.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\plot3_multi_color_alpha.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver\quiver3_2.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
@ -370,6 +370,9 @@ def getplotstyle(style, caption, **kwargs):
|
||||
c, style = getcolor_style(style)
|
||||
if kwargs.has_key('color'):
|
||||
c = getcolor(kwargs.pop('color'))
|
||||
alpha = kwargs.pop('alpha', None)
|
||||
if alpha is not None:
|
||||
c = getcolor(c, alpha)
|
||||
lineStyle, style = getlinestyle_1(style)
|
||||
pointStyle = getpointstyle(style)
|
||||
if not pointStyle is None:
|
||||
|
||||
@ -86,7 +86,7 @@ public class RectLinearInterpolator extends RectInterpolator{
|
||||
|
||||
double interpolate(double x, double y) {
|
||||
List<Array> points = Arrays.asList(this.ya, this.xa);
|
||||
Array xi = Array.factory(DataType.DOUBLE, new int[]{3});
|
||||
Array xi = Array.factory(DataType.DOUBLE, new int[]{2});
|
||||
xi.setDouble(0, y);
|
||||
xi.setDouble(1, x);
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -34,7 +34,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<revision>3.7.3</revision>
|
||||
<revision>3.7.4</revision>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user