Example #1
0
void DrawCmd::DrawWindLibrary( void )
{
	AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道:" ) );
	if( objId.isNull() ) return;
	if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;


	AcGePoint3d pt,insertPt;

	double angle;

	if( !ArxUtilHelper::PromptPt( _T( "\n请指定风库的插入点坐标:" ), pt ) ) return;

	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

	AcGeVector3d v = AcGeVector3d(AcGeVector3d::kXAxis);
	v.rotateBy(angle - PI/2,AcGeVector3d::kZAxis);
	v.normalize();

	insertPt = pt + v * 60;

	WindLibrary* pWindLib = new WindLibrary( insertPt, angle ); 	
	if( pWindLib == 0 ) return;


	pWindLib->setRelatedGE( objId ); // 关联巷道

	// 初始化并提交到数据库
	if( !ArxUtilHelper::PostToModelSpace( pWindLib ) ) delete pWindLib;

}
Example #2
0
// 从图元的扩展词典中查找数据对象
static void GetDataObjectFromExtDict( AcDbObjectIdArray& dbObjIds )
{
    AcDbObjectIdArray allObjIds;
    ArxDataTool::GetEntsByType( _T( "MineGE" ), allObjIds, true );

    // 判断是否数据对象DataObject
    // 且类型名称==type
    if( allObjIds.isEmpty() ) return;

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

    int len = allObjIds.length();
    for( int i = 0; i < len; i++ )
    {
        AcDbObject* pObj;
        if( Acad::eOk != pTrans->getObject( pObj, allObjIds[i], AcDb::kForRead ) ) continue;

        MineGE* pGE = MineGE::cast( pObj );
        if( pGE == 0 ) continue;

        AcDbObjectId dbObjId = pGE->getDataObject();
        if( !dbObjId.isNull() )
        {
            dbObjIds.append( dbObjId );
        }
    }
    actrTransactionManager->endTransaction();
}
Example #3
0
void DrawCmd::DrawChimney( void )
{
    acutPrintf( _T( "\n绘制风筒测试..." ) );

    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcDbObjectIdArray objIds;
    DrawHelper::GetTagGEById2( objId, _T( "Chimney" ), objIds );
    if( !objIds.isEmpty() )
    {
        AfxMessageBox( _T( "该掘进工作面已设置了风筒!" ) );
        return;
    }

    AcGePoint3dArray pts;
    PolyLineJig jig;
    if( !jig.doJig( pts ) ) return;

    int len = pts.length();
    acutPrintf( _T( "\n点个数:%d" ), len );
    if( len < 2 ) return;

    Chimney* pChimney = new Chimney();
    pChimney->setRelatedGE( objId ); // 关联的图元必须是掘进工作面

    for( int i = 0; i < len; i++ ) pChimney->addControlPoint( pts[i] );

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pChimney ) ) delete pChimney;
}
Example #4
0
static bool CheackTubeLenth(AcDbObjectId& objId)
{
	objId = ArxUtilHelper::SelectObject( _T( "请选择一条瓦斯管路:" ) );
	if( objId.isNull() ) return false;
	if( !ArxUtilHelper::IsEqualType( _T( "GasTube" ), objId ) ) return false;

	AcTransaction *pTrans = actrTransactionManager->startTransaction();
	if ( 0 == pTrans ) return false;
	AcDbObject *pObj;
	if (Acad::eOk != pTrans->getObject(pObj,objId,AcDb::kForRead)) return false;
	GasTube *pGasTube = GasTube::cast(pObj);
	if ( 0 == pGasTube)
	{
		actrTransactionManager->abortTransaction();
		return false;
	}
	AcGePoint3d spt,ept;
	pGasTube->getSEPoint(spt,ept);
	//double angle = pGasTube->getAngle();
	actrTransactionManager->endTransaction();

	AcGeVector3d v = ept - spt;
	double tubeLenth = v.length();
	return true;
}
Example #5
0
void DrawMText( AcGiWorldDraw* mode, const AcGePoint3d& pt, double angle, const CString& str, double height, AcDbMText::AttachmentPoint ap, const CString& style )
{
    //acutPrintf(_T("\n绘制前--文字颜色:%d"), mode->subEntityTraits().color());
    AcDbMText mt;

 //   //AcDbObjectId style; // 文字样式
	AcDbObjectId fontId = GetTextStyle(style);
	if(!fontId.isNull())
	{
		acutPrintf(_T("\n设置样式为罗马字体"));
		mt.setTextStyle(fontId);
	}
    mt.setLocation( pt );
    mt.setTextHeight( height );

	mt.setAttachment( ap );
    mt.setRotation( angle );

    mt.setContents( str );

    // 经过测试发现,AcDbMText调用worldDraw的同时会修改mode的一些属性
    mt.setColorIndex( mode->subEntityTraits().color() );
	
    mt.worldDraw( mode );

    //acutPrintf(_T("\n绘制后--文字颜色:%d"), mode->subEntityTraits().color());
}
// 设置独立用风分支
// 独立用风地点:采掘工作面、采区变电所
static bool SetEdgeType( const AcDbObjectId& objId, EdgeData* pEdgeData )
{
    bool ret = true;
    if( objId.isNull() )
    {
        pEdgeData->et = ET_VIRTUAL;
    }
    else if( ArxUtilHelper::IsEqualType( _T( "WorkSurface" ), objId ) )
    {
        pEdgeData->et = ET_USEAIR;  // 工作面
    }
    else if( ArxUtilHelper::IsEqualType( _T( "StorageGE" ), objId ) )
    {
        if( !ArxUtilHelper::IsEqualType( _T( "MachineRoom" ), objId ) )
        {
            pEdgeData->et = ET_USEAIR;  // 火药库或充电室
        }
        else if( IsPowerSubstation( objId ) )
        {
            pEdgeData->et = ET_USEAIR;  // 机电硐室--变电所(用风地点)
        }
    }
    else if( ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) )
    {
        pEdgeData->et = ET_USEAIR;  // 掘进工作面
    }
    /*else if(IsNeedAir(objId))
    {
    	pEdgeData->et = ET_USEAIR;
    }*/
    return ret;
}
void WindStationDockBarChildDlg::OnBnClickedAirSelBtn()
{
    // 拾取按钮
    //BeginEditorCommand();
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道: " ) );
    //CompleteEditorCommand();
    if( !objId.isNull() )
    {
        //MessageBox(_T("拾取成功"));
        int pos = m_objIds.find( objId );
        if( pos != -1 )
        {
            //滚动条自动滚动该行,并选中
            m_list.EnsureVisible( pos, FALSE );
            m_list.SetItemState( pos, LVIS_SELECTED, LVIS_SELECTED );

            // 取消选中
            //m_list.SetItemState(pos, NULL, NULL);
        }
    }
    else
    {
        MessageBox( _T( "拾取失败" ) );
    }
}
Example #8
0
void DrawCmd::DrawJoint()
{
	AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道、或掘进工作面:" ) );
	if( objId.isNull() ) return;
	if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;

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

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

	LinkedGE* pEdge = LinkedGE::cast( pObj );
	if( pEdge == 0 )
	{
		actrTransactionManager->abortTransaction();
		return;
	}
	actrTransactionManager->endTransaction();
	AcGePoint3d spt,ept;
	pEdge->getSEPoint(spt,ept);
	AcGePoint3d pt;
	if( !PromptInsertPt( objId, pt ) ) return;

	double angle;
	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

	SplitByPoint(objId,spt,ept,pt);
	CreatJoint( objId, pt, angle );
}
Example #9
0
void DrawCmd::DrawLocalFan()
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcDbObjectIdArray objIds;
    DrawHelper::GetTagGEById2( objId, _T( "LocalFan" ), objIds );
    if( !objIds.isEmpty() )
    {
        AfxMessageBox( _T( "该掘进工作面已设置了局部通风机!" ) );
        return;
    }

    AcGePoint3d pt;
    if( !ArxUtilHelper::PromptPt( _T( "\n请指定局扇的插入点坐标:" ), pt ) ) return;

    Fan* pFan = new LocalFan( pt, 0 ); // 目前假设局扇的角度为0(实际绘图中局扇是没有方向的)
    if( pFan == 0 ) return;

    pFan->setRelatedGE( objId ); // 关联巷道

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pFan ) ) delete pFan;
}
Acad::ErrorStatus
ArxDbgPersistentObjReactor::dxfInFields(AcDbDxfFiler* filer)
{
    Acad::ErrorStatus es;
    if (((es = AcDbObject::dxfInFields(filer)) != Acad::eOk) ||
        (filer->atSubclassData(this->desc()->name()) != Adesk::kTrue))
        return filer->filerStatus();

    resbuf rb;
	m_attachedToObjs.setLogicalLength(0);

    while ((es == Acad::eOk) && ((es = filer->readResBuf(&rb)) == Acad::eOk)) {
        if (rb.restype == AcDb::kDxfSoftPointerId) {
            AcDbObjectId tmpId;
            tmpId.setFromOldId(rb.resval.rlong);
            if (tmpId.isNull() == false)
                m_attachedToObjs.append(tmpId);
        }
        else {
            filer->pushBackItem();
            es = Acad::eEndOfFile;
        }
    }

    if (es != Acad::eEndOfFile)
        return Acad::eInvalidResBuf;

    return filer->filerStatus();
}
Example #11
0
void DrawCmd::DrawLocalFan()
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;
	//if( !ArxUtilHelper::IsEqualType( _T( "Chimney" ), objId ) ) return;

    AcDbObjectIdArray objIds;
    DrawHelper::GetTagGEById2( objId, _T( "LocalFan" ), objIds );
    //if( !objIds.isEmpty() )
    //{
    //    AfxMessageBox( _T( "该掘进工作面已设置了局部通风机!" ) );
    //    return;
    //}

    AcGePoint3d pt,insertPt;

	double angle;
	//if( !GetClosePtAndAngle( objId, pt, angle ) ) return;
	
	if( !ArxUtilHelper::PromptPt( _T( "\n请指定局扇的插入点坐标:" ), pt ) ) return;

	insertPt = pt;
	if( !GetClosePtAndAngle( objId, pt, angle ) ) return;
    Fan* pFan = new LocalFan( insertPt, angle ); 
    if( pFan == 0 ) return;

    pFan->setRelatedGE( objId ); // 关联巷道

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pFan ) ) delete pFan;
}
Example #12
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;
}
Example #13
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 );
}
Example #14
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;
    }
}
Example #15
0
void TTunnel::setInTunnel( const AcDbObjectId& objId )
{
    assertWriteEnabled();
    if( objId.isNull() ) return;
    if( m_inTunnel == objId ) return;
    m_inTunnel = objId;
}
Example #16
0
AcDbObjectId DoubleLine::draw()
{
    //计算始端的2个坐标
    AcGePoint3d m_leftStartPt, m_leftEndPt;
    AcGePoint3d m_rightStartPt, m_rightEndPt;
    caclStartPoint( m_leftStartPt, m_rightStartPt );
    //计算末端的2个坐标
    caclEndPoint( m_leftEndPt, m_rightEndPt );
    //绘制2条直线
    AcDbObjectId line1 = ArxDrawHelper::DrawLine( m_leftStartPt, m_leftEndPt );
    AcDbObjectId line2 = ArxDrawHelper::DrawLine( m_rightStartPt, m_rightEndPt );

    //构造group
    AcDbObjectIdArray objIds;
    objIds.append( line1 );
    objIds.append( line2 );
    //构造临时的组名
    CString name;
    name.Format( _T( "巷道%d" ), count++ );
    AcDbObjectId groupId = ArxGroupHelper::CreateGroup( name, objIds );
    if( !groupId.isNull() )
    {
        ArxGroupHelper::ConvertToAnonymousGroup( groupId );
    }
    return groupId;
}
Example #17
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;
}
Example #18
0
ArxDictTool2* ArxDictTool2::GetDictTool( const CString& dictName )
{
    AcDbObjectId dictId = ArxDictTool::GetDict( dictName );
    if( dictId.isNull() )
        return 0;
    else
        return new ArxDictTool2( dictId );
}
Example #19
0
void UIHelper::DisplayData()
{
    // 显示图元的属性数据
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个图元:" ) );
    if( objId.isNull() ) return;

    PropertyDataDlgHelper::DisplayPropertyDataDlg( objId );
}
Example #20
0
void TagGE::setRelatedGE( const AcDbObjectId& objId )
{
    assertWriteEnabled();
    if( objId.isNull() || ( objId == m_objId ) ) return;
    if( objId == objectId() ) return;                            // 不能和图元自身关联
    if( !ArxUtilHelper::IsEqualType( _T( "MineGE" ), objId ) ) return; // 必须从MineGE派生

    m_objId = objId;
}
Example #21
0
void ArxEntityHelper::UpdateEntity( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return;
    /*
     * 使用常规的Open/Close机制更新实体
     * 注:使用事务机制更新实体有时候好使, 有时候不好使
     *      原因暂时不明
     */
    UpdateEntity2( objId );
}
Example #22
0
void DrawHelper::GetModelGEById( const AcDbObjectId& objId, AcDbObjectIdArray& objIds )
{
    if( objId.isNull() ) return;

    // 查找所有模型图元ModelGE
    AcDbObjectIdArray modelObjIds;
    ArxDataTool::GetEntsByType( _T( "ModelGE" ), modelObjIds, true );

    // 筛选出图元关联的模型图元ModelGE
    GetModelGEById_Helper( objId, modelObjIds, objIds );
}
Example #23
0
void PropertyDataDlgHelper::DisplayAllPropertyDataDlg( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return;

    // 切换资源
    CAcModuleResourceOverride myResources;

    PropertyDataDlg pdd;
    pdd.showAllData( true );
    pdd.setMineGE( objId );
    pdd.DoModal();
}
Example #24
0
void BaseGraph::addEnt( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return;
    if( ArxUtilHelper::IsEqualType( _T( "AcDbGroup" ), objId ) )
    {
        ArxGroupHelper::GetObjectIds( objId, m_ents );
    }
    else if( ArxUtilHelper::IsEqualType( _T( "AcDbEntity" ), objId ) )
    {
        m_ents.append( objId );
    }
}
Example #25
0
bool PropertyDataUpdater::ReadDataFromGE( CMFCPropertyGridCtrl* pPropDataList, const AcDbObjectId& objId )
{
    if( pPropDataList == NULL ) return false;
    if( objId.isNull() ) return false;

    //PrintPropList(pPropDataList);

    // 填充内容
    AcTransaction* pTrans = actrTransactionManager->startTransaction();
    if( pTrans == 0 ) return false;

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

    //acutPrintf(_T("\n读取数据..."));
    DataHelperImpl dh( pDO );
    int nCount = pPropDataList->GetPropertyCount();
    for ( int i = 0; i < nCount; i++ )
    {
        CMFCPropertyGridProperty* pProp = pPropDataList->GetProperty( i );

        CString value;
        dh.getPropertyData( pProp->GetName(), value ); // 更新属性数据

        FieldInfo info; // 默认设置(DT_STRING, m_enable=true, m_descr =_T(""))
        FieldInfoHelper::ReadFieldInfo( pDO->getType(), pProp->GetName(), info );

        SetPropValue( pProp, info, value ); // 设置属性值

		//DATA_TYPE dt       = info.m_dt;
		//LIST_TYPE lt       = info.m_lt;
		//if (dt == DT_LIST && lt == LT_INT)
		//{
		//	
		//}

    }

    actrTransactionManager->endTransaction();
	//PrintPropList(pPropDataList);
    return true;
}
Example #26
0
void DrawHelper::GetAllTagGEById( const AcDbObjectId& objId, AcDbObjectIdArray& objIds )
{
    if( objId.isNull() ) return;

    //acutPrintf(_T("\n查找图元..."));
    AcDbObjectIdArray tagObjIds;
    ArxDataTool::GetEntsByType( _T( "TagGE" ), tagObjIds, true );

    // 筛选过滤出与ObjId关联的tag
    GetAllTagGEById_Helper( objId, tagObjIds, objIds );

    //acutPrintf(_T("\n剩余%d个图元..."), objIds.length());
}
Example #27
0
void DrawCmd::DrawDirection( void )
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个巷道、采掘工作面、硐室:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;

    AcGePoint3d pt;
    if( !PromptInsertPt( objId, pt ) ) return;

    double angle;
    if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

    CreateDirection( objId, pt, angle );
}
Digraph::Arc IdentifyLiaisonTunnel::getEdgeById( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return INVALID;

    Digraph::Arc ee = INVALID;
    for( Digraph::ArcIt e( dg ); e != INVALID; ++e )
    {
        if( datas[e]->objId == objId )
        {
            ee = e;
            break;
        }
    }
    return ee;
}
Example #29
0
void DrawCmd::DrawCasement( int flag )
{
    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个巷道、回采工作面、硐室:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return;
    if( ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcGePoint3d pt;
    if( !PromptInsertPt( objId, pt ) ) return;

    double angle;
    if( !GetClosePtAndAngle( objId, pt, angle ) ) return;

    CreateCasement( flag, objId, pt, angle );
}
Example #30
0
Digraph::Arc FindWindStation::getEdgeById( const AcDbObjectId& objId )
{
    if( objId.isNull() ) return INVALID;

    Digraph::Arc ee = INVALID;
    for( Digraph::ArcIt e( dg ); e != INVALID; ++e )
    {
        if( datas[e]->objId == objId )
        {
            ee = e;
            break;
        }
    }
    return ee;
}