前几天,到航天部实施项目,用户提出需求:希望电路分析后,能显示电路中电流流动效果。 回想起以前电力系统用户希望的电力接线图中潮流的需求,觉得这件事应该做一做了。
粗一想,不好做,但深入一想也容易解决,因此,花了一天时间,结果还令人满意。
大致应该分以下几步:
1.
设计处理对象及其成员与函数
2.
解决流动效果
3.
根据连接关系与分析结果确定各导线中电流方向
4.
联调
直观地想,电流流动效果应在导线中处理,在其每条线段中应知道如何画出效果。
首先,应由窗口进行调用或触发,演示时应有时钟。
加入TTimer *Timer_FlowEffect;
具体事务函数: void __fastcall ShowFlowEffect();
void
__fastcall TCbwGraphBaseForm::ShowFlowEffect()

...
{
Timer_FlowEffect->Enabled = !Timer_FlowEffect->Enabled;
FlushVector(FDemoLines, false);
if(Timer_FlowEffect->Enabled)

...{
GetBranchSimulateModule();
FBranchSimulateModule->DemoEffect(FDemoLines);
vector<TPin *> inPins, outPins;
CBW_ITERATOR(CbwObjects, FObjects)

...{
TWire * wire = dynamic_cast<TWire *>(*it);
if(wire)
wire->ShowDemoEffect(FDemoLines, inPins, outPins);
}
}
else
RefreshCurrentScreen();
}























在Timer_FlowEffect的OnTimer事件中,进行动态显示效果展示而在导线类中加入演示效果处理函数:












