Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-13 Thread haubourg
Hi Larry, 
there it is:  http://www.sendspace.com/file/8quogm
http://www.sendspace.com/file/8quogm  


--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Freeze-dynamic-labels-in-advanced-labeling-tp4987087p4988149.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-13 Thread Paolo Cavallini
Il 13/07/2012 10:12, haubourg ha scritto:
 Hi Larry, 
 there it is:  http://www.sendspace.com/file/8quogm

Hi Régis,
IMHO, better publishing it and mark it as experimental, so it will be easier to
cooperate.
All the best, and thanks.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-13 Thread haubourg
Sure, I should have send a private mail.. sorry for that. 

--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Freeze-dynamic-labels-in-advanced-labeling-tp4987087p4988161.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-12 Thread Larry Shaffer
Hi Martin,

On Wed, Jul 11, 2012 at 1:58 PM, Martin Dobias wonder...@gmail.com wrote:
 Hi Larry

 On Tue, Jul 10, 2012 at 6:11 AM, Larry Shaffer lar...@dakotacarto.com 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
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-12 Thread haubourg

Larry_S wrote
 
 
 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?
 

Hi, +1 for that functionnality. 

I wrote a plugin to duplicate a layer and add advanced labeling fields in
order to quickly make a labeling ready layer. having XY prelocated thanks
to PAL is big feature I miss. 
 (I have some more things to fix before releasing it.. ) 

Régis

--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Freeze-dynamic-labels-in-advanced-labeling-tp4987087p4987950.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-12 Thread Larry Shaffer
Hi Régis,

On Thu, Jul 12, 2012 at 6:45 AM, haubourg
regis.haubo...@eau-adour-garonne.fr wrote:

 Larry_S wrote


 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?


 Hi, +1 for that functionnality.

 I wrote a plugin to duplicate a layer and add advanced labeling fields in
 order to quickly make a labeling ready layer. having XY prelocated thanks
 to PAL is big feature I miss.
  (I have some more things to fix before releasing it.. )

I have an immediate need on my current project for just such a plugin!
Please contact me directly if you don't mind sharing it a bit before
release.

The logic in my patch to freeze dynamic labels comes just after the
labels are drawn to the canvas using PAL. It currently can't write all
layer labels to its source (or a duplicated layer) unless all the
labels can be shown in the canvas when zooming to the layer's extent,
which is possible in some labeling setups.

In other words, with my approach, it requires some specific setup or
interactivity from the user. The freeze labels tool I'm working
towards (need it on my project with thousands of labels right now) is
basically an interactive one, similar to the other labeling tools.

It may be possible to mimic those actions in a plugin, to freeze all
labels for a layer, but it won't be very elegant until the Python
access is crafted, as mentioned by Martin (unless you are coding your
plugin in C++, I guess).

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-11 Thread Martin Dobias
Hi Larry

On Tue, Jul 10, 2012 at 6:11 AM, Larry Shaffer lar...@dakotacarto.com 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 :-)

Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Freeze dynamic labels in advanced labeling

2012-07-10 Thread Giovanni Manghi
Hi Larry,

 Currently, I have to manually move a label to have its coords written.

it is known issue. If you want to have the label automatically rotated
using a data defined value I think you will need to use the old
labelling engine.

cheers

-- Giovanni --

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer