[Users] GeoExt.data.PrintPage: incorrect behaviour of method fit()?

Alexandre Saunier alexandre.saunier at camptocamp.com
Thu Aug 19 18:12:33 CEST 2010


Hi Andreas,
thanks for replying. I have created a ticket and attached the patch here:
http://trac.geoext.org/ticket/318
alex

PS: I don't know if it is on purpose but "GeoExt.data.PrintPage" is
missing in the components list in Trac.

2010/8/19 Andreas Hocevar <ahocevar at opengeo.org>:
> Hi Alex,
>
> you are absolutely right, the latest change introduced this regression, and your fix is perfectly valid. Can you create a ticket please?
>
> Thanks,
> Andreas.
>
> On Aug 19, 2010, at 16:05 , Alexandre Saunier wrote:
>
>> Hello all,
>>
>> I use GeoExt.ux.SimplePrint with a "autoFit:true" option to display
>> the largest print page extent that fits in the map.
>> However I keep getting one-size-too-large extents (page extent does
>> not fit in the map, the next scale in the list is the good one).
>>
>> In GeoExt.data.PrintPage.fit() code (updated a few days ago), I have
>> noticed the following piece of code in the scales list iteration (see
>> [1]):
>>
>> var bounds = this.calculatePageBounds(rec, units);
>> var contains = bounds.containsBounds(extent);
>> if (contains) {
>>      scale = rec;
>> }
>> => the scale is updated only if the print extent is still larger than
>> the map. So when the print extent actually fits within the map, the
>> scale is not updated accordingly.
>> With the following patch, the print extent is fine:
>>
>> Index: data/PrintPage.js
>> ===================================================================
>> --- data/PrintPage.js   (revision 2275)
>> +++ data/PrintPage.js   (working copy)
>> @@ -202,9 +202,7 @@
>>         this.printProvider.scales.each(function(rec) {
>>             var bounds = this.calculatePageBounds(rec, units);
>>             var contains = bounds.containsBounds(extent);
>> -            if (contains) {
>> -                scale = rec;
>> -            }
>> +            scale = rec;
>>             if (loose) {
>>                 var diff = Math.min(
>>                     Math.abs(bounds.getWidth() - mapWidth),
>>
>> Do I miss something?
>>
>> Thanks for your help,
>> alex
>>
>> [1] http://trac.geoext.org/browser/core/trunk/geoext/lib/GeoExt/data/PrintPage.js?rev=2275#L202
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>


More information about the Users mailing list