- 积分
- 1486
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-10-27
- 最后登录
- 1970-1-1
|
发表于 2012-11-15 19:18:44
|
显示全部楼层
本帖最后由 ♂雨已~○ 于 2012-11-15 19:19 编辑
王老师,我用你新更新的文件再执行以前你给的MeteoinfoDemo的时候,下面这几句代码不行了,不知道王老师在最新版的文件中把这个 GridDataPara类弄到哪儿呢?还是给去掉了?用了新更新的文件这个插值功能就不行了!- private void TSMI_StationShaded_Click(object sender, EventArgs e)
- {
- this.Cursor = Cursors.WaitCursor;
- //Read data info
- MeteoDataInfo aDataInfo = new MeteoDataInfo();
- string aFile = Application.StartupPath + "\\Sample\\rain_2008072220.csv";
- aDataInfo.OpenLonLatData(aFile);
- //Get station data
- StationData stationData = aDataInfo.GetStationData("Precipitation6h");
- //Interpolate
- GridDataPara aGDP = new GridDataPara();
- aGDP.dataExtent.minX = 60;
- aGDP.dataExtent.maxX = 140;
- aGDP.dataExtent.minY = -20;
- aGDP.dataExtent.maxY = 60;
- aGDP.xNum = 80;
- aGDP.yNum = 80;
- GridInterpolation gridInterp = new GridInterpolation();
- gridInterp.GridDataParaV = aGDP;
- gridInterp.GridInterMethodV = GridInterMethod.IDW_Radius;
- gridInterp.Radius = 2;
- gridInterp.MinPointNum = 1;
- double[] X = new double[1];
- double[] Y = new double[1];
- ContourDraw.CreateGridXY(gridInterp.GridDataParaV, ref X, ref Y);
- double[,] S = stationData.Data;
- S = ContourDraw.FilterDiscreteData_Radius(S, gridInterp.Radius,
- gridInterp.GridDataParaV.dataExtent, stationData.UNDEF);
- GridData gridData = ContourDraw.InterpolateDiscreteData_Radius(S,
- X, Y, gridInterp.MinPointNum, gridInterp.Radius, stationData.UNDEF);
- //Create legend scheme
- bool hasNoData = true;
- LegendScheme aLS = LegendManage.CreateLegendSchemeFromGridData(gridData, LegendType.GraduatedColor,
- ShapeTypes.Polygon, ref hasNoData);
- ((PolygonBreak)aLS.breakList[0]).DrawFill = false;
- //Create layer
- VectorLayer aLayer = new VectorLayer(ShapeTypes.Polygon);
- aLayer = DrawMeteoData.CreateShadedLayer(gridData, aLS, "Rain", "Rain");
- aLayer.IsMaskout = true;
- //Add layer
- layersLegend1.ActiveMapFrame.AddLayer(aLayer);
- layersLegend1.ActiveMapFrame.MoveLayer(aLayer.Handle, 0);
- layersLegend1.Refresh();
- //Change title of the layout
- LayoutGraphic aTitle = mapLayout1.GetTexts()[0];
- aTitle.SetLabelText("MeteoInfo Class Library Demo - Station Shaded Layer");
- //Add or change the legend in layout
- LayoutLegend aLegend;
- if (mapLayout1.GetLegends().Count > 0)
- aLegend = mapLayout1.GetLegends()[0];
- else
- aLegend = mapLayout1.AddLegend(650, 100);
- aLegend.LegendStyle = LegendStyleEnum.Bar_Vertical;
- aLegend.LegendLayer = aLayer;
- if (tabControl1.SelectedIndex == 1)
- mapLayout1.PaintGraphics();
- this.Cursor = Cursors.Default;
复制代码
|
|