Esempio n. 1
0
int COXSplashWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
	{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if ((HRGN)m_rgn != NULL)
		{
		CRgn rgn;
		rgn.CreateRectRgn(0,0,1,1);
		switch(rgn.CopyRgn(&m_rgn))
			{
			case ERROR:
				TRACE0("COXSplashWnd::OnCreate(): fail to load the calculated region.\r\n");
				rgn.DeleteObject();
				break;
			case NULLREGION:
				TRACE0("COXSplashWnd::OnCreate(): empty region was encountered.\r\n");
				rgn.DeleteObject();
				break;
			default:
				::SetWindowRgn(m_hWnd, (HRGN)rgn.Detach(), TRUE);
			}
		}
	
	CenterWindow();
	if (m_nTimeout != SPLASH_NOTIMER)
		SetTimer(OXSPLASHWND_TIMERID_HIDE, m_nTimeout, NULL);

	SetCapture();
	::SetCursor(::LoadCursor(NULL, IDC_ARROW));
	
	return 0;
	}
Esempio n. 2
0
// @pymethod int|PyCRgn|CopyRgn|Copies the region defined by pRgnSrc into the CRgn object
// Return Values: success or failure flag (BOOL)
PyObject *
PyCRgn::copy_rgn(PyObject *self, PyObject *args)
	{
	CRgn *pRgn = PyCRgn::GetRgn(self);
	if (!pRgn) return NULL;

	PyObject *objRgnSrc = Py_None;
	if (!PyArg_ParseTuple(args,"O:CopyRgn",&objRgnSrc))
		return NULL;

	CRgn *pRgnSrc = PyCRgn::GetRgn(objRgnSrc);
	if (!pRgnSrc) return NULL;

	int result=pRgn->CopyRgn(pRgnSrc);

	return Py_BuildValue("i",result);
	}
Esempio n. 3
0
void CDialogCreateRoi::AddROIElement(CRgn& rgn, Element::IElementPtr pElement)
{
	if (!m_bMulti)
	{
		ROI_INFO* ri = new ROI_INFO();
		m_lstROI.push_back(ri);
		ELE_INFO eleInfo;
		Display::ISymbolPtr pSymbol = pElement->GetSymbol();
		srand(time(NULL));
		m_lCurColor = RGB(rand() % 256,rand() % 256,rand() % 256);
		pSymbol->SetColor(m_lCurColor);
		m_pMapCtrl->UpdateControl(drawElement);
		CString str;
		str.Format("%d",pSymbol->GetColor());
		int n = m_list.GetItemCount();

		CBitmap bitmap;
		bitmap.Attach(CoverBitmap(pSymbol));
		int Index = m_ImageList.Add(&bitmap, RGB(255, 255, 255));
		bitmap.DeleteObject();

		LV_ITEM lvi;

		lvi.mask = /*LVIF_TEXT |*/ LVIF_IMAGE /*| LVIF_STATE*/;
		lvi.iItem = n;
		lvi.iSubItem = 0;
		lvi.iImage = Index;

		//m_list.InsertItem(n, "", Index);
		m_list.InsertItem( &lvi );
		str.Format("类别%d",n);
		int nCount = m_lstROI.size();
		ROI_INFO* roiInfo =m_lstROI[nCount-1];
		roiInfo->lColor = pSymbol->GetColor();
		roiInfo->strClassNmae = str;
		eleInfo.strClassNmae = str;
		eleInfo.elems.push_back(pElement);
		m_lstEle.push_back(eleInfo);
		CRgn* pRgn = new CRgn();
		rgn.CopyRgn(pRgn);
		roiInfo->rgns.push_back(pRgn);
		m_list.SetItemText(n,1,str);
		m_list.SetItemText(n,2,"1");
		m_nIndex = n;
		m_nCount = 1;
	}
	else
	{
		Display::ISymbolPtr pSymbol = pElement->GetSymbol();
		pSymbol->SetColor(m_lCurColor);
		m_pMapCtrl->UpdateControl(drawElement);
		int nCount = m_lstROI.size();
		ROI_INFO* roiInfo =m_lstROI[nCount-1];
		m_lstEle[nCount-1].elems.push_back(pElement);
		CRgn* pRgn = new CRgn();
		rgn.CopyRgn(pRgn);
		roiInfo->rgns.push_back(pRgn);
		m_nCount++;
		CString str;
		str.Format("%d",m_nCount);
		m_list.SetItemText(m_nIndex,2,str.GetBuffer());
	}
	m_bMulti = true;
	//m_bNewROI = false;
}