- //组件初始化
- MapLayout layout=new MapLayout();
- layout.setSize(2970, 2100);
- layout.setBackground(new Color(255, 255, 255, 0));
- MapFrame mapFrame=layout.getActiveMapFrame();
- MapView mapView =mapFrame.getMapView();
- //加载clip图层
- VectorLayer clipLayer = MapDataManage.readMapFile_ShapeFile(SavePath.CONFIGPATH+"市界.shp");
- //加载站点数据
- CountourDAO dao=new CountourDAOImpl();
- List<MapRainInfoVO> vo=dao.queryRainInfoForContour(start,end);
- StationData stationData = new StationData();
- for(int i=0;i<vo.size()-1;i++){
- stationData.addData(vo.get(i).getStcd(),
- vo.get(i).getLttd(), vo.get(i).getLgtd(), vo.get(i).getQuery()); //站点名称,经度,维度,值
- }
- GridDataSetting gridDataSetting=new GridDataSetting();
- gridDataSetting.dataExtent = clipLayer.getExtent();
- stationData.projInfo = clipLayer.getProjInfo();
- gridDataSetting.xNum = 2000;// 格点点数
- gridDataSetting.yNum = 950;// 格点点数
- //绘制等值线 剪切图层
- InterpolationSetting interSet = new InterpolationSetting();
- interSet.setGridDataSetting(gridDataSetting);
- interSet.setInterpolationMethod(InterpolationMethods.IDW_Radius);
- interSet.setRadius(5);
- interSet.setMinPointNum(1);
- GridData gridData = stationData.interpolateData(interSet);
- LegendScheme legendScheme =LegendManage.createLegendSchemeFromGridData(gridData, LegendType.UniqueValue,ShapeTypes.Polygon);
- VectorLayer contourLayer = DrawMeteoData.createShadedLayer(gridData, legendScheme, "ContourLayer", "Data",true);
- VectorLayer lastLayer = contourLayer.clip(clipLayer);
- lastLayer.setProjInfo(clipLayer.getProjInfo());
- mapView.addLayer(clipLayer);
- mapView.addLayer(lastLayer);
- mapView.setGridXDelt(0.2);
- mapView.setGridYDelt(0.5);
老师,这段是我绘制的java代码,最小值的设置没有搞明白 |