示例#1
0
文件: Caculate.cpp 项目: wyrover/GDES
bool Calculate::MinePreGasCacul( const AcStringArray& baseDatas,const AcStringArray& listDatas,CString& strRet )
{
	if(baseDatas.isEmpty() || listDatas.isEmpty()) return false;
	doubleVector dBaseDatas,dListDatas;
	StringsToNum(baseDatas,dBaseDatas);
	StringsToNum(listDatas,dListDatas);
	if(dBaseDatas[4] <= 0) return false;
	if(abs(dBaseDatas[0] - dBaseDatas[1]) < 0.00001) return false;
	int faceNum = (int)dBaseDatas[6];
	double sumFace = 0;
	for(int j = 0; j < faceNum; j++)
	{
		double length = dListDatas[5*j];
		double height = dListDatas[5*j+1];
		double dencity = dListDatas[5*j+2];
		double dayAdvance = dListDatas[5*j + 3];
		double recovRate = dListDatas[5*j+4];

		double temp = length*height*dencity*dayAdvance*0.01*recovRate;
		sumFace += temp;
	}

	double ret = dBaseDatas[3]*0.01*dBaseDatas[2]*0.0001/dBaseDatas[4]/(dBaseDatas[0] - dBaseDatas[1]) + dBaseDatas[5]*330*0.0001*sumFace;
	strRet.Format(_T("%.2lf"),ret);
	return true;

}
示例#2
0
void FieldInfoDlg::fillVarList()
{
    m_varList.ResetContent();   // 清空列表

    AcStringArray names;
    switch( m_lt )
    {
    case LT_STRING:
        StringListHelper::GetAllNames( names );
        break;

    case LT_INT:
        IntStrListHelper::GetAllNames( names );
        break;

    case LT_OBJECT:
        DataObjectListHelper::GetAllNames( names );
        break;
    }

    if( names.isEmpty() ) return;

    int index = names.find( m_varName );
    if( index < 0 ) m_varName = _T( "" ); // 清空

    int len = names.length();
    for( int i = 0; i < len; i++ )
    {
        m_varList.AddString( names[i].kACharPtr() );
    }
    m_varList.SetCurSel( index );
}
示例#3
0
bool PropertyDataDlgHelper::DisplayPropertyDataDlg( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return false;

    AcDbObjectId dObjId;
    if( !DataHelper::GetDataObject( objId, dObjId ) ) return false;

    CString type;
    if( !DataHelper::GetTypeName( objId, type ) ) return false;

    AcStringArray fields;
    FieldHelper::GetAllFields( type, fields );
	//acutPrintf(_T("\n类型:%s"),type);
    if( fields.isEmpty() )
    {
        CString msg;
        //msg.Format(_T("类型:%s的字段个数为0,没有数据可以显示..."), type);
        msg.Format( _T( "没有数据可以显示..." ) );
        AfxMessageBox( msg );
        return false;
    }
    else
    {
		DisplayPartialPropertyDataDlg( dObjId, fields );
        return true;
    }
}
示例#4
0
void BlockDraw::explodeBlock( AcGeVoidPointerArray& ents )
{
    // 填充属性数据
    AcStringArray names;
    regPropertyDataNames( names );
    if( names.isEmpty() )
    {
        acutPrintf( _T( "\n没有注册要提取的字段..." ) );
        return;
    }

    if( names.length() != m_attValues.length() )
    {
        acutPrintf( _T( "\n注册的属性数据与读取的数据个数不相等!" ) );
        return;
    }

    AcDbObjectId blkId = GetBlockDefinitionByName( m_blockName );
    if( blkId.isNull() )
    {
        acutPrintf( _T( "\n未知的块定义:%s" ), m_blockName );
        return;
    }

    // 计算变换矩阵
    AcGeMatrix3d blkXform = GetBlockTransformMatrix( blkId, m_insertPt, m_angle, m_scale );

    // 分解块定义
    BlockToEntity( blkId, blkXform, names, m_attValues, ents );
}
示例#5
0
bool PropertyDataDlgHelper::DisplayPropertyByFunName( const AcDbObjectId& objId, const CString funName )
{
	if( objId.isNull() ) return false;

	AcDbObjectId dObjId;
	if( !DataHelper::GetDataObject( objId, dObjId ) ) return false;

	CString type;
	if( !DataHelper::GetTypeName( objId, type ) ) return false;

	AcStringArray fields;
	FuncFieldHelper::GetFields(funName,type,fields);
	//for (int i = 0; i < fields.length(); i++)
	//{
	//	acutPrintf(_T("\n功能:%s\t字段:%s"),funName,fields[i]);
	//}
	//FieldHelper::GetAllFields( type, fields );
	if( fields.isEmpty() )
	{
		CString msg;
		//msg.Format(_T("类型:%s的字段个数为0,没有数据可以显示..."), type);
		msg.Format( _T( "没有数据可以显示..." ) );
		AfxMessageBox( msg );
		return false;
	}
	InputPropertyDataDlg( dObjId, fields,funName );
	return true;
}
示例#6
0
bool PropertyDataUpdater::BuildPropGridCtrl( CMFCPropertyGridCtrl* pPropDataList, const CString& type, const AcStringArray& fields )
{
    if( pPropDataList == NULL ) return false;
    if( type.GetLength() == 0 ) return false;
    if( fields.isEmpty() ) return false;

    // 清空已添加的属性
    pPropDataList->RemoveAll();
    //acutPrintf(_T("\n清空所有属性..."));

    // 创建MFCPropertyGridCtrlHelper对象
    // 同时初始化m_propertyDataList的属性
    // 参见MFCPropertyGridCtrlHelper的构造函数
    MFCPropertyGridCtrlHelper pgch( pPropDataList );

    int len = fields.length();
    for( int i = 0; i < len; i++ )
    {
        CString name = fields[i].kACharPtr();

        FieldInfo info; // 默认设置(DT_STRING, m_enable=true, m_descr =_T(""))
        FieldInfoHelper::ReadFieldInfo( type, name, info );

        // 构建PropertyList
        BuildPropList( pgch, name, _T( "" ), info ); // 赋予空字符串
    }

    //PrintPropList(pPropDataList);

    return true;
}
示例#7
0
bool ArxClassHelper::GetTopParentClass( const CString& type, CString& parentType )
{
    AcStringArray types;
    GetClassHierarchy( type, types, false );
    if( types.isEmpty() ) return false;	   // type本身就是抽象类

    parentType = types.first().kACharPtr();
    return true;
}
示例#8
0
文件: Caculate.cpp 项目: wyrover/GDES
/*
 * 参数1代表
 *	|-0矿井相对瓦斯涌出量
 *	|-1矿井总回风巷瓦斯浓度
 *	|-2当地大气压
 *	|-3矿井最大总回风风量
 *	|-4抽采系统工况系数
 *	|-5瓦斯泵台数
 * 参数2代表
 * 单台瓦斯泵额定流量、瓦斯抽采浓度、瓦斯泵压力、抽采泵富余系数、每套抽采主管道实际内径、每套管道混合经济流速、管道富余系数
 * 参数3代表计算结果
*/
bool Calculate::MineGasCapacityCacul( const AcStringArray& baseDatas,const AcStringArray& pumpDatas,CString& strPumpRet,CString& strSysRet )
{
	if(baseDatas.isEmpty() || pumpDatas.isEmpty()) return false;
	doubleVector dBaseDatas,dPumpDatas;
	StringsToNum(baseDatas,dBaseDatas);
	StringsToNum(pumpDatas,dPumpDatas);
	if(dBaseDatas[0] <= 0) return false;
	int pumpNum = (int)dBaseDatas[5];
	double sumPump = 0;
	double sumTube = 0;
	for(int j = 0; j < pumpNum; j++)
	{
		double pumpQ = dPumpDatas[7*j];
		double pumpCon = dPumpDatas[7*j+1];
		double pumpP = dPumpDatas[7*j+2];
		double pumpKP = dPumpDatas[7*j + 3];
		double tubeD = dPumpDatas[7*j+4];
		double tubeV = dPumpDatas[7*j+5];
		double tubeKS = dPumpDatas[7*j+6];

		double tmp1 = pumpQ * pumpCon* 0.01 * dBaseDatas[4] * (dBaseDatas[2]-pumpP);
		double temp = tmp1 / pumpKP / 101.325;
		sumPump += temp;

		double tmp2 = (tubeD / 0.1457) * (tubeD / 0.1457) * tubeV * pumpCon * 0.01  * (dBaseDatas[2]-pumpP);
		double temp2 = tmp2 / tubeKS / 101.325;
		sumTube += temp2;

		//acutPrintf(_T("\n第%d台泵\t Q:%.2lf,C:%.2lf,P:%.2lf"),j+1,pumpQ,pumpCon,pumpP);
	}

	double ret = (dBaseDatas[1]*0.01*dBaseDatas[3] + sumPump) * 330 * 1440 * 0.0001 / dBaseDatas[0];
	strPumpRet.Format(_T("%.2lf"),ret);

	ret = (dBaseDatas[1]*0.01*dBaseDatas[3] + sumTube) * 330 * 1440 * 0.0001 / dBaseDatas[0];
	strSysRet.Format(_T("%.2lf"),ret);

	//for(int i = 0 ; i < dBaseDatas.size(); i++)
	//{
	//	acutPrintf(_T("\n第%d个值:%.2lf"),i+1,dBaseDatas[i]);
	//}
	//acutPrintf(_T("\n第一个值:%.2lf\t第二个值:%.2lf\t第三个值:%.2lf"),dBaseDatas[1]*0.01*dBaseDatas[3],sumPump,330 * 1440 * 0.0001 / dBaseDatas[0]);
	return true;
}
示例#9
0
文件: Caculate.cpp 项目: wyrover/GDES
bool Calculate::MineRateGasCacul( const AcStringArray& datas,CString& strRet )
{
	if(datas.isEmpty()) return false;
	doubleVector dDatas;
	StringsToNum(datas,dDatas);

	if(dDatas[0] <= 0) return false;
	double ret = dDatas[1] * 330 * 1440 * 0.0001 / dDatas[0];
	strRet.Format(_T("%.2lf"),ret);
	return true;
}
示例#10
0
文件: Caculate.cpp 项目: wyrover/GDES
bool Calculate::MineGasRealCacul( const AcStringArray& datas,CString& strYearRet )
{
	if(datas.isEmpty()) return false;
	doubleVector dDatas;
	StringsToNum(datas,dDatas);

	if(dDatas[4] <= 0) return false;
	double ret = (dDatas[2]*0.01*dDatas[3] + dDatas[0]/dDatas[4]/365/1440) * 330 * 1440 * 0.0001 / dDatas[1];
	//acutPrintf(_T("\nQs:%.2lf,k:%.2lf"),dDatas[0],dDatas[4]);
	//acutPrintf(_T("\n第一个值:%.2lf\t第二个值:%.2lf\t第三个值:%.2lf"),dDatas[2]*0.01*dDatas[3], dDatas[0]/dDatas[4]/365/1440,330 * 1440 * 0.0001 / dDatas[1]);

	strYearRet.Format(_T("%.2lf"),ret);
	return true;
}
示例#11
0
bool StringListHelper::AddStringList( const CString& name, const AcStringArray& strList )
{
    if( ( name.GetLength() == 0 ) || strList.isEmpty() ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( STRING_LIST_DICT );
    bool ret = pDictTool->findKey( name );
    if( !ret ) // 如果变量name已存在,则不进行修改
    {
        int len = strList.length();
        for( int i = 0; i < len; i++ )
        {
            pDictTool->addEntry( name, strList[i].kACharPtr() );
        }
    }
    delete pDictTool;
    return !ret;
}
示例#12
0
void PropertyDataDlgHelper::DisplayPartialPropertyDataDlg( const AcDbObjectId& objId, const AcStringArray& fields )
{
    if( objId.isNull() ) return;
    if( fields.isEmpty() ) return;

    // 切换资源
    CAcModuleResourceOverride myResources;

    PropertyDataDlg pdd;
    pdd.showAllData( true );
    pdd.setMineGE( objId );
    int len = fields.length();
    for( int i = 0; i < len; i++ )
    {
        pdd.addField( fields[i].kACharPtr() );
		//acutPrintf(_T("\n字段:%s"),fields[i].kACharPtr());
    }
    pdd.DoModal();
}
示例#13
0
bool ArxClassHelper::GetAllTopParentClass( const CString& root, AcStringArray& types )
{
    AcStringArray allGETypes;
    ArxClassHelper::GetArxClassTypes( root, allGETypes, false );
    if( allGETypes.isEmpty() ) return false;

    int len = allGETypes.length();
    for( int i = 0; i < len; i++ )
    {
        CString parentType;
        if( !ArxClassHelper::GetTopParentClass( allGETypes[i].kACharPtr(), parentType ) ) continue;
        if( allGETypes[i].compareNoCase( parentType ) != 0 ) continue;
        if( !types.contains( parentType ) )
        {
            types.append( parentType );
        }
    }
    return true;
}
示例#14
0
bool IntStrListHelper::AddIntStrList( const CString& name, const AcDbIntArray& intList, const AcStringArray& strList )
{
    if( ( name.GetLength() == 0 ) || strList.isEmpty() || intList.isEmpty() ) return false;
    if( intList.length() != strList.length() ) return false;

    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( INT_LIST_DICT );
    bool ret = pDictTool->findKey( name );
    if( !ret )
    {
        int len = intList.length();
        for( int i = 0; i < len; i++ )
        {
            CString intValue;
            intValue.Format( _T( "%d" ), intList[i] );
            pDictTool->addEntry( name, intValue );             // 偶数位置的元素为整数
            pDictTool->addEntry( name, strList[i].kACharPtr() ); // 奇数位置的元素为字符串
        }
    }
    delete pDictTool;
    return !ret;
}
示例#15
0
void FieldManagerDlg::fillFieldListBox( const CString& type )
{
    setLastSelIndex( LB_ERR ); // 记录listbox切换之前的索引位置

    AcStringArray fields;
    FieldHelper::GetAllFields( type, fields );
    if( fields.isEmpty() ) return;
	
    int len = fields.length();
    for( int i = 0; i < len; i++ )
    {
        CString field = fields[i].kACharPtr();
        m_fieldListBox.AddString( field );

        // 初始为默认设置
        FieldInfo* pInfo = new FieldInfo();
        // 读取字段信息
        FieldInfoHelper::ReadFieldInfo( type, field, *pInfo );
        m_infoes.append( pInfo );
    }
    m_fieldListBox.SetCurSel( 0 );
}
示例#16
0
void PropertyDataDlgHelper::InputPropertyDataDlg( const AcDbObjectId& objId, const AcStringArray& fields, const CString& func )
{
	if( objId.isNull() ) return;
	if( fields.isEmpty() ) return;

	// 切换资源
	CAcModuleResourceOverride myResources;
	if (_T("参与评价的煤量") == func)
	{
		GasWidthCaculDlg gaswidthdlg;
		gaswidthdlg.setMineGE(objId);
		int ret = gaswidthdlg.DoModal();
		if (IDCANCEL == ret) return;
	}

	if (_T("邻近层瓦斯涌出量") == func)
	{
		if(!AddNearByFields(objId,func)) return;
	}

	if(_T("工作面瓦斯抽采率") == func)
	{
		CString strGD,strVD,strGDold,strVDold;
		DataHelper::GetPropertyData(objId,_T("瓦斯绝对涌出量"),strGD);
		DataHelper::GetPropertyData(objId,_T("风排瓦斯量"),strVD);
		DataHelper::GetPropertyData(objId,_T("当月工作面月平均瓦斯抽采量"),strGDold);
		DataHelper::GetPropertyData(objId,_T("当月工作面风排瓦斯量"),strVDold);
		double ret = _tstof(strGD) - _tstof(strVD);
		CString strRet;
		strRet.Format(_T("%.2lf"),ret);
		if(_tstof(strGDold) <= 0 && ret >= 0)
			DataHelper::SetPropertyData(objId,_T("当月工作面月平均瓦斯抽采量"),strRet);
		if(_tstof(strVDold) <= 0)
			DataHelper::SetPropertyData(objId,_T("当月工作面风排瓦斯量"),strVD);
	}

	//if (_T("管路阻力") == func)
	//{
	//	ValueHelper::setGasAirValue(objId);
	//}

	//if(_T("通过瓦斯抽采量计算") == func || _T("通过残余瓦斯压力反算") == func)
	//{
	//	WcyPropertyDlg pdd(NULL,func);
	//	pdd.showAllData( true );
	//	pdd.setMineGE( objId );
	//	int len = fields.length();
	//	for( int i = 0; i < len; i++ )
	//	{
	//		pdd.addField( fields[i].kACharPtr() );
	//		//acutPrintf(_T("\n字段:%s"),fields[i].kACharPtr());
	//	}
	//	pdd.DoModal();
	//}
	//else
	//{
		PropertyDataDlg pdd(NULL,func);
		pdd.showAllData( true );
		pdd.setMineGE( objId );
		int len = fields.length();
		for( int i = 0; i < len; i++ )
		{
			pdd.addField( fields[i].kACharPtr() );
			//acutPrintf(_T("\n字段:%s"),fields[i].kACharPtr());
		}
		pdd.DoModal();
	//}
}
示例#17
0
/*
 * 方法:
 *	  1) 得到原始的字段链表L1和字段列表框中的字段链表L2
 *    2) 遍历链表L2,判断字段是否存在于L1中
 *       a) 如果存在,则该字段保持不变,并从L1中移除该字段;
 *       b) 如果不存在,则转第(3)步
 *    3) 该字段是新添加的字段,则执行"增加字段"操作Add
 *    4) 完成遍历L2,最后剩下的L1的元素就是需要删除的字段
 *    5) 执行"删除字段"操作Remove
 */
void FieldManagerDlg::OnBnClickedApplyBtn()
{
    if( m_fieldListBox.GetCount() > 0 )
    {
        // 切换之前更新上次选择的字段信息
        // 并检查字段信息的有效性
        if( !updateFieldInfo() ) return;
    }

    // 选择的图元类型
    CString selType = getSelType();
    if( selType.GetLength() == 0 ) return;

    AcStringArray fields;
    FieldHelper::GetAllFields( selType, fields );
    if( fields.isEmpty() && m_fieldListBox.GetCount() == 0 )
    {
        MessageBox( _T( "没有字段可更新" ) );
        return;
    }

    // "剩余"字段
    // 与m_infoes应该是一一对应的
    AcStringArray leftFields;
    for( int i = 0; i < m_fieldListBox.GetCount(); i++ )
    {
        CString text;
        m_fieldListBox.GetText( i, text );
        leftFields.append( text );
    }

    int len = leftFields.length();
    for( int i = 0; i < len; i++ )
    {
        CString field = leftFields[i].kACharPtr();
        int index = fields.find( field );
        if( index >= 0 ) // 已存在,不变
        {
            fields.removeAt( index );
        }
        else
        {
            // 增加字段
            FieldHelper::AddField( selType, field );
        }
        // 默认属性设置不需要添加到词典中
        if( m_infoes[i]->isDefault() )
        {
            FieldInfoHelper::RemoveFieldInfo( selType, field );
        }
        else
        {
            // 新增的字段
            if( index < 0 || !FieldInfoHelper::FindFieldInfo( selType, field ) )
            {
                FieldInfoHelper::AddFieldInfo( selType, field, *m_infoes[i] );
            }
            else
            {
                // 更新已有的字段信息
                FieldInfoHelper::WriteFieldInfo( selType, field, *m_infoes[i] );
            }
        }
    }

    // 删除字段
    len = fields.length();
    for( int i = 0; i < len; i++ )
    {
        FieldHelper::RemoveField( selType, fields[i].kACharPtr() );
    }

    MessageBox( _T( "字段信息更新成功!" ) );
}