tools/hhtracer/tracer.h
changeset 16085 9ad74696ddec
parent 16084 2d65bd46c92f
equal deleted inserted replaced
16084:2d65bd46c92f 16085:9ad74696ddec
    21 
    21 
    22 struct Solution {
    22 struct Solution {
    23   QList<Primitive> primitives;
    23   QList<Primitive> primitives;
    24   double fitness;
    24   double fitness;
    25   QSizeF size;
    25   QSizeF size;
       
    26   QString fileName;
    26 
    27 
    27   explicit Solution(QSizeF size, const QList<QColor>& palette);
    28   explicit Solution(QSizeF size, const QList<QColor>& palette);
    28   void calculateFitness(const QImage& image);
    29   void calculateFitness(const QImage& target);
    29   void render(const QString& fileName) const;
    30   void render(const QString& fileName);
    30   double cost() const;
    31   double cost() const;
       
    32   void mutate(const QList<QColor>& palette);
       
    33   void crossover(Solution &other);
    31 };
    34 };
    32 
    35 
    33 class Tracer : public QObject {
    36 class Tracer : public QObject {
    34   Q_OBJECT
    37   Q_OBJECT
    35   QML_ELEMENT
    38   QML_ELEMENT
    62   QList<QColor> palette_;
    65   QList<QColor> palette_;
    63   double bestSolution_;
    66   double bestSolution_;
    64   QStringList solutions_;
    67   QStringList solutions_;
    65   QList<Solution> generation_;
    68   QList<Solution> generation_;
    66   QTemporaryDir tempDir_;
    69   QTemporaryDir tempDir_;
    67   QImage image_;
    70   QImage referenceImage_;
    68 
    71 
    69   QString newFileName();
    72   QString newFileName();
    70 };
    73 };