爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4453|回复: 6

关于图层显示问题

[复制链接]

新浪微博达人勋

发表于 2012-5-2 10:10:45 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
mapframe1.MapView = mapView1;
            mapframe1.Active = true;
            G_LayerLegend.MapFrames.Add(mapframe1);
            this.splitContainer1.Panel1.Controls.Add(G_LayerLegend);
            G_LayerLegend.Dock = DockStyle.Fill;
            mapView1.Dock = DockStyle.Fill;
TabPage TabPageonehour = new TabPage();
            TabPageonehour.Name = "TabPageqyz";
            this.tabControl1.TabPages.Add(TabPageonehour);
            tabControl1.SelectedTab = TabPageonehour;
            tabControl1.SelectedTab.Controls.Add(mapView1);
            //Open default project file            
            string aFile = Application.StartupPath + "\\rainlayers.mip";
            if (File.Exists(aFile))
            {
                m_ProjectFilePicM.LoadProjFile(aFile);
            }
            //Set window size
            this.Width = 1200;
            this.Height = 900;
            mapView1.LockViewUpdate = false;
            G_LayerLegend.MapFrames[0].MapView.MaskOut.MaskLayer = "卢氏县";
            G_LayerLegend.MapFrames[0].Text = "地图图层";
            G_LayerLegend.Refresh();
mapview1的地图能加载但是G_LayerLegend里面的图层不能对应显示。
m_ProjectFilePicM.LoadProjFile(aFile);
函数如下:
m_FileName = aFile;
            XmlDocument doc = new XmlDocument();
            
            doc.Load(aFile);
            XmlElement root = doc.DocumentElement;
            
            //Load elements
            frmain.G_LayerLegend.ActiveMapFrame.MapView.LockViewUpdate = true;
            
            //Load MapView content
            frmain.G_LayerLegend.ActiveMapFrame.MapView.ImportProjectXML(r

oot);
            frmain.G_LayerLegend.ActiveMapFrame.MapView.LockViewUpdate = false;
            frmain.G_LayerLegend.ActiveMapFrame.MapView.PaintLayers();
这是由于什么原因造成的?
未命名.bmp
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-5-2 11:19:33 | 显示全部楼层
在LayersLegend的MapFrame中添加图层,会在LayersLegend中添加图层节点,并给MapFrame中的MapView添加上该图层,反之则不然。也就是说给MapView添加图层并不能自动给其所属的LayersLegend加上图层节点,因此要用LayersLegend的ImportProjectXML方法来加载图层:

frmMain.G_LayersLegend.ImportProjectXML(root);
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-2 11:39:35 | 显示全部楼层
frmMain.G_LayersLegend.ImportProjectXML(root);改成这样以后反而mapview1里面没有地图显示了。还需要修改其他设置吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-2 11:44:59 | 显示全部楼层
知道了,再把mapframe的mapview赋值给mapview1,多谢
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-2 15:39:54 | 显示全部楼层
还有问题,这样做以后this.mapView1.MouseMove += new MouseEventHandler(this.MapView_MouseMove);反而不触发了。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-5-2 15:49:23 | 显示全部楼层

可以把添加事件的这行代码放在后面
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-5-2 15:59:55 | 显示全部楼层
可能是使用函数的缘故,不使用函数了就可以了。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表