Exemple #1
0
	/*!
	\brief 依据当前BOX对象组来创建一个指定轴的边界组

	\param axis 当前坐标轴
	\param group BOX对象组
	\param boundaryList 存储边界结构的链表
	*/
	void _FindOpenCloseBoundaryList(AXIS axis, LIST<BOX*> &group,
		LIST<OPENCLOSEBOUNDARY> &boundaryList)
	{
		OPENCLOSEBOUNDARY thisBoundary;
		BOX* thisBox = NULL;
		for(LIST<BOX*>::NOTE *thisNote = group.GetFirst();
			thisNote; thisNote = thisNote->GetNext())
		{
			thisBoundary.pBox = thisBox = thisNote->Get();

			thisBoundary.type = TYPE_OPEN;
			thisBoundary.value = (axis == AXIS_X)?
				(thisBox->GetAnchor().x - thisBox->GetWidth() / 2.0f):
			(thisBox->GetAnchor().y - thisBox->GetHeight() / 2.0f);
			boundaryList.Create(thisBoundary);

			thisBoundary.type = TYPE_CLOSE;
			thisBoundary.value = (axis == AXIS_X)?
				(thisBox->GetAnchor().x + thisBox->GetWidth() / 2.0f):
			(thisBox->GetAnchor().y + thisBox->GetHeight() / 2.0f);
			boundaryList.Create(thisBoundary);
		}
	}