mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add visible property in Graphic class
This commit is contained in:
parent
9476908639
commit
74363fd57c
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -1,38 +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\wrf">
|
||||
<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\io\grads"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\io\netcdf">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\geoshow"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\json"/>
|
||||
<RecentFolder Folder="D:\Temp\working\acidrain"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\subplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\awx"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\projection"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\geoshow"/>
|
||||
<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\meteo\eof"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\wrf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\hdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\awx"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grads"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\eof\reof_elnino.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\eof\reof_sst.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\projection\stere_proj.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\eof\reof_function_hgt.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\wrf\wrf_destagger_uv_webmap_loop.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\wrf\wrf_destagger_uv_webmap_loop_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\geoshow\geoshow_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\Line2D_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\netcdf\eccc_1.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\eof\reof_elnino.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\eof\reof_sst.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\map\projection\stere_proj.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\eof\reof_function_hgt.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\wrf\wrf_destagger_uv_webmap_loop.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\wrf\wrf_destagger_uv_webmap_loop_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\map\geoshow\geoshow_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\Line2D_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\netcdf\eccc_1.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -40,5 +34,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1358,821"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
</MeteoInfo>
|
||||
|
||||
@ -49,10 +49,15 @@
|
||||
<artifactId>docking-frames-core</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-nop</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Binary file not shown.
@ -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):
|
||||
|
||||
Binary file not shown.
@ -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):
|
||||
|
||||
@ -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):
|
||||
"""
|
||||
|
||||
@ -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<? extends Shape> 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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<revision>3.8.2</revision>
|
||||
<revision>3.8.3</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