This is undoubtedly a problem with unfamiliarity with Ext, but I am 
having a struggle creating an extension to GeoExt to handle ArcGIS legend.

The difference between WMSLegend and AGS legend, is that you get a json 
with effective and array of text, url_to_image pairs instead on one 
image. I have object that encapsulates that and it is property of an 
ArcGISREST92 layer.

The fun is in trying to layout the image and text.

Using wmsLegend as model, I have following:
   layerContainer:null;
     initComponent: function(){
         var me = this;
         me.callParent();
         var layer = me.layerRecord.getLayer();
         me._noMap = !layer.map;
         this.legendContainer = Ext.create('Ext.panel.Panel',{
                                             layout: 'vbox',
                                             border: false,
                                         });
         this.add(this.legendContainer);
         layer.events.register("moveend", me, me.onLayerMoveend);
         me.update();
     },

The legend Container is supposed to be panel to manage a vertical list 
of components.
Forgetting the text for moment, the code to add the images is:
         for  (j=0, lenj = layerNames.length; j<lenj; j++) {
             layerName = layerNames[j];
             for(i = 0, len = 
layer.agsLegend.layerLegend[layerName].legend.length; i<len; i++) {
                 if(!this.items || !this.getComponent(layerName+i)) {
                     if (!layer.hideInLegend) {
                       var lg = 
layer.agsLegend.layerLegend[layerName].legend[i];
                       this.legendContainer.add({
                                     xtype: "gx_legendimage",
                                     url: layer.agsLegend.serverUrl 
+'/'+ layerName +'/images/'+lg.url,
                                     itemId: lg.label
                       });
                     }
                 }
             }
         }
         this.doLayout();

If I examine the DOM, then I can find all the images as entries, but not 
displayed. Stuck in a 0,0 div???

If I add the images directly to the agsLegend (this.add({ 
xtype:"gx_legendimage" etc) instead of this.legendContainer.add, then 
the images are all displayed - but in a horizontal row.

I am blowed if I can see what I have missed in layering this out. 
Something preventing doLayout from calculating size???





Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
Dev mailing list
Dev@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to