コード例 #1
0
// 完成一个区域的编辑
void CRegionEditDlgSector::FinishRegion()
{

	if(m_pRegionEditAction)
	{
		if(m_pListboxRegion)
		{
			int iIndex = m_pListboxRegion->GetSelection();
			if(-1 != iIndex)
			{
				unsigned long uiId = (unsigned long)m_pListboxRegion->GetClientData(iIndex);
				if(!m_pRegionEditAction->IsRegionValidate(uiId))
				{
					wxMessageBox(_T("当前区域含有不合法的点, 请改正。\n"), _T("正在编辑区域!"), wxOK, this);
					return;

				}
			}
		}
	}

	if(m_pRegionEditAction)
	{
		if(m_pListboxRegion)
		{
			int iIndex = m_pListboxRegion->GetSelection();
			if(-1 != iIndex)
			{
				unsigned long uiId = (unsigned long)m_pListboxRegion->GetClientData(iIndex);//fujia
				CUnreachRegion* pRegion = m_pRegionEditAction->GetRegionById(uiId);
				if( pRegion )
				{
					int PassLevel =  Ogre::StringConverter::parseInt(m_pFlyableCB->GetValue().c_str());
					if (PassLevel < 1) PassLevel = 1;
					if (PassLevel > 10) PassLevel = 10;
					pRegion->SetFlyable(PassLevel);
				}
				m_pRegionEditAction->ReshapeArea(uiId);
				m_pRegionEditAction->HideRegionArea(uiId, false);
			}
		}
		
	}
	
	if(m_pAddNewRegionBn)
	{
		m_bIsEditingRegion = false;
		m_pAddNewRegionBn->Enable( true );
	}
}
コード例 #2
0
void CRegionEditDlgSector::OnFlyable( wxCommandEvent &event )
{
	if(m_pRegionEditAction)
	{
		int iIndex = m_pListboxRegion->GetSelection();
		if( iIndex != -1 )
		{
			unsigned long ulRegionId = (unsigned long)m_pListboxRegion->GetClientData(iIndex);
			CUnreachRegion* pRegion = m_pRegionEditAction->GetRegionById(ulRegionId);
			if( pRegion )
			{
				int PassLevel =  Ogre::StringConverter::parseInt(m_pFlyableCB->GetValue().c_str());
				if (PassLevel < 1) PassLevel = 1;
				if (PassLevel > 10) PassLevel = 10;
				pRegion->SetFlyable( PassLevel );
			}
		}
	}
}