bugfix for GLForm class

This commit is contained in:
wyq 2022-12-03 10:01:49 +08:00
parent b5fa6aa590
commit 80fcc693c5
7 changed files with 51 additions and 56 deletions

View File

@ -111,6 +111,15 @@ public class GLChartPanel extends GLJPanel implements IChartPanel{
* Constructor
*/
public GLChartPanel() {
this(new GLChart());
}
/**
* Constructor
*
* @param chart Chart
*/
public GLChartPanel(GLChart chart) {
super(createCapabilities(true, true, 4));
//this.setBackground(Color.white);
@ -191,18 +200,9 @@ public class GLChartPanel extends GLJPanel implements IChartPanel{
});
popupMenu.add(saveFigure);
this.chart = null;
this.mouseMode = MouseMode.DEFAULT;
//this.setMouseMode(mouseMode.ZOOM_IN);
}
/**
* Constructor
*
* @param chart Chart
*/
public GLChartPanel(GLChart chart) {
this();
this.chart = chart;
if (this.chart != null) {
this.chart.setParent(this);

View File

@ -7,6 +7,8 @@ package org.meteoinfo.chart.jogl;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
import org.meteoinfo.chart.GLChartPanel;
import org.meteoinfo.chart.MouseMode;
import javax.swing.*;
@ -15,18 +17,18 @@ import javax.swing.*;
* @author yaqiang
*/
public class GLForm extends JFrame{
private Plot3DGL plt;
private GLChartPanel glcp;
private GLPlot plt;
private GLChartPanel chartPanel;
public GLForm(Plot3DGL plt) {
public GLForm(GLPlot plt) {
this.plt = plt;
final GLProfile gp = GLProfile.get(GLProfile.GL2);
GLCapabilities cap = new GLCapabilities(gp);
glcp = new GLChartPanel(cap, plt);
glcp.setSize(400, 400);
chartPanel = new GLChartPanel();
chartPanel.setSize(400, 400);
chartPanel.setMouseMode(MouseMode.ROTATE);
chartPanel.getChart().addPlot(this.plt);
this.getContentPane().add(glcp);
this.getContentPane().add(chartPanel);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {

View File

@ -2424,12 +2424,6 @@ public class GLPlot extends Plot {
//Rendering text string
Font font = title.getFont();
this.updateTextRender(font);
if (this.dpiScale == 1) {
textRenderer = new TextRenderer(font, true, true);
} else {
textRenderer = new TextRenderer(new Font(font.getFontName(), font.getStyle(),
(int)(font.getSize() * this.dpiScale)), true, true);
}
textRenderer.beginRendering(this.width, this.height);
textRenderer.setColor(title.getColor());
textRenderer.setSmoothing(true);

View File

@ -1,34 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\meteo">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\wrf"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\toolbox"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW\airship"/>
<RecentFolder Folder="D:\Temp\test"/>
<RecentFolder Folder="D:\Temp\test\eof"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\linalg"/>
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\toolbox\miml\neural_network"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\toolbox\miml"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\toolbox\miml\classification"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\interpolation"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\FY"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW\airship"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\isosurface"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/>
</Path>
<File>
<OpenedFiles>
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\LaSW\airship\typhoon_streamplot3.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\eof_elnino.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\anomalies.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar\bar_3.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\plot3_pipe_color_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\LaSW\airship\typhoon_streamplot3.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\eof_elnino.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\anomalies.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar\bar_3.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\plot3_pipe_color_1.py"/>
</RecentFiles>
</File>
<Font>
@ -36,5 +34,5 @@
</Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,0" MainFormSize="1370,772"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
</MeteoInfo>

View File

@ -628,7 +628,8 @@ class Axes3D(Axes):
#Set plot data styles
label = kwargs.pop('label', 'S_1')
mvalues = kwargs.pop('mvalues', None)
if mvalues is None:
cdata = kwargs.pop('cdata', mvalues)
if cdata is None:
if style is None:
line = plotutil.getlegendbreak('line', **kwargs)[0]
line.setCaption(label)
@ -645,30 +646,30 @@ class Axes3D(Axes):
else:
ls = kwargs.pop('symbolspec', None)
if ls is None:
if isinstance(mvalues, (list, tuple)):
mvalues = np.array(mvalues)
if isinstance(cdata, (list, tuple)):
cdata = np.array(cdata)
levels = kwargs.pop('levs', None)
if levels is None:
levels = kwargs.pop('levels', None)
if levels is None:
cnum = kwargs.pop('cnum', None)
if cnum is None:
ls = plotutil.getlegendscheme([], mvalues.min(), mvalues.max(), **kwargs)
ls = plotutil.getlegendscheme([], cdata.min(), cdata.max(), **kwargs)
else:
ls = plotutil.getlegendscheme([cnum], mvalues.min(), mvalues.max(), **kwargs)
ls = plotutil.getlegendscheme([cnum], cdata.min(), cdata.max(), **kwargs)
else:
ls = plotutil.getlegendscheme([levels], mvalues.min(), mvalues.max(), **kwargs)
ls = plotutil.getlegendscheme([levels], cdata.min(), cdata.max(), **kwargs)
ls = plotutil.setlegendscheme_line(ls, **kwargs)
#Add graphics
if mvalues is None:
if cdata is None:
if colors is None:
graphics = GraphicFactory.createLineString3D(xdata, ydata, zdata, line)
else:
graphics = GraphicFactory.createLineString3D(xdata, ydata, zdata, cbs)
else:
mdata = plotutil.getplotdata(mvalues)
graphics = GraphicFactory.createLineString3D(xdata, ydata, zdata, mdata, ls)
cdata = plotutil.getplotdata(cdata)
graphics = GraphicFactory.createLineString3D(xdata, ydata, zdata, cdata, ls)
#Pipe
pipe = kwargs.pop('pipe', False)

View File

@ -2,13 +2,13 @@
<MeteoInfo File="default.mip" Type="projectfile">
<MapFrames>
<MapFrame Active="true" DrawGridLabel="true" DrawGridLine="false" DrawNeatLine="true" Expanded="true" GridFontName="Arial" GridFontSize="12" GridLineColor="0xff808080" GridLineSize="1.0" GridLineStyle="DASH" GridXDelt="10.0" GridXOrigin="-180.0" GridYDelt="10.0" GridYOrigin="-90.0" Height="364" Left="48" Name="New Map Frame" NeatLineColor="0xff000000" NeatLineSize="1.0" Order="0" Top="30" Width="776">
<Extents xMax="56.10991640761918" xMin="22.609371765495784" yMax="42.84901721616686" yMin="25.730607041895013"/>
<Extents xMax="180.0" xMin="-180.0" yMax="83.62359619140625" yMin="-90.0"/>
<MapProperty BackColor="0xffffffff" ForeColor="0xff000000" HighSpeedWheelZoom="true" MultiGlobalDraw="true" PointSmoothingMode="true" SelectColor="0xff66ffff" SmoothingMode="false" XYScaleFactor="1.0"/>
<GridLine DrawGridLine="false" DrawGridTickLine="false" GridLineColor="0xff808080" GridLineSize="1.0" GridLineStyle="DASH"/>
<MaskOut MaskLayer="china.shp" SetMaskLayer="false"/>
<Projection IsLonLatMap="true" ProjStr="+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees "/>
<GroupLayer>
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\Distribution\Java\MeteoInfo\MeteoInfo\map\cn_province.shp" Handle="2" IsMaskout="false" LayerDrawType="MAP" LayerName="cn_province.shp" LayerType="VECTOR_LAYER" ShapeType="POLYGON_Z" TransparencyPerc="0" Visible="true">
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\Distribution\Java\MeteoInfo\MeteoInfo\map\cn_province.shp" Handle="1" IsMaskout="false" LayerDrawType="MAP" LayerName="cn_province.shp" LayerType="VECTOR_LAYER" ShapeType="POLYGON_Z" TransparencyPerc="0" Visible="true">
<LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYGON_Z" UNDEF="-9999.0">
<Breaks>
<Break BackColor="0x00ffffff" Caption="" Color="0xfffffbc3" DrawFill="false" DrawOutline="true" DrawShape="true" EndValue="0" OutlineColor="0xff808080" OutlineSize="1.0" StartValue="0" Style="NONE" StyleSize="8" Tag=""/>
@ -24,7 +24,7 @@
<ChartGraphics/>
<VisibleScale EnableMaxVisScale="false" EnableMinVisScale="false" MaxVisScale="0.0" MinVisScale="0.0"/>
</Layer>
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\..\Temp\Map\country1.shp" Handle="3" IsMaskout="false" LayerDrawType="MAP" LayerName="country1.shp" LayerType="VECTOR_LAYER" ShapeType="POLYGON" TransparencyPerc="0" Visible="true">
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\..\Temp\Map\country1.shp" Handle="2" IsMaskout="false" LayerDrawType="MAP" LayerName="country1.shp" LayerType="VECTOR_LAYER" ShapeType="POLYGON" TransparencyPerc="0" Visible="true">
<LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYGON" UNDEF="-9999.0">
<Breaks>
<Break BackColor="0x00ffffff" Caption="" Color="0xfffffbc3" DrawFill="false" DrawOutline="true" DrawShape="true" EndValue="0" OutlineColor="0xff000000" OutlineSize="1.0" StartValue="0" Style="NONE" StyleSize="8" Tag=""/>
@ -41,8 +41,8 @@
<VisibleScale EnableMaxVisScale="false" EnableMinVisScale="false" MaxVisScale="0.0" MinVisScale="0.0"/>
</Layer>
<Group Expanded="true" GroupHandle="1" GroupName="Trajectory">
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\..\Temp\traj\test\201901mainversion.shp" Handle="4" IsMaskout="false" LayerDrawType="TRAJECTORY_LINE" LayerName="201901mainversion.shp" LayerType="VECTOR_LAYER" ShapeType="POLYLINE_Z" TransparencyPerc="0" Visible="true">
<LegendScheme BreakNum="1" FieldName="Year" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYLINE" UNDEF="-9999.0">
<Layer AvoidCollision="false" Expanded="false" FileName="..\..\..\..\..\Temp\traj\test\201901mainversion.shp" Handle="3" IsMaskout="false" LayerDrawType="TRAJECTORY_LINE" LayerName="201901mainversion.shp" LayerType="VECTOR_LAYER" ShapeType="POLYLINE_Z" TransparencyPerc="0" Visible="true">
<LegendScheme BreakNum="1" FieldName="Year" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYLINE_Z" UNDEF="-9999.0">
<Breaks>
<Break Caption="" Color="0xffff33cc" DrawShape="true" DrawSymbol="false" EndValue="0" FillSymbol="false" Size="1.0" StartValue="0" Style="SOLID" SymbolColor="0xff000000" SymbolFillColor="0xff000000" SymbolInterval="1" SymbolSize="8.0" SymbolStyle="UP_TRIANGLE" Tag=""/>
</Breaks>