- 积分
- 2071
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-9-28
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-4-29 00:15:53
|
显示全部楼层
画错的图:
下面是正确的图,用GrDAS画的:
代码如下:
aDataInfo.DimensionSet = PlotDimension.Level_Time;//PlotDimension.Level_Lat;
double y = 36.1;
double x = 115.8;
aDataInfo.LonIndex = (int)((x - 114) * 10 + 1);//经度索引
aDataInfo.LatIndex = (int)((y - 34) * 10); ;//纬度索引
GridData qdata = aDataInfo.GetGridData("TmTd");//.GetGridData_LevelLat(aDataInfo.GetVariableNames()[8]);
SetXYCoords(qdata);
sPlot.LayersLegend1.ActiveMapFrame.MapView.XGridStrs = getTimeLabels(aDataInfo); //getLatLabels(aDataInfo);//
sPlot.LayersLegend1.ActiveMapFrame.MapView.YGridStrs = getLevelLabels(aDataInfo);
sPlot.LayersLegend1.ActiveMapFrame.AddLayer(aLayer);//(aLayer);
Extent aExtent = new Extent();
aExtent.minX = aLayer.Extent.minX;//- 0.1;
aExtent.maxX = aLayer.Extent.maxX;//+ 0.1;
aExtent.minY = aLayer.Extent.minY - 2;//10; //- 0.1;
aExtent.maxY = aLayer.Extent.maxY + 5;// + 0.1;
sPlot.LayersLegend1.ActiveMapFrame.MapView.ZoomToExtent(aExtent);
sPlot.LayersLegend1.Refresh();
private List<string> getTimeLabels(MeteoDataInfo aDataInfo)
{
List<string> latLabels = new List<string>();
List<DateTime> times = aDataInfo.GetTimes();
times.Reverse();
string drawStr;
foreach (DateTime tm in times)
{
drawStr = tm.ToString();
latLabels.Add(drawStr);
}
return latLabels;
} |
|