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