Beispiel #1
0
void CTSE_Info_Object::x_DSDetach(CDataSource& ds)
{
    _ASSERT(m_TSE_Info);
    _ASSERT(m_Parent_Info || m_TSE_Info == this);
    _ASSERT(!m_Parent_Info || &ds == &GetDataSource());
    x_DSDetachContents(ds);
}
Beispiel #2
0
std::string CCoreAudioDevice::GetCurrentDataSourceName() const
{
  UInt32 dataSourceId = 0;
  std::string dataSourceName = "";
  if(GetDataSource(dataSourceId))
  {
    dataSourceName = GetDataSourceName(dataSourceId);
  }
  return dataSourceName;
}
Beispiel #3
0
void CTSE_Info_Object::x_DetachObject(CTSE_Info_Object& object)
{
    _ASSERT(&object.GetBaseParent_Info() == this);
    if ( HasDataSource() ) {
        object.x_DSDetach(GetDataSource());
    }
    if ( HasTSE_Info() ) {
        object.x_TSEDetach(GetTSE_Info());
    }
}
Beispiel #4
0
//连接数据库
void CADO::CreateDBCNT( CONNECTPTR& cnt )
{
	try
	{
		cnt.time = CTime::GetCurrentTime();//2012.07.20 无条件的记录一个时间
		cnt.pConn.CreateInstance(__uuidof(Connection));
		cnt.pConn->ConnectionTimeout=30;//连接超时时间设置,单位秒
		CString str;
#ifdef XWB_SQL_LINK
		//Provider=SQLOLEDB;Data Source=192.168.0.102; Initial Catalog=hsrun10; User ID=sa; Password=hs2003info
		str.Format("Provider=SQLOLEDB;Data Source=%s; Initial Catalog=%s; User ID=%s; Password=%s",
			GetDataSource(),GetInitialCatalog(),GetUserID(),GetPassword() );
#else
		str.Format("Provider=OraOLEDB.Oracle;Data Source=%s;User ID=%s;Password=%s;PLSQLRSet=1",
			GetDataSource(),GetUserID(),GetPassword() );
#endif
		_variant_t varSRC( (LPSTR)(LPCTSTR)str );
		_bstr_t bsConnect(varSRC);
		if (S_OK != cnt.pConn->Open(bsConnect, "", "", adModeUnknown))
		{//连接失败
			if(cnt.pConn->State)
				cnt.pConn->Close();
			cnt.pConn = NULL;
		}
		else
		{//连接成功
#ifdef XWB_SQL_LINK //2013.06.13 xuwb: SQL SERVER兼容读取出参和数据集
			cnt.pConn->CursorLocation = adUseClient;
#endif
			cnt.pCommand.CreateInstance(__uuidof(Command));
			cnt.pCommand->ActiveConnection = cnt.pConn;
		}
	}
	catch(...)
	{
		cnt.pConn = NULL;
		cnt.pCommand = NULL;
	}
}
SuperMapLpFeatureSchemaCollection* SuperMapConnection::GetLpSchemas()
{
	TRACE(_T("开始调用 SuperMapConnection::GetLpSchemas() 。\n"));
	//第一次调用时对逻辑物理模式初始化,初始化成功后就只需直接返回。
	if(m_LpSchemas == NULL)
	{
		TRACE(_T("调用 SuperMapConnection::GetLpSchemas():逻辑物理模式为空 。\n"));
		UGC::UGDataSource* pDataSource = GetDataSource();
		m_LpSchemas = new SuperMapLpFeatureSchemaCollection(
			this, pDataSource);
	}
	TRACE(_T("结束调用 SuperMapConnection::GetLpSchemas() 。\n"));
	return FDO_SAFE_ADDREF(m_LpSchemas.p);
}
Beispiel #6
0
////////////////////////////////////////////////
//
// 初始化TOOLTIP控件
//
void CDataGridEx::InitToolTipControl()
{
	if(m_RecordCount<0)
	{
		LPUNKNOWN pUnknown;
		HRESULT hr;
		_RecordsetPtr IRecordset;

		pUnknown=GetDataSource();
		
		if(pUnknown==NULL)
			return;

		try
		{
			hr=pUnknown->QueryInterface(__uuidof(Recordset),(void**)&IRecordset);

			pUnknown->Release();

			if(FAILED(hr))
			{
				throw _com_error(hr);
			}

			m_RecordCount=IRecordset->GetRecordCount();
		}
		catch(_com_error &e)
		{
			AfxMessageBox(e.ErrorMessage());
		}
	}

	if(IsWindow(m_ToolTip.GetSafeHwnd()))
		return;

	m_ToolTip.Create(this);
	
	TOOLINFO ToolInfo;

	memset(&ToolInfo,0,sizeof(TOOLINFO));

	ToolInfo.cbSize=sizeof(TOOLINFO);
	ToolInfo.uFlags=TTF_TRACK|TTF_IDISHWND| TTF_ABSOLUTE;
	ToolInfo.hwnd=this->m_hWnd;
	ToolInfo.uId=(UINT)this->m_hWnd;
	ToolInfo.lpszText=LPSTR_TEXTCALLBACK;

	m_ToolTip.SendMessage(TTM_ADDTOOL,0,(LPARAM)&ToolInfo);
}
Beispiel #7
0
CDataLoader::TTSE_Lock
CSRADataLoader::GetBlobById(const TBlobId& blob_id)
{
    CTSE_LoadLock load_lock = GetDataSource()->GetTSE_LoadLock(blob_id);
    if ( !load_lock.IsLoaded() ) {
        const CSRABlobId& sra_id = dynamic_cast<const CSRABlobId&>(*blob_id);
        CRef<CSeq_entry> entry =
            m_Impl->LoadSRAEntry(sra_id.m_Accession, sra_id.m_SpotId);
        if ( entry ) {
            load_lock->SetSeq_entry(*entry);
        }
        load_lock.SetLoaded();
    }
    return load_lock;
}
Beispiel #8
0
COLORREF CGetColor::GetPixel(int nXPos, int nYPos)
{
	COLORREF cr = {0};
	RECT rcScreen;
	rcScreen.left = nXPos;
	rcScreen.top = nYPos;
	rcScreen.right = nXPos + 1;
	rcScreen.bottom = nYPos + 1;
	if(CopyScreenToData(&rcScreen))
	{
		BYTE* pData;
		DWORD dwLen;
		GetDataSource(&pData, &dwLen);
		DWORD dwBitCount = GetBitCount();
		DWORD dwPaletteSize = 0;
		if (dwBitCount <= 8) 
			dwPaletteSize = (1 <<  dwBitCount) *  sizeof(RGBQUAD);
		BITMAPFILEHEADER bmpFileHred;
		BITMAPINFOHEADER bi;
		memcpy(&bmpFileHred, pData, sizeof(BITMAPFILEHEADER));
		memcpy(&bi, pData + sizeof(BITMAPFILEHEADER), sizeof(BITMAPINFOHEADER));
		
		if(dwBitCount == 8)
		{
			DWORD DataSizePerLine = ((bi.biWidth * dwBitCount + 31) / 32) * 4;
			BYTE* pColor = pData +  sizeof(BITMAPFILEHEADER) +  sizeof(BITMAPINFOHEADER) + dwPaletteSize + DataSizePerLine * ( bi.biHeight - 1) + 0;
			BYTE bColor; memcpy(&bColor, pColor, sizeof(BYTE));
			int nColor = (int)bColor;
			RGBQUAD rgb;
			memcpy(&rgb, pData +  sizeof(BITMAPFILEHEADER) +  sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD)*nColor) , sizeof(RGBQUAD));
			cr = RGB(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue);
		}
		if(dwBitCount == 24)
		{
			DWORD DataSizePerLine = ((bi.biWidth * dwBitCount + 31) / 32) * 4;
			BYTE* pColor = pData +  sizeof(BITMAPFILEHEADER) +  sizeof(BITMAPINFOHEADER) + 0 + DataSizePerLine * ( bi.biHeight - 1) + 0;
		//	BYTE bColor; memcpy(&bColor, pColor, sizeof(BYTE));
		//	int nColor = (int)bColor;
			RGBQUAD rgb;
			memcpy(&rgb, pColor , sizeof(RGBQUAD));
			cr = RGB(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue);
		}
		LockData(false);
	}
	return cr;
}
CAsnCache_DataLoader::TTSE_Lock
CAsnCache_DataLoader::GetBlobById(const TBlobId& blob_id)
{
    CSeq_id_Handle idh =
        dynamic_cast<const CBlobIdSeq_id&>(*blob_id).GetValue();

    CTSE_LoadLock lock = GetDataSource()->GetTSE_LoadLock(blob_id);
    if ( !lock.IsLoaded() ) {
        SCacheInfo& index = x_GetIndex();
        CFastMutexGuard LOCK(index.cache_mtx);

        CRef<CSeq_entry> entry = index.cache->GetEntry(idh);
        ++index.requests;

        if (entry) {
            ++index.found;
            lock->SetSeq_entry(*entry);
            lock.SetLoaded();

            /**
            LOG_POST(Error
                     << "CAsnCache_DataLoader::GetBlobById(): loaded seq-entry for "
                     << idh);
        } else {

            LOG_POST(Error
                     << "CAsnCache_DataLoader::GetBlobById(): failed to load seq-entry for "
                     << idh);
                     **/
        }
        /**
    } else {
        LOG_POST(Error
                 << "CAsnCache_DataLoader::GetBlobById(): already loaded: "
                 << idh);
                 **/
    }
    return lock;
}
Beispiel #10
0
void CTSE_Info_Object::x_DSDetachContents(CDataSource& _DEBUG_ARG(ds))
{
    _ASSERT(&ds == &GetDataSource());
}
Beispiel #11
0
CDataLoader::TTSE_LockSet
CWGSDataLoader::GetRecords(const CSeq_id_Handle& idh,
                           EChoice choice)
{
    return m_Impl->GetRecords(GetDataSource(), idh, choice);
}
SuperMapSpatialContextCollection* SuperMapConnection::GetSpatialContexts()
{
	TRACE(_T("开始调用 SuperMapConnection::GetSpatialContexts() 。\n"));
	if(m_SpatialContextColl == NULL)
	{
		// 通过物理数据源初始化空间语义列表
		FdoStringP strName;
		FdoStringP strDescription;
		FdoStringP strCoordSysName;

		UGC::EmSpatialRefType eType;             //  空间语义类型
		FdoStringP strDatumName ;           //  基准面名 DATUM
		FdoStringP strSpheroidName ;        //  椭球体名
		double dSemiMajor;                       //  椭球体长半轴长度
		double dInvflattening;                   //  椭球体扁率倒数 
		FdoStringP strPrimeMeridian ;       //  本初子午线(0度经线)通常为"Greenwich"
		FdoStringP GeoUnit ;                //  地理单位
		FdoStringP GeoUnitFactor ;          //  地理单位换算系数
		FdoStringP Unit ;                   //  单位
		FdoStringP UnitFactor ;             //  单位换算系数
		
		FdoPtr<SuperMapSpatialContext> pSpatialContext = new SuperMapSpatialContext(); 
		
		// 经纬度坐标和投影坐标都要取的公共参数
		UGC::UGPrjCoordSys prjCoordSys = GetDataSource()->GetPrjCoordSys();
		strName = prjCoordSys.GetName();
		
		eType = prjCoordSys.GetSpatialRefType();
		UGC::UGGeoCoordSys geoCoordSys = prjCoordSys.GetGeoCoordSys(); // 获取地理坐标信息
		strCoordSysName = geoCoordSys.GetName();
		UGC::UGHorizonDatum datum = geoCoordSys.GetHorizonDatum();   // 获取基准面信息
		strDatumName = datum.GetDatumName();
		UGC::UGSpheroid spheroid = datum.GetSpheroid();  // 获取椭球体信息
		strSpheroidName = spheroid.GetName();
		dSemiMajor = spheroid.GetAxis();
		dInvflattening = 1/(spheroid.GetFlatten());
		UGC::UGPrimeMeridian prmMeridian = geoCoordSys.GetPrimeMeridian();        // 获取本初子午线信息
		strPrimeMeridian = prmMeridian.GetName();

		// 获取地理单位和地理单位系数
		switch(geoCoordSys.GetUnit())
		{
			// 角度单位换算到弧度单位
		case AU_DEGREE:
			GeoUnit = L"Degree";
			GeoUnitFactor = L"0.01745329";
			break;
		case AU_RADIAN:
			GeoUnit = L"Radian";
			GeoUnitFactor = L"1.00000000";
			break;
		case AU_MINUTE:
			GeoUnit = L"Minute";
			GeoUnitFactor = L"0.00029089";
			break;
		case AU_SECOND:
			GeoUnit = L"Second";
			GeoUnitFactor = L"0.00000485";
			break;
		case AU_GRAD:
			GeoUnit = L"Gard";
			GeoUnitFactor = L"0.01570796";
			break;
		case AU_MICRORADIAN:
			GeoUnit = L"MicroRadian";
			GeoUnitFactor = L"0.00000100";
			break;
		case AU_MINUTE_CENTESIMAL:
			GeoUnit = L"Minute_Centesimal";
			GeoUnitFactor = L"0.00015708";
			break;
		case AU_SECOND_CENTESIMAL:
			GeoUnit = L"Second_Centesimal";
			GeoUnitFactor = L"0.00000157";
			break;
		case AU_MIL_6400:
			GeoUnit = L"Mil_6400";
			GeoUnitFactor = L"0.00098175";
			break;
		}
		// 投影坐标单位
		switch(prjCoordSys.GetUnit())
		{
		// 长度单位换算到米
		case AU_MM:
			Unit = L"MILLIMETER";
			UnitFactor = L"0.001";
			break;
		case AU_CM:
			Unit = L"CENTIMETER";
			UnitFactor = L"0.01";
			break;
		case AU_DM:
			Unit = L"DECIMETER";
			UnitFactor = L"0.10";
			break;
		case AU_M:
			Unit = L"METER";
			UnitFactor = L"1.0";
			break;
		case AU_KM:
			Unit = L"KILOMETER";
			UnitFactor = L"1000.00";
			break;
		case AU_MI:
			Unit = L"MILE";
			UnitFactor = L"1609.31";
			break;
		case AU_IN:
			Unit = L"INCH";
			UnitFactor = L"0.0254";
			break;
		case AU_YARD:
			Unit = L"YARD";
			UnitFactor = L"0.9144";
			break;
		case AU_FT:
			Unit = L"FOOT";
			UnitFactor = L"0.3048";
			break;
		default:
			Unit = L"";
			UnitFactor = L"";
		}
		

		if(eType == UGC::SPATIALREF_EARTH_PROJECTION) // 如果是投影坐标系,获取相关投影参数。
		{
			UGC::UGProjection projection = prjCoordSys.GetProjection();
			pSpatialContext->m_ProjectName = projection.GetProjectionName();
			UGC::UGPrjParams prjParams = prjCoordSys.GetPrjParams();
			//需要赋值的投影参数:
			//double m_dFalseEasting;			//  0 False easting (X0)
			//double m_dFalseNorthing;		//  1 False northing (Y0)
			//double m_dCentralMeridian;		//  2 Central meridian, Longitude of origin (LON0)
			//double m_dCentralParallel;		//  6 Central parallel, Latitude of origin	(LAT0)

			//double m_dStandardParallel1;	//  3 Standard parallel 1, Latitude of 1st point (LAT1)
			//double m_dStandardParallel2;	//  4 Standard parallel 2, Latitude of 2nd point (LAT2)

			//double m_dScaleFactor;			//  5 Scale factor
			//double m_dAzimuth;				//  7 Azimuth

			//double m_dFirstPointLongitude;		//  8 Longitude of 1st point (LON1)
			//double m_dSecondPointLongitude;		//  9 Longitude of 2nd point  (LON2)
			pSpatialContext->m_dFalseEasting = prjParams.m_dFalseEasting;
			pSpatialContext->m_dFalseNorthing = prjParams.m_dFalseNorthing;
			pSpatialContext->m_dCentralMeridian = prjParams.m_dCentralMeridian;
			pSpatialContext->m_dCentralParallel = prjParams.m_dCentralParallel;
			pSpatialContext->m_dStandardParallel1 = prjParams.m_dStandardParallel1;
			pSpatialContext->m_dStandardParallel2 = prjParams.m_dStandardParallel2;
			pSpatialContext->m_dScaleFactor = prjParams.m_dScaleFactor;
			pSpatialContext->m_dAzimuth = prjParams.m_dAzimuth;
			pSpatialContext->m_dFirstPointLongitude = prjParams.m_dFirstPointLongitude;
			pSpatialContext->m_dSecondPointLongitude = prjParams.m_dSecondPointLongitude;
		}
		// end for 取空间语义的实际值
	
		// 设置公共的空间语义的参数
		pSpatialContext->SetName(strName);
		pSpatialContext->SetDescription(strDescription);
		pSpatialContext->SetCoordSysName(strCoordSysName); //(strCoordSysName.Right(L"---"));
		pSpatialContext->m_eType = eType;
		pSpatialContext->m_DatumName = strDatumName;
		pSpatialContext->m_SpheroidName = strSpheroidName;
		pSpatialContext->m_dSemiMajor = dSemiMajor;
		pSpatialContext->m_dInvflattening = dInvflattening;
		pSpatialContext->m_PrimeMeridian = strPrimeMeridian;
		pSpatialContext->m_Unit = Unit;
		pSpatialContext->m_UnitFactor = UnitFactor;
		pSpatialContext->m_GeoUnit = GeoUnit;
		pSpatialContext->m_GeoUnitFactor = GeoUnitFactor;

		m_SpatialContextColl = new SuperMapSpatialContextCollection();
		m_SpatialContextColl->Add(pSpatialContext);
	}

	return FDO_SAFE_ADDREF(m_SpatialContextColl.p);
}