Beispiel #1
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 );
}
Beispiel #2
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;
}
bool IntStrListHelper::GetIntStrList( const CString& name, AcDbIntArray& intList, AcStringArray& strList )
{
    AcStringArray entries;
    if( !ArxDictHelper::GetAllEntries( INT_LIST_DICT, name, entries ) ) return false;

    int len = entries.length();
    bool ret = ( len > 0 && len % 2 == 0 );
    if( ret ) // 长度必须为偶数
    {
        intList.removeAll();
        strList.removeAll();

        for( int i = 0; i < len; i++ )
        {
            if( i % 2 == 0 ) // 偶数位置的元素为整数
            {
                intList.append( _ttoi( entries[i].kACharPtr() ) );
            }
            else       // 奇数位置的元素为字符串
            {
                strList.append( entries[i] );
            }
        }
    }
    return ret;
}
Beispiel #4
0
void ReportDataHelper::ReadDatas( const CString& name, ArrayVector& datasVector,int unitCount )
{
	AcStringArray getDatas;
	AcDbObjectId objId;
	GDESDataObjectHelper::GetObjectId(name,objId);
	GetObjectDatas(objId,getDatas);
	//AcStringArray strName,strIsRunning,strReason;
	ArrayVector datas;
	int nCount = getDatas.length();
	if(nCount <= 0) return;
	datas.resize( unitCount );
	for(int i = 0;  i < nCount; i = i+2 )
	{
		int j = (i/2)% unitCount;
		datas[j].append(getDatas[i]);
	}

	datasVector.clear();
	for(int i = 0; i < nCount / (2 * unitCount); i++)
	{
		CString temp;
		AcStringArray temps;
		for(int j = 0; j < unitCount; j++)
		{
			temp.Format(_T("%s"),datas[j][i].kACharPtr());
			if(temp == ISNULL) temp = _T("");
			temps.append(temp);
		}
		datasVector.push_back(temps);
	}
}
Beispiel #5
0
void WGFPBlockDraw::regPropertyDataNames( AcStringArray& names ) const
{
    names.append( _T( "绝对瓦斯涌出量" ) );
    names.append( _T( "相对瓦斯涌出量" ) );
    names.append( _T( "工作面日产量" ) );
    names.append( _T( "回采年月" ) );
}
Beispiel #6
0
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;

}
Beispiel #7
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;
}
Beispiel #8
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 );
}
Beispiel #9
0
void CDHBlockDraw::regPropertyDataNames( AcStringArray& names ) const
{
    names.append( _T( "¿×ºÅ" ) );
    names.append( _T( "µØÃæ±ê¸ß" ) );
    names.append( _T( "ú²ãµ×°å±ê¸ß" ) );
    names.append( _T( "úºñ" ) );
}
Beispiel #10
0
static void GetDatasFromList(const CGridListCtrlGroups& listCtrl,AcStringArray& strName,AcStringArray& strIsRunning,AcStringArray& strReason,int num)
{
	for(size_t i = 0; i < num; i++)
	{
		CString	name = listCtrl.GetItemText(i,1);
		if (name.IsEmpty())
		{
			name = ISNULL;
		}
		strName.append(name);
		CString isRunning = listCtrl.GetItemText(i,2);
		if (isRunning.IsEmpty())
		{
			isRunning = ISNULL;
		}
		strIsRunning.append(isRunning);
		CString reason = listCtrl.GetItemText(i,3);
		if (reason.IsEmpty())
		{
			reason = ISNULL;
		}

		strReason.append(reason);
		//acutPrintf(_T("\n第%d行数据:%s\t%s\t%s"),i+1,strName,isRunning,strReason);
	}
}
Beispiel #11
0
static CString ExcludePath( const CString& supportPath, const CString& arxPath )
{
    AcStringArray cc;
    SplitCString( supportPath, _T( ";" ), cc );

    AcStringArray paths;

    int n = cc.length();
    for( int i = 0; i < n; i++ )
    {
        if( cc[i].compareNoCase( arxPath ) == 0 ) continue;
        paths.append( cc[i] );
    }

    CString path;
    n = paths.length();
    for( int i = 0; i < n; i++ )
    {
        if( i == n - 1 )
        {
            path.AppendFormat( _T( "%s" ), paths[i].kACharPtr() );
        }
        else
        {
            path.AppendFormat( _T( "%s;" ), paths[i].kACharPtr() );
        }
    }
    return path;
}
Beispiel #12
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;
    }
}
Beispiel #13
0
void CSDCIBlockDraw::regPropertyDataNames( AcStringArray& names ) const
{
    names.append( _T( "瓦斯放散初速度" ) );
    names.append( _T( "煤的坚固性系数" ) );
    // 实际只有2个字段,该字段并不存在!!!
    // 注册一个不存在的字段,返回值为""
    names.append( _T( "瓦斯突出危险性综合指标K值" ) );
}
Beispiel #14
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;
}
Beispiel #15
0
static BOOL ShowRetDlg()
{
	ResultDlg retDlg;
	AcStringArray datas;
	datas.append(_T("目前矿井瓦斯抽采系统正常运转,能保证生产接续"));
	datas.append(_T("建立了部分部分瓦斯抽采系统,无法保证生产接续"));
	datas.append(_T("没有建立地面固定瓦斯抽采系统"));
	datas.append(_T("其他"));
	retDlg.setItemDatas(datas);

	IntArray trueIndxs;
	trueIndxs.push_back(0);
	trueIndxs.push_back(1);
	retDlg.setTrueIndex(trueIndxs,RET_GASSYS_OBJCT_NAME,DESC_GASSYS_OBJCT_NAME);

	AcStringArray bookMks;
	bookMks.append(_T("GasSys_Ret"));
	bookMks.append(_T("GasSys_Method"));
	bookMks.append(_T("GasSys_Conclusion"));
	bookMks.append(_T("GasSys_YesOrNo"));
	retDlg.setBookMarks(bookMks);

	if(IDOK == retDlg.DoModal()) 
	{
		return TRUE;
	}
	else return FALSE;
}
Beispiel #16
0
void FieldHelper::RemoveAllFields( const CString& type )
{
    AcStringArray fields;
    GetAllFields( type, fields );
    int len = fields.length();
    for( int i = 0; i < len; i++ )
    {
        RemoveField( type, fields[i].kACharPtr() );
    }
    RemoveKey_Helper( PROPERTY_DATA_FIELD_DICT, type );
}
bool IntStrListHelper::AddIntStrPair( const CString& name, int intValue, const CString& strValue )
{
    if( ( name.GetLength() == 0 ) || strValue.GetLength() == 0 ) return false;

    AcStringArray strList;
    AcDbIntArray intList;
    GetIntStrList( name, intList, strList );
    if( intList.contains( intValue ) || strList.contains( strValue ) ) return false;

    intList.append( intValue );
    strList.append( strValue );
    RemoveIntStrList( name );
    return AddIntStrList( name, intList, strList );
}
Beispiel #18
0
static BOOL ReadTableDatas(const CString& itemName,AcStringArray& names,AcStringArray& datas)
{
	names.removeAll();
	datas.removeAll();
	ArrayVector dataVector;
	ReportDataHelper::ReadDatas(itemName,dataVector,2);
	if(dataVector.empty()) return FALSE;
	for(int i = 0; i < dataVector.size(); i++)
	{
		names.append(dataVector[i][0]);
		datas.append(dataVector[i][1]);
	}
	return TRUE;

}
Beispiel #19
0
void ReportDataHelper::WriteDatas( const CString& name,const ArrayVector& datas )
{
	AcDbObjectId objId;
	GDESDataObjectHelper::GetObjectId(name,objId);
	AcStringArray values;
	for(int i = 0; i < datas[0].length();i++)
	{
		for(int j = 0; j < datas.size(); j++)
		{
			values.append(datas[j][i]);
			values.append(_T("$"));
		}
	}
	SetObjectDatas(objId,values);
}
Beispiel #20
0
void ContourLayerDlg::FillLayerList()
{
    // 读取所有图层列表
    AcStringArray layers;
    GetEntityLayers( _T( "ContourGE" ), layers );

    m_layerList.ResetContent();

    // 填充列表
    int n = layers.length();
    for( int i = 0; i < n; i++ )
    {
        m_layerList.AddString( layers[i].kACharPtr() );
    }
}
Beispiel #21
0
void ArxDictHelper::GetAllKeys( const CString& dictName, AcStringArray& keys )
{
    keys.removeAll();
    ArxDictTool* pDictTool = ArxDictTool::GetDictTool( dictName );
    pDictTool->getAllKeys( keys );
    delete pDictTool;
}
Beispiel #22
0
bool ReportDataHelper::SetObjectDatas( const AcDbObjectId& objId,const AcStringArray& values )
{
	if( objId.isNull() ) return false;

	AcTransaction* pTrans = actrTransactionManager->startTransaction();
	if( pTrans == 0 ) return false;

	AcDbObject* pObj;
	if( Acad::eOk != pTrans->getObject( pObj, objId, AcDb::kForWrite ) )
	{
		actrTransactionManager->abortTransaction();
		return false;
	}
	DataObject* pDO = DataObject::cast( pObj );
	if( pDO == 0 )
	{
		actrTransactionManager->abortTransaction();
		return false;
	}

	pDO->clearAll();
	for(int i = 0;  i < values.length(); i++)
	{
		CString value = values[i].kACharPtr();
		pDO->addData();
		pDO->setData(i,value);
	}
	actrTransactionManager->endTransaction();
	return true;
}
Beispiel #23
0
// 查找从根类型派生的图元
void ArxClassHelper::GetArxClassTypes( const CString& root, AcStringArray& types, bool findAbstractType )
{
    // 如果根类型不存在,默认为AcDbObject
    AcRxClass* pParentClass = AcRxClass::cast( acrxClassDictionary->at( root ) );
    if( pParentClass == 0 ) pParentClass = AcDbObject::desc();

    AcRxDictionaryIterator* iter = acrxClassDictionary->newIterator();
    if( iter == 0 ) return;

    for( ; !iter->done(); iter->next() )
    {
        AcRxClass* pClass;
        if( ( pClass = AcRxClass::cast( iter->object() ) ) != NULL )
        {
            if( pClass->isDerivedFrom( pParentClass ) )
            {
                const ACHAR* text = pClass->name();
                if( text == NULL ) continue;

                if( !findAbstractType && ( pClass->dxfName() == NULL ) || ( pClass->appName() == NULL ) ) continue;

                //acutPrintf(_T("appName:%s\ndxfName:%s\nname:%s\n"), pClass->appName(), pClass->dxfName(), pClass->name());
                types.append( text );
            }
        }
    }
    delete iter;
}
bool DataObjectListHelper::RemoveAllObject( const CString& name )
{
    if( name.GetLength() == 0 ) return false;

    AcStringArray values;
    GetObjectNameList( name, values );

    bool ret = true;
    int len = values.length();
    for( int i = 0; i < len; i++ )
    {
        ret = ( ret && RemoveObject( name, values[i].kACharPtr() ) );
    }
    ArxDictHelper::RemoveAllEntries( OBJECT_LIST_DICT, name );
    return ret;
}
Beispiel #25
0
static bool GetFieldsDatas(const CString& type, const CString& func, const AcDbObjectId& objId,AcStringArray& fields,AcStringArray& datas)
{
	fields.removeAll();
	datas.removeAll();
	if(!FuncFieldHelper::GetFields(func,type,fields)) return false;
	fields.remove(_T("钻孔名称"));
	for(int i = 0; i < fields.length(); i++)
	{
		CString strData;
		if(!DataHelper::GetPropertyData(objId,fields[i].kACharPtr(),strData)) return false;
		DealIntListDatas(fields[i].kACharPtr(),strData);
		datas.append(strData);
	}

	return true;
}
Beispiel #26
0
static bool IsPathExit( const CString& supportPath, const CString& arxPath )
{
    AcStringArray cc;
    SplitCString( supportPath, _T( ";" ), cc );

    bool bFind = false;
    int n = cc.length();
    for( int i = 0; i < n; i++ )
    {
        if( cc[i].compareNoCase( arxPath ) == 0 )
        {
            bFind = true;
            break;
        }
    }
    return bFind;
}
Beispiel #27
0
static void StringsToNum( const AcStringArray& strDatas, doubleVector& doubleDatas)
{
	for(int i = 0; i < strDatas.length(); i++)
	{
		double temp = _tstof(strDatas[i].kACharPtr());
		doubleDatas.push_back(temp);
	}
}
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;
}
Beispiel #29
0
/*
 * 参数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;
}
Beispiel #30
0
void ArxClassHelper::GetClassHierarchy( const CString& type, AcStringArray& types, bool findAbstractType )
{
    AcRxClass* pClass = AcRxClass::cast( acrxClassDictionary->at( type ) );
    if( pClass == 0 ) return;

    while( pClass != AcDbEntity::desc() )
    {
        // 排除抽象类型
        if( !findAbstractType && ( ( pClass->dxfName() == NULL ) || ( pClass->appName() == NULL ) ) )
        {
            pClass = pClass->myParent();
            continue;
        }

        types.append( pClass->name() );
        pClass = pClass->myParent();
    }
    types.reverse();
}