Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

liwh 1 год назад
Родитель
Сommit
5a9be586ae
1 измененных файлов с 10 добавлено и 5 удалено
  1. 10 5
      tile-service/src/main/java/cn/com/taiji/tile/util/TileUtils.java

+ 10 - 5
tile-service/src/main/java/cn/com/taiji/tile/util/TileUtils.java

@@ -65,9 +65,6 @@ public class TileUtils {
         Graphics2D g = (Graphics2D) image.getGraphics();
         g.setColor(Color.GREEN);
         for (POI poi : poiList) {
-            int[] pxy = TileUtils.toPixelXY(poi.getLon(), poi.getLat(), bbox[0], bbox[1], bbox[2], bbox[3]);
-            g.drawArc(pxy[0], pxy[1], 6, 6, 0, 360);
-            g.fillArc(pxy[0], pxy[1], 6, 6, 0, 360);
             TileUtils.drawShapeToTile(poi, g, bbox, 1);
         }
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@@ -81,11 +78,18 @@ public class TileUtils {
 
     public static void drawShapeToTile(POI poi, Graphics2D graphics, double[] bbox, int lineSize) {
         Geometry shape = GeoUtils.getGeoUtils().createGeometry(poi.getShape());
-        if (shape != null && shape.getCoordinates() != null && (shape.getCoordinates()).length > 1 &&
-                StringUtils.isNotBlank(poi.getPcolor()) && StringUtils.indexOf(poi.getPcolor(), "rgb(") >= 0) {
+        if(StringUtils.isNotBlank(poi.getPcolor())) {
             String[] rgb = StringUtils.substring(poi.getPcolor(), poi.getPcolor().indexOf("rgb(") + 4, poi.getPcolor().length() - 1).split(",");
             Color color = new Color(Integer.parseInt(rgb[0].trim()), Integer.parseInt(rgb[1].trim()), Integer.parseInt(rgb[2].trim()));
             graphics.setColor(color);
+        }
+        if(shape!=null&&shape.getCoordinate()!=null&&StringUtils.equals(shape.getGeometryType(),"Point")){
+            int[] pxy = TileUtils.toPixelXY(shape.getCoordinate().getX(),shape.getCoordinate().getY(), bbox[0], bbox[1], bbox[2], bbox[3]);
+            graphics.drawArc(pxy[0], pxy[1], 6, 6, 0, 360);
+            graphics.fillArc(pxy[0], pxy[1], 6, 6, 0, 360);
+        }
+        if (shape != null && shape.getCoordinates() != null && (shape.getCoordinates()).length > 1 &&
+                StringUtils.isNotBlank(poi.getPcolor()) && StringUtils.indexOf(poi.getPcolor(), "rgb(") >= 0) {
             if (StringUtils.equals(shape.getGeometryType(), "Polygon") ||
                     StringUtils.equals(shape.getGeometryType(), "LinearRing") ||
                     StringUtils.equals(shape.getGeometryType(), "LineString") ||
@@ -127,4 +131,5 @@ public class TileUtils {
         return new int[]{dx, dy};
     }
 
+
 }