爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4688|回复: 12

【麻烦王老师解答】学习MeteoInfoDemo代码的一些疑问,

[复制链接]

新浪微博达人勋

发表于 2016-6-27 21:28:17 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 jzd19851102 于 2016-6-29 09:29 编辑

       从知道meteoInfo开始,就感觉到它的强大,很想进行二次开发,特别是源码开放后,甚是激动,不仅仅有使用价值,通过源码学习,也在提高c#的水平。
       准备整体吃透MeteoInfoMap_CSharp-mastercode,结合MeteoInfoLib_CSharp-masterMeteoInfoC.chmMeteoInfoMap_CSharp-master中的code进行系统研究,遇到了不少问题,麻烦王老师在工作之余有空的话予以解读,
    也欢迎其他学习meteoInfo比较早的同学,如果知道的话麻烦解答或者大家一起讨论下。

  1, frmMain()里面  

  这句mapView1.Projection.ProjInfo.Transform.Init(mapView1.Projection.ProjInfo);是什么作用?
  如果没有这句会是什么情况?

    多重属性调用有的晕了 直接看感觉都比较吃力,对照MeteoInfoC.chm看了很久, 如果后面想自己脱离Demo开发,该如何吃透? 才能自如运用?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-27 21:29:04 | 显示全部楼层
2、layersLegend1.ActiveMapFrame.MoveLayer(aLayer.Handle, 2);
这句代码是把相应句柄图层调整至第2层么? 我把2改成0貌似没有变化?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-27 21:31:06 | 显示全部楼层
3、根据二次开发第一次教程,通过如下步骤将这三个控件相互关联起来:
给layersLegend1添加一个MapFrame,点击layersLegend1属性中的MapFrames属性,在弹出的对话框中增加一个MapFrame:
将刚添加的MapFrame的MapView属性设置为mapView1,Active属性设置为True:
将layersLegend1的MapLayout属性设置为mapLayout1:

操作完后,在frmMain.designer.cs中有哪些相应代码的完成上述功能?


另外MeteoInfoDemo显示图层的思路是不是将三个控件关联后,数据图层会同步显示在mapviewMapLayout中。
我在TSMI_GridContour_Click(object sender, EventArgs e)的代码块中,将layersLegend1.Refresh();代码及其后的代码全部注释后,发现无数据图层显示,取消layersLegend1.Refresh();的注释,在Map和Layout中同步显示了数据图层。
调用layersLegend1.Refresh()刷新layersLegend1后即能重绘mapviewMapLayout中的图像

密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-27 21:31:51 | 显示全部楼层
4 LayoutGraphic aTitle = mapLayout1.GetTexts()[0];  []中的0是表示第0图层吗?
类似的aLegend = mapLayout1.GetLegends()[0];
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-27 21:31:58 | 显示全部楼层
5 GetGridData有几个重载版本
public GridData G(int timeIdx, int varIdx, int levelIdx,        int aFactor)
public GridData GetGridData(int timeIdx, int varIdx,int levelIdx)
public GridData GetGridData()
public GridData GetGridData(string varName)
在TSMI_GridVector_Click(object sender, EventArgs e)中,
//Get GridData
            aDataInfo.TimeIndex = 2;
            aDataInfo.LevelIndex = 3;
            GridData tData = aDataInfo.GetGridData("T");
            GridData uData = aDataInfo.GetGridData("U");
            GridData vData = aDataInfo .GetGridData ("V");
上述代码能否用
GridData tData = aDataInfo.GetGridData(2,0("T"),3,1);
   GridData tData = aDataInfo.GetGridData(2,1(" U "),3,1);
GridData tData = aDataInfo.GetGridData(2,2(" V "),3,1);
代替?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-6-27 21:40:42 来自手机 | 显示全部楼层
厉害啊
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2016-6-28 09:36:00 | 显示全部楼层
6. 1、在Program.cs中,
static void Main(string[] args)中,当args.Length == 1时,进入脚本编辑模式,否则是GUI图形应用界面。
  疑问:在程序运行时,如何满足args.Length==1的条件?

点击主窗口的Tools->Script, 执行的是如下代码:         
  frmTextEditor aForm = new frmTextEditor();
aForm.Show();
仅仅是调用了脚本编辑窗口!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-28 09:36:07 | 显示全部楼层
7
private MeteoInfo.Classes.Options _options = new MeteoInfo.Classes.Options();
关于MeteoInfo.Classes命名空间,在MeteoInfo class library help 和MeteoInfoC.chm中没有找到

this.Location = _options.MainFormLocation;
            this.Size = _options.MainFormSize;
            if (_options.ShowStartMeteoDataDlg)
            {
                _frmMeteoData.Show(this);
                _frmMeteoData.Left = this.Left + 10;
                _frmMeteoData.Top = this.Bottom - _frmMeteoData.Height - 40;
            }
          不明白_options的作用,所以不懂上述代码的意思
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-28 09:36:29 | 显示全部楼层
8    public IMapView MapView  
        {
            get { return _mapDocument.ActiveMapFrame.MapView; }
        }
IMapView是接口?  这里为什么不是 public MapView MapView。 用接口有什么好处呢?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-28 09:37:15 | 显示全部楼层
9
      MapDocument.IsLayoutView = false;//
            _mapView.IsLayoutMap = false; //

IsLayoutView和IsLayoutMap属性表示什么意思?
在MeteoInfoLib_CSharp-master找到了IsLayoutView的源码,当MapDocument.IsLayoutView = false;时,执行aMF.IsFireMapViewUpdate = false;,不知道IsFireMapViewUpdate属性什么意思?

        /// Get or set if is layout view
        public bool IsLayoutView
        {
            get { return _isLayoutView; }
            set
            {
                _isLayoutView = value;
                if (_isLayoutView)
                {  if (_mapLayout != null)
                    {
                        foreach (MapFrame aMF in _mapFrames)
                            aMF.IsFireMapViewUpdate = true;
                        if (_mapLayout.HasLegendElement)
                            _mapLayout.ActiveLayoutMap.FireMapViewUpdatedEvent();
                    }
                }
                else
                {   if (_mapLayout != null)
                    {   foreach (MapFrame aMF in _mapFrames)
                            aMF.IsFireMapViewUpdate = false;
                    }
                }
            }
        }
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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