Ejemplo n.º 1
0
//目标变量的Label.
CTString CEvaluate::GetLabel(int nValue)
{
	int i=0, nSize=0;
	CTString szLabel("");
	
	nSize = m_pDecTree->m_TargetField.FieldLabel.size();
	for (i=0; i<nSize; i++)
	{
		if (nValue == m_pDecTree->m_TargetField.FieldLabel.at(i)->varValue.nVal)
		{
			szLabel = m_pDecTree->m_TargetField.FieldLabel.at(i)->strLabelName;
		}
	}
	if (szLabel.GetLength() < 1)
	{
		szLabel.Format("%d",nValue);
	}
	return szLabel;
}
Ejemplo n.º 2
0
bool ReadFromRetQueue(const string &szQueue, char *pBuffer, int &nRetSize, string szIDCUser = "******",
                       string szAddr = "localhost")
{
    bool bRet = false;
    static const string szDynLabel = "DYNPARAM";
    static const string szEnd   = "DYNEND";

    MQRECORD mrd = PopMessage(szQueue, 2000, szIDCUser, szAddr);
	if(mrd != INVALID_VALUE)
	{
        string szLabel("");
        svutil::TTime ct;
	    unsigned int len = 0;
	    if(GetMessageData(mrd, szLabel, ct, NULL, len))
	    {
            if(szLabel == szDynLabel)
            {
                if(pBuffer && len <= static_cast<unsigned int>(nRetSize))
                {
                    if(!::GetMessageData(mrd, szLabel, ct, pBuffer, len))
                    {
                        memset(pBuffer, 0, nRetSize);
                    }
                    else
                    {
                        nRetSize = len;
                        bRet = true;
                    }
                }
            }
            else if(szLabel == szEnd)
            {
                bRet = true;
            }
        }
    }
    return bRet;
}
void CSignalProcessDlg::OutputResultConfigArgs() //返回正确的配置参数
{
	const unsigned ListCtrlCount = m_Config.GetItemCount(); //获得配置列表行数
	const unsigned ArgsItemSize = m_ConfigArgs.size();
	CString szLabel(_T("----结果----"));
	m_Config.InsertItem(ListCtrlCount, szLabel);

	for (unsigned i=0; i<ArgsItemSize; ++i)
	{
		CString szConfigArgs[4]; 
		szConfigArgs[0] = m_ConfigArgs[i].ArgName;  //参数名称
		szConfigArgs[1].Format(_T("%0.4f"),m_ConfigArgs[i].BeginTime);  //起始时间
		szConfigArgs[2].Format(_T("%0.4f"),m_ConfigArgs[i].EndTime);	//结束时间
		if (szConfigArgs[0] == _T("禁止积分"))
		{
			szConfigArgs[3] = _T("--");
		}
		if (szConfigArgs[0] == _T("手工分峰"))
		{
			szConfigArgs[2] = _T("--");
			szConfigArgs[3] = _T("--");
		}
		if (szConfigArgs[0] == _T("合并峰"))
		{
			szConfigArgs[3] = _T("--");
		}
		if (szConfigArgs[0] == _T("重叠峰处理"))
		{
			if (m_ConfigArgs[i].InputValue == 1)
				szConfigArgs[3] = _T("垂直分峰");
			else if (m_ConfigArgs[i].InputValue == 2)
				szConfigArgs[3] = _T("正切分峰");
			else if (m_ConfigArgs[i].InputValue == 3)
				szConfigArgs[3] = _T("反切分峰");
			else
				szConfigArgs[3] = _T("峰谷基线");
		}
		else if(szConfigArgs[0] == _T("手工调峰"))
		{
			if (m_ConfigArgs[i].InputValue == 11)
				szConfigArgs[3] = _T("起点");
			else if (m_ConfigArgs[i].InputValue == 22)
				szConfigArgs[3] = _T("峰谷");
			else if(m_ConfigArgs[i].InputValue == 33)
				szConfigArgs[3] = _T("终点");

			szConfigArgs[2] = _T("--");
		}
		else
		{
			szConfigArgs[3].Format(_T("%0.2f"),m_ConfigArgs[i].InputValue); //值
		}
		

		if (m_Config.InsertItem(i+ListCtrlCount+1, szConfigArgs[0]) != -1)
		{
			for (int j=1; j<4; ++j)
				if (!m_Config.SetItemText(i+ListCtrlCount+1, j, szConfigArgs[j]))
					TRACE(_T("m_Config.SetItemText false"));
		}
		else
			TRACE(_T("m_Config.InsertItem false"));
	}
}
Ejemplo n.º 4
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 枚举此设备可以使用的所有监测器
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEccAddMonitor1st::EnumMT(const string &szParentID, const string &szDTName, const string &szNetworkSet)
{
    m_szParentID = szParentID;
    m_szNetworkset = szNetworkSet;

    if(szDTName.empty() || m_szDTName == szDTName)
        return ;

    m_szDTName = szDTName;

    // 移除已有的消息绑定
    removeMapping();

    if(m_pContent)
    {
        m_pContent->clear();

        list<int> lsMTID;
        CEccMainView::m_pTreeView->GetDevMTList(szDTName, lsMTID);
        list<int>::iterator lstItem;
        // 枚举每个监测器模板
        for(lstItem = lsMTID.begin(); lstItem != lsMTID.end(); lstItem++)
        {
            int nMTID = (*lstItem);
            // 打开监测器模板
            OBJECT objMonitor = GetMonitorTemplet(nMTID, CEccMainView::m_szIDCUser, CEccMainView::m_szAddr);
            if(objMonitor != INVALID_VALUE)
            {// 成功
                // 主节点
                MAPNODE node = GetMTMainAttribNode(objMonitor);
                if(node != INVALID_VALUE)
                {
                    // 名称 显示 是否隐藏 描述
                    string szLabel(""), szHidden (""), szDesc ("");
                    if(FindNodeValue(node, svLabel, szLabel))
                        szLabel = SVResString::getResString(szLabel.c_str());
                    
                    if(FindNodeValue(node, svDescription, szDesc))
                        szDesc = SVResString::getResString(szDesc.c_str());

                    FindNodeValue(node, svHidden, szHidden);

                    if(szHidden != "true")
                    {
                        int nRow = m_pContent->numRows();

                        // 监测器显示文字
                        WText *pName = new WText(szLabel, m_pContent->elementAt(nRow, 0));
                        if(pName)
                        {
                            // 文字样式
                            sprintf(pName->contextmenu_, "style='color:#1E5B99;cursor:pointer;' onmouseover='" \
                                "this.style.textDecoration=\"underline\"' " \
                                "onmouseout='this.style.textDecoration=\"none\"'");
                            // 绑定 click
                            connect(pName, SIGNAL(clicked()), "showbar();", &m_MTMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC);
                            m_MTMapper.setMapping(pName, nMTID);
                            pName->setToolTip(szLabel);
                            m_lsText.push_back(pName);
                        }
                        new WText(szDesc, m_pContent->elementAt(nRow, 1));

                        m_pContent->GetRow(nRow)->setStyleClass("padding_top");
                        m_pContent->elementAt(nRow, 0)->setStyleClass("widthbold");
                        m_pContent->elementAt(nRow, 1)->setStyleClass("color_2");
                    }
                }
                // 关闭监测器模板
                CloseMonitorTemplet(objMonitor);
            }
        }
    }
}