本文整理汇总了C++中Output::Magnetize方法的典型用法代码示例。如果您正苦于以下问题:C++ Output::Magnetize方法的具体用法?C++ Output::Magnetize怎么用?C++ Output::Magnetize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::Magnetize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadActionParameters
bool AddConnection::ReadActionParameters()
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
pOut->FlushKeyQueue();
pOut->ClearStatusBar();
//Print Action Message
pOut->PrintMsg("Adding Connection : Click to add the first edge ");
pOut->UpdateBuffer();
if ( pManager->GetComponent( UI.u_GfxInfo.x1 , UI.u_GfxInfo.y1 )==NULL)
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK&& (pManager->GetArr()[Cy][Cx])!=NULL) {
if (((pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().first != 0
&& (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().second != 0)) {
GInfo.x1 = (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().first;
GInfo.y1 = (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().second;
break;
}
else {
pOut->ClearStatusBar();
pOut->PrintMsg("Please choose a vaild Gate or Switch ");
pOut->UpdateBuffer();
}
}
} while (true);
else
{
GInfo.x1 = (pManager->GetComponent( UI.u_GfxInfo.x1,UI.u_GfxInfo.y1))->GetOutputPinCoordinates( ).first;
GInfo.y1 = (pManager->GetComponent(UI.u_GfxInfo.x1,UI.u_GfxInfo.y1))->GetOutputPinCoordinates( ).second;
}
pOut->ClearStatusBar();
pOut->PrintMsg("Adding Connection : Click to add the second edge ");
pOut->UpdateBuffer();
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK && (pManager->GetArr()[Cy][Cx]) != NULL)
{
pOut->Magnetize(Cx, Cy);
if (pManager->GetArr()[Cy][Cx]->GetInputPinCoordinates(make_pair(Cx, Cy)) != NULL) {
GInfo.x2 = (pManager->GetComponent( Cx , Cy ))->GetInputPinCoordinates( make_pair( Cx , Cy ) )->first;
GInfo.y2 = (pManager->GetComponent( Cx , Cy ))->GetInputPinCoordinates( make_pair( Cx , Cy ) )->second;
break;
}
else
{
pOut->ClearStatusBar();
pOut->PrintMsg("You choosed an invalid Component, please choose a Gate or Led !!");
pOut->UpdateBuffer();
}
}
} while (true);
bfs(GInfo.x1, GInfo.y1, GInfo.x2, GInfo.y2, pManager->GetArr(), outx);
if (outx.check)
return true;
else {
pManager->GetOutput()->ClearStatusBar();
pManager->GetOutput()->PrintMsg("There is no valid path");
pManager->GetOutput()->UpdateBuffer();
return false;
}
}