Exemple #1
0
  void Sort() {
   
//  if(allow_rotation)
//    std::transform(contentVector.begin(), contentVector.end(), contentVector.begin(), MakeHorizontal());
    
    std::sort( contentVector.begin(), contentVector.end(), GreatestWidthThenGreatestHeightSort() );
  }
Exemple #2
0
  bool Fits( const Content<_T> &content ) const {
   
    if( (content.coord.x + content.size.w) > w )
      return false;
    
    if( (content.coord.y + content.size.h) > h )
      return false;
    
    for( typename Content<_T>::Vector::const_iterator itor = contentVector.begin(); itor != contentVector.end(); itor++ )  
      if( content.intersects( *itor ) )
	return false;
    
    return true;
  }
Exemple #3
0
  bool Place(const typename Content<_T>::Vector &contentVector, typename Content<_T>::Vector &remainder) {
    
    bool placedAll = true;
    
    for( typename Content<_T>::Vector::const_iterator itor = contentVector.begin(); itor != contentVector.end(); itor++ ) {
      
      const Content<_T> & content = *itor;
      
      if( Place( content ) == false ) {
	
	placedAll = false;
	remainder.push_back( content );
      }
    }
    
    return placedAll;
  }