static bool GetReferenced( CFile& rFile, CString& rString, TOPOMAP& theMap ) { CRuntimeClass *pRT; if( NULL == ( pRT = GetPictureType( &rFile ) ) ); CPicture *pPict = (CPicture*) pRT->CreateObject(); VERIFY( pPict->Attach( &rFile ) && pPict->ReadHeader() ); long X0, Y0, X1, Y1; TAG tag270; GetPictInfo( pPict, X0, Y0, X1, Y1); if( pPict->GetTag( 270, tag270 ) ) { rString = tag270.strVal(); } delete pPict; ////////////////////////////////////////////////////////////////// // Karteninformation basteln theMap.m_sizeOfPicture.cx = X1; theMap.m_sizeOfPicture.cy = Y1; // GCP's: LinksUnten, RechtsUnten, RechtsOben, LinksOben GEOPOINT LO, RU; LO.X = 0; LO.Y = 0; RU.X = 0; RU.Y = 0; theMap.m_listOfGCP.erase( theMap.m_listOfGCP.begin(), theMap.m_listOfGCP.end() ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( LO.X, RU.Y, 0 ), GEOPOINT( 0, Y1, 0 ) ) ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( RU.X, RU.Y, 0 ), GEOPOINT( X1, Y1, 0 ) ) ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( RU.X, LO.Y, 0 ), GEOPOINT( X1, 0, 0 ) ) ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( LO.X, LO.Y, 0 ), GEOPOINT( 0, 0, 0 ) ) ); return true; }
static bool GetIntergraph( CFile& rFile, CString& rString, TOPOMAP& theMap ) { CRuntimeClass *pRT; bool bRet = false; if( NULL == ( pRT = GetPictureType( &rFile ) ) ); CPicture *pPict = (CPicture*) pRT->CreateObject(); VERIFY( pPict->Attach( &rFile ) && pPict->ReadHeader() ); long X0, Y0, X1, Y1; TAG tag270; TAG tag33918; GetPictInfo( pPict, X0, Y0, X1, Y1); if( pPict->GetTag( 33918, tag33918 ) ) { long nItems = tag33918.Count(); if( ( 4 + 64 ) == nItems ) { IGTAG33918* pData = (IGTAG33918*) tag33918.pVal(); _ASSERTE(sizeof(theMap.m_transform.m_matrix) == sizeof(pData->dblVal) ); memcpy( theMap.m_transform.m_matrix, pData->dblVal, sizeof(theMap.m_transform.m_matrix) ); ////////////////////////////////////////////////////////////////// // Karteninformation basteln theMap.m_sizeOfPicture.cx = X1; theMap.m_sizeOfPicture.cy = Y1; // GCP's: LinksUnten, RechtsUnten, RechtsOben, LinksOben theMap.m_listOfGCP.erase( theMap.m_listOfGCP.begin(), theMap.m_listOfGCP.end() ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( ), GEOPOINT( 0, Y1, 0 ) ) ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( ), GEOPOINT( X1, Y1, 0 ) ) ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( ), GEOPOINT( X1, 0, 0 ) ) ); theMap.m_listOfGCP.push_back( GCP( GEOPOINT( ), GEOPOINT( 0, 0, 0 ) ) ); bRet = true; } } delete pPict; return bRet; }
void testRandom(unsigned int const n) { srand(time(0)); std::vector<uint64_t> V(n); for ( uint64_t i = 0; i <n; ++i ) V[i] = rand(); ::libmaus::timing::RealTimeClock rtc; rtc.start(); CountPut CP; ::libmaus::gamma::GammaEncoder< CountPut > GCP(CP); for ( uint64_t i = 0; i < n; ++i ) GCP.encode(V[i]); GCP.flush(); double const cencsecs = rtc.getElapsedSeconds(); std::cerr << "[V] count encoded " << n << " numbers in time " << cencsecs << " rate " << (n / cencsecs)/(1000*1000) << " m/s" << " output words " << CP.cnt << std::endl; VectorPut<uint64_t> VP; rtc.start(); ::libmaus::gamma::GammaEncoder< VectorPut<uint64_t> > GE(VP); for ( uint64_t i = 0; i < n; ++i ) GE.encode(V[i]); GE.flush(); double const encsecs = rtc.getElapsedSeconds(); std::cerr << "[V] encoded " << n << " numbers to dyn growing vector in time " << encsecs << " rate " << (n / encsecs)/(1000*1000) << " m/s" << std::endl; rtc.start(); VectorGet<uint64_t> VG(VP.begin()); ::libmaus::gamma::GammaDecoder < VectorGet<uint64_t> > GD(VG); bool ok = true; for ( uint64_t i = 0; ok && i < n; ++i ) { uint64_t const v = GD.decode(); ok = ok && (v==V[i]); if ( ! ok ) { std::cerr << "expected " << V[i] << " got " << v << std::endl; } } double const decsecs = rtc.getElapsedSeconds(); std::cerr << "[V] decoded " << n << " numbers in time " << decsecs << " rate " << (n / decsecs)/(1000*1000) << " m/s" << std::endl; if ( ok ) { std::cout << "Test of gamma coding with " << n << " random numbers ok." << std::endl; } else { std::cout << "Test of gamma coding with " << n << " random numbers failed." << std::endl; } }