Commit 7428627272fd8823420586b242ce7cb553bcaeac

Authored by Austin Van Blanton
1 parent 63d945ad

Add any child elements of <presentation> as bounding boxes

Showing 1 changed file with 15 additions and 0 deletions
openbr/core/bee.cpp
@@ -75,6 +75,21 @@ FileList BEE::readSigset(const File &amp;sigset, bool ignoreMetadata) @@ -75,6 +75,21 @@ FileList BEE::readSigset(const File &amp;sigset, bool ignoreMetadata)
75 else if (!ignoreMetadata) file.set(key, value); 75 else if (!ignoreMetadata) file.set(key, value);
76 } 76 }
77 77
  78 + // add bounding boxes, if they exist (will be child elements of <presentation>)
  79 + if (fileNode.hasChildNodes()) {
  80 + QList<QRectF> rects;
  81 + QDomNodeList bboxes = fileNode.childNodes();
  82 + for (int i=0; i<bboxes.length(); i++) {
  83 + QDomElement bbox = bboxes.at(i).toElement();
  84 + qreal x = bbox.attribute("x").toDouble();
  85 + qreal y = bbox.attribute("y").toDouble();
  86 + qreal width = bbox.attribute("width").toDouble();
  87 + qreal height = bbox.attribute("height").toDouble();
  88 + rects += QRectF(x, y, width, height);
  89 + }
  90 + file.setRects(rects);
  91 + }
  92 +
78 if (file.name.isEmpty()) qFatal("Missing file-name in %s.", qPrintable(sigset)); 93 if (file.name.isEmpty()) qFatal("Missing file-name in %s.", qPrintable(sigset));
79 fileList.append(file); 94 fileList.append(file);
80 95