登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请问用JAVA+meteoinfo制作色斑图无法显示站点名只能显示站点值是为什么啊?
- //图片分辨率
- int[] imageSize = {suferImage.getWidth(), suferImage.getHeight()};
- //画布大小
- int[] layoutSize = {595, 410};
- //画布偏移
- int[] layoutOffset = {20, 105};
- //创建画图
- //初始化
- MapLayout mapLayout = new MapLayout();
- mapLayout.setBackground(new Color(255, 255, 255, 0));
- mapLayout.setFont(new Font("微软雅黑", Font.BOLD, suferImage.getFontSize()));
- mapLayout.getLayoutMaps().get(0);
- //图片分辨率
- mapLayout.setSize(imageSize[0], imageSize[1]);
- mapLayout.setPageBounds(new Rectangle(0, 0, imageSize[0], imageSize[1]));
- mapLayout.getActiveLayoutMap().setLeft(layoutOffset[0]);
- mapLayout.getActiveLayoutMap().setTop(layoutOffset[1]);
- mapLayout.getActiveLayoutMap().setWidth(layoutSize[0]);
- mapLayout.getActiveLayoutMap().setHeight(layoutSize[1]);
- LayoutMap layoutMap = mapLayout.getActiveLayoutMap();
- layoutMap.setDrawGridLine(false);
- layoutMap.setDrawNeatLine(false);
- layoutMap.setDrawGridLabel(false);
- layoutMap.setDrawGridTickLine(false);
- //创建mapView对象
- MapFrame mapFrame = mapLayout.getActiveMapFrame();
- MapView mapView = mapFrame.getMapView();
- //格点配置
- GridDataSetting gridDataSetting = new GridDataSetting();
- gridDataSetting.dataExtent = shapeLayer.getExtent();
- gridDataSetting.xNum = 100;
- gridDataSetting.yNum = 100;
- //站点插值配置
- InterpolationSetting interpolationSetting = new InterpolationSetting();
- interpolationSetting.setInterpolationMethod(InterpolationMethods.IDW_Neighbors);
- interpolationSetting.setMinPointNum(3);
- interpolationSetting.setGridDataSetting(gridDataSetting);
- //站点插值成格点数据
- GridData gridData = stationData.interpolateData(interpolationSetting);
- //等值面分析
- // 站点
- VectorLayer stPointLayer = null;
- if (suferImage.isShowStationValue()) {
- stPointLayer = DrawMeteoData.createSTPointLayer(stationData, "站点值", "Data");
- }else{
- stPointLayer = DrawMeteoData.createSTPointLayer(stationData, "站点名", "Stid");
- }
- // 是否显示数值
- if(suferImage.isShowStationValue()){
- LabelSet labelSet = new LabelSet();
- labelSet.setFieldName("Data");
- labelSet.setDrawLabels(true);
- labelSet.setAutoDecimal(true);
- labelSet.setAvoidCollision(true);
- stPointLayer.setLabelSet(labelSet);
- stPointLayer.addLabels();
- }
- // 是否显示站名(无论写什么只能显示站值)
- if(suferImage.isShowStationName()){
- LabelSet labelSet = stPointLayer.getLabelSet();
- labelSet.setFieldName("Stid");
- labelSet.setDrawLabels(true);
- labelSet.setAutoDecimal(false);
- labelSet.setAvoidCollision(true);
- stPointLayer.setLabelSet(labelSet);
- stPointLayer.addLabels();
- }
复制代码
|