[ka-Map-users] printing maps with added objects & printing transparent layers

Lorenzo Becchi lorenzo at ominiverdi.com
Mon Sep 4 05:37:03 EDT 2006



> Hi Lorenzo,

hi Donal,

>
> Thanks for your e-mail.
>
> I am sorry, the strange changes you mention below are because I  
> sent you an old copy of print_map.php. I thought I was editing the  
> most recent version of print_map.php. The only changes that I  
> delibarately made were the ones concerning the opacity. Sorry for   
> my mistake.

No problem at all.


>
> I will have a look at the issue you raise with respect to the order  
> of the layers.


thanks it will be great to include this feature too.

let us know

ciao
Lorenzo










>
>
>
> Lorenzo Becchi <lorenzo at ominiverdi.com> wrote:
> Donal thanks for your code. I've put it on CVS but with some changes.
>
> Why have you changed this line?
>
> header("Content-Disposition: attachment; filename=\"".$oMap- 
> >name.".tiff\"");
>
> in this:
>
> header("Content-Disposition: attachment; filename=".$oMap- 
> >name.".tiff");
>
> and why this:
>
> header("Content-Disposition: attachment; filename=\"".$oMap- 
> >name.".".strtolower($_REQUEST['output_type'])."\"");
>
>
> in this:
>
> header("Content-Disposition: attachment; filename=".$oMap->name.".". 
> $_REQUEST['output_type']);
>
>
> All that strange syntax was granting some compatibility  with  
> filenames with all browsers in windows and mac.
> I suggest you to put it on again.
>
> and why  did you skipped
> location.href='tools/print/print_map.php?'+params;
> using the old winOpener ?
>
> I know there's not a perfect solution, I'm interested in your opinion.
>
> Testing the new solution I've found another limitation of my code:  
> if you move layers up and down the printed map is maintaining the  
> orginal disposition.
> This means looping layers inside a new loop of "group" array  
> caching correspondences.
> Do you want to do this too?
>
> I've put your name in the code. Update from CVS.
>
> ciao
> Lorenzo
>
> ps: please if you don't want to use a line of code leave it  
> commented in your new code so I can understand quickly what you've  
> change without looking for diffs.
>
>
>
>
>
>
>
>
> On 01/set/06, at 04:13, Donal Regan wrote:
>
>> Lorenzo,
>>
>> I have attached a copy of print_map.php that now takes into  
>> account layer opacity. The changes to the javascript function  
>> myPrint() are shown down below.
>> I took on board  what you suggested so print_map.php now checks  
>> for opacitys in the querystring:
>>
>>
>> if (isset($_REQUEST['opacitys']))$opacitys=$_REQUEST['opacitys'];
>> else $opacitys="";
>> $aOpacity=explode(',',$opacitys);
>>
>>
>> and while looping through the layers we can now do the following
>>
>> elseif (in_array($oLayer->group,$aGroup)){
>>                 $oLayer->set('status',MS_ON);
>>                 $opacity = $aOpacity[array_search($oLayer->group, 
>> $aGroup)];
>>                 if($opacity!='')$oLayer->set('transparency', 
>> $opacity);
>>                 if(!$oLayer->isVisible() && ($oLayer->minscale <  
>> $scale && $oLayer->maxscale > $scale )){
>>                 $oLayer->set("minscale",0);
>>                 $oLayer->set("maxscale",(200000000)); // has to be  
>> greater that map maximum scale
>>                 }
>>         }
>>
>> The myPrint() function should now look like the following
>>
>> function myPrint() {
>>     var szLayers = '';
>>     var szOpacitys = '';
>>
>>     var layers = myKaMap.getCurrentMap().getLayers();
>>     for (var i=0;i<layers.length;i++) {
>>         szLayers = szLayers + "," + layers[i].name;
>>         szOpacitys = szOpacitys + "," + layers[i].opacity;
>>     }
>>
>>     var extent = myKaMap.getGeoExtents();
>>     var scale = myKaMap.getCurrentScale();
>>     var cMap = myKaMap.getCurrentMap().name;
>>
>>     var img_width = '600';// pixel dimension. max_img_width set  
>> inside print_map.php
>>     var params='map='+cMap+'&scale='+scale+'&img_width='+img_width 
>> +'&groups='+szLayers+"&opacitys="+szOpacitys+'&extent='+extent[0] 
>> +'|'+extent[1]+'|'+extent[2]+'|'+extent[3];
>>
>>     WOOpenWin( 'Print', '../tools/print/print_map.php?'+params,  
>> 'resizable=yes,scrollbars=yes,width=600,height=400' );
>>
>> }
>>
>>
>> The code works for me on Windows 2000, IE6 and Firefox 1.5.06.
>>
>> Cheers.
>
>
> The all-new Yahoo! Mail goes wherever you go - free your email  
> address from your Internet provider.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20060904/c0d888e0/attachment.html


More information about the ka-Map-users mailing list