Home | Products | Download | Purchase | Support 


   

AdvanceExport Sample

 

The AdvanceExport sample demonstrates how to create a map application with E-XD++, you can pan it with mouse, and export the canvas to any bitmap or jpeg file.

Steps:

1. Design the diagram with DiagramEditor, and save it to a xdg file

2. Load Xdg file to the canvas by call:
LoadXdgFromResource(IDR_WORLDMAP, _T("XdgRes"), FALSE);
MoveToCenter();
this->SetZoomScale(25);

GetCurrentModel()->SetBkColor(RGB(160,224,255));
GetCurrentModel()->SetDesignMode(FALSE);

3. Export to multiple parts of bitmap files:


void CAdvanceExportView::OnFileExportMBitmap() 
{
	// TODO: Add your command handler code here
	CExportSetDlg dlg;
	dlg.m_pModel = GetCurrentModel();
	if(dlg.DoModal() == IDOK)
	{
		double dWidth = dlg.m_fWidth;
		double dHeight = dlg.m_fHeight;

		GetCurrentModel()->UIToLog(dWidth, FALSE);
		GetCurrentModel()->UIToLog(dHeight);
		int nWidth = CFODrawHelper::RoundValue(dWidth);
		int nHeight = CFODrawHelper::RoundValue(dHeight);
		m_szDefaultPartImageSize = CSize(nWidth, nHeight);
		
		int nTotal = GetTotalPartBitmap();

		CMainFrame *pParent = STATIC_DOWNCAST(CMainFrame,AfxGetMainWnd());
		ASSERT_VALID(pParent);


		//	m_wndProgress.SetAnimationFile("buzz.avi");
		CString strMsg;
		strMsg.Format(_T("This canvas will be exported to %u image files, please waiting..."), nTotal);

		for( int x = 1; x <= nTotal; x++)
		{
			CString strFile;
			strFile.Format(_T("%u.bmp"), x);
			ExportPartAsBmpfile(dlg.m_strPath + strFile, x);
			strMsg.Format(_T("Exporting page image file %u"), x);
			
			strMsg = strMsg + _T(", Fath:") + dlg.m_strPath + strFile;
			pParent->SetWindowText(strMsg);
		}

	}
}

4.  Export canvas to multiple jpeg files, by call:


void CAdvanceExportView::OnFileExportMJpeg() 
{
	// TODO: Add your command handler code here
	CExportSetDlg dlg;
	dlg.m_pModel = GetCurrentModel();
	if(dlg.DoModal() == IDOK)
	{
		double dWidth = dlg.m_fWidth;
		double dHeight = dlg.m_fHeight;
		
		GetCurrentModel()->UIToLog(dWidth, FALSE);
		GetCurrentModel()->UIToLog(dHeight);
		int nWidth = CFODrawHelper::RoundValue(dWidth);
		int nHeight = CFODrawHelper::RoundValue(dHeight);
		m_szDefaultPartImageSize = CSize(nWidth, nHeight);
		
		int nTotal = GetTotalPartBitmap();
		
		CMainFrame *pParent = STATIC_DOWNCAST(CMainFrame,AfxGetMainWnd());
		ASSERT_VALID(pParent);
		
		
		//	m_wndProgress.SetAnimationFile("buzz.avi");
		CString strMsg;
		strMsg.Format(_T("This canvas will be exported to %u image files, please waiting..."), nTotal);
		
		for( int x = 1; x <= nTotal; x++)
		{
			CString strFile;
			strFile.Format(_T("%u.bmp"), x);
			ExportPartAsJpegfile(dlg.m_strPath + strFile, x);
			strMsg.Format(_T("Exporting page image file %u"), x);
			
			strMsg = strMsg + _T(", Fath:") + dlg.m_strPath + strFile;
			pParent->SetWindowText(strMsg);
		}
		
	}
}

[ Home | Products | Download Area | Purchase | SupportContact us ]


Copyright ?1998-2007 UCanCode.Net Software, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.com