diff --git a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapGridLine3D.java b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapGridLine3D.java index ad12d1a3..0b531c16 100644 --- a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapGridLine3D.java +++ b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapGridLine3D.java @@ -21,6 +21,7 @@ public class MapGridLine3D extends MapGridLine { */ public MapGridLine3D() { super(); + this.extent = new Extent3D(-100, 100, -100, 100, 0, 100); } /** @@ -28,7 +29,7 @@ public class MapGridLine3D extends MapGridLine { * @param projInfo Projection * @param extent Extent */ - public MapGridLine3D(ProjectionInfo projInfo, Extent extent) { + public MapGridLine3D(ProjectionInfo projInfo, Extent3D extent) { super(true); this.projInfo = projInfo; this.setExtent(extent); diff --git a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapPlot.java b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapPlot.java index 67558c2f..255e54f8 100644 --- a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapPlot.java +++ b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/geo/MapPlot.java @@ -489,30 +489,32 @@ public class MapPlot extends Plot2D implements IWebMapPanel { int barIdx = 0; for (int m = 0; m < this.graphics.getNumGraphics(); m++) { Graphic graphic = this.graphics.get(m); - if (graphic instanceof WebMapImage) { - this.drawWebMapImage(g, (WebMapImage) graphic, area); - continue; - } - - ColorBreak cb = graphic.getLegend(); - ShapeTypes shapeType = graphic.getGraphicN(0).getShape().getShapeType(); - switch(shapeType){ - case BAR: - this.drawBars(g, (GraphicCollection) graphic, barIdx, area); - barIdx += 1; + if (graphic.isVisible()) { + if (graphic instanceof WebMapImage) { + this.drawWebMapImage(g, (WebMapImage) graphic, area); continue; - case STATION_MODEL: - this.drawStationModel(g, (GraphicCollection) graphic, area); - continue; - } + } - if (graphic.getExtent().intersects(this.drawExtent)) { - drawGraphics(g, graphic, area); - } + ColorBreak cb = graphic.getLegend(); + ShapeTypes shapeType = graphic.getGraphicN(0).getShape().getShapeType(); + switch (shapeType) { + case BAR: + this.drawBars(g, (GraphicCollection) graphic, barIdx, area); + barIdx += 1; + continue; + case STATION_MODEL: + this.drawStationModel(g, (GraphicCollection) graphic, area); + continue; + } - if (this.isLonLatMap() && graphic instanceof GeoGraphicCollection) { - if (this.drawExtent.maxX > 180) { - drawGraphics(g, ((GeoGraphicCollection) graphic).xShiftCopy(360), area); + if (graphic.getExtent().intersects(this.drawExtent)) { + drawGraphics(g, graphic, area); + } + + if (this.isLonLatMap() && graphic instanceof GeoGraphicCollection) { + if (this.drawExtent.maxX > 180) { + drawGraphics(g, ((GeoGraphicCollection) graphic).xShiftCopy(360), area); + } } } } diff --git a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/graphic/GeoGraphicCollection.java b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/graphic/GeoGraphicCollection.java index 7bc40813..aeee2dbb 100644 --- a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/graphic/GeoGraphicCollection.java +++ b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/graphic/GeoGraphicCollection.java @@ -7,13 +7,13 @@ import org.meteoinfo.common.PointD; import org.meteoinfo.geometry.graphic.Graphic; import org.meteoinfo.geometry.graphic.GraphicCollection; import org.meteoinfo.geometry.legend.*; -import org.meteoinfo.geometry.shape.PointShape; -import org.meteoinfo.geometry.shape.PolylineShape; +import org.meteoinfo.geometry.shape.*; import org.meteoinfo.geometry.shape.Shape; -import org.meteoinfo.geometry.shape.ShapeTypes; import org.meteoinfo.ndarray.DataType; import org.meteoinfo.projection.ProjectionInfo; import org.meteoinfo.table.AttributeTable; +import org.meteoinfo.table.DataRow; +import org.meteoinfo.table.DataTable; import org.meteoinfo.table.Field; import javax.swing.*; @@ -38,6 +38,57 @@ public class GeoGraphicCollection extends GraphicCollection { this.projInfo = ProjectionInfo.LONG_LAT; } + /** + * Factory method create GeoGraphicCollection from GraphicsCollection + * @param graphics The GraphicCollection object + * @return GeoGraphicCollection object + */ + public static GeoGraphicCollection factory(GraphicCollection graphics) { + GeoGraphicCollection geoGraphics = new GeoGraphicCollection(); + geoGraphics.graphics = graphics.getGraphics(); + geoGraphics.extent = graphics.getExtent(); + geoGraphics.setSingleLegend(graphics.isSingleLegend()); + geoGraphics.setLabelSet(graphics.getLabelSet()); + geoGraphics.setLabelPoints(graphics.getLabelPoints()); + geoGraphics.setLegendScheme(graphics.getLegendScheme()); + geoGraphics.setLegendBreak(graphics.getLegendBreak()); + geoGraphics.setAntiAlias(graphics.isAntiAlias()); + + AttributeTable attrTable = new AttributeTable(); + ShapeTypes shapeType = graphics.getShapeType(); + switch (shapeType) { + case POLYGON: + case POLYGON_Z: + attrTable.addField(new Field("data_Low", DataType.DOUBLE)); + attrTable.addField(new Field("data_High", DataType.DOUBLE)); + break; + default: + attrTable.addField(new Field("data", DataType.DOUBLE)); + break; + } + DataTable dataTable = attrTable.getTable(); + for (Graphic graphic : geoGraphics.graphics) { + try { + DataRow dataRow = dataTable.addRow(); + switch (shapeType) { + case POLYGON: + case POLYGON_Z: + dataRow.setValue("data_Low", ((PolygonShape) graphic.getShape()).lowValue); + dataRow.setValue("data_High", ((PolygonShape) graphic.getShape()).highValue); + break; + default: + dataRow.setValue("data", graphic.getShape().getValue()); + break; + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + geoGraphics.setAttributeTable(attrTable); + + return geoGraphics; + } + /** * Get attribute table * @return Attribute table diff --git a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/EarthGLPlot.java b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/EarthGLPlot.java index f8844eec..7797a38b 100644 --- a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/EarthGLPlot.java +++ b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/EarthGLPlot.java @@ -521,7 +521,12 @@ public class EarthGLPlot extends GLPlot { @Override protected void drawPolygonShape(GL2 gl, Graphic graphic) { + //gl.glDisable(GL2.GL_DEPTH_TEST); + //gl.glEnable(GL2.GL_CULL_FACE); + //gl.glFrontFace(GL2.GL_CW); super.drawPolygonShape(gl, graphic); + //gl.glEnable(GL2.GL_DEPTH_TEST); + //gl.glDisable(GL2.GL_CULL_FACE); } // diff --git a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/plot/Plot2D.java b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/plot/Plot2D.java index 33e5c355..208d11e7 100644 --- a/meteoinfo-chart/src/main/java/org/meteoinfo/chart/plot/Plot2D.java +++ b/meteoinfo-chart/src/main/java/org/meteoinfo/chart/plot/Plot2D.java @@ -285,17 +285,19 @@ public class Plot2D extends AbstractPlot2D { int barIdx = 0; for (int m = 0; m < this.graphics.getNumGraphics(); m++) { Graphic graphic = this.graphics.get(m); - ColorBreak cb = graphic.getLegend(); - ShapeTypes shapeType = graphic.getGraphicN(0).getShape().getShapeType(); - switch(shapeType){ - case BAR: - this.drawBars(g, (GraphicCollection) graphic, barIdx, area); - barIdx += 1; - continue; - } + if (graphic.isVisible()) { + ColorBreak cb = graphic.getLegend(); + ShapeTypes shapeType = graphic.getGraphicN(0).getShape().getShapeType(); + switch (shapeType) { + case BAR: + this.drawBars(g, (GraphicCollection) graphic, barIdx, area); + barIdx += 1; + continue; + } - if (graphic.getExtent().intersects(this.drawExtent)) { - drawGraphics(g, graphic, area); + if (graphic.getExtent().intersects(this.drawExtent)) { + drawGraphics(g, graphic, area); + } } } } 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 aa3c2bc5..dc3a3b76 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.8.2"; + version = "3.8.3"; } return version; } diff --git a/meteoinfo-geo/src/main/java/org/meteoinfo/geo/mapdata/ShapeFileManage.java b/meteoinfo-geo/src/main/java/org/meteoinfo/geo/mapdata/ShapeFileManage.java index bd4a421a..a2fd56b5 100644 --- a/meteoinfo-geo/src/main/java/org/meteoinfo/geo/mapdata/ShapeFileManage.java +++ b/meteoinfo-geo/src/main/java/org/meteoinfo/geo/mapdata/ShapeFileManage.java @@ -13,16 +13,19 @@ */ package org.meteoinfo.geo.mapdata; + import org.meteoinfo.chart.graphic.GeoGraphicCollection; import org.meteoinfo.common.Extent; import org.meteoinfo.common.PointD; import org.meteoinfo.common.io.EndianDataOutputStream; import org.meteoinfo.geo.layer.LayerDrawType; import org.meteoinfo.geo.layer.VectorLayer; import org.meteoinfo.geo.legend.LegendManage; + import org.meteoinfo.geometry.graphic.GraphicCollection; import org.meteoinfo.geometry.shape.Shape; import org.meteoinfo.geometry.shape.*; import org.meteoinfo.projection.ProjectionInfo; import org.meteoinfo.table.AttributeTable; + import org.w3c.dom.Attr; import java.awt.*; import java.io.*; @@ -714,28 +717,10 @@ public class ShapeFileManage { * @param shpfilepath Shape file path * @param aLayer Vector layer * @return Boolean - * @throws IOException*/ + * @throws IOException + */ public static boolean saveShapeFile(String shpfilepath, VectorLayer aLayer) throws IOException { - String shxfilepath = shpfilepath.replace(shpfilepath.substring(shpfilepath.lastIndexOf(".")), ".shx"); - String dbffilepath = shpfilepath.replace(shpfilepath.substring(shpfilepath.lastIndexOf(".")), ".dbf"); - String projFilePath = shpfilepath.replace(shpfilepath.substring(shpfilepath.lastIndexOf(".")), ".prj"); - - switch (aLayer.getShapeType()) { - case POINT: - case POINT_Z: - case POLYLINE: - case POLYLINE_Z: - case POLYGON: - case POLYGON_Z: - writeShxFile(shxfilepath, aLayer); - writeShpFile(shpfilepath, aLayer); - writeDbfFile(dbffilepath, aLayer); - writeProjFile(projFilePath, aLayer); - return true; - - default: - return false; - } + return saveShapeFile(shpfilepath, aLayer, null); } /** @@ -743,8 +728,8 @@ public class ShapeFileManage { * @param shpfilepath Shape file path * @param aLayer Vector layer * @param encoding Encoding - * @return Boolean - * @throws IOException*/ + * @throws IOException + */ public static boolean saveShapeFile(String shpfilepath, VectorLayer aLayer, String encoding) throws IOException { String shxfilepath = shpfilepath.replace(shpfilepath.substring(shpfilepath.lastIndexOf(".")), ".shx"); String dbffilepath = shpfilepath.replace(shpfilepath.substring(shpfilepath.lastIndexOf(".")), ".dbf"); @@ -759,15 +744,83 @@ public class ShapeFileManage { case POLYGON_Z: writeShxFile(shxfilepath, aLayer); writeShpFile(shpfilepath, aLayer); - writeDbfFile(dbffilepath, aLayer, encoding); + if (encoding == null) { + writeDbfFile(dbffilepath, aLayer); + } else { + writeDbfFile(dbffilepath, aLayer, encoding); + } writeProjFile(projFilePath, aLayer); return true; - default: return false; } } + /** + * Save shape file + * @param shpFilePath Shape file path + * @param graphics Graphics + * @throws IOException + */ + public static boolean saveShapeFile(String shpFilePath, GraphicCollection graphics) throws IOException { + return saveShapeFile(shpFilePath, GeoGraphicCollection.factory(graphics), null); + } + + /** + * Save shape file + * @param shpFilePath Shape file path + * @param graphics Graphics + * @param encoding Encoding + * @throws IOException + */ + public static boolean saveShapeFile(String shpFilePath, GraphicCollection graphics, String encoding) throws IOException { + return saveShapeFile(shpFilePath, GeoGraphicCollection.factory(graphics), encoding); + } + + /** + * Save shape file + * @param shpFilePath Shape file path + * @param geoGraphics GeoGraphics + * @param encoding Encoding + * @throws IOException + */ + public static boolean saveShapeFile(String shpFilePath, GeoGraphicCollection geoGraphics) throws IOException { + return saveShapeFile(shpFilePath, geoGraphics, null); + } + + /** + * Save shape file + * @param shpFilePath Shape file path + * @param geoGraphics GeoGraphics + * @param encoding Encoding + * @throws IOException + */ + public static boolean saveShapeFile(String shpFilePath, GeoGraphicCollection geoGraphics, String encoding) throws IOException { + String shxFilePath = shpFilePath.replace(shpFilePath.substring(shpFilePath.lastIndexOf(".")), ".shx"); + String dbfFilePath = shpFilePath.replace(shpFilePath.substring(shpFilePath.lastIndexOf(".")), ".dbf"); + String projFilePath = shpFilePath.replace(shpFilePath.substring(shpFilePath.lastIndexOf(".")), ".prj"); + + switch (geoGraphics.getShapeType()) { + case POINT: + case POINT_Z: + case POLYLINE: + case POLYLINE_Z: + case POLYGON: + case POLYGON_Z: + writeShxFile(shxFilePath, geoGraphics); + writeShpFile(shpFilePath, geoGraphics); + if (encoding == null) { + writeDbfFile(dbfFilePath, geoGraphics.getAttributeTable()); + } else { + writeDbfFile(dbfFilePath, geoGraphics.getAttributeTable(), encoding); + } + writeProjFile(projFilePath, geoGraphics.getProjInfo()); + return true; + default: + return false; + } + } + private static void writeShpFile(String shpfilepath, VectorLayer aLayer) throws FileNotFoundException, IOException { File shpFile = new File(shpfilepath); EndianDataOutputStream bw = new EndianDataOutputStream(new BufferedOutputStream(new FileOutputStream(shpFile))); @@ -789,6 +842,27 @@ public class ShapeFileManage { bw.close(); } + private static void writeShpFile(String shpFilePath, GraphicCollection graphics) throws FileNotFoundException, IOException { + File shpFile = new File(shpFilePath); + EndianDataOutputStream bw = new EndianDataOutputStream(new BufferedOutputStream(new FileOutputStream(shpFile))); + + //Write header + int FileLength = getShpFileLength(graphics); + writeHeader(bw, graphics, FileLength); + + //Write records + int RecordNumber; + + for (int i = 0; i < graphics.getNumGraphics(); i++) { + Shape aShape = graphics.getShapes().get(i); + RecordNumber = i + 1; + writeRecord(bw, RecordNumber, aShape, graphics.getShapeType()); + } + + //Close + bw.close(); + } + private static int getShpFileLength(VectorLayer aLayer) { int fileLength = 50; @@ -801,6 +875,18 @@ public class ShapeFileManage { return fileLength; } + private static int getShpFileLength(GraphicCollection graphics) { + int fileLength = 50; + + for (int i = 0; i < graphics.getNumGraphics(); i++) { + Shape aShape = graphics.getShapes().get(i); + int cLen = getContentLength(aShape, graphics.getShapeType()); + fileLength += 4 + cLen; + } + + return fileLength; + } + private static int getContentLength(Shape aShape, ShapeTypes aST) { int contentLength = 0; switch (aST) { @@ -933,32 +1019,40 @@ public class ShapeFileManage { } } - private static void writeHeader(EndianDataOutputStream bw, VectorLayer aLayer, int FileLength) throws IOException { - int i; - int FileCode = 9994; - //FileCode = swapByteOrder(FileCode); - int Unused = 0; - //Unused = swapByteOrder(Unused); - //FileLength = swapByteOrder(FileLength); - int Version = 1000; - int aShapeType = aLayer.getShapeType().getValue(); - - bw.writeIntBE(FileCode); - for (i = 0; i < 5; i++) { - bw.writeIntBE(Unused); - } - bw.writeIntBE(FileLength); - bw.writeIntLE(Version); - bw.writeIntLE(aShapeType); - bw.writeDoubleLE(aLayer.getExtent().minX); - bw.writeDoubleLE(aLayer.getExtent().minY); - bw.writeDoubleLE(aLayer.getExtent().maxX); - bw.writeDoubleLE(aLayer.getExtent().maxY); - for (i = 0; i < 4; i++) { - bw.writeDoubleLE(0.0); - } + private static void writeHeader(EndianDataOutputStream bw, VectorLayer aLayer, int fileLength) throws IOException { + writeHeader(bw, aLayer.getShapeType(), aLayer.getExtent(), fileLength); } + private static void writeHeader(EndianDataOutputStream bw, GraphicCollection graphics, int fileLength) throws IOException { + writeHeader(bw, graphics.getShapeType(), graphics.getExtent(), fileLength); + } + + private static void writeHeader(EndianDataOutputStream bw, ShapeTypes shapeType, Extent extent, int fileLength) throws IOException { + int i; + int FileCode = 9994; + //FileCode = swapByteOrder(FileCode); + int Unused = 0; + //Unused = swapByteOrder(Unused); + //FileLength = swapByteOrder(FileLength); + int Version = 1000; + int aShapeType = shapeType.getValue(); + + bw.writeIntBE(FileCode); + for (i = 0; i < 5; i++) { + bw.writeIntBE(Unused); + } + bw.writeIntBE(fileLength); + bw.writeIntLE(Version); + bw.writeIntLE(aShapeType); + bw.writeDoubleLE(extent.minX); + bw.writeDoubleLE(extent.minY); + bw.writeDoubleLE(extent.maxX); + bw.writeDoubleLE(extent.maxY); + for (i = 0; i < 4; i++) { + bw.writeDoubleLE(0.0); + } + } + private static void writeShxFile(String shxfilepath, VectorLayer aLayer) throws IOException { File shxFile = new File(shxfilepath); EndianDataOutputStream bw = new EndianDataOutputStream(new BufferedOutputStream(new FileOutputStream(shxFile))); @@ -985,35 +1079,72 @@ public class ShapeFileManage { bw.close(); } - private static void writeDbfFile(String dbffilepath, VectorLayer aLayer) { - aLayer.getAttributeTable().saveAs(dbffilepath, true); + private static void writeShxFile(String shxFilePath, GraphicCollection graphics) throws IOException { + File shxFile = new File(shxFilePath); + EndianDataOutputStream bw = new EndianDataOutputStream(new BufferedOutputStream(new FileOutputStream(shxFile))); + + //Write header + int FileLength = graphics.getNumGraphics() * 4 + 50; + writeHeader(bw, graphics, FileLength); + + //Write content + int OffSet, ContentLength; + OffSet = 50; + + for (int i = 0; i < graphics.getNumGraphics(); i++) { + Shape aShape = graphics.getShapes().get(i); + ContentLength = getContentLength(aShape, graphics.getShapeType()); + + bw.writeIntBE(OffSet); + bw.writeIntBE(ContentLength); + + OffSet = OffSet + 4 + ContentLength; + } + + //Close + bw.close(); + } + + private static void writeDbfFile(String dbfFilePath, VectorLayer aLayer) { + writeDbfFile(dbfFilePath, aLayer.getAttributeTable()); } - private static void writeDbfFile(String dbffilepath, VectorLayer aLayer, String encoding) { - AttributeTable attTable = aLayer.getAttributeTable(); - attTable.setEncoding(encoding); - attTable.saveAs(dbffilepath, true); + private static void writeDbfFile(String dbfFilePath, VectorLayer aLayer, String encoding) { + writeDbfFile(dbfFilePath, aLayer.getAttributeTable(), encoding); } - private static void writeProjFile(String projFilePath, VectorLayer aLayer) { - BufferedWriter sw = null; - try { - String esriString = aLayer.getProjInfo().toEsriString(); - sw = new BufferedWriter(new FileWriter(new File(projFilePath))); - sw.write(esriString); - sw.flush(); - sw.close(); - } catch (IOException ex) { - Logger.getLogger(ShapeFileManage.class.getName()).log(Level.SEVERE, null, ex); - } finally { - try { - sw.close(); - } catch (IOException ex) { - Logger.getLogger(ShapeFileManage.class.getName()).log(Level.SEVERE, null, ex); - } - } + private static void writeDbfFile(String dbfFilePath, AttributeTable attrTable) { + attrTable.saveAs(dbfFilePath, true); + } + + private static void writeDbfFile(String dbfFilePath, AttributeTable attrTable, String encoding) { + attrTable.setEncoding(encoding); + attrTable.saveAs(dbfFilePath, true); + } + + private static void writeProjFile(String projFilePath, VectorLayer layer) { + writeProjFile(projFilePath, layer.getProjInfo()); } + private static void writeProjFile(String projFilePath, ProjectionInfo projectionInfo) { + BufferedWriter sw = null; + try { + String esriString = projectionInfo.toEsriString(); + sw = new BufferedWriter(new FileWriter(new File(projFilePath))); + sw.write(esriString); + sw.flush(); + sw.close(); + } catch (IOException ex) { + Logger.getLogger(ShapeFileManage.class.getName()).log(Level.SEVERE, null, ex); + } finally { + try { + sw.close(); + } catch (IOException ex) { + Logger.getLogger(ShapeFileManage.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + /** * Swaps the byte order of an int32 * diff --git a/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/Artist.java b/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/Artist.java index 039e1ec1..da19e255 100644 --- a/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/Artist.java +++ b/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/Artist.java @@ -3,6 +3,7 @@ package org.meteoinfo.geometry.graphic; public class Artist { protected boolean antiAlias = false; + protected boolean visible = true; /** * Return antiAlias @@ -19,4 +20,20 @@ public class Artist { public void setAntiAlias(boolean value) { this.antiAlias = value; } + + /** + * Return visible + * @return Visible + */ + public boolean isVisible() { + return this.visible; + } + + /** + * Set visible + * @param value Visible + */ + public void setVisible(boolean value) { + this.visible = value; + } } diff --git a/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/GraphicCollection.java b/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/GraphicCollection.java index 4ebcb520..2c7d9872 100644 --- a/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/GraphicCollection.java +++ b/meteoinfo-geometry/src/main/java/org/meteoinfo/geometry/graphic/GraphicCollection.java @@ -71,6 +71,19 @@ public class GraphicCollection extends Graphic implements Iterator { } } + /** + * Get shape by index + * @param index The index + * @return Shape + */ + public Shape getShape(int index) { + if (this.graphics.isEmpty()) { + return null; + } else { + return this.graphics.get(index).getShape(); + } + } + /** * Get graphic list * diff --git a/meteoinfo-lab/milconfig.xml b/meteoinfo-lab/milconfig.xml index 6fd07f0d..531680dd 100644 --- a/meteoinfo-lab/milconfig.xml +++ b/meteoinfo-lab/milconfig.xml @@ -1,38 +1,32 @@ - - - - - - + + + + + + - - - - - + + - - - + + + + + + - - - - - - + + + - - - - - - + + + @@ -40,5 +34,5 @@
- + diff --git a/meteoinfo-lab/pom.xml b/meteoinfo-lab/pom.xml index 520f870e..bde8a17f 100644 --- a/meteoinfo-lab/pom.xml +++ b/meteoinfo-lab/pom.xml @@ -49,10 +49,15 @@ docking-frames-core 2.0.0 - + + + org.slf4j + slf4j-nop + 1.7.25 diff --git a/meteoinfo-lab/pylib/mipylib/meteolib/_eof.py b/meteoinfo-lab/pylib/mipylib/meteolib/_eof.py index b8333d1d..bc6b092b 100644 --- a/meteoinfo-lab/pylib/mipylib/meteolib/_eof.py +++ b/meteoinfo-lab/pylib/mipylib/meteolib/_eof.py @@ -1,3 +1,7 @@ +""" +For EOF analysis. The code were ported from Python eofs library - https://github.com/ajdawson/eofs +""" + import mipylib.numeric as np import warnings diff --git a/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg$py.class b/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg$py.class index 39651995..9a72c268 100644 Binary files a/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg$py.class and b/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg$py.class differ diff --git a/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg.py b/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg.py index 19f245e8..41117bf7 100644 --- a/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg.py +++ b/meteoinfo-lab/pylib/mipylib/numeric/linalg/linalg.py @@ -13,7 +13,7 @@ from org.meteoinfo.math.stats import StatsUtil from .. import core as np __all__ = ['solve', 'cholesky', 'cond', 'det', 'lu', 'qr', 'svd', 'eig', 'inv', 'lstsq', 'slogdet', - 'solve_triangular', 'norm', 'pinv'] + 'solve_triangular', 'norm', 'pinv', 'LinAlgError'] class LinAlgError(Exception): diff --git a/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes$py.class b/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes$py.class index ae19d051..ff7ef93d 100644 Binary files a/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes$py.class and b/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes$py.class differ diff --git a/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes.py b/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes.py index 1066cc81..3cde4aa5 100644 --- a/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes.py +++ b/meteoinfo-lab/pylib/mipylib/plotlib/_mapaxes.py @@ -529,9 +529,10 @@ class MapAxes(Axes): if antialias is not None: graphics.setAntiAlias(antialias) - graphics = self.add_graphic(graphics, projection=layer.proj, zorder=zorder) - self._axes.setDrawExtent(graphics.getExtent().clone()) - self._axes.setExtent(graphics.getExtent().clone()) + if visible: + graphics = self.add_graphic(graphics, projection=layer.proj, zorder=zorder) + #self._axes.setDrawExtent(graphics.getExtent().clone()) + #self._axes.setExtent(graphics.getExtent().clone()) return GeoGraphicCollection(graphics) else: if isinstance(args[0], Graphic): diff --git a/meteoinfo-lab/pylib/mipylib/plotlib/graphic/lines.py b/meteoinfo-lab/pylib/mipylib/plotlib/graphic/lines.py index f84f65c3..e1bc8522 100644 --- a/meteoinfo-lab/pylib/mipylib/plotlib/graphic/lines.py +++ b/meteoinfo-lab/pylib/mipylib/plotlib/graphic/lines.py @@ -40,6 +40,18 @@ class Line2D(Line2DGraphic, Artist): if curve: self.setCurve(curve) + @property + def visible(self): + """ + The artist is visible or not. + """ + return self.isVisible() + + @visible.setter + def visible(self, val): + self.setVisible(val) + self.stale = True + @property def xdata(self): """ diff --git a/meteoinfo-projection/src/main/java/org/meteoinfo/projection/ProjectionUtil.java b/meteoinfo-projection/src/main/java/org/meteoinfo/projection/ProjectionUtil.java index 2442d97e..f311cc87 100644 --- a/meteoinfo-projection/src/main/java/org/meteoinfo/projection/ProjectionUtil.java +++ b/meteoinfo-projection/src/main/java/org/meteoinfo/projection/ProjectionUtil.java @@ -948,16 +948,16 @@ public class ProjectionUtil { public static Graphic projectClipGraphic(Graphic graphic, ProjectionInfo fromProj, ProjectionInfo toProj) { if (graphic instanceof GraphicCollection) { try { - GraphicCollection newGCollection = new GraphicCollection(); + Graphic newGCollection = graphic.getClass().getDeclaredConstructor().newInstance(); for (Graphic aGraphic : ((GraphicCollection) graphic).getGraphics()) { List shapes = projectClipShape(aGraphic.getShape(), fromProj, toProj); if (shapes != null && shapes.size() > 0) { aGraphic.setShape(shapes.get(0)); - newGCollection.add(aGraphic); + ((GraphicCollection) newGCollection).add(aGraphic); } } - newGCollection.setLegendScheme(((GraphicCollection) graphic).getLegendScheme()); - newGCollection.setSingleLegend(((GraphicCollection) graphic).isSingleLegend()); + ((GraphicCollection) newGCollection).setLegendScheme(((GraphicCollection) graphic).getLegendScheme()); + ((GraphicCollection) newGCollection).setSingleLegend(((GraphicCollection) graphic).isSingleLegend()); newGCollection.setAntiAlias(graphic.isAntiAlias()); return newGCollection; diff --git a/meteoinfo-table/src/main/java/org/meteoinfo/table/AttributeTable.java b/meteoinfo-table/src/main/java/org/meteoinfo/table/AttributeTable.java index 3f4462fe..9f77fb24 100644 --- a/meteoinfo-table/src/main/java/org/meteoinfo/table/AttributeTable.java +++ b/meteoinfo-table/src/main/java/org/meteoinfo/table/AttributeTable.java @@ -549,7 +549,7 @@ public final class AttributeTable implements Cloneable { * Save this table to the specified file name * * @param fileName The file name to be saved - * @param overwrite If over write the file if it exists + * @param overwrite If overwrite the file if it exists */ public void saveAs(String fileName, boolean overwrite) { if (_file == null) { diff --git a/pom.xml b/pom.xml index 74ef2412..7d09ea4a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ UTF-8 1.8 - 3.8.2 + 3.8.3 8 8 8