Planning the graphics handling
Did some reading and thinking, to come to this conclusion:
- Each image and its annotation areas should be handled using an MdhSurface class.
- The display of the image and zones should be handled using a QGraphicsScene descendant, which is a member of MdhSurface.
- The image might be rendered as a background using QBrush, or it might be a QGraphicsPixmap item (item 0 in the array held by QGraphicsScene).
- The zones should be handled either by QGraphicsRectItem descendants (if we handle only rectangles), or QGraphicsPolygonItem descendants (if we handle polygons -- see below).
- The actual view should be handled by a QGraphicsView. I'm not sure yet whether that should be part of MdhSurface, or external to it; and I'm not sure at what level we should create an actual widget to be instantiated on a panel. Probably the widget would be MdhSurface, and would have the QGraphicsView as a member, but I'm still fuzzy on that.
I've also figured out a way of encoding polygonal zones in P5. Here's a brief description I sent to the TEI list for some feedback:
The current spec for <facsimile> and its children allows only rectangular zones on a surface:
<surface> <zone ulx="10" uly="10" lrx="50" lry="50"></zone> <zone ulx="60" uly="100" lrx="90" lry="200"></zone> </surface>
specifying two rectangular zones on the surface.
Digging around a bit, I noticed that <zone> can contain <desc>, <desc> can contain <dim>. <dim> "contains any single measurement forming part of a dimensional specification of some sort." So I'm thinking that I can do polygons like this:
<surface> <zone ulx="10" uly="10" lrx="50" lry="50"> <desc> <dim type="point">10,10</dim> <dim type="point">30,30</dim> <dim type="point">50,50</dim> </desc> </zone> </surface>
The standard attributes on <zone> define the bounding rectangle for the polygon (enabling processing by any agent that only handles rectangles), while the points of the polygon (triangle in this case) are defined in the <dim> elements for IMT and any suitably-aware processor to handle.