Commit 48d8b3cc9b70911c5051430344aae5a53714dca2

Authored by Scott Klum
1 parent 8c5213c9

PP5 fix, file::flat() and init() tweaks

sdk/core/core.cpp
... ... @@ -189,8 +189,6 @@ struct AlgorithmCore
189 189 enroll(file);
190 190 gallery.reset(Gallery::make(getMemoryGallery(file)));
191 191 galleryFiles = gallery->files();
192   -
193   - qDebug() << galleryFiles;
194 192 }
195 193 }
196 194  
... ...
sdk/openbr_plugin.cpp
... ... @@ -45,7 +45,20 @@ QString File::flat() const
45 45 foreach (const QString &key, keys) {
46 46 const QVariant value = this->value(key);
47 47 if (value.isNull()) values.append(key);
48   - else values.append(key + "=" + value.toString());
  48 + else {
  49 + if (value.canConvert(QVariant::String)) {
  50 + values.append(key + "=" + value.toString());
  51 + }
  52 + else {
  53 + if (value.type() == QVariant::PointF) values.append(key + "=" + QString("(%1,%2)").arg(QString::number(qvariant_cast<QPointF>(value).x()),
  54 + QString::number(qvariant_cast<QPointF>(value).y())));
  55 + else if (value.type() == QVariant::RectF) values.append(key + "=" + QString("(%1,%2,%3,%4)").arg(QString::number(qvariant_cast<QRectF>(value).x()),
  56 + QString::number(qvariant_cast<QRectF>(value).y()),
  57 + QString::number(qvariant_cast<QRectF>(value).width()),
  58 + QString::number(qvariant_cast<QRectF>(value).height())));
  59 + else values.append(key + "=");
  60 + }
  61 + }
49 62 }
50 63  
51 64 QString flat = name;
... ... @@ -240,7 +253,18 @@ void File::init(const QString &amp;file)
240 253 if (unnamed) setParameter(i, words[0]);
241 254 else set(words[0], QVariant());
242 255 } else {
243   - set(words[0], words[1]);
  256 + if (words[1][0] == '(') {
  257 + QStringList values = words[1].split(',');
  258 + if (values.size() == 2) /* QPointF */ {
  259 + QPointF point(values[0].remove('(').toFloat(), values[1].remove(')').toFloat());
  260 + set(words[0], point);
  261 + }
  262 + else /* QRectF */ {
  263 + QRectF rect(values[0].remove('(').toFloat(), values[1].toFloat(), values[2].toFloat(), values[3].remove(')').toFloat());
  264 + set(words[0], rect);
  265 + }
  266 + }
  267 + else set(words[0], words[1]);
244 268 }
245 269 }
246 270 name = name.left(index);
... ...
sdk/plugins/pp5.cpp
... ... @@ -191,15 +191,13 @@ struct PP5Context
191 191 ppr_landmark_type &landmark = landmark_list.landmarks[j];
192 192 if (landmark.category != category) continue;
193 193  
194   - metadata.insert(metadataString+"_X", landmark.position.x);
195   - metadata.insert(metadataString+"_Y", landmark.position.y);
  194 + metadata.insert(metadataString, QPointF(landmark.position.x, landmark.position.y));
196 195 found = true;
197 196 break;
198 197 }
199 198  
200 199 if (!found) {
201   - metadata.insert(metadataString+"_X", std::numeric_limits<float>::quiet_NaN());
202   - metadata.insert(metadataString+"_Y", std::numeric_limits<float>::quiet_NaN());
  200 + metadata.insert(metadataString, QPointF(std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN()));
203 201 }
204 202 }
205 203  
... ...