Sfoglia il codice sorgente

图片大小动态配置

gushoubang 8 mesi fa
parent
commit
c37d1528ef

+ 4 - 1
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("开始生成图片");
@@ -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 = 1000;
+            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();