コード例 #1
0
void 
TilesNotice::load( SharedBuffer& buf )
{
   // Offset.
   m_offset = buf.readNextBALong();
   
   // start lat
   m_startLatIdx = buf.readNextBALong();
   // end lat
   m_endLatIdx = buf.readNextBALong();
   // start lon
   m_startLonIdx = buf.readNextBALong();
   // end lon 
   m_endLonIdx = buf.readNextBALong();

   // Size of m_impRange.
   m_nbrLayers = buf.readNextBAShort();
   MC2_ASSERT( m_nbrLayers > 0 );
   delete [] m_impRange;
   m_impRange = new impRange_t[ m_nbrLayers ];
   for ( uint32 i = 0; i < m_nbrLayers; ++i ) {
      m_impRange[ i ].m_layerID = buf.readNextBAShort();
      m_impRange[ i ].m_firstImp = buf.readNextBALong();
      m_impRange[ i ].m_lastImp = buf.readNextBALong();
   } 
}
コード例 #2
0
uint32 
TileCollectionNotice::load( SharedBuffer& buf )
{
   // Load the m_indexByLayerID map.
   uint32 size = buf.readNextBAShort();
   {for ( uint32 i = 0; i < size; ++i ) {
      // Layer ID.
      int layerID = buf.readNextBAShort();

      // Index.
      int index = buf.readNextBAShort();
     
      m_indexByLayerID[ layerID ] = index;
   }}
  
   // Size of m_tilesForAllDetails.
   size = buf.readNextBAShort();

   m_tilesForAllDetails.reserve( size );

   // Load all the TilesForAllDetailsNotices. 
   {for ( uint32 i = 0; i < size; ++i ) {
      TilesForAllDetailsNotice notice;
      notice.load( buf );
      m_tilesForAllDetails.push_back( notice );
   }}

   return buf.getCurrentOffset();
}
コード例 #3
0
void 
TilesForAllDetailsNotice::load( SharedBuffer& buf )
{
   // Start detail.
   m_startDetail = buf.readNextBAShort();

   // The notices.
   uint32 size = buf.readNextBAShort();
   m_tilesNotice.reserve( size );

   for ( uint32 i = 0; i < size; ++i ) {
      TilesNotice notice;
      notice.load( buf );
      m_tilesNotice.push_back( notice );
   }
}
コード例 #4
0
void
SFDLoadableHeader::loadRemainingHeader( SharedBuffer& buf )
{
   // File size.
   m_fileSize = buf.readNextBALong();

   // The name.
   m_name = buf.readNextString();

   mc2dbg << "[SFDLH] m_name = " << m_name << endl;

   // Check the file size.
   if ( m_fileHandler->getFileSize() != m_fileSize ) {
      m_state = failed_to_load;
      m_nbrBytesToRead = 0;
      innerLoad();
      return;
   }

   // Creation time.
   m_creationTime = buf.readNextBALong();

   // Null terminated strings?
   m_stringsAreNullTerminated = buf.readNextBAByte();

   // Longest length of string.
   m_maxStringSize = buf.readNextBAByte();

   // Nbr initial chars.
   byte nbrInitialChars = buf.readNextBAByte();
   m_initialCharacters.resize( nbrInitialChars );
   // Initial chars.
   {for ( byte b = 0; b < nbrInitialChars; ++b ) {
      m_initialCharacters[ b ] = buf.readNextBAByte();
   }}
   
   // Nbr route ids.
   byte nbrRouteIDs = buf.readNextBAByte();
   m_routeIDs.reserve( nbrRouteIDs );
   {for ( byte b = 0; b < nbrRouteIDs; ++b ) {
      uint32 id = buf.readNextBALong();
      uint32 creationTime = buf.readNextBALong(); 
      m_routeIDs.push_back( RouteID( id, creationTime ) );
   }}

   // Number of bits for the string index.
   m_strIdxEntrySizeBits = buf.readNextBALong();

   // Position for the start of strings index.
   m_strIdxStartOffset = buf.readNextBALong();

   // Number strings.
   m_nbrStrings = buf.readNextBALong();
   
   // Position for the start of string data.
   m_strDataStartOffset = buf.readNextBALong();

   // Position for the start of the buffers index.
   m_bufferIdxStartOffset = buf.readNextBALong();

   // Position for the start of the buffer data.
   m_bufferDataStartOffset = buf.readNextBALong();
  
   // If to read debug param strings for the multi buffers.
   m_readDebugParams = buf.readNextBAByte();
   
   // The tile collections.
   uint32 nbrCollections = buf.readNextBAShort();

   m_tileCollection.resize( nbrCollections );
   {for ( uint32 i = 0; i < nbrCollections; ++i ) {
      m_tileCollection[ i ].load( buf );
   }}
  
   // All is now loaded.
   m_state = loaded_all_header;
   m_nbrBytesToRead = 0;
   innerLoad();
}