当前位置: 首页>>代码示例>>C++>>正文


C++ Output::ClearDrawArea方法代码示例

本文整理汇总了C++中Output::ClearDrawArea方法的典型用法代码示例。如果您正苦于以下问题:C++ Output::ClearDrawArea方法的具体用法?C++ Output::ClearDrawArea怎么用?C++ Output::ClearDrawArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Output的用法示例。


在下文中一共展示了Output::ClearDrawArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute

void Delete::Execute()
{
	Input *pIn = pManager->GetInput();
	Output *pOut = pManager->GetOutput();

	//Get List of selected statements
	list<Statement*> SelectedStatements = pManager->GetSelectedStatements();
	list<Connector*> SelectedConnectors = pManager->GetSelectedConnectors();
	Point TempP;
	//list<Connector*>ConnList = pManager->GetConnList();

	//Print Message and Wait for any click
	pOut->PrintMessage("Delete: Deleting Selected Statements if any, press any key to continue");
	pIn->GetPointClicked(TempP);
	for (list<Connector*>::iterator it = SelectedConnectors.begin(); it != SelectedConnectors.end(); it++)
	{
		pManager->DeleteConnector((*it));
	}


	list<Connector*>ConnList = pManager->GetConnList();

	for (list<Statement*>::iterator it = SelectedStatements.begin(); it != SelectedStatements.end(); it++)
	{
		//Delete Input Connectors
		if ((*it)->GetStatementType() != 0 || ((*it)->GetStatementType() == 0 && ((StartEnd*)(*it))->GetMode() == true))
		{
			list<Connector*> InputConnectors;

			for (list<Connector*>::iterator itConn = ConnList.begin(); itConn != ConnList.end(); itConn++)
			{
				if ((*itConn)->getDstStat() == (*it))
					InputConnectors.push_back((*itConn));
			}
			for (list<Connector*>::iterator itConn = InputConnectors.begin(); itConn != InputConnectors.end(); itConn++)
			{
				/*
				if ((*itConn)->getSrcStat()->GetpConn == (*itConn))
				(*itConn)->getSrcStat()->SetpConn(NULL);
				else if (((Conditional*)(*itConn)->getSrcStat())->GetpConnL() == (*itConn))
				((Conditional*)(*itConn)->getSrcStat())->SetpConnL(NULL);
				*/
				if ((*itConn)->GetBranchType() == 2)
					((Conditional*)(*itConn)->getSrcStat())->SetpConnL(NULL);
				else
					(*itConn)->getSrcStat()->SetpConn(NULL);

				pManager->DeleteConnector((*itConn));
			}
		}

		//Conditional
		if ((*it)->GetStatementType() == 3)
		{
			//Yes
			if (((Conditional*)(*it))->GetpConn() != NULL)
				pManager->DeleteConnector(((Conditional*)(*it))->GetpConn());
			//No
			if (((Conditional*)(*it))->GetpConnL() != NULL)
				pManager->DeleteConnector(((Conditional*)(*it))->GetpConnL());
		}
		else //Not Conditional
		{
			if ((*it)->GetpConn() != NULL)
				pManager->DeleteConnector((*it)->GetpConn());
		}
		pManager->DeleteStatement((*it));
	}

	pOut->PrintMessage("");
	pOut->ClearDrawArea();
	pManager->UpdateInterface();
}
开发者ID:Ahmkel,项目名称:Flowchart-Creator,代码行数:73,代码来源:Delete.cpp

示例2: Execute


//.........这里部分代码省略.........
					//Print Error Message
					pOut->PrintMessage("Unsuitable point for copying. Action terminated! Press any key to continue");
					
					//Remove all new statements
					for (list<Statement*>::iterator it2 = NewStatements.begin(); it2 != NewStatements.end(); it2++)
					{
						delete (*it2);
					}
					NewStatements.clear();

					//Wait for key press
					pIn->GetPointClicked(P);
					pOut->PrintMessage("");
					return;
				}

				//Statement position is okay, add it
				NewStatements.push_back(NewStatement);
			}

			//All statements don't overlap, add them to Statements list
			for (list<Statement*>::iterator it = NewStatements.begin(); it != NewStatements.end(); it++)
			{
				pManager->AddStatement((*it));
			}
			pManager->UpdateCopiedOrCutStatements(0);

		}
		//If they are Cut
		else if (CopiedOrCutStatements.front()->GetCopiedOrCut() == 2) //Cut Action
		{
			//Cutting Statement Only

			Point LeftCornerUp, LeftCornerDown, RightCornerUp, RightCornerDown;
			//Get First Copied statement type to help in calculating dx & dy
			int Type = CopiedOrCutStatements.front()->GetStatementType();
			//Get 4 corners of the point based on its type;
			pManager->GetCorners(P, Type, LeftCornerUp, LeftCornerDown, RightCornerUp, RightCornerDown);
			int dx, dy;
			dx = LeftCornerUp.x - CopiedOrCutStatements.front()->GetLeftCorner().x;
			dy = LeftCornerUp.y - CopiedOrCutStatements.front()->GetLeftCorner().y;

			//Store Old points before cutting
			list<Point> OldPoints;

			for (list<Statement*>::iterator it = CopiedOrCutStatements.begin(); it != CopiedOrCutStatements.end(); it++)
			{
				//Get Type of each statement
				Point NewStatementPoint = (*it)->GetLeftCorner();
				
				//Save Old Point
				OldPoints.push_back(NewStatementPoint);

				//Calculate New Point
				NewStatementPoint.x += dx;
				NewStatementPoint.y += dy;

				//Edit Point
				(*it)->SetLeftCorner(NewStatementPoint);

				//Dummy variable
				bool tt;
				//Check validity of new position of pasted statement
				if (pManager->IsOutOfBounds((*it), tt, tt, tt, tt) || pManager->IsOverlapping((*it)))
				{
					//Print Error Message
					pOut->PrintMessage("Unsuitable point for cutting. Action terminated! Press any key to continue");

					//Return pasted statements to their old positions
					list<Statement*>::iterator it2 = CopiedOrCutStatements.begin();
					for (list<Point>::iterator Pointit = OldPoints.begin(); Pointit != OldPoints.end(); Pointit++)
					{
						(*it2)->SetLeftCorner((*Pointit));
						it2++;
					}
					OldPoints.clear();

					//Wait for key press
					pIn->GetPointClicked(P);
					pOut->PrintMessage("");

					pOut->ClearDrawArea();
					pManager->UpdateInterface();
					return;
				}

				
				(*it)->UpdatePoints();
			}

			for (list<Statement*>::iterator it = CopiedOrCutStatements.begin(); it != CopiedOrCutStatements.end(); it++)
			{
				(*it)->SetCopiedOrCut(0);
			}
			pManager->UpdateCopiedOrCutStatements(0);
		}
		pOut->ClearDrawArea();
		pManager->UpdateInterface();
	}
}
开发者ID:Ahmkel,项目名称:Flowchart-Creator,代码行数:101,代码来源:Paste.cpp


注:本文中的Output::ClearDrawArea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。