mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update shape read function for optional measure data of PolylineZShape
This commit is contained in:
parent
62ff9c0fb9
commit
81c824ebf3
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -1726,6 +1726,68 @@ public class GraphicFactory {
|
||||
return graphics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create 3D polygons
|
||||
*
|
||||
* @param xa X coordinate array
|
||||
* @param ya Y coordinate array
|
||||
* @param za Z coordinate array
|
||||
* @param pgbs PolygonBreak list
|
||||
* @return Graphics
|
||||
*/
|
||||
public static GraphicCollection3D createPolygons3D(Array xa, Array ya, Array za, List<PolygonBreak> pgbs) {
|
||||
xa = xa.copyIfView();
|
||||
ya = ya.copyIfView();
|
||||
za = za.copyIfView();
|
||||
|
||||
GraphicCollection3D graphics = new GraphicCollection3D();
|
||||
double x, y, z;
|
||||
int n = (int) xa.getSize();
|
||||
PolygonZShape pgs;
|
||||
PointZ p;
|
||||
List<PointZ> points = new ArrayList<>();
|
||||
if (xa.getRank() == 1) {
|
||||
IndexIterator xIter = xa.getIndexIterator();
|
||||
IndexIterator yIter = ya.getIndexIterator();
|
||||
IndexIterator zIter = za.getIndexIterator();
|
||||
int ii = 0;
|
||||
while (xIter.hasNext()) {
|
||||
x = xIter.getDoubleNext();
|
||||
y = yIter.getDoubleNext();
|
||||
z = zIter.getDoubleNext();
|
||||
points.add(new PointZ(x, y, z));
|
||||
}
|
||||
if (points.size() > 2) {
|
||||
points.add((PointZ) points.get(0).clone());
|
||||
pgs = new PolygonZShape();
|
||||
pgs.setPoints(points);
|
||||
Graphic aGraphic = new Graphic(pgs, pgbs.get(ii));
|
||||
graphics.add(aGraphic);
|
||||
ii++;
|
||||
}
|
||||
} else {
|
||||
int[] shape = xa.getShape();
|
||||
int nRow = shape[0];
|
||||
int nCol = shape[1];
|
||||
int idx;
|
||||
for (int i = 0; i < nCol; i++) {
|
||||
points = new ArrayList<>();
|
||||
for (int j = 0; j < nRow; j++) {
|
||||
idx = j * nCol + i;
|
||||
x = xa.getDouble(idx);
|
||||
y = ya.getDouble(idx);
|
||||
z = za.getDouble(idx);
|
||||
points.add(new PointZ(x, y, z));
|
||||
}
|
||||
points.add((PointZ) points.get(0).clone());
|
||||
pgs = new PolygonZShape();
|
||||
pgs.setPoints(points);
|
||||
graphics.add(new Graphic(pgs, pgbs.get(i)));
|
||||
}
|
||||
}
|
||||
return graphics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add wireframe polylines
|
||||
*
|
||||
|
||||
@ -2162,18 +2162,19 @@ public class GLPlot extends Plot {
|
||||
skip = getLabelGap(this.zAxis.getTickLabelFont(), tlabs, axisLen);
|
||||
float x1 = x;
|
||||
float y1 = y;
|
||||
float tickLen = this.zAxis.getTickLength() * this.lenScale * transform.getYLength() / 2;
|
||||
float yTickLen = this.zAxis.getTickLength() * this.lenScale * transform.getYLength() / 2;
|
||||
float xTickLen = this.zAxis.getTickLength() * this.lenScale * transform.getXLength() / 2;
|
||||
if (x < center.x) {
|
||||
if (y > center.y) {
|
||||
y1 += tickLen;
|
||||
y1 += yTickLen;
|
||||
} else {
|
||||
x1 -= tickLen;
|
||||
x1 -= xTickLen;
|
||||
}
|
||||
} else {
|
||||
if (y > center.y) {
|
||||
x1 += tickLen;
|
||||
x1 += xTickLen;
|
||||
} else {
|
||||
y1 -= tickLen;
|
||||
y1 -= yTickLen;
|
||||
}
|
||||
}
|
||||
xAlign = XAlign.RIGHT;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -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.6.0-beta1";
|
||||
version = "3.6.0";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ package org.meteoinfo.geo.mapdata;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@ -106,7 +107,7 @@ public class ShapeFileManage {
|
||||
loadShxFile(shxFile);
|
||||
|
||||
//Open shp file
|
||||
DataInputStream br = new DataInputStream(new BufferedInputStream(new FileInputStream(shpFile)));
|
||||
DataInputStream br = new DataInputStream(new BufferedInputStream(Files.newInputStream(shpFile.toPath())));
|
||||
VectorLayer aLayer;
|
||||
//byte[] arr = new byte[(int)shpFile.length()];
|
||||
byte[] arr = new byte[100];
|
||||
@ -394,12 +395,14 @@ public class ShapeFileManage {
|
||||
}
|
||||
|
||||
//Read measure
|
||||
double[] mArray = new double[numPoints];
|
||||
if (buffer.position() < buffer.capacity()) {
|
||||
double mmin = buffer.getDouble();
|
||||
double mmax = buffer.getDouble();
|
||||
double[] mArray = new double[numPoints];
|
||||
for (int j = 0; j < numPoints; j++) {
|
||||
mArray[j] = buffer.getDouble();
|
||||
}
|
||||
}
|
||||
|
||||
//Get pointZ list
|
||||
List<PointZ> pointZs = new ArrayList<>();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -1,36 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\patch"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\map">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\FY"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<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\plot_types\contour"/>
|
||||
<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\surf"/>
|
||||
<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"/>
|
||||
<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"/>
|
||||
</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\mesh_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\meshc_peaks.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\test_shaperead-2.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\mesh_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\mesh\meshc_peaks.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\map\test_shaperead-2.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -38,5 +38,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1429,860"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
</MeteoInfo>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<artifactId>meteoinfo-lab</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
Binary file not shown.
@ -368,14 +368,26 @@ class Axes3DGL(Axes3D):
|
||||
|
||||
:return: Filled 3D patches.
|
||||
"""
|
||||
if color is not None:
|
||||
kwargs['facecolor'] = color
|
||||
lbreak, isunique = plotutil.getlegendbreak('polygon', **kwargs)
|
||||
|
||||
x = plotutil.getplotdata(x)
|
||||
y = plotutil.getplotdata(y)
|
||||
z = plotutil.getplotdata(z)
|
||||
graphics = GraphicFactory.createPolygons3D(x, y, z, lbreak)
|
||||
|
||||
lb, isunique = plotutil.getlegendbreak('polygon', **kwargs)
|
||||
if color is None:
|
||||
graphics = GraphicFactory.createPolygons3D(x, y, z, lb)
|
||||
else:
|
||||
alpha = kwargs.pop('alpha', None)
|
||||
colors = plotutil.getcolors(color, alpha)
|
||||
if len(colors) == 1:
|
||||
lb.setColor(colors[0])
|
||||
graphics = GraphicFactory.createPolygons3D(x, y, z, lb)
|
||||
else:
|
||||
lbs = []
|
||||
for c in colors:
|
||||
nlb = lb.clone()
|
||||
nlb.setColor(c)
|
||||
lbs.append(nlb)
|
||||
graphics = GraphicFactory.createPolygons3D(x, y, z, lbs)
|
||||
|
||||
self.add_graphic(graphics)
|
||||
return graphics
|
||||
|
||||
Binary file not shown.
@ -478,6 +478,10 @@ class GLFigure(GLChartPanel):
|
||||
self.axes.append(ax)
|
||||
self.getChart().addPlot(ax._axes)
|
||||
self.getChart().setCurrentPlot(self.getChart().getPlots().size())
|
||||
if isinstance(ax, Axes3DGL):
|
||||
self.set_mousemode("rotate")
|
||||
else:
|
||||
self.set_mousemode("pan")
|
||||
|
||||
def remove_axes(self, ax=None):
|
||||
"""
|
||||
|
||||
Binary file not shown.
@ -1162,9 +1162,9 @@ def clf():
|
||||
if g_figure is None:
|
||||
return
|
||||
|
||||
if isinstance(g_figure, GLFigure):
|
||||
delfig()
|
||||
return
|
||||
# if isinstance(g_figure, GLFigure):
|
||||
# delfig()
|
||||
# return
|
||||
|
||||
if g_figure.getChart() is None:
|
||||
return
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="config.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Temp\nc"/>
|
||||
<Path OpenPath="D:\Temp\test"/>
|
||||
<Font>
|
||||
<TextFont FontName="YaHei Consolas Hybrid" FontSize="14"/>
|
||||
<LegendFont FontName="宋体" FontSize="12"/>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<artifactId>meteoinfo-map</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>MeteoInfo</artifactId>
|
||||
<groupId>org.meteothink</groupId>
|
||||
<version>3.6-SNAPSHOT</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user