MapXtreme2004代码 简单专题图的显示

博客给出一段代码示例,展示了地图文件的加载操作,包括清除地图、加载.gst和.tab文件。还定义了RangedTheme主题和Legend图例,并说明了如何在LegendControl1控件中显示图例,同时指出不同地图文件代码需修改。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值