[Qgis-developer] QGIS Server - GetPrint request does not respect text boxes size and position if dynamic content passed

Marco Hugentobler marco.hugentobler at sourcepole.ch
Mon May 27 23:31:32 PDT 2013


Hi René-Luc

 >du to the method adjustSizeToText()
 >Someone can confim it ?

I guess yes. 'adjustSizeToText()' works for text, not html. Html support 
for composer label was added recently to the composer label class. 
Please adapt the relevant lines to work with html labels too.

 >Question for Marco, Why removed label, if the request doesn't define a 
value ? Why not used the default value ?

The idea was that the web client has the possibility to remove an 
advertised text label completely if it is not used. E.g. if a 
composition defines a text item with id 'author', the web client can 
simply ignore it if it does not want to have author's name printed. Note 
that the labels without ids are not removed as they are considered to be 
fix, so not subject to client text replacement (original meaning of 
label id was that this text item is subject to text replacement by web 
client. Later, the id has been generalized as an id for every item type).

Another possibility would be to remove the item only if the client gives 
an empty text and use the default text otherwise. What do you think?

Regards,
Marco


On 27.05.2013 22:23, rldhont wrote:
> Hi Marco and other devs,
>
> In src/mapserver/qgsconfigparser.cpp:530 we can read :
>
>   //replace label text
>   foreach ( QgsComposerLabel *currentLabel, composerLabels )
>   {
>     QString title = parameterMap.value( currentLabel->id().toUpper() );
>
>     if ( title.isEmpty() )
>     {
>       //remove exported labels not referenced in the request
>       if ( !currentLabel->id().isEmpty() )
>       {
>         c->removeItem( currentLabel );
>         delete currentLabel;
>       }
>       continue;
>     }
>
>     currentLabel->setText( title );
>     currentLabel->adjustSizeToText();
>   }
>
> This code is used to draw composer label with value defined by the 
> QGIS WMS Server Request GetPrint.
>
> The bug defined in the issues #7894 http://hub.qgis.org/issues/7894 is 
> probably du to the method adjustSizeToText()
> Someone can confim it ?
>
> Question for Marco, Why removed label, if the request doesn't define a 
> value ? Why not used the default value ?
>
> Regards,
> René-Luc D'Hont
> 3Liz
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


-- 
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee



More information about the Qgis-developer mailing list