[Users] Some printing questions

Hugo hfpmartins at gmail.com
Fri Oct 7 14:49:34 CEST 2011


Hello Geoffrey,

Thanks a lot for your comments but my problem is exactly at destroying the
legend printing for the vector layers. I have no idea on how to do this. I
have tried the following but without success:

beforeprint: function(printProv, printMap, printPages, printOpt){
var includeLegend = Ext.getCmp('includeleg').getValue();
if (includeLegend == true){
var legOpt = printOpt.legend;
var legLayerStore = legOpt.layerStore;
legLayerStore.each(function(layerRec){
var layerDef = layerRec.get('layer');
if (layerDef.ClASS_NAME == 'OpenLayers.Layer.Vector'){
legLayerStore.remove(layerRec);
}
})
}
}

So my question would be, how can i tell the printprovider to not print the
legend for this type of layers?

Thanks a lot,
Hugo

On Fri, Oct 7, 2011 at 8:37 AM, gbrun <gbrun at myopera.com> wrote:

> Hi!
>
> I would rather use the "beforeprint" or the "beforeencodelayer" function
>  from the "printProvider" class. This function allows you to change some
> parameters before layers are printed. So, trough this function, you can
> test if your map contains vector layers. In this case, you can probably
> find a way to destroy their relative legend from the print process. You
> will find below an example:
>
>        printProvider = new GeoExt.data.PrintProvider({
>                method: 'POST', // 'POST' recommended for production use
> ('GET' for
> development)
>                capabilities: printCapabilities, // from the info.json
> script in the html
>                listeners:{
>                        beforeprint: function(){
>                                // test each layer
>                                        // if the layer is vector, remove it
> from the printed legend
>                        }, // or use the "beforeencodelayer" function
>                        beforeencodelayer: function (printProvider, layer){
>                                // test each layer (easy with the layer
> parameter provided by this
> function!)
>                                        // if the layer is vector, remove it
> from the printed legend
>                        }
>                }
>        });
>
> I hope it might help you!
>
> Geoffrey
>
>
> Le Thu, 06 Oct 2011 20:17:20 +0200, Hugo <hfpmartins at gmail.com> a écrit:
>
> > Hello once again,
> >
> > One more question though... If i still want to print legends without wfs
> > and
> > vector layers, how can i avoid these layers being passed in the request?
> >
> > At the moment i have:
> > printProvider.print(mapPanel, printPage, {legend: legendPanel});
> >
> > So i suppose i have to clone my legendPanel and set some properties for
> > the
> > layers i don't want to include in the legend. What would be the approach
> > to
> > follow?
> >
> > Thanks,
> > Hugo
> >
> > On Thu, Oct 6, 2011 at 2:48 PM, Hugo <hfpmartins at gmail.com> wrote:
> >
> >> Hello Chris and Geoffrey,
> >>
> >> Thanks a lot for your replies. I will look further into your suggestions
> >> and come back with feedback.
> >> Cheers,
> >>
> >> Hugo
> >>
> >>
> >> On Tue, Oct 4, 2011 at 8:15 PM, Christian Mayer
> >> <mayer at terrestris.de>wrote:
> >>
> >>> **
> >>> Hello Hugo,
> >>>
> >>> for your second problem you may use the beforeprint event of the
> >>> PrintProvider class, with the
> >>> listener arguments:
> >>>
> >>>    - printProvider -
> >>> GeoExt.data.PrintProvider<
> http://geoext.org/lib/GeoExt/data/PrintProvider.html#GeoExt.data.PrintProvider
> >this
> >>> PrintProvider
> >>>    - map - OpenLayers.Map the map being printed
> >>>    - pages - Array of
> >>> GeoExt.data.PrintPage<
> http://geoext.org/lib/GeoExt/data/PrintPage.html#GeoExt.data.PrintPage>the
> >>> print pages being printed
> >>>    - options - Object the options to the print command
> >>>
> >>> see: http://geoext.org/lib/GeoExt/data/PrintProvider.html
> >>>
> >>> Maybe you check and rearrange your map object here.
> >>>
> >>> Best regards,
> >>> Chris
> >>>
> >>> Am 04.10.2011 19:58, schrieb gbrun:
> >>>
> >>> Hi Hugo,
> >>>
> >>> As far as I know, printing vector legend is not supported in the
> >>> current
> >>> GeoExt trunk.
> >>>
> >>> No idea for your second problem!
> >>>
> >>> Geoffrey
> >>>
> >>>
> >>> Le Tue, 04 Oct 2011 17:15:01 +0200, Hugo <hfpmartins at gmail.com>
> >>> <hfpmartins at gmail.com> a écrit:
> >>>
> >>>
> >>>  Hello all,
> >>>
> >>> I was able to implement printing using printprovider, printpage and the
> >>> printextent plugin. However i have some small bugs which, untill now, i
> >>> wasn't able to solve.
> >>>
> >>> The first problem i'm having is related with printing legends when
> >>> having
> >>> WFS layers on the map (firebuf is always showing: encFn is undefined).
> >>> I
> >>> have checked the encoders part of the prinProvider.js and in fact i
> >>> don't
> >>> see WFS there. However there is an encoder for vector layers. So my
> >>> first
> >>> question would be is it possible to print legends with WFS?
> >>>
> >>> My second problem is related with layer order. When the app is loaded,
> >>> there
> >>> are some initial layers that are loaded (WMS, WFS and TileCache). I
> >>> also
> >>> have the functionality to allow user to add additional layers returned
> >>> by
> >>> WMS capabilities of geoserver. Because i wnated to keep all layers that
> >>> were
> >>> initially loaded above all others i'm setting layers ZIndex dynamically
> >>> in
> >>> the app. All is working fine when viewing and adding new layers (i
> >>> always
> >>> get inital loaded layers on top of the added ones). However, when
> >>> trying
> >>> to
> >>> print, the added layers from wms capabilities are always on the top of
> >>> all
> >>> others. More interesting is that, after printing, all layers are
> >>> magically
> >>> rearranged and in fact, the added layers become on top of all the
> >>> others.
> >>> What property am i missing here???
> >>>
> >>> Kind regards,
> >>> Hugo
> >>>
> >>>
> >>>  _______________________________________________
> >>> Users mailing
> >>> listUsers at geoext.orghttp://
> www.geoext.org/cgi-bin/mailman/listinfo/users
> >>>
> >>>
> >>>
> >>> --
> >>> Dipl.-Ing.(FH) Christian Mayer
> >>>   - Anwendungsentwickler -
> >>>
> >>>   terrestris GmbH & Co. KG
> >>>   Irmintrudisstraße 17
> >>>   53111 Bonn
> >>>
> >>>   Tel:    ++49 (0)228 / 96 28 99 -53
> >>>   Fax:    ++49 (0)228 / 96 28 99 -57
> >>>
> >>>   Email:  mayer at terrestris.de
> >>>   Web:    http://www.terrestris.de
> >>>
> >>>   Amtsgericht Bonn, HRA 6835
> >>>   Komplementärin:  terrestris Verwaltungsgesellschaft mbH
> >>>   vertreten durch: Hinrich Paulsen, Till Adams
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at geoext.org
> >>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> >>>
> >>>
> >>
> >>
> >> --
> >> Hugo Martins
> >> LabNT - ISEGI UNL
> >> Campus de Campolide
> >> 1070-312 Lisboa
> >> N 38°43'56.84", W 9°9'35.74"
> >>
> >
> >
> >
>
>
> --
> --
> Geoffrey BRUN
>
> Étudiant en master SIGMA
> Stagiaire au PNR du Haut-Languedoc
>
> Hameau de Brassac
> Saint-Pons de Thomières
> +33 (0) 6 77 74 44 16
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>



-- 
Hugo Martins
LabNT - ISEGI UNL
Campus de Campolide
1070-312 Lisboa
N 38°43'56.84", W 9°9'35.74"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20111007/4ca07446/attachment.htm 


More information about the Users mailing list