提交 f9255149 authored 作者: 张航's avatar 张航

添加了默认下载基础地图以及地图的发布

上级 e7586d80
package com.comleader.ldmapdownload.config;
import com.comleader.ldmapdownload.util.CLStringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* @ClassName WebMvcConfig
* @Description: WebMvcConfig配置类(设置地图资源静态路径)
* @Author zhanghang
* @Date 2020/4/14
* @Version V1.0
**/
@Configuration
@PropertySource(value = {"classpath:config/download-map.properties"}, encoding = "UTF-8")
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Value("${file.mapImgPath}")
private String mapImgPath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("file:/"+ mapImgPath +"/");
super.addResourceHandlers(registry);
}
}
...@@ -29,13 +29,15 @@ public class DownMapLv3 { ...@@ -29,13 +29,15 @@ public class DownMapLv3 {
for (int y = 0; y <= 7; y++) { // X轴 for (int y = 0; y <= 7; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网) //高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y); String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y); File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl); System.out.println(imgUrl);
// 开始下载地图 // 开始下载地图
try { if (file != null) {
HttpUtil.downImageByGet(imgUrl, file); try {
} catch (Exception e) { HttpUtil.downImageByGet(imgUrl, file);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
} }
} }
......
...@@ -29,14 +29,16 @@ public class DownMapLv4 { ...@@ -29,14 +29,16 @@ public class DownMapLv4 {
for (int y = 0; y <= 9; y++) { // X轴 for (int y = 0; y <= 9; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网) //高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y); String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y); File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl); System.out.println(imgUrl);
// 开始下载地图 // 开始下载地图
try { if (file != null) {
HttpUtil.downImageByGet(imgUrl, file); try {
} catch (Exception e) { HttpUtil.downImageByGet(imgUrl, file);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
} }
} }
......
...@@ -17,8 +17,8 @@ public class DownMapLv5 { ...@@ -17,8 +17,8 @@ public class DownMapLv5 {
private static int z = 5; private static int z = 5;
/** /**
* @description: 下载第四级的Map
* @param * @param
* @description: 下载第四级的Map
* @return: void * @return: void
* @author: zhanghang * @author: zhanghang
* @date: 2020/4/3 * @date: 2020/4/3
...@@ -29,14 +29,16 @@ public class DownMapLv5 { ...@@ -29,14 +29,16 @@ public class DownMapLv5 {
for (int y = 10; y <= 23; y++) { // X轴 for (int y = 10; y <= 23; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网) //高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y); String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y); File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl); System.out.println(imgUrl);
// 开始下载地图 // 开始下载地图
try { if (file != null) {
HttpUtil.downImageByGet(imgUrl, file); try {
} catch (Exception e) { HttpUtil.downImageByGet(imgUrl, file);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
} }
} }
......
...@@ -17,8 +17,8 @@ public class DownMapLv6 { ...@@ -17,8 +17,8 @@ public class DownMapLv6 {
private static int z = 6; private static int z = 6;
/** /**
* @description: 下载第四级的Map
* @param * @param
* @description: 下载第四级的Map
* @return: void * @return: void
* @author: zhanghang * @author: zhanghang
* @date: 2020/4/3 * @date: 2020/4/3
...@@ -29,14 +29,16 @@ public class DownMapLv6 { ...@@ -29,14 +29,16 @@ public class DownMapLv6 {
for (int y = 20; y <= 28; y++) { // X轴 for (int y = 20; y <= 28; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网) //高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y); String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y); File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl); System.out.println(imgUrl);
// 开始下载地图 // 开始下载地图
try { if (file != null) {
HttpUtil.downImageByGet(imgUrl, file); try {
} catch (Exception e) { HttpUtil.downImageByGet(imgUrl, file);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
} }
} }
......
...@@ -36,6 +36,5 @@ public class DownMapLv6Runner implements ApplicationRunner { ...@@ -36,6 +36,5 @@ public class DownMapLv6Runner implements ApplicationRunner {
DownMapLv4.downLoad(); DownMapLv4.downLoad();
DownMapLv5.downLoad(); DownMapLv5.downLoad();
DownMapLv6.downLoad(); DownMapLv6.downLoad();
} }
} }
# 下载地图的保存路径 # 下载地图的保存路径
file.basepath=E:/em-downloadmap file.basepath=E:/em-downloadmap
# 项目的发布地址
file.mapImgPath=E:/em-downloadmap
# 下载地图的地址 # 下载地图的地址
#天地图服务器t0-t8间选一个 #天地图服务器t0-t8间选一个
...@@ -25,7 +27,7 @@ map.maxLv=15 ...@@ -25,7 +27,7 @@ map.maxLv=15
map.threadNum=2000 map.threadNum=2000
# 是否下载前6级(不能与其余的同时进行) # 是否下载前6级(不能与其余的同时进行)
map.Lv6.flag=false map.Lv6.flag=true
# 是否覆盖已有 # 是否覆盖已有
map.download.append=false map.download.append=false
......
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
// 校验信息 // 校验信息
if (verifyParam()) { if (verifyParam()) {
// 开始建立连接 // 开始建立连接
$("#filePath").val($("#filePath").val()); // $("#filePath").val($("#filePath").val());
sendReady(); sendReady();
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论