Commit bc389df09461a9a210653eb4b34bd593174676d0

Authored by Scott Klum
1 parent 284a46fd

Handling lists in namelandmarks

openbr/plugins/metadata/namelandmarks.cpp
... ... @@ -36,17 +36,19 @@ class NameLandmarksTransform : public UntrainableMetadataTransform
36 36  
37 37 void projectMetadata(const File &src, File &dst) const
38 38 {
39   - if (indices.size() != names.size()) qFatal("Index/name size mismatch");
  39 + const bool makeList = indices.size() != names.size();
40 40  
41 41 dst = src;
42 42  
43 43 if (point) {
44 44 QList<QPointF> points = src.points();
45 45  
46   - for (int i=0; i<indices.size(); i++) {
47   - if (indices[i] < points.size()) dst.set(names[i], points[indices[i]]);
48   - else qFatal("Index out of range.");
49   - }
  46 + if (makeList)
  47 + dst.setList(names.first(),points);
  48 + else
  49 + for (int i=0; i<indices.size(); i++)
  50 + if (indices[i] < points.size()) dst.set(names[i], points[indices[i]]);
  51 + else qFatal("Index out of range.");
50 52 } else {
51 53 QList<QRectF> rects = src.rects();
52 54  
... ...