[Qgis-developer] Information about Progress in diagram branch
Marco Hugentobler
marco.hugentobler at karto.baug.ethz.ch
Mon Feb 19 15:46:14 EST 2007
Hi Martin,
> that's interesting work! I will surely try it out soon and investigate
> the possibilities of connecting it with label placement in future.
> Just to make sure if I understand well how does it work: every vector
> layer has its own overlay to which it can receive some objects from
> outside. Then position manager looks at the objects in overlays and
> creates a placement from the information obtained from them. Is that
>correct?
yes, overlay objects are created depending on view extent, then the method
findOptimalOverlayPositions() of the overlay manager is called. Then all the
overlays are drawn. This is done in QgsVectorLayer::drawOverlays.
> Do you draw the vector overlay directly to the rendered map or do you
> use map canvas items?
At the moment, the objects are directly drawn on map using
QPainter::drawImage. Though canvas items may be better for collision
detection and manually move items around. I'm not experienced with canvas
item, so I'm wondering if the layer order is maintained if feature geometries
are drawn on the map, then overlay objects as map canvas items and then again
feature geometries.
>
> For labeling I'd like to use this algorithm: from every feature you'll
> get a set of label candidates (also with priorities). Then a conflict
> graph of overlapping candidates will be created (candidate = vertex,
> conflict = edge). There's a good heuristic for solving this conflict
> graph, resolving in a set of labels to be drawn. Does the current
> implementation fit well to this?
The current impementation does not yet do any collision detection or
intelligent placement (just center point placement and drawing diagrams). But
I hope that this algorithm can be done in future in a more sophisticated
subclass of QgsOverlayObjectPositionManager. As this class has all the
information about the overlay objects (basically the bounding box of the
object and the geometry of the corresponding feature), I think it should be
able to implement this algorithm.
cheers,
Marco
More information about the Qgis-developer
mailing list