[Qgis-developer] New adv labeling freeze-thaw tools

Larry Shaffer larrys at dakotacarto.com
Mon Aug 6 13:28:50 PDT 2012


Hi Régis,

On Mon, Aug 6, 2012 at 7:28 AM, haubourg
<regis.haubourg at eau-adour-garonne.fr> wrote:
> Hi Larry,
> your tool is awesome! Users will love it.

I had fun building the tool. Since the underlying code from Martin and
Marco H. was so well done and readable I was able to somewhat quickly
add on to what they made.

I really needed the functionality of the tool I made. It's kind of a
testament to the project that someone with my C++ coding skills can
download and understand the source, tinker around with it, make
improvements, have them peer-reviewed and eventually committed for
others to try out. And, I even want to learn more about coding C++!

> One thing is missing, or maybe I missed it: a shortcut to unhide a label. Is
> it possible?
> I did not find any other way than manually changing label size to more than
> 0.

Yes this is possible. I have thought about several ways to accomplish
it and think I've come up with a good interactive implementation:

* Add a new Show Label data-defined column that will contain 1 or 0
(shown or hidden). This can then readily be mapped to a checkbox in
various ui forms. The PAL labeling engine will be updated to key off
of that field for showing /hiding labels, while still retaining
current method of font-size manipulation.

* Change code for hiding label to just setting Show Label field to 0.

* Add to the Freeze/Thaw tool the ability to Shift+Ctl+click-or-drag
on feature(s) (not label) to show label again. This would just set
Show Label to 1.

Other than Show Label just really needs to be added, it also allows
the mapped label size field to retain its value. Otherwise, an
automated showing of a label won't know what size to input into the
field. Lastly, these features should be added to Change Label dialog.


Here are other improvements I am thinking of adding to the labeling
tools, while the label tools and PAL labeling engine code is still
fresh in my head:

* Move freeze/thaw tool methods to base QgsMapToolLabel class. This
will allow adding to move and rotate label tools so they can have
those capabilities when selecting with a rubber-band marquee. Won't
have to constantly switch back-and-forth between tools anymore.

* Add frozen and frozen-but-editable highlight colors to app prefs.

* Improve Change Label dialog:
- Temporarily add (colored) PAL solution x, y, rot info to specific
fields if nothing is data-defined yet.
- Add ability to set relevant fields to NULL (instead of just 0).
- Show expression output for label Text and make non-editable if using
expression.
- Add Apply button and function, allowing dialog to stay open after
changes (tracking/reverting undo stack for Cancel operation).
- Add ability to select features, not just labels, to adjust aspects
of hidden labels.


> Last thing missing with labels will be arrows..

Do you mean call-out lines or arrows that automatically stay connected
to a label's corner  and a destination point? If so, yeah, that would
be very cool. There is already the QgsComposerArrow class that could
jump-start implementing such a feature.


Please let me know what you think of these ideas, and if you have any
others. I have several other ideas and will look at adding a new wiki
page for improvements to the new labeling tools, which would be
different than adding back in missing features noted here:

http://hub.qgis.org/wiki/quantum-gis/Switching_from_Old_to_New_Symbology_and_Labeling

Regards,

Larry


More information about the Qgis-developer mailing list