Ejemplo n.º 1
0
// 刷新区域中的点的数据
void CRegionEditDlgSector::RefreshRegionPointData(unsigned long ulRegionId)
{
	
	if(m_pRegionEditAction)
	{

		CUnreachRegion* pRegion = m_pRegionEditAction->GetRegionById(ulRegionId);
		if(NULL == pRegion)
		{
			return ;
		}
		
		// 清空以前的数据.
		m_pListboxPointInRegion->Clear();

		int iPointCount = pRegion->GetPointCount();
		CPointInfo* pPointInfo = NULL;
		for(int i = 0; i < iPointCount; i++)
		{
			pPointInfo = pRegion->GetPointInfoByIndex(i);
			if(pPointInfo)
			{
				RegionAddNewPoint(pPointInfo->m_ulPointId, true);
			}
		}//

	}




}
Ejemplo n.º 2
0
// 做区域选中时的操作
void CRegionEditDlgSector::DoSelRegion()
{
	if(NULL == m_pListboxRegion)
	{
		return;
	}

	int iIndex = m_pListboxRegion->GetSelection();

	// 记录当前在listbox中选择的区域index
	m_iCurSelRegionIndex = iIndex;
	unsigned long ulRegionId = 0;
	if(-1 != iIndex)
	{

		// 得到区域id
		ulRegionId = (unsigned long)m_pListboxRegion->GetClientData(iIndex);
		if(m_pRegionEditAction)
		{
			CUnreachRegion* pRegion = m_pRegionEditAction->GetRegionById(ulRegionId);
			if(NULL == pRegion)
			{
				return ;
			}

			m_pRegionEditAction->UnSelRegion(m_ulCurRegionId);
			// 当前正在编辑的区域
			m_ulCurRegionId = ulRegionId;
			m_pRegionEditAction->SelRegion(ulRegionId, m_bIsChangeCamera);

			// 清空以前的数据.
			m_pListboxPointInRegion->Clear();

			int iPointCount = pRegion->GetPointCount();
			CPointInfo* pPointInfo = NULL;
			for(int i = 0; i < iPointCount; i++)
			{
				pPointInfo = pRegion->GetPointInfoByIndex(i);
				if(pPointInfo)
				{
					RegionAddNewPoint(pPointInfo->m_ulPointId, true);
				}

			}//

			//pRegion->SetFlyable( m_pFlyableCB->GetValue() );
			m_pFlyableCB->SetValue( Ogre::StringConverter::toString( pRegion->GetFlyable()) );
		
		}
	}
}
Ejemplo n.º 3
0
// 删除一个区域
void CRegionEditDlgSector::DelRegion(unsigned long ulId)
{
	if(NULL == m_pListboxRegion)
	{
		return;
	}

	// 删除当前区域后需要选中的区域的index
	int iNextIndex   = -1;
	int iIndex       = m_pListboxRegion->GetSelection();
	int iRegionCount = m_pListboxRegion->GetCount();

	unsigned long ulRegionId = 0;
	// 删除当前区域后需要选中的区域的ID
	unsigned long ulNextRegionId = 0;

	if(-1 != iIndex)
	{
		if(iIndex > 0)
		{
			// 如果不是选择删除的头一个区域
			// 下一个选择的区域就是当前选择的前一个区域
			iNextIndex = iIndex-1;
		}
		else
		{
			if(iRegionCount > 1)
			{
				
				iNextIndex = iIndex+1;
				
			}
			else
			{
				iNextIndex = -1;
			}
		}

		if(-1 != iNextIndex)
		{
			ulNextRegionId = (unsigned long)m_pListboxRegion->GetClientData(iNextIndex);
		}

		// 得到区域id
		ulRegionId = (unsigned long)m_pListboxRegion->GetClientData(iIndex);
		if(m_pRegionEditAction)
		{
			// 删除当前的region数据
			m_pRegionEditAction->DelRegion(ulRegionId);
			
			
			
			//设置当前正在编辑的区域
			m_ulCurRegionId = ulNextRegionId;
			m_pRegionEditAction->SelRegion(ulNextRegionId);

			// 清空以前的数据, 填充点的数据
			m_pListboxPointInRegion->Clear();

			
			// 得到下一个要选择的区域
			CUnreachRegion* pRegion = m_pRegionEditAction->GetRegionById(ulNextRegionId);
			if(pRegion)
			{
				int iPointCount = pRegion->GetPointCount();
				CPointInfo* pPointInfo = NULL;
				for(int i = 0; i < iPointCount; i++)
				{
					pPointInfo = pRegion->GetPointInfoByIndex(i);
					if(pPointInfo)
					{
						RegionAddNewPoint(pPointInfo->m_ulPointId, true);
					}
				}//
			}
		
		}//if(m_pRegionEditAction)

		if(-1 != iNextIndex)
		{
			m_pListboxRegion->SetSelection(iNextIndex);
			m_iCurSelRegionIndex = iNextIndex;
		}

		m_pListboxRegion->Delete(iIndex);

		// 设置当前没有编辑区域标记
		SetEditRegionFlag(false);
		

	}// if(-1 != iIndex)


}