一、设置图色斑图背景为透明

  1. MapLayout mapLayout = new MapLayout();
  2. mapLayout.setPageBackColor(new Color(0,0,0,0));//设置图片背景为无色

二、气象色斑图大小设置

  1. //最小边界经度
  2. double startlon = shapeLayer.getExtent().minX;
  3. //最大边界经度
  4. double endlon = shapeLayer.getExtent().maxX;
  5. //最小边界纬度
  6. double startlat = shapeLayer.getExtent().minY;
  7. //最大边界纬度
  8. double endlat = shapeLayer.getExtent().maxY;
  9. //倍数
  10. int noun = 5;
  11. //经度差值
  12. double xx=endlon-startlon;
  13. //纬度差值
  14. double yy=endlat-startlat;
  15. //获取经纬度差值乘以倍数,也可理解为步长,也可以理解为图片分辨率
  16. int x = (int) (xx*100*noun); //经度(lon)最大最小值差值*100
  17. int y = (int) (yy*100*noun);//纬度(lat)最大最小值差值*100
  18. //边界
  19. Rectangle _pageBounds = new Rectangle();
  20. _pageBounds.x = 0;
  21. _pageBounds.y = 0;
  22. //色斑图外部框架的大小,当前x,y是色斑图的大小
  23. _pageBounds.width = x;
  24. _pageBounds.height = y;
  25. mapLayout.setPageBounds(_pageBounds);
  26. /*******************设置图片大小******************/
  27. LayoutMap layoutMap = mapLayout.getActiveLayoutMap();
  28. layoutMap.setDrawGridLine(true);
  29. layoutMap.setDrawNeatLine(false);
  30. layoutMap.setDrawGridLabel(false);
  31. layoutMap.setDrawGridTickLine(false);
  32. //创建mapView对象
  33. MapFrame mapFrame = mapLayout.getActiveMapFrame();
  34. //设置图片高宽
  35. int cx = 0;
  36. int cy = 0;
  37. //cw越大色斑图越往右靠,ch越大越往下
  38. int cw = x;
  39. int ch = y;
  40. mapFrame.setActive(true);
  41. mapFrame.setLayoutBounds(new Rectangle(cx, cy, cw, ch));