示例#1
0
  void Sort() {
   
//  if(allow_rotation)
//    std::transform(contentVector.begin(), contentVector.end(), contentVector.begin(), MakeHorizontal());
    
    std::sort( contentVector.begin(), contentVector.end(), GreatestWidthThenGreatestHeightSort() );
  }
示例#2
0
 ContentAccumulator<_T>& operator += ( const typename Content<_T>::Vector & content ) {
  
   contentVector.insert( contentVector.end(), content.begin(), content.end() );
  
   
   return *this;
 }
示例#3
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;
        }
示例#4
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;
        }