示例#1
0
BOOL CObjectAttDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	if(m_pRecordset != NULL)
	{		
		m_lstObject.SetExtendedStyle(LVS_EX_GRIDLINES|LVS_EX_INFOTIP|LVS_EX_FULLROWSELECT);
		LVCOLUMN lvColumn;
		lvColumn.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_FMT;
		lvColumn.fmt = LVCFMT_LEFT;
		
		CString strText = _T("");
		lvColumn.cx = 100;
		
		strText.LoadString(IDS_FIELD_NAME);
		OgdcString strTmp = (OgdcString)strText;
		lvColumn.pszText = (char*)strTmp.Cstr();
		
		m_lstObject.InsertColumn(0, &lvColumn);

		lvColumn.cx = 100;
		strText.LoadString(IDS_FIELD_VALUE);
		OgdcString strTmp2 = (OgdcString)strText;
		lvColumn.pszText = (char*)strTmp2.Cstr();
		m_lstObject.InsertColumn(1, &lvColumn);

		OgdcFieldInfos fieldInfos;
		m_pRecordset->GetFieldInfos(fieldInfos);
		for(int i=0;i<fieldInfos.GetSize();i++)
		{
			OgdcFieldInfo fieldInfo = fieldInfos.GetAt(i);
			OgdcString strName = fieldInfo.m_strForeignName;
			if(strName.IsEmpty())
			{
				strName = fieldInfo.m_strName;
			}
			m_lstObject.InsertItem(i, strName);
			m_lstObject.SetItemText(i, 0, fieldInfo.m_strName);
			OgdcVariant var;
			m_pRecordset->GetFieldValue(fieldInfo.m_strName, var);
			m_lstObject.SetItemText(i, 1, var.ToString());
		}
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
示例#2
0
void COpenDBDlg::OnOK() 
{	 
	UpdateData();	
	OgdcString strAlias = m_strAlias;
	if(strAlias.IsEmpty() ||
		(m_pDataSources != NULL && m_pDataSources->Lookup(strAlias) != NULL))
	{		
		AfxMessageBox(IDS_ALIAS_ISEXISTED);
		return;
	}
	OgdcInt n_Class = m_Provider.GetEngineClass();	
	if(n_Class == 2)
	{
		OgdcString strTmpServer = OgdcString(m_strServer);
		char cTmp = '\\';
		if (strTmpServer.Find(cTmp,0)==-1) 
		{
			AfxMessageBox("请输入正确的路径!");
		     return;
		}
	}
	CDialog::OnOK();
}
示例#3
0
void CViewerWnd::AddDataset(OgdcDataset* pDataset, OgdcStyle& style, OgdcString& strName, BOOL bClear)
{	
	if(pDataset == NULL)
	{
		return;
	}

	if(bClear)
	{
		m_nSelectID = -1;
		m_pSelectDataset = NULL;
		m_datasets.RemoveAll();
		m_styles.RemoveAll();
		m_names.RemoveAll();
	}
	else if(FindDataset(pDataset) != -1)
	{
		return;
	}

	if(pDataset->GetType() == OgdcDataset::Tabular ||
		strName.IsEmpty())
	{
		return;
	}

	m_datasets.Add(pDataset);	
	m_styles.Add(style);
	m_names.Add(strName);

	m_drawing.m_rcBounds = ComputeBounds();
    if(m_datasets.GetSize() == 1)
	{
		m_drawing.ViewEntire();
		if(!pDataset->IsRaster())
		{
			OgdcDatasetVector* pDatasetV = (OgdcDatasetVector*)pDataset;
			long nCount = pDatasetV->GetObjectCount();
			if(nCount > 1000000)		//! 百万以上
			{
				m_drawing.Zoom(100);
			}
			else if(nCount > 100000)	//! 十万以上
			{
				m_drawing.Zoom(32);
			}
			else if(nCount > 10000)		//! 一万以上
			{
				m_drawing.Zoom(8);
			}
			else if(nCount > 3000)		//! 三千以上
			{
				m_drawing.Zoom(2);
			}
		}
		else
		{
			OgdcDatasetRaster *pDatasetR = (OgdcDatasetRaster *)pDataset;
			double dWidth = m_drawing.m_rcBounds.Width();
			double dHeight = m_drawing.m_rcBounds.Height();
			LONG nWidth = pDatasetR->GetWidth();
			LONG nHeight = pDatasetR->GetHeight();

			if(nWidth!=0 && nHeight!=0)
			{
				double dResolutionX = dWidth / nWidth;
				double dResolutionY = dHeight / nHeight;
				if(dResolutionX > dResolutionY)
				{
					m_drawing.SetCoordRatio(dResolutionX);
				}
				else
				{
					m_drawing.SetCoordRatio(dResolutionY);
				}
			}
		}
	}
}