Marble: Implement webpopup alignment with correct arrow positions
completed by: Mohammed Nafees
mentors: Torsten Rahn, Dennis Nienhüser
To complete this task, two features need to be implemented:
- Extend BillboardGraphicsItem by a method
setAlignment( Qt::Alignmentalignment );
The alignment should be stored as a member in
voidsetProjection(constViewportParams*viewport) should take that alignment into account (see below)
- Choose an appropriate arrow based on the alignment (see below) and render it in
voidPopupItem::paint(QPainter*painter) such that its arrow tip points to the screen position of the given coordinates.
Please implement the top feature first and ignore the arrow position while doing that.
When implementing the alignment in BillboardGraphicsItem, please do it accordingly to this sketch:
Start with different vertical positions as shown in the sketch first. To do that, the current calculation
needs to be changed accordingly. This calculation corresponds to the second image in the sketch. Change it according to the projection and the different behaviors shown in the sketch. Top, VCenter and Bottom should be easy to implement. When no alignment is set for the vertical axis, the position should be calculated optimally for the current viewport. Note that this means that panning the map vertically will fix the screen position in vertical direction of the popup in this case, while in all other cases it will stick to the geo position in vertical direction instead.
After implementing the alignment for the vertical axis as described above, do the same for the horizontal alignment by extending
Test the alignment with different alignment values for the horizontal and vertical axis.
After the alignment works fine in BillboardGraphicsItem, modify PopupItem.cpp to render the arrow in a suitable way. This needs similar calculations like above. Here is a set of arrows to use: