Commit 89dd55fcda62dd21326240c3812cd56dfba7909d

Authored by Keyur Patel
1 parent c849ef1b

Modifed Expand Rect to allow the use of propName

openbr/plugins/metadata/expandrect.cpp
... ... @@ -28,8 +28,10 @@ namespace br
28 28 class ExpandRectTransform : public UntrainableTransform
29 29 {
30 30 Q_OBJECT
  31 + Q_PROPERTY(QString propName READ get_propName WRITE set_propName RESET reset_propName STORED false)
31 32 Q_PROPERTY(float widthExpand READ get_widthExpand WRITE set_widthExpand RESET reset_widthExpand STORED false)
32 33 Q_PROPERTY(float heightExpand READ get_heightExpand WRITE set_heightExpand RESET reset_heightExpand STORED false)
  34 + BR_PROPERTY(QString, propName, "")
33 35 BR_PROPERTY(float, widthExpand, .5)
34 36 BR_PROPERTY(float, heightExpand, .5)
35 37  
... ... @@ -37,7 +39,13 @@ class ExpandRectTransform : public UntrainableTransform
37 39 {
38 40 dst = src;
39 41 dst.file.clearRects();
40   - QList<QRectF> rects = src.file.rects();
  42 + QList<QRectF> rects;
  43 +
  44 + if (!propName.isEmpty())
  45 + rects.append(src.file.get<QRectF>(propName));
  46 + else
  47 + rects = src.file.rects();
  48 +
41 49 for (int i=0;i < rects.size(); i++) {
42 50 qreal widthGrowth = rects[i].width() * widthExpand;
43 51 qreal heightGrowth = rects[i].height() * heightExpand;
... ... @@ -47,8 +55,8 @@ class ExpandRectTransform : public UntrainableTransform
47 55 dst.file.appendRect(QRectF(x, y,
48 56 std::min(src.m().cols - x - 1, rects[i].width() + widthGrowth),
49 57 std::min(src.m().rows - y - 1, rects[i].height() + heightGrowth)));
50   -
51 58 }
  59 +
52 60 }
53 61 };
54 62  
... ...