CAA中交互选择对象——设置代理选择类型
在BuildGraph函数变量中定义(根据功能需求不同,适当增减代码,不可全用);
//定义一个CATString类型链表
CATLISTV(CATString) TypeList1 = NULL;
//添加选择类型限制
TypeList1.Append(CATString("CATISketch"));
TypeList1.Append(CATString("CATIPrtPart"));
//实例化(初始化)对象;指针要预先声明好;
_piSelectPartAgent = new CATOtherDocumentAgent("select Part","CATBasicMultiDocumentCommand","CATDialogEngine");
//设置代理要选择的类型;
_piSelectPartAgent -> SetOrderedTypeList(TypeList1);
//设置代理的行为(高亮等等)
_piSelectPartAgent -> SetBehavior(CATDlgEngWithPrevaluation|CATDlgEngWithPSOHSO|CATDlgEngWithTooltip|CATDlgEngOneShot);
//根据要执行的方法的地址创建代理筛选器(得到pFilterOtherPart )。
//其中CheckSelectedLineFunc检查筛选的方法函数需要自己写
CATAcquisitionFilter * pFilterOtherPart = Filter((FilterMethod) &作用域::CheckSelectedPartFunc,(void *)NULL);
//将筛选器关联到获取代理
_piSelectPartAgent->SetFilter(pFilterOtherPart);
//如果有选择多种情况,就重复上面创建
CATLISTV(CATString) TypeList2 = NULL;
TypeList2.Append(CATString("CATLine"));
_piSelectVectorAgent = new CATFeatureImportAgent("select Vector");
_piSelectVectorAgent -> SetOrderedTypeList(TypeList2);
_piSelectVectorAgent -> SetBehavior(CATDlgEngWithPrevaluation|CATDlgEngWithPSOHSO|CATDlgEngWithTooltip|CATDlgEngOneShot);
CATAcquisitionFilter * pFilterOtherLine = Filter((FilterMethod) &作用域::CheckSelectedLineFunc,(void *)NULL);
_piSelectVectorAgent->SetFilter(pFilterOtherLine);
CATLISTV(CATString) TypeList3 = NULL;
TypeList3.Append(CATString("CATPoint"));
_piSelectPointAgent = new CATFeatureImportAgent("select Midpt");
_piSelectPointAgent -> SetOrderedTypeList(TypeList3);
_piSelectPointAgent -> SetBehavior(CATDlgEngWithPrevaluation|CATDlgEngWithPSOHSO|CATDlgEngWithTooltip|CATDlgEngOneShot);
CATAcquisitionFilter * pFilterOtherPoint = Filter((FilterMethod) &作用域::CheckSelectedPointFunc,(void *)NULL);
_piSelectPointAgent->SetFilter(pFilterOtherPoint);