UI(四)之拓扑图创建

关键函数:

1.LoadMap

void CTopology::LoadMap()
{
    //m_map.RemoveAllLayers();

    AddLayersBasemap();

    //AddLayerCell();    
    AddLayerLine();
    AddLayerStation();

    m_map.ZoomToMaxExtents();
    m_map.Redraw();
    
}

包含5个函数

1.1 AddLayersBasemap();

  加载底图,暂时用不到

1.2//AddLayerCell();

  添加网图

1.3AddLayerLine();

  界面添加基线参数

1.4AddLayerStation();

  添加基站图层

1.5m_map.ZoomToMaxExtents();

void CMap1::ZoomToMaxExtents()
{
    InvokeHelper(0x1e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

1.6m_map.Redraw();

void CMap1::Redraw()
{
    InvokeHelper(0x15, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

2.BOOL CTopology::OnInitDialog()  包括1的LoadMap

3.BOOL CTopology::PreTranslateMessage(MSG* pMsg)  包括1的LoadMap

4.很多函数的的初始化都调用了 CPropertyPage::OnInitDialog(); 其中包括前面的函数  CTopology::OnInitDialog() 

其在头文件afxwin.h的定义为:

// Overridables (special message map entries)  翻译为可重写项(特殊消息映射项)
    virtual BOOL OnInitDialog();

意思是初始化函数的作用是虚函数重写,实现对话框初始化。

实现函数是:

BOOL CDialog::OnInitDialog()
{
    // execute dialog RT_DLGINIT resource    执行对话资源
    BOOL bDlgInit;
    if (m_lpDialogInit != NULL)
        bDlgInit = ExecuteDlgInit(m_lpDialogInit);
    else
        bDlgInit = ExecuteDlgInit(m_lpszTemplateName);

    if (!bDlgInit)
    {
        TRACE(traceAppMsg, 0, "Warning: ExecuteDlgInit failed during dialog init.\n");
        EndDialog(-1);
        return FALSE;
    }

    // transfer data into the dialog from member variables
    if (!UpdateData(FALSE))
    {
        TRACE(traceAppMsg, 0, "Warning: UpdateData failed during dialog init.\n");
        EndDialog(-1);
        return FALSE;
    }

    // enable/disable help button automatically
    CWnd* pHelpButton = GetDlgItem(ID_HELP);
    if (pHelpButton != NULL)
        pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE);

    return TRUE;    // set focus to first one
}

主要执行了三项操作:1、资源初始化;2、通过member数据初始化CEdit等,UpdateData(FLASE)3、就是Help按钮的处理,有此按钮就显示。

AddLayersBasemap

猜你喜欢

转载自www.cnblogs.com/liuliwei-leo/p/10424954.html