Commit 8ad77f17cfd5d875f1800724e69d6f2dbe3f4507

Authored by Josh Klontz
1 parent e3a93e08

cleaned up Expanded logic

Showing 1 changed file with 6 additions and 5 deletions
openbr/plugins/meta.cpp
... ... @@ -32,22 +32,23 @@ static TemplateList Expanded(const TemplateList &templates)
32 32 {
33 33 TemplateList expanded;
34 34 foreach (const Template &t, templates) {
  35 + const bool enrollAll = t.file.get<bool>("enrollAll");
35 36 if (t.isEmpty()) {
36   - if (!t.file.get<bool>("enrollAll", false))
  37 + if (!enrollAll)
37 38 expanded.append(t);
38 39 continue;
39 40 }
40 41  
41   - const bool fte = t.file.get<bool>("FTE", false);
42   - QList<QPointF> points = t.file.points();
43   - QList<QRectF> rects = t.file.rects();
  42 + const bool fte = t.file.get<bool>("FTE");
  43 + const QList<QPointF> points = t.file.points();
  44 + const QList<QRectF> rects = t.file.rects();
44 45 if (points.size() % t.size() != 0) qFatal("Uneven point count.");
45 46 if (rects.size() % t.size() != 0) qFatal("Uneven rect count.");
46 47 const int pointStep = points.size() / t.size();
47 48 const int rectStep = rects.size() / t.size();
48 49  
49 50 for (int i=0; i<t.size(); i++) {
50   - if (!fte || !t.file.get<bool>("enrollAll", false)) {
  51 + if (!fte || !enrollAll) {
51 52 expanded.append(Template(t.file, t[i]));
52 53 expanded.last().file.setRects(rects.mid(i*rectStep, rectStep));
53 54 expanded.last().file.setPoints(points.mid(i*pointStep, pointStep));
... ...