当前位置: 首页>>代码示例>>C++>>正文


C++ TileMap::coordsRef方法代码示例

本文整理汇总了C++中TileMap::coordsRef方法的典型用法代码示例。如果您正苦于以下问题:C++ TileMap::coordsRef方法的具体用法?C++ TileMap::coordsRef怎么用?C++ TileMap::coordsRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TileMap的用法示例。


在下文中一共展示了TileMap::coordsRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: coord

void 
CoordsArg::addCoord( int32 lat, int32 lon, TileMap& tileMap ) 
{
   if ( m_startCoordIdx == MAX_UINT32 ) {
      m_allCoords = &tileMap.coordsRef();
      m_startCoordIdx = m_allCoords->size();
      m_endCoordIdx = m_allCoords->size();
   }

   TileMapCoord coord( lat, lon );
   // Snap the coordinate to a pixel in the tile map.
   tileMap.snapCoordToPixel( coord );

   // Check that we're not adding duplicate coordinates.
   if ( size() > 0 ) {
      const TileMapCoord& lastCoord = back();
      if ( lastCoord != coord ) {
         // Not duplicated. Add.
         push_back( coord );
      }
   } else {
      // First coordinate. Add.
      push_back( coord );
   } 
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:25,代码来源:TileFeatureArg.cpp

示例2: TileMapCoord

bool 
CoordsArg::load( BitBuffer& buf, TileMap& tileMap,
                 const TileFeatureArg* prevArg ) 
{
   const TileMapCoord* referenceCoord = &(tileMap.getReferenceCoord());

   // Check if the previous coords last coordinate can be used as
   // reference.
 
   if ( prevArg != NULL ) {
      // Use previous feature's last coordinate as reference. 
      const CoordsArg* prevCoordsArg = 
         static_cast<const CoordsArg*> ( prevArg );
      MC2_ASSERT( prevCoordsArg->size() > 0 );
      
#ifndef SLIM_TILE_COORDS
      referenceCoord = &(prevCoordsArg->back());
#else
      referenceCoord = &(prevCoordsArg->back(tileMap));
#endif
   }

   // Write the number of coordinates.
   int nbrBitsCoordSize = buf.readNextBits( 4 );
   uint16 nbrCoords = buf.readNextBits( nbrBitsCoordSize );

   if ( nbrCoords == 0 ) {
      return true;
   }

   mc2dbg8 << "CoordsArg::load" << endl;
   mc2dbg8 << "referenceCoord = "
      << referenceCoord->getLon()
      << ", " << 
      referenceCoord->getLat()
      << ", mc2scale = "
      << tileMap.getMC2Scale() 
      << endl;

   // Nbr bits needed for start diff.
   int nbrStartDiffBits = buf.readNextBits( 4 );
   // Read startLatDiff.
   int16 startLatDiff = buf.readNextSignedBits( nbrStartDiffBits );
   // Read startLonDiff.
   int16 startLonDiff = buf.readNextSignedBits( nbrStartDiffBits );
   
   mc2dbg8 << "nbrStartDiffBits = " << nbrStartDiffBits << endl;
   mc2dbg8 << " startLatDiff = " << startLatDiff << ", startLonDiff = "
      << startLonDiff << endl;
   
   // Read bitsPerLatDiff.
   int bitsPerLatDiff = buf.readNextBits( 4 );
   // Read bitsPerLonDiff.
   int bitsPerLonDiff = buf.readNextBits( 4 );

   // Set the coordinates
   TileMapCoords* allCoords = &(tileMap.coordsRef());
   m_startCoordIdx = allCoords->size();
   m_endCoordIdx = allCoords->size() + nbrCoords;
   
   // Calculate the starting coordinate.
   int32 prevLat = startLatDiff * tileMap.getMC2Scale() +
      referenceCoord->getLat();
   int32 prevLon = startLonDiff * tileMap.getMC2Scale() +
      referenceCoord->getLon();
  
   allCoords->push_back( TileMapCoord( prevLat, prevLon ) );
   
   // Read the rest of the coords.
   for ( int i = 1; i < nbrCoords; ++i ) {
      // Lat
      int16 latDiff = buf.readNextSignedBits( bitsPerLatDiff );
      int32 curLat = latDiff * tileMap.getMC2Scale() + prevLat;
      // Lon
      int16 lonDiff = buf.readNextSignedBits( bitsPerLonDiff ); 
      int32 curLon = lonDiff * tileMap.getMC2Scale() + prevLon;
      mc2dbg8 << "diff " << latDiff << ", " << lonDiff << endl;
      mc2dbg8 << "coord " << curLat << ", " << curLon << endl;
      // Update prev coordinates.
      prevLat = curLat;
      prevLon = curLon;
      // Set the coord.
      allCoords->push_back( TileMapCoord( curLat, curLon ) );
   }

   // Oopendate de bundingboex.
   for( uint32 h = m_startCoordIdx; h < m_endCoordIdx; ++h ) {
      m_bbox.update( (*allCoords)[h].getLat(),
                     (*allCoords)[h].getLon(), false );
   }
#ifndef SLIM_TILE_COORDS
   m_allCoords = allCoords;
#endif
   
   return true;
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:96,代码来源:TileFeatureArg.cpp

示例3:

 TileMapCoords::const_iterator 
 CoordsArg::end( TileMap& tileMap ) const 
 {
    return tileMap.coordsRef().begin() + m_endCoordIdx;
 }
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:5,代码来源:TileFeatureArg.cpp


注:本文中的TileMap::coordsRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。