- 积分
- 55
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-9-5
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-10-20 14:39:41
|
显示全部楼层
本帖最后由 guba82 于 2014-10-20 14:41 编辑
这是详细的错误信息
就是在我程序控制添加新层的时候出错了。
详细代码
string Titletxt, Datetxt;
MeteoDataInfo aDataInfo = new MeteoDataInfo();
aDataInfo.OpenMICAPSData(YbFileName);
MeteoInfoC.Data.MeteoData.MICAPS3DataInfo M3DataInfo = (MeteoInfoC.Data.MeteoData.MICAPS3DataInfo)aDataInfo.DataInfo;
Titletxt = M3DataInfo.Description.ToString().Substring(10);
Datetxt = M3DataInfo.DateTime.ToShortDateString();
StationData stationData=aDataInfo.GetStationData("Var1");
//Interpolate
GridDataSetting aGDP = new GridDataSetting();
aGDP.DataExtent.minX = 110.354;
aGDP.DataExtent.maxX = 116.644;
aGDP.DataExtent.minY = 31.384;
aGDP.DataExtent.maxY = 36.874;
aGDP.XNum = 200;
aGDP.YNum = 200;
InterpolationSetting gridInterp = new InterpolationSetting();
gridInterp.GridDataSet = aGDP;
gridInterp.InterpolationMethod = InterpolationMethods.IDW_Radius;
gridInterp.Radius = 0.5;
gridInterp.MinPointNum = 1;
double[] X = new double[1];
double[] Y = new double[1];
ContourDraw.CreateGridXY(gridInterp.GridDataSet, ref X, ref Y);
double[,] S = stationData.Data;
S = ContourDraw.FilterDiscreteData_Radius(S, gridInterp.Radius,
gridInterp.GridDataSet.DataExtent, 9999);
GridData gridData = ContourDraw.InterpolateDiscreteData_Radius(S,
X, Y, gridInterp.MinPointNum, gridInterp.Radius, 9999);
//Create legend scheme
bool hasNoData = true;
LegendScheme aLS = LegendManage.CreateLegendSchemeFromGridData(gridData, LegendType.GraduatedColor,
ShapeTypes.Polygon, ref hasNoData);
((PolygonBreak)aLS.LegendBreaks[0]).DrawFill = false;
//Create layer
VectorLayer aLayer = new VectorLayer(ShapeTypes.Polygon);
if (IsJcData)
{
aLayer = DrawMeteoData.CreateShadedLayer(gridData, aLS, Datetxt + "监测等级", "Dj");
}
else if (IsYbData)
{
aLayer = DrawMeteoData.CreateShadedLayer(gridData, aLS, Datetxt + "预警等级", "Dj");
}
aLayer.IsMaskout = true;
aLayer.LegendScheme.ImportFromXMLFile(Application.StartupPath + "\\DjColor.lgs");
//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.SetFont("黑体", 18); //设置标题为小二号黑体
aTitle.SetLabelText(Titletxt);
//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 = LegendStyles.Normal;
aLegend.LegendLayer = aLayer;
TitleLegend = aLegend;
if (xtraTabControl1.SelectedTabPageIndex == 1)
mapLayout1.PaintGraphics();
xtraTabControl1.SelectedTabPageIndex = 1;
|
|