|
阅读:997回复:0
MapXtreme2004代码(简单专题图的显示)
MapControl1.Map.Clear();<br>MapGeosetLoader gl=new MapGeosetLoader(@"F:\test.gst");<br>MapControl1.Map.Load(gl);<br>//打开地图<br><br>MapControl1.Map.Load(new MapTableLoader(@"F:\test.tab"));<br>//打开test.tab地图文件<br><br>FeatureLayer lyrPnt=MapControl1.Map.Layers["test"] as FeatureLayer;<br>RangedTheme thm = new RangedTheme(lyrPnt,"PH__1999","ph",3,DistributionMethod.EqualCountPerRange);<br>lyrPnt.Modifiers.Insert(0,thm);<br>//定义一个RangedTheme<br><br>ThemeLegendFrame frame = LegendFrameFactory.CreateThemeLegendFrame("PH__1999","pp",thm);<br><br>Legend legend = MapControl1.Map.Legends.CreateLegend(new Size(5,5));<br>legend.Frames.Append(frame);<br>//定义一个Legend<br><br>//MapControl1.Map.Adornments.Append(legend);<br>//如果保留此句,MapControl1中将显示Legend<br><br>LegendControl1.Map = MapControl1.Map;<br>if (MapControl1.Map.Legends.Count > 0) <br>{<br>LegendControl1.Legend = MapControl1.Map.Legends[0];<br>}<br>//在LegendControl1控件中显示Legend<br><br>说明:这只是个简单的例子,对于不同的地图文件,具体代码有所不同,要修改一些地方。<br><br>
[此贴子已经被作者于2005-6-29 13:56:11编辑过]
|
|
|