gushoubang 1 éve
szülő
commit
8f17d3dfb2

+ 7 - 4
onemap-modules/onemap-spatial/src/main/java/com/onemap/spatial/service/impl/ImageServiceImpl.java

@@ -51,6 +51,9 @@ public class ImageServiceImpl implements IImageService {
     @Value("${Path.rootPath}")
     public String rootPath;
 
+    @Value("${Image.with}")
+    public int imageWith;
+
     @Override
     public String getSensingImage(WktsVo wktsVo) throws Exception {
         System.out.println("开始生成图片");
@@ -71,9 +74,9 @@ public class ImageServiceImpl implements IImageService {
         // 加载并添加 TIFF 栅格图层
         System.out.println("影像地址:" + rsImage);
         File file = new File(rsImage);
-        if(file.exists()){
+        if (file.exists()) {
             System.out.println("文件存在");
-        }else {
+        } else {
             System.out.println("文件不存在");
         }
         Hints tiffHints = new Hints();
@@ -125,7 +128,7 @@ public class ImageServiceImpl implements IImageService {
         // 将地图绘制到图片
         File outputFile = new File(filePath);
         try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile); ImageOutputStream outputImageFile = ImageIO.createImageOutputStream(fileOutputStream);) {
-            int w = 800;
+            int w = imageWith;
             int h = (int) (w * (combinedBounds.getHeight() / combinedBounds.getWidth()));
             BufferedImage bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
             Graphics2D g2d = bufferedImage.createGraphics();
@@ -154,7 +157,7 @@ public class ImageServiceImpl implements IImageService {
             System.out.println(ex);
             ex.printStackTrace();
         }
-        System.out.println("生成图片成功:"+filePath);
+        System.out.println("生成图片成功:" + filePath);
         return filePath;
     }