Hi Martin, On Wed, Jul 11, 2012 at 1:58 PM, Martin Dobias <[email protected]> wrote: > Hi Larry > > On Tue, Jul 10, 2012 at 6:11 AM, Larry Shaffer <[email protected]> wrote: >> Hi, >> >> I'm working on a fairly detailed map for print output at a known scale >> (1:24000 @ 300 dpi, 1.2 m x 2.4 m). I'm using the new label engine, >> and manually adjusting many of the labels for x/y and rotation. Labels >> are in map units, with parallel-to-line feature layout. >> >> Is there a means to have PAL layout the labels, then do something to >> freeze (write) *all* labels' x/y coords to the data source? > > I'm not aware of any straightforward solution. I have heard of some > plans to provide PyQGIS wrappers for classes responsible for (PAL) > labeling, so with your Python skills you could create a script/plugin > that would take care of freezing labels - though the API would > probably need some tweaks to allow not only draw the resulting labels, > but also fetch the label positions. > > Freezing the labeling and editing of label placement were things I > wanted to do from the early times when playing with PAL, but never got > to it close enough :-)
Thanks for taking the time to address my question. I've actually coded this in C++ and it works pretty well, as a rough proof-of-concept [0]. I'd appreciate it if you checked it out, if you have the time. It's my first attempt at an actual C++ feature. There's no GUI, but it can be bluntly toggled for testing like this: * Load a line vector layer with x, y, and rotation fields in its attribute table * Configure label engine settings (I only tested with parallel-to-line settings noted above) * Enable editing for layer and the labels of its features within the map canvas extent have their coords and rotation written to the attribute table * Try move, rotate, and change label tools to test (all work well for me, and no longer 'reset' the label on first edit) The caveat here is that, on every canvas update while the layer is still editable, labels are always written to the table, even if they have already been and are identical. This causes a lot of writes that can take time to undo if layer editing is cancelled. This can be fixed. It only writes what's visible in the extent (actually a good feature), but panning around at different zoom levels, or just zooming out to layer extent if using map units and showing all labels, eventually writes most or all labels to the table. I'm thinking of wiring it to a toggle-able button in the adv. labeling toolbar. Then a user can leave it on or off while they pan. A user can then zoom in on a troublesome area, freeze the labels there, toggle freezing off, then adjust the frozen labels, while leaving the rest dynamic. There can be other settings, like only freezing selected feature's labels. [0] https://dl.dropbox.com/u/4058089/qgis/qgspallabeling-cpp_patch.diff Regards, Larry Shaffer Dakota Cartography Black Hills, South Dakota _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
