update web map functions

This commit is contained in:
wyq 2021-09-02 14:13:16 +08:00
parent 3fecf63dfc
commit 5364bc713a
8 changed files with 70 additions and 62 deletions

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.formdev:flatlaf:1.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/1.5/flatlaf-1.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/1.5/flatlaf-1.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/1.5/flatlaf-1.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.formdev:flatlaf-extras:1.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf-extras/1.5/flatlaf-extras-1.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf-extras/1.5/flatlaf-extras-1.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf-extras/1.5/flatlaf-extras-1.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1614,7 +1614,7 @@ public class GeoTiff {
ByteBuffer buffer = ByteBuffer.allocate(8); ByteBuffer buffer = ByteBuffer.allocate(8);
int n = channel.read(buffer); int n = channel.read(buffer);
assert n == 8; assert n == 8;
buffer.flip(); ((Buffer)buffer).flip();
if (this.showHeaderBytes) { if (this.showHeaderBytes) {
printBytes(System.out, "header", buffer, 4); printBytes(System.out, "header", buffer, 4);
buffer.rewind(); buffer.rewind();
@ -1639,7 +1639,7 @@ public class GeoTiff {
buffer = ByteBuffer.allocate(size); buffer = ByteBuffer.allocate(size);
buffer.order(this.byteOrder); buffer.order(this.byteOrder);
channel.read(buffer); channel.read(buffer);
buffer.flip(); ((Buffer)buffer).flip();
firstIFD = buffer.getLong(); firstIFD = buffer.getLong();
} else { } else {
firstIFD = buffer.getInt(); firstIFD = buffer.getInt();
@ -1666,7 +1666,7 @@ public class GeoTiff {
buffer.order(this.byteOrder); buffer.order(this.byteOrder);
int n = channel.read(buffer); int n = channel.read(buffer);
buffer.flip(); ((Buffer)buffer).flip();
if (this.showBytes) { if (this.showBytes) {
printBytes(System.out, "IFD", buffer, 2); printBytes(System.out, "IFD", buffer, 2);
buffer.rewind(); buffer.rewind();
@ -1698,7 +1698,7 @@ public class GeoTiff {
buffer = this.bigTiff ? ByteBuffer.allocate(8) : ByteBuffer.allocate(4); buffer = this.bigTiff ? ByteBuffer.allocate(8) : ByteBuffer.allocate(4);
buffer.order(this.byteOrder); buffer.order(this.byteOrder);
n = channel.read(buffer); n = channel.read(buffer);
buffer.flip(); ((Buffer)buffer).flip();
long nextIFD = this.bigTiff ? buffer.getLong() : buffer.getInt(); long nextIFD = this.bigTiff ? buffer.getLong() : buffer.getInt();
if (this.debugRead) { if (this.debugRead) {
System.out.println(" nextIFD == " + nextIFD); System.out.println(" nextIFD == " + nextIFD);
@ -1723,7 +1723,7 @@ public class GeoTiff {
ByteBuffer buffer = this.bigTiff ? ByteBuffer.allocate(20) : ByteBuffer.allocate(12); ByteBuffer buffer = this.bigTiff ? ByteBuffer.allocate(20) : ByteBuffer.allocate(12);
buffer.order(this.byteOrder); buffer.order(this.byteOrder);
channel.read(buffer); channel.read(buffer);
buffer.flip(); ((Buffer)buffer).flip();
if (this.showBytes) { if (this.showBytes) {
printBytes(System.out, "IFDEntry bytes", buffer, buffer.limit()); printBytes(System.out, "IFDEntry bytes", buffer, buffer.limit());
} }
@ -1755,7 +1755,7 @@ public class GeoTiff {
ByteBuffer vBuffer = ByteBuffer.allocate((int)ifd.count * ifd.type.size); ByteBuffer vBuffer = ByteBuffer.allocate((int)ifd.count * ifd.type.size);
vBuffer.order(this.byteOrder); vBuffer.order(this.byteOrder);
channel.read(vBuffer); channel.read(vBuffer);
vBuffer.flip(); ((Buffer)vBuffer).flip();
readValues(vBuffer, ifd); readValues(vBuffer, ifd);
} }

View File

@ -55,7 +55,7 @@ public class TileFactoryInfo {
private String zparam; private String zparam;
private boolean xr2l = true; private boolean xr2l = true;
private boolean yt2b = true; private boolean yt2b = true;
private int defaultZoomLevel; private int defaultZoomLevel = 1;
/** /**
* A name for this info. * A name for this info.
*/ */

View File

@ -196,9 +196,9 @@ public class WebMapLayer extends MapLayer {
} }
//if(zoom >= 0 && zoom <= 15 && zoom != this.zoom) { //if(zoom >= 0 && zoom <= 15 && zoom != this.zoom) {
int oldzoom = this.zoom; int oldZoom = this.zoom;
Point2D oldCenter = getCenter(); Point2D oldCenter = getCenter();
Dimension oldMapSize = getTileFactory().getMapSize(oldzoom); Dimension oldMapSize = getTileFactory().getMapSize(oldZoom);
this.zoom = zoom; this.zoom = zoom;
//this.firePropertyChange("zoom", oldzoom, zoom); //this.firePropertyChange("zoom", oldzoom, zoom);
@ -327,8 +327,8 @@ public class WebMapLayer extends MapLayer {
*/ */
public void setTileFactory(TileFactory factory) { public void setTileFactory(TileFactory factory) {
this.factory = factory; this.factory = factory;
this.setZoom(factory.getInfo().getDefaultZoomLevel()); //this.setZoom(factory.getInfo().getDefaultZoomLevel());
this.setCenterPosition(new GeoPosition(0, 0)); //this.setCenterPosition(new GeoPosition(0, 0));
} }
/** /**

View File

@ -4357,13 +4357,13 @@ public class MapView extends JPanel implements IWebMapPanel {
drawProjectedMap(g, this.getWidth(), this.getHeight()); drawProjectedMap(g, this.getWidth(), this.getHeight());
} }
private void drawProjectedMap(Graphics2D g, int width, int heigth) { private void drawProjectedMap(Graphics2D g, int width, int height) {
this.drawProjectedMap(g, width, heigth, tileLoadListener); this.drawProjectedMap(g, width, height, tileLoadListener);
} }
private void drawProjectedMap(Graphics2D g, int width, int heigth, TileLoadListener tll) { private void drawProjectedMap(Graphics2D g, int width, int height, TileLoadListener tll) {
//Draw layers //Draw layers
drawProjectedLayers(g, width, heigth, tll); drawProjectedLayers(g, width, height, tll);
//Draw lon/lat //Draw lon/lat
if (_drawGridLine) { if (_drawGridLine) {
@ -5716,45 +5716,30 @@ public class MapView extends JPanel implements IWebMapPanel {
layer.setWebMapScale(this._scaleX); layer.setWebMapScale(this._scaleX);
layer.setZoom(this.zoomLevel); layer.setZoom(this.zoomLevel);
} else { } else {
zoomLevel = layer.getZoom();
double webMapScale = layer.getWebMapScale(); double webMapScale = layer.getWebMapScale();
if (!MIMath.doubleEquals(_scaleX, webMapScale)) { if (!MIMath.doubleEquals(_scaleX, webMapScale)) {
int minZoom = layer.getTileFactory().getInfo().getMinimumZoomLevel(); int minZoom = layer.getTileFactory().getInfo().getMinimumZoomLevel();
int maxZoom = layer.getTileFactory().getInfo().getMaximumZoomLevel(); int maxZoom = layer.getTileFactory().getInfo().getMaximumZoomLevel();
//int totalZoom = layer.getTileFactory().getInfo().getTotalMapZoom(); int newZoom = minZoom;
int nzoom = minZoom; double scale = webMapScale;
double scale;
for (int i = maxZoom; i >= minZoom; i--) { for (int i = maxZoom; i >= minZoom; i--) {
//int z = totalZoom - i;
//double res = GeoUtil.getResolution(z, geoCenter.Y);
//double scale = 1.0 / res;
//layer.setAddressLocation(new GeoPosition(geoCenter.Y, geoCenter.X), i);
layer.setZoom(i); layer.setZoom(i);
scale = getWebMapScale(layer, i, width, height); scale = getWebMapScale(layer, i, width, height);
if (_scaleX < scale || MIMath.doubleEquals(_scaleX, scale)) { if (_scaleX < scale) {
this.setScale(scale, width, height); newZoom = i;
nzoom = i; if (_scaleX < webMapScale) {
webMapScale = scale; if (i < maxZoom) {
layer.setWebMapScale(webMapScale); newZoom = i + 1;
scale = getWebMapScale(layer, newZoom, width, height);
}
}
break; break;
} }
} }
this.setScale(scale, width, height);
boolean addOne = false; layer.setWebMapScale(scale);
if (zoomLevel == minZoom) { layer.setZoom(newZoom);
addOne = true; zoomLevel = newZoom;
} else if (nzoom < maxZoom) {
addOne = true;
}
if (addOne) {
zoomLevel = nzoom + 1;
webMapScale = getWebMapScale(layer, zoomLevel, width, height);
this.setScale(webMapScale, width, height);
layer.setWebMapScale(webMapScale);
layer.setZoom(zoomLevel);
} else {
zoomLevel = nzoom;
}
} }
this.fixMapScale = true; this.fixMapScale = true;
} }
@ -5901,9 +5886,7 @@ public class MapView extends JPanel implements IWebMapPanel {
PointD p2 = Reproject.reprojectPoint(new PointD(pos2.getLongitude(), pos2.getLatitude()), PointD p2 = Reproject.reprojectPoint(new PointD(pos2.getLongitude(), pos2.getLatitude()),
KnownCoordinateSystems.geographic.world.WGS1984, this.getProjection().getProjInfo()); KnownCoordinateSystems.geographic.world.WGS1984, this.getProjection().getProjInfo());
if (pos2.getLongitude() - pos1.getLongitude() < 360.0) { if (pos2.getLongitude() - pos1.getLongitude() < 360.0) {
double xlen = p2.X - p1.X; double xlen = Math.abs(p2.X - p1.X);
// if (pos2.getLongitude() - pos1.getLongitude() > 360)
// xlen += 2.0037497210840166E7 * 2;
return (double) width / xlen; return (double) width / xlen;
} else { } else {
double ylen = Math.abs(p2.Y - p1.Y); double ylen = Math.abs(p2.Y - p1.Y);

View File

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile"> <MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\dataframe"> <Path OpenPath="D:\Working\MIScript\Jython\mis\io\geotiff">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\wind"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\subplot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\special"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\special"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
@ -14,19 +10,21 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\patch"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\patch"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\interpolate"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\geotiff"/>
</Path> </Path>
<File> <File>
<OpenedFiles> <OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf_sombrero.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf_sombrero.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\patch\polygon.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\io\geotiff\geotiff_dem.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\dataframe\read_aaot.py"/>
</OpenedFiles> </OpenedFiles>
<RecentFiles> <RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf_sombrero.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf_sombrero.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\patch\polygon.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\io\geotiff\geotiff_dem.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\dataframe\read_aaot.py"/>
</RecentFiles> </RecentFiles>
</File> </File>
<Font> <Font>

View File

@ -2,13 +2,14 @@
<MeteoInfo File="default.mip" Type="projectfile"> <MeteoInfo File="default.mip" Type="projectfile">
<MapFrames> <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"> <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="180.0" xMin="-180.0" yMax="83.62359619140625" yMin="-90.0"/> <Extents xMax="1.4641954417758651E7" xMin="6820686.104558709" yMax="6975934.872413158" yMin="2922054.0434102565"/>
<MapProperty BackColor="0xffffffff" ForeColor="0xff000000" HighSpeedWheelZoom="true" MultiGlobalDraw="true" PointSmoothingMode="true" SelectColor="0xff66ffff" SmoothingMode="false" XYScaleFactor="1.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"/> <GridLine DrawGridLine="false" DrawGridTickLine="false" GridLineColor="0xff808080" GridLineSize="1.0" GridLineStyle="DASH"/>
<MaskOut MaskLayer="china.shp" SetMaskLayer="false"/> <MaskOut MaskLayer="china.shp" SetMaskLayer="false"/>
<Projection IsLonLatMap="true" ProjStr="+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees "/> <Projection IsLonLatMap="false" ProjStr="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 "/>
<GroupLayer> <GroupLayer>
<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"> <Layer Handle="1" IsMaskout="false" LayerDrawType="IMAGE" LayerName="WebMap_BingSatelliteMap" LayerType="WEB_MAP_LAYER" TransparencyPerc="0" Visible="true" WebMapProvider="BingSatelliteMap"/>
<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">
<LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYGON_Z" UNDEF="-9999.0"> <LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYGON_Z" UNDEF="-9999.0">
<Breaks> <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=""/> <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 +25,7 @@
<ChartGraphics/> <ChartGraphics/>
<VisibleScale EnableMaxVisScale="false" EnableMinVisScale="false" MaxVisScale="0.0" MinVisScale="0.0"/> <VisibleScale EnableMaxVisScale="false" EnableMinVisScale="false" MaxVisScale="0.0" MinVisScale="0.0"/>
</Layer> </Layer>
<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"> <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">
<LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYGON" UNDEF="-9999.0"> <LegendScheme BreakNum="1" FieldName="" HasNoData="false" LegendType="SINGLE_SYMBOL" MaxValue="0.0" MinValue="0.0" ShapeType="POLYGON" UNDEF="-9999.0">
<Breaks> <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=""/> <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=""/>