`
yidongkaifa
  • 浏览: 4059670 次
文章分类
社区版块
存档分类
最新评论

MapXtreme2004代码 简单专题图的显示

 
阅读更多

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

说明:这只是个简单的例子,对于不同的地图文件,具体代码有所不同,要修改一些地方。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics