您的位置:首页 > 编程语言

MapXtreme2004代码 简单专题图的显示

2005-01-20 12:13 676 查看
MapControl1.Map.Clear();
MapGeosetLoader gl=new MapGeosetLoader(@"F:/test.gst");
MapControl1.Map.Load(gl);
//打开地图

MapControl1.Map.Load(new MapTableLoader(@"F:/test.tab"));
//打开test.tab地图文件

FeatureLayer lyrPnt=MapControl1.Map.Layers["test"] as FeatureLayer;
RangedTheme thm = new RangedTheme(lyrPnt,"PH__1999","ph",3,DistributionMethod.EqualCountPerRange);
lyrPnt.Modifiers.Insert(0,thm);
//定义一个RangedTheme

ThemeLegendFrame frame = LegendFrameFactory.CreateThemeLegendFrame("PH__1999","pp",thm);

Legend legend = MapControl1.Map.Legends.CreateLegend(new Size(5,5));
legend.Frames.Append(frame);
//定义一个Legend

//MapControl1.Map.Adornments.Append(legend);
//如果保留此句,MapControl1中将显示Legend

LegendControl1.Map = MapControl1.Map;
if (MapControl1.Map.Legends.Count > 0)
{
LegendControl1.Legend = MapControl1.Map.Legends[0];
}
//在LegendControl1控件中显示Legend

说明:这只是个简单的例子,对于不同的地图文件,具体代码有所不同,要修改一些地方。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: