mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update surf plot function
This commit is contained in:
parent
77660473f9
commit
f50beb48ea
@ -8033,16 +8033,31 @@ public class GraphicFactory {
|
||||
float[] vertexColor = new float[rowNum * colNum * 4];
|
||||
Color color;
|
||||
Index index = va.getIndex();
|
||||
for (int i = 0; i < rowNum; i++) {
|
||||
for (int j = 0; j < colNum; j++) {
|
||||
idx = i * colNum + j;
|
||||
vertexPosition[idx * 3] = xa.getFloat(idx);
|
||||
vertexPosition[idx * 3 + 1] = ya.getFloat(idx);
|
||||
vertexPosition[idx * 3 + 2] = za.getFloat(idx);
|
||||
index.set0(i);
|
||||
index.set1(j);
|
||||
color = new Color(va.getInt(index.set2(0)), va.getInt(index.set2(1)), va.getInt(index.set2(2)));
|
||||
System.arraycopy(color.getRGBComponents(null), 0, vertexColor, idx * 4, 4);
|
||||
if (va.getDataType() == DataType.INT) {
|
||||
for (int i = 0; i < rowNum; i++) {
|
||||
for (int j = 0; j < colNum; j++) {
|
||||
idx = i * colNum + j;
|
||||
vertexPosition[idx * 3] = xa.getFloat(idx);
|
||||
vertexPosition[idx * 3 + 1] = ya.getFloat(idx);
|
||||
vertexPosition[idx * 3 + 2] = za.getFloat(idx);
|
||||
index.set0(i);
|
||||
index.set1(j);
|
||||
color = new Color(va.getInt(index.set2(0)), va.getInt(index.set2(1)), va.getInt(index.set2(2)));
|
||||
System.arraycopy(color.getRGBComponents(null), 0, vertexColor, idx * 4, 4);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < rowNum; i++) {
|
||||
for (int j = 0; j < colNum; j++) {
|
||||
idx = i * colNum + j;
|
||||
vertexPosition[idx * 3] = xa.getFloat(idx);
|
||||
vertexPosition[idx * 3 + 1] = ya.getFloat(idx);
|
||||
vertexPosition[idx * 3 + 2] = za.getFloat(idx);
|
||||
index.set0(i);
|
||||
index.set1(j);
|
||||
color = new Color(va.getFloat(index.set2(0)), va.getFloat(index.set2(1)), va.getFloat(index.set2(2)));
|
||||
System.arraycopy(color.getRGBComponents(null), 0, vertexColor, idx * 4, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
surfaceGraphic.setVertexPosition(vertexPosition, rowNum);
|
||||
|
||||
@ -1433,7 +1433,7 @@ public class GLPlot extends Plot {
|
||||
yMax = this.transform.transform_y((float) axesExtent.maxY);
|
||||
zMin = this.transform.transform_z((float) axesExtent.minZ);*/
|
||||
|
||||
float[] rgba = this.boxColor.getRGBComponents(null);
|
||||
float[] rgba = this.gridLine.getColor().getRGBComponents(null);
|
||||
gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
|
||||
gl.glBegin(GL2.GL_LINE_STRIP);
|
||||
@ -1590,14 +1590,8 @@ public class GLPlot extends Plot {
|
||||
yMax = (float) axesExtent.maxY;
|
||||
zMin = (float) axesExtent.minZ;
|
||||
zMax = (float) axesExtent.maxZ;
|
||||
/*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);
|
||||
zMax = this.transform.transform_z((float) axesExtent.maxZ);*/
|
||||
|
||||
float[] rgba = this.boxColor.getRGBComponents(null);
|
||||
float[] rgba = this.gridLine.getColor().getRGBComponents(null);
|
||||
gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
|
||||
if (this.angleY >= 180 && this.angleY < 360) {
|
||||
@ -1644,14 +1638,8 @@ public class GLPlot extends Plot {
|
||||
yMax = (float) axesExtent.maxY;
|
||||
zMin = (float) axesExtent.minZ;
|
||||
zMax = (float) axesExtent.maxZ;
|
||||
/*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);
|
||||
zMax = this.transform.transform_z((float) axesExtent.maxZ);*/
|
||||
|
||||
float[] rgba = this.boxColor.getRGBComponents(null);
|
||||
float[] rgba = this.gridLine.getColor().getRGBComponents(null);
|
||||
gl.glColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
gl.glLineWidth(this.gridLine.getSize() * this.dpiScale);
|
||||
if (this.angleY >= 180 && this.angleY < 360) {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
package org.meteoinfo.chart.plot;
|
||||
|
||||
import org.meteoinfo.common.colors.ColorUtil;
|
||||
import org.meteoinfo.geometry.legend.LineStyles;
|
||||
import org.meteoinfo.geometry.legend.PolylineBreak;
|
||||
|
||||
@ -36,7 +37,7 @@ public class GridLine {
|
||||
*/
|
||||
public GridLine(boolean visible) {
|
||||
this.lineBreak = new PolylineBreak();
|
||||
this.lineBreak.setColor(Color.LIGHT_GRAY);
|
||||
this.lineBreak.setColor(new Color(0.15f, 0.15f, 0.15f, 0.15f));
|
||||
this.lineBreak.setStyle(LineStyles.DASH);
|
||||
this.top = false;
|
||||
this.drawXLine = visible;
|
||||
@ -58,8 +59,36 @@ public class GridLine {
|
||||
* @param value Color
|
||||
*/
|
||||
public void setColor(Color value){
|
||||
int alpha = this.getColor().getAlpha();
|
||||
Color color = ColorUtil.getColor(value, alpha);
|
||||
this.lineBreak.setColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set color
|
||||
* @param value Color
|
||||
*/
|
||||
public void setColorAndAlpha(Color value){
|
||||
this.lineBreak.setColor(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set alpha
|
||||
* @param value Alpha
|
||||
*/
|
||||
public void setAlpha(int value) {
|
||||
Color color = ColorUtil.getColor(this.getColor(), value);
|
||||
this.lineBreak.setColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set alpha
|
||||
* @param value Alpha
|
||||
*/
|
||||
public void setAlpha(float value) {
|
||||
Color color = ColorUtil.getColor(this.getColor(), value);
|
||||
this.lineBreak.setColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get size
|
||||
|
||||
@ -70,6 +70,27 @@ public class ColorUtil {
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Get Set Methods">
|
||||
|
||||
/**
|
||||
* Get new color from existing color and alpha
|
||||
* @param color Existing color
|
||||
* @param alpha Alpha
|
||||
* @return
|
||||
*/
|
||||
public static Color getColor(Color color, int alpha) {
|
||||
return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get new color from existing color and alpha
|
||||
* @param color Existing color
|
||||
* @param alpha Alpha
|
||||
* @return
|
||||
*/
|
||||
public static Color getColor(Color color, float alpha) {
|
||||
float[] rgba = color.getRGBColorComponents(null);
|
||||
return new Color(rgba[0], rgba[1], rgba[2], alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get common color
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\map">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\FY"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\funny"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\awx"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grib"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\fill"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\dataconvert"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\_reload.py"/>
|
||||
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surfc_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\meshc_peaks.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_color_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_alpha_1.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\_reload.py"/>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surfc_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\meshc_peaks.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_color_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_alpha_1.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -36,5 +38,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1383,767"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1419,836"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Binary file not shown.
@ -606,7 +606,7 @@ class Axes3D(Axes):
|
||||
axis.setTickLabelColor(ticklabelcolor)
|
||||
axis.setTickLabelFont(font)
|
||||
|
||||
def grid(self, b, **kwargs):
|
||||
def grid(self, b=None, **kwargs):
|
||||
"""
|
||||
Turn the axes grids on or off.
|
||||
|
||||
@ -615,23 +615,29 @@ class Axes3D(Axes):
|
||||
:param kwargs: *kwargs* are used to set the grid line properties.
|
||||
"""
|
||||
gridline = self._axes.getGridLine()
|
||||
if b is None:
|
||||
if b is None and len(kwargs) == 0:
|
||||
b = not gridline.isDrawZLine()
|
||||
|
||||
axis = kwargs.pop('axis', 'all')
|
||||
if axis == 'all':
|
||||
gridline.setDrawXLine(b)
|
||||
gridline.setDrawYLine(b)
|
||||
gridline.setDrawZLine(b)
|
||||
elif axis == 'x':
|
||||
gridline.setDrawXLine(b)
|
||||
elif axis == 'y':
|
||||
gridline.setDrawYLine(b)
|
||||
elif axis == 'z':
|
||||
gridline.setDrawZLine(b)
|
||||
if b is not None:
|
||||
if axis == 'all':
|
||||
gridline.setDrawXLine(b)
|
||||
gridline.setDrawYLine(b)
|
||||
gridline.setDrawZLine(b)
|
||||
elif axis == 'x':
|
||||
gridline.setDrawXLine(b)
|
||||
elif axis == 'y':
|
||||
gridline.setDrawYLine(b)
|
||||
elif axis == 'z':
|
||||
gridline.setDrawZLine(b)
|
||||
|
||||
color = kwargs.pop('color', None)
|
||||
if not color is None:
|
||||
c = plotutil.getcolor(color)
|
||||
gridline.setColor(c)
|
||||
alpha = kwargs.pop('alpha', None)
|
||||
if alpha is not None:
|
||||
gridline.setAlpha(float(alpha))
|
||||
linewidth = kwargs.pop('linewidth', None)
|
||||
if not linewidth is None:
|
||||
gridline.setSize(linewidth)
|
||||
|
||||
Binary file not shown.
@ -8,8 +8,7 @@
|
||||
|
||||
from org.meteoinfo.chart.graphic import GraphicFactory
|
||||
from org.meteoinfo.chart import AspectType
|
||||
from org.meteoinfo.geometry.legend import BreakTypes, BarBreak
|
||||
from org.meteoinfo.geo.legend import LegendManage
|
||||
from org.meteoinfo.geometry.legend import BreakTypes, BarBreak, LegendManage
|
||||
from org.meteoinfo.geo.layer import LayerTypes
|
||||
from org.meteoinfo.geometry.shape import ShapeTypes
|
||||
from org.meteoinfo.geometry.graphic import Graphic, GraphicCollection
|
||||
|
||||
Binary file not shown.
@ -210,7 +210,7 @@ def getcolormap(**kwargs):
|
||||
cs.append(c)
|
||||
cmap = ColorMap(cs)
|
||||
else:
|
||||
cmapstr = kwargs.pop('cmap', 'matlab_jet')
|
||||
cmapstr = kwargs.pop('cmap', 'parula')
|
||||
if len(cmapstr) > 2 and cmapstr[-2:] == '_r':
|
||||
cmapstr = cmapstr[:-2]
|
||||
reverse = True
|
||||
@ -843,7 +843,9 @@ def setlegendscheme_polygon(ls, **kwargs):
|
||||
edge = kwargs.pop('edge', edge)
|
||||
edgesize = kwargs.pop('edgesize', None)
|
||||
fill = kwargs.pop('fill', fill)
|
||||
alpha = kwargs.pop('alpha', None)
|
||||
alpha = kwargs.pop('facealpha', None)
|
||||
if alpha is None:
|
||||
alpha = kwargs.pop('alpha', None)
|
||||
hatch = kwargs.pop('hatch', None)
|
||||
hatch = gethatch(hatch)
|
||||
hatchsize = kwargs.pop('hatchsize', None)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user