1 /**
  2  * @fileOverview  
  3  * Copyright (c) 2013 Regione Autonoma della Sardegna
  4  * Published under the GPL license.<br>
  5  * See <a href="https://sardegnageoportale.it/webgis/license.txt">https://sardegnageoportale.it/webgis/license.txt</a>
  6  * for the full text of the license.
  7  * @version 0.1
  8  */
  9 
 10 
 11 /**
 12  * @include OpenLayers/Control/DrawFeature.js
 13  * @include OpenLayers/StyleMap.js
 14  * @include OpenLayers/Projection.js
 15  * @include OpenLayers/Layer/Vector.js
 16  * @include OpenLayers/BaseTypes/LonLat.js
 17  * @include OpenLayers/Geometry/Point.js
 18  * @include OpenLayers/Geometry/LineString.js
 19  * @include OpenLayers/Handler/Point.js
 20  */
 21 
 22 /**
 23  * @namespace framework.plugins
 24  */
 25 
 26 Ext.namespace('framework.widgets');
 27 
 28 /**
 29  * Creates a combo box that handles results from a geocoding service. By
 30  * default it uses Directory OpenLS service by Regione Autonoma della Sardegna, but it can be configured with a custom store
 31  * to use other services standard OpenLS. If the user enters a valid address in the search
 32  * box, the combo's store will be populated with records that match the
 33  * address.
 34  * @name_ RoutingPanel
 35  * @class Creates a form that handles results from a routing service OpenLS.
 36  * @constructor
 37  * @extends <a target="_blank" href="http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.FormPanel">Ext.form.FormPanel</a>
 38  */
 39 
 40 framework.widgets.RoutingPanel = Ext.extend(Ext.form.FormPanel, 
 41 /** 
 42  * @lends framework.widgets.RoutingPanel.prototype 
 43  */
 44 {
 45     
 46     /**
 47     *  Configured map for rounting
 48     * 
 49     * @public
 50     * @type {Object} OpenLayers.Map
 51     */
 52     map: null,
 53     
 54     /**
 55     *  The combo box used for searching the start point
 56     *  In order to work, the combo needs to have a propoerty locationString: lat,lon (WGS 84, example: locationString: '47.25976,9.58423') assigned depending of the searched position
 57     *  See geocoding_type for the proposed combo.
 58     * 
 59     * @public
 60     * @type {Object} Ext.form.ComboBox
 61     */
 62     startLocationCombo: null,
 63 
 64     /**
 65     *  The combo box used for searching the end point
 66     *  In order to work, the combo needs to have a propoerty locationString: lat,lon (WGS 84, example: locationString: '47.25976,9.58423') assigned depending of the searched position
 67     *  See geocoding_type for the proposed combo.
 68     * 
 69     * @public
 70     * @type {Object} Ext.form.ComboBox
 71     */
 72     endLocationCombo: null,
 73     
 74     /**
 75     *  Proxy to make the search request. default null.
 76     * 
 77     * @public
 78     * @type string
 79     */
 80     proxy: null,
 81     
 82     /**
 83     *  Store for toring the routing results
 84     * 
 85     * @public
 86     * @type {Object} Ext.data.Store
 87     */
 88     routingStore: null,
 89      
 90     /**
 91     *  Language (used for the routing)
 92     * 
 93     * @public
 94     * @type string
 95     */
 96    
 97     lang: 'en',
 98     
 99     /**
100     * Type of routing service used for the computation. Per default: 'cloudmade'. Can also be 'openls'.
101     * 
102     * @public
103     * @type string
104     */
105     routingServiceType: 'cloudmade',
106     
107     /**
108     * Type of routing service used for the computation. Per default: 'http://routes.cloudmade.com/'.
109     * Can also be 'http://webgis.regione.sardegna.it/followmeplus/ControllerServletToponimi'
110     * 
111     * @public
112     * @type string
113     */
114     routingServiceURL: 'http://routes.cloudmade.com/',
115     
116     /**
117     * Routing version of the routing service, available after an itinerary computation
118     * See http://developers.cloudmade.com/wiki/routing-http-api/Response_structure
119     * Cloudmade specific. Default null.
120     * 
121     * @public
122     * @type string
123     */
124     routingVersionCloudmade: null,
125        
126     /**
127     * Routing status of the routing service, available after an itinerary computation
128     * See http://developers.cloudmade.com/wiki/routing-http-api/Response_structure
129     * Cloudmade specific. Default null.
130     *  
131     * @public
132     * @type string
133     */
134     routingStatusCloudmade: null,
135 
136     /**
137     * Routing status message of the routing service, available after an itinerary computation
138     * See http://developers.cloudmade.com/wiki/routing-http-api/Response_structure
139     * Cloudmade specific. Default null.
140     *   
141     * @public
142     * @type string
143     */
144     routingStatusMessageCloudmade: null,
145     
146     /**
147     *  Routing route summary of the routing service, available after an itinerary computation
148     *  See http://developers.cloudmade.com/wiki/routing-http-api/Response_structure
149     *  Cloudmade specific. Default null.
150     *  
151     * @public
152     * @type string
153     */
154     routingRouteSummaryCloudmade: null,
155     
156     /**
157     * Routing route geometry of the routing service, available after an itinerary computation
158     * See http://developers.cloudmade.com/wiki/routing-http-api/Response_structure
159     * Cloudmade specific. Default null.
160     *   
161     * @public
162     * @type string
163     */
164     routingRouteGeometryCloudmade: null,
165     
166     /** 
167     * Routing route instruction of the routing service, available after an itinerary computation
168     *  See http://developers.cloudmade.com/wiki/routing-http-api/Response_structure
169     *  Cloudmade specific
170     *  
171     * @public
172     * @type string
173     */
174     routingRouteInstructionsCloudmade: null,
175     
176     /** 
177     *  Layer presenting the routing result geometry. Per default, a layer named "Routing" will be created.
178     *  
179     * @public
180     * @type {Object} OpenLayers.Layer.Vector
181     */
182     routingLayer: null,
183     
184     /** 
185     * Defines if the map is recentered after routing computation. Per default, yes.
186     *  
187     * @public
188     * @type boolean 
189     */
190     routingRecenterMap: true,
191     
192     /** 
193     *  Line feature storing the routing path.
194     *  
195     * @public
196     * @type {Object} OpenLayers.Layer.Vector
197     */
198     routingPathFeature: null,
199     
200     /** 
201     *  Line feature storing the routing path for Point of Interest and Route.
202     *  
203     * @public
204     * @type {Object} OpenLayers.Layer.Vector
205     */
206     routingPathFeaturePOI: null,
207     
208     /** 
209     *  Point feature storing the start point, if digitized by the user.
210     *  
211     * @public
212     * @type {Object} OpenLayers.Layer.Vector
213     */
214     routingStartFeature: null,
215     
216     /** 
217     *  Point feature storing the end point, if digitized by the user.
218     *  
219     * @public
220     * @type {Object} OpenLayers.Layer.Vector
221     */
222     routingEndFeature: null,
223     
224     /** 
225     *  Point feature storing the first step, if digitized by the user.
226     *  
227     * @public
228     * @type {Object} OpenLayers.Layer.Vector
229     */
230     routingVia1Feature: null,
231     
232     /** 
233     *  Point feature storing the second step, if digitized by the user.
234     *  
235     * @public
236     * @type {Object} OpenLayers.Layer.Vector
237     */
238     routingVia2Feature: null,
239     
240     /** 
241     *  Control to get start and end feature
242     *  
243     * @public
244     * @type {Object} OpenLayers.Control.DrawFeature
245     */
246     routingPointDrawControl: null,
247     
248     /** 
249     *  Panel presenting the computation result
250     *  
251     * @public
252     * @type {Object} Ext.Panel
253     */
254     routingResultPanel: null,
255        
256     /** 
257     *  Computation route type. Per default: car. Can be 'foot' or 'bicycle'.
258     *  
259     * @public
260     * @type string
261     */
262     route_typeCloudmade: 'car',
263     
264     /** 
265     *  Cloudmade key used for the routing and geocoding services. Default null.
266     *  
267     * @public
268     * @type string
269     */
270     cloudmadeKey: null,
271     
272     /** 
273     *  Geocoding type. Per default: 'cloudmade'. Can also be 'geonames' or 'openls'.
274     *  
275     * @public
276     * @type string
277     */
278     geocodingType: 'cloudmade',
279     
280     /** 
281     *  Geocoding query param used for cloudmade geocoding service. Per default: 'query'
282     *  
283     * @public
284     * @type string
285     */
286     geocodingQueryParam: 'query',
287 
288     /** 
289     *  Maximum number of rows returned by the cloudmade geocoding service. Per default: 20
290     *  
291     * @public
292     * @type number
293     */
294     geocodingMaxRows: 20,
295     
296     /** 
297     *  Geocoding url of the cloudmade geocoding service.
298     *  
299     * @public
300     * @type string
301     */
302     geocodingUrl: null,
303     
304     /** 
305     *  Define if the google itinerary links are shown in the result panel. Default yes.
306     *  
307     * @public
308     * @type boolean
309     */
310     showGoogleItinerary: true,
311     
312     /** 
313     *  Define if the poi search panel is shown in the result panel. Default yes.
314     *  
315     * @public
316     * @type boolean
317     */
318     showPoiSearch: true,
319     
320     /**
321     *  Text for title Google Service (i18n).
322     *  
323     * @public
324     * @type string
325     */
326     googleTitle: 'Google Maps',
327     
328     /**
329     *  Text for Google Itinerary on foot with Google Service (i18n).
330     *  
331     * @public
332     * @type string
333     */
334     googleItineraryFoot: 'A piedi',
335     
336     /**
337     *  Text for Google Itinerary by public transport with Google Service (i18n).
338     *  
339     * @public
340     * @type string
341     */
342     googleItineraryTransport: 'Con trasporto pubblico',
343     
344     /**
345     *  Text for Google Itinerary by car with Google Service (i18n).
346     *  
347     * @public
348     * @type string
349     */
350     googleItineraryCar: 'In auto',   
351     
352     /** 
353     *  Vector style of the routing path
354     *  
355     * @public
356     * @type {Object} Vector Style
357     */
358     routingStyle: {
359         strokeColor: "#FF0000",
360         strokeOpacity: 0.5,
361         strokeWidth: 5
362     },
363     
364     /** 
365     *  Vector style of the routing path to Route from POI
366     *  
367     * @public
368     * @type {Object} Vector Style
369     */
370     routingStylePOI: {
371         strokeColor: "#AAAAAA",
372         strokeOpacity: 0.5,
373         strokeWidth: 5
374     },
375     
376     /**   
377     * @public
378     * @type {String} base url image
379     */
380     baseUrlImg: '',
381     
382     /** 
383     *  Vector style of the start point
384     *  
385     * @public
386     * @type {Object} Vector Style
387     */
388     vectorStyleA: {
389         graphicZIndex: 100,
390         externalGraphic: 'theme/app/img/routing/start_shadow.png',
391         graphicWidth: 68,
392         graphicHeight: 48,
393         graphicXOffset: -28,
394         graphicYOffset: -48,
395         graphicOpacity: 1
396     },
397     
398     /** 
399     *  Vector style of the end point
400     *  
401     * @public
402     * @type {Object} Vector Style
403     */
404     vectorStyleB: {
405         graphicZIndex: 100,
406         externalGraphic: 'theme/app/img/routing/stop_shadow.png',
407         graphicWidth: 68,
408         graphicHeight: 48,
409         graphicXOffset: -28,
410         graphicYOffset: -48,
411         graphicOpacity: 1
412     },
413     
414     /** 
415     *  Vector style of the first step point
416     *  
417     * @public
418     * @type {Object} Vector Style
419     */
420     vectorStyle1: {
421         graphicZIndex: 100,
422         externalGraphic: 'theme/app/img/routing/via1_shadow.png',
423         graphicWidth: 68,
424         graphicHeight: 48,
425         graphicXOffset: -28,
426         graphicYOffset: -48,
427         graphicOpacity: 1
428     },
429     
430     /** 
431     *  Vector style of the second step point
432     *  
433     * @public
434     * @type {Object} Vector Style
435     */
436     vectorStyle2: {
437         graphicZIndex: 100,
438         externalGraphic: 'theme/app/img/routing/via2_shadow.png',
439         graphicWidth: 68,
440         graphicHeight: 48,
441         graphicXOffset: -28,
442         graphicYOffset: -48,
443         graphicOpacity: 1
444     },
445     
446     /** 
447     *  Projection of routing system.
448     *  
449     * @public
450     * @type {Object} OpenLayers.Projection
451     */
452     routingProjection: new OpenLayers.Projection("EPSG:4326"),
453     
454     /** 
455     *  Read the permalink in the url if presents
456     *  
457     * @public
458     * @type {Object} OpenLayers.Projection
459     */
460     readPermalink: false,
461     
462     /**
463     * Type of Spatial Reference used for the computation. Per default: 'EPSG:4326'
464     * 
465     * @public
466     * @type string
467     */
468     srs: "EPSG:4326",
469     
470     /**
471     * Type of EPSG used for the computation. Per default: '4326'
472     * 3003 - Gauss-Boaga (Roma40) fuso Ovest
473     * 32632 - UTM (WGS84) fuso 32N
474     * 4326 - WGS84 - geografico
475     * 
476     * @public
477     * @type string
478     */
479     epsgOutput: '4326',
480     
481     /**
482     * The query parameter for the user entered search text (openls routing)
483     * 
484     * @public
485     * @type string
486     */
487     xmlRequest: '',
488     
489     /**
490     * Distance units 
491     * 
492     * @public
493     * @type string
494     */
495     distanceUnit: 'M',
496     
497     /**
498     * Route preferenze for openls routing. Default "Fastest". 
499     * Shortest - Percorso più corto (default)
500     * Fastest - Percorso più veloce
501     * Pedestrian - Percorso a piedi
502     *      
503     * @public
504     * @type string
505     */
506     routePreference: 'Fastest',
507     
508     /**
509     *  Text for label shortest (i18n).
510     * @public
511     * @type string
512     */
513     labelShortest: "in auto breve",
514     
515     /**
516     *  Text for label fastest (i18n).
517     * @public
518     * @type string
519     */
520     labelFastest: "in auto veloce",
521     
522     /**
523     *  Text for label pedestrian (i18n).
524     * @public
525     * @type string
526     */
527     labelPedestrian: "a piedi",
528     
529     /**
530     *  County code. Default italian.
531     * "IT" - Italiano
532     * "EN" - Inglese
533     * 
534     * @public
535     * @type string
536     */
537     countryCode: 'IT',
538     
539     /**
540     *  Language. Default italian.
541     * "it-IT" - Italiano
542     * "en-US" - Inglese
543     * 
544     * @public
545     * @type string
546     */
547     language: 'it-IT',
548     
549     /**
550     *  Format Type for response service routing openls. Default text.
551     * "TEXT_TYPE" Testo
552     * "HTML_TYPE" HTML
553     * 
554     * @public
555     * @type string
556     */
557     formatType: 'TEXT_TYPE',
558     
559     /**
560     *  Exact street name for service routing openls. Default 'false'.
561     * 
562     * @public
563     * @type string ('true' or 'false')
564     */
565     exactStreetName: 'false',
566     
567     /** 
568     *  Store for response geocode routing.
569     *  
570     * @private
571     * @type {Object} Ext.data.Store
572     */
573     geocoderStore: null,
574     
575     /** 
576     *   Panel presenting the computation result
577     *  
578     * @private
579     * @type {Object} Ext.Panel
580     */
581     routingResultPanel2: null,
582     
583     /**  
584     *   Panel presenting the alternative result (did you mean)
585     *  
586     * @private
587     * @type {Object} Ext.Panel
588     */
589     routingResultPanel3: null,
590     
591     /**  
592     *   Panel presenting the link for Google Maps
593     *  
594     * @private
595     * @type {Object} Ext.Panel
596     */
597     routingResultPanel4: null,
598     
599     /**  
600     *   Panel presenting the link for search poi on route
601     *  
602     * @private
603     * @type {Object} Ext.Panel
604     */
605     routingResultPanel5: null,
606     
607     /**
608     *  Path folder image for the route instruction.
609     *  
610     * @public
611     * @type string
612     */
613     pathImgStep: 'theme/app/img/routing/numeretti/tondi/',
614     
615     /**
616     *  Type image for the route instruction.
617     *  
618     * @public
619     * @type string
620     */
621     typeImgStep: 'png',
622     
623     /**
624     *  Path image for the start point in the search form.
625     *  
626     * @public
627     * @type string
628     */
629     ImgStartForm: 'theme/app/img/routing/start.gif',
630     
631     /**
632     *  Path image for the end point in the search form.
633     *  
634     * @public
635     * @type string
636     */
637     ImgStopForm: 'theme/app/img/routing/stop.gif',
638     
639     /**
640     *  Path image for the first step point in the search form.
641     *  
642     * @public
643     * @type string
644     */
645     ImgPointOneForm: 'theme/app/img/routing/via1.gif',
646     
647     /**
648     *  Path image for the second step point in the search form.
649     *  
650     * @public
651     * @type string
652     */
653     ImgPointTwoForm: 'theme/app/img/routing/via2.gif',
654     
655     /**
656     *  Text for example start search combo (i18n).
657     *  
658     * @public
659     * @type string
660     */
661     emptyTextStart: 'ad es. via Roma, Cagliari',
662     
663     /**
664     *  Text for example stop search combo (i18n).
665     *  
666     * @public
667     * @type string
668     */
669     emptyTextStop: 'ad es. via Milano, Sassari',
670     
671     /**
672     *  Text for example first step search combo (i18n).
673     *  
674     * @public
675     * @type string
676     */
677     emptyTextPointOne: 'ad es. via Torino, Oristano',
678     
679     /**
680     *  Text for example second step search combo (i18n).
681     *  
682     * @public
683     * @type string
684     */
685     emptyTextPointTwo: 'ad es. via Palermo, Nuoro',
686     
687     /**
688     *  Text for wait search (i18n).
689     *  
690     * @public
691     * @type string
692     */
693     emptyTextSearch: 'ricerca in corso...',
694     
695     /**
696     *  Text button for search routing (i18n).
697     *  
698     * @public
699     * @type string
700     */
701     textButtonSearch: 'Trova indicazioni stradali',
702     
703     /**
704     *  Text button for invert search routing (i18n).
705     *  
706     * @public
707     * @type string
708     */
709     textButtonInvSearch: 'Inverti il percorso..',
710     
711     /**
712     *  Text button for add step combo (i18n).
713     *  
714     * @public
715     * @type string
716     */
717     textButtonAddPoint: 'Aggiungi tappa intermedia',
718     
719     /**
720     *  Text button for search poi on route.
721     *  
722     * @public
723     * @type string
724     */
725     textButtonSearhPoi: 'Cerca POI nel percorso',
726     
727     /**
728     *  Text for processing routing (i18n).
729     *  
730     * @public
731     * @type string
732     */
733     textMsgRounting: 'Elaborazione in corso...',
734     
735     /**
736     *  Text for title result path routing (i18n).
737     *  
738     * @public
739     * @type string
740     */
741     textTitleResultPath: 'Indicazioni stradali per',
742     
743     
744     /**
745     *  Text for error message routing service.
746     *  
747     * @public
748     * @type string
749     */
750     textMsgErrorService: '<span style="color: #FF0000;font-weight: bold;">Ops.. c\'è qualcosa che non va nel servizio di ricerca :(</span><br />'+
751             "Prova un'altra volta, se il problema persiste riprova più tardi..",
752     
753     /**
754     *  Text for insert all field.
755     *  
756     * @public
757     * @type string
758     */
759     textMsgNoText: '<span style="color: #FF0000;font-weight: bold;">inserire tutti i campi</span>',
760     
761     /**
762     *  Text for label start point (i18n).
763     *  
764     * @public
765     * @type string
766     */
767     textTitleStart: 'Partenza',
768     
769      /**
770     *  Text for label end point (i18n).
771     *  
772     * @public
773     * @type string
774     */
775     textTitleStop: 'Arrivo',
776     
777     /**
778     *  Text for label first step point (i18n).
779     *  
780     * @public
781     * @type string
782     */
783     textTitlePointOne: 'Tappa 1',
784     
785     /**
786     *  Text for label second step point (i18n).
787     *  
788     * @public
789     * @type string
790     */
791     textTitlePointTwo: 'Tappa 2',
792     
793     /**
794     *  Text for delete first step compo (i18n).
795     *  
796     * @public
797     * @type string
798     */
799     textButtonHiddenPointOne: 'Elimina la tappa 1',
800      
801     /**
802     *  Text for delete second step combo (i18n).
803     *  
804     * @public
805     * @type string
806     */
807     textButtonHiddenPointTwo: 'Elimina la tappa 2',
808     
809     /**
810     *  Text for title route instruction (i18n).
811     *  
812     * @public
813     * @type string
814     */
815     titlePath: 'Percorso',
816     
817     /**
818     *  XML start location point for rounting openls
819     *  
820     * @private
821     * @type string
822     */
823     startLocationXML: null,
824     
825     /**
826     *  XML stop location point for rounting openls
827     *  
828     * @private
829     * @type string
830     */
831     stopLocationXML: null,
832     
833     /**
834     *  XML first step location point for rounting openls
835     *  
836     * @private
837     * @type string
838     */
839     via1LocationXML: null,
840     
841     /**
842     *  XML second step location point for rounting openls
843     *  
844     * @private
845     * @type string
846     */
847     via2LocationXML: null,
848     
849     /**
850     *  Text for message "not found" (i18n).
851     *  
852     * @public
853     * @type string
854     */
855     msgNoFound: "<b>Impossibile trovare il percorso specificato.</b><br />"+
856                 "Assicurati che tutti i nomi di strade e città siano stati digitati correttamente.<br />"+
857                 "L'indirizzo deve comprendere una città.<br />"+
858                 "Il percorso potrebbe essere disponibile selezionando l'alternativa a piedi.",
859      
860      
861     /**
862     *  id for search type  (i18n).
863     *  
864     * @private
865     * @type string
866     */
867     searchName:'routing',
868     
869     /**
870     * Normal mode and print mode have different views. 
871     *      
872     * @public
873     * @type string
874     */
875     printMode: false,
876 
877     /**
878     * Zoom level above which is allowed to search for POIs located near a path resulting from a search.
879     * This properties has higher precedence respect to searchKmLimit
880     *      
881     * @public
882     * @type string
883     */
884     searchZoomLimit: 100,
885 
886     /**
887     * Path length (in km) up to which is allowed to search for POIs located near a path resulting from a search.
888     * This properties has lower precedence respect to searchZoomLimit
889     *      
890     * @public
891     * @type string
892     */
893     searchKmLimit: 15,
894     /** 
895      *  Private initComponent override.
896      *  Create two events:
897      *  - routingcomputed
898      *  - beforeroutingcomputed
899      *  
900      *  @private
901      */
902     initComponent: function() {
903 
904 
905         var defConfig = {
906             plain: true,
907             border: false
908         };
909 
910         Ext.applyIf(this, defConfig);
911         
912         //update path images
913         if(this.baseUrlImg != ''){
914             this.vectorStyleA.externalGraphic = this.baseUrlImg + this.vectorStyleA.externalGraphic;
915             this.vectorStyleB.externalGraphic = this.baseUrlImg + this.vectorStyleB.externalGraphic;
916             this.vectorStyle1.externalGraphic = this.baseUrlImg + this.vectorStyle1.externalGraphic;
917             this.vectorStyle2.externalGraphic = this.baseUrlImg + this.vectorStyle2.externalGraphic;
918             this.pathImgStep = this.baseUrlImg + this.pathImgStep;
919             this.ImgStartForm = this.baseUrlImg + this.ImgStartForm;
920             this.ImgStopForm = this.baseUrlImg + this.ImgStopForm;
921             this.ImgPointOneForm = this.baseUrlImg + this.ImgPointOneForm;
922             this.ImgPointTwoForm = this.baseUrlImg + this.ImgPointTwoForm;
923         }
924  
925         /**
926          * Create cloudmade geocoding search combo
927          */
928         if (this.geocodingType == 'cloudmade') {
929             this.geocodingUrl = 'http://geocoding.cloudmade.com/' + this.cloudmadeKey + '/geocoding/v2/find.js?results=' + this.geocodingMaxRows + '&return_geometry=false';
930             this.startLocationCombo = new Ext.form.ComboBox({
931                 fieldLabel: OpenLayers.i18n('A'),
932                 name: 'startLocationCombo',
933                 emptyText: this.emptyTextStart,
934                 minChars: 1,
935                 queryDelay: 50,
936                 hideTrigger: true,
937                 charset: 'UTF8',
938                 forceSelection: true,
939                 displayField: 'name',
940                 queryParam: this.geocodingQueryParam,
941                 tpl: '<tpl for="."><div class="x-combo-list-item"><h1>{name}</h1></div></tpl>',
942                 store: new Ext.data.Store({
943                     proxy: new Ext.data.ScriptTagProxy({
944                         url: this.geocodingUrl,
945                         method: 'GET'
946                     }),
947                     reader: new Ext.data.JsonReader({
948                         totalProperty: "found",
949                         root: "features",
950                         fields: [
951                             {
952                                 name: 'name',
953                                 mapping: 'properties.name'
954                             },
955                             {
956                                 name: 'centroid'
957                             }
958                         ]
959                     })
960                 }),
961                 listeners: {
962                     "select": function(combo, record, index) {
963                         if (this.routingStartFeature) {
964                             this.routingLayer.removeFeatures([this.routingStartFeature]);
965                         }
966                         this.startLocationCombo.locationString = record.data.centroid.coordinates[0] + ',' + record.data.centroid.coordinates[1];
967                     },
968                     scope: this
969                 }
970             });
971 
972             this.endLocationCombo = new Ext.form.ComboBox({
973                 fieldLabel: OpenLayers.i18n('B'),
974                 name: 'endLocationCombo',
975                 emptyText: this.emptyTextStop,
976                 minChars: 1,
977                 queryDelay: 50,
978                 hideTrigger: true,
979                 charset: 'UTF8',
980                 forceSelection: true,
981                 displayField: 'name',
982                 queryParam: this.geocodingQueryParam,
983                 tpl: '<tpl for="."><div class="x-combo-list-item"><h1>{name}</h1></div></tpl>',
984                 store: new Ext.data.Store({
985                     proxy: new Ext.data.ScriptTagProxy({
986                         url: this.geocodingUrl,
987                         method: 'GET'
988                     }),
989                     reader: new Ext.data.JsonReader({
990                         totalProperty: "found",
991                         root: "features",
992                         fields: [
993                             {
994                                 name: 'name',
995                                 mapping: 'properties.name'
996                             },
997                             {
998                                 name: 'centroid'
999                             }
1000                         ]
1001                     })
1002                 }),
1003                 listeners: {
1004                     "select": function(combo, record, index) {
1005                         if (this.routingEndFeature) {
1006                             this.routingLayer.removeFeatures([this.routingEndFeature]);
1007                         }
1008                         this.endLocationCombo.locationString = record.data.centroid.coordinates[0] + ',' + record.data.centroid.coordinates[1];
1009                     },
1010                     scope: this
1011                 }
1012             });
1013         }
1014 
1015         /**
1016          * Create geonames search combo
1017          */
1018         if (this.geocodingType == 'geonames') {
1019             this.startLocationCombo = new framework.form.GeoNamesSearchCombo({
1020                 fieldLabel: OpenLayers.i18n('A'),
1021                 emptyText: this.emptyTextStart,
1022                 loadingText: OpenLayers.i18n('Search in Geonames...'),
1023                 map: this.map,
1024                 zoom: 13
1025             });
1026             this.startLocationCombo.on(
1027                     "select", function(combo, record, index) {
1028                     if (this.routingStartFeature) {
1029                         this.routingLayer.removeFeatures([this.routingStartFeature]);
1030                     }
1031                     this.startLocationCombo.locationString = record.data.lat + ',' + record.data.lng;
1032                 }, this
1033              );
1034 
1035 
1036             this.endLocationCombo = new framework.form.GeoNamesSearchCombo({
1037                 fieldLabel: OpenLayers.i18n('B'),
1038                 emptyText: this.emptyTextStop,
1039                 loadingText: OpenLayers.i18n('Search in Geonames...'),
1040                 map: this.map,
1041                 zoom: 13
1042             });
1043             this.endLocationCombo.on("select", function(combo, record, index) {
1044                 if (this.routingEndFeature) {
1045                     this.routingLayer.removeFeatures([this.routingEndFeature]);
1046                 }
1047                 this.endLocationCombo.locationString = record.data.lat + ',' + record.data.lng;
1048             }, this);
1049         }
1050 
1051         /**
1052          * Create openls geocoding search combo
1053          */
1054         if (this.geocodingType == 'openls') {
1055             
1056             
1057             /**
1058              * START POINT (A)
1059              */
1060             this.startLocationCombo = new framework.form.GeocoderOpenLSComboBox({
1061                 //fieldLabel: OpenLayers.i18n('A'),
1062                 emptyText: this.emptyTextStart,
1063                 loadingText: this.emptyTextSearch,
1064                 width: 100,
1065                 listWidth: 200,
1066                 srs: this.srs,
1067                 map: this.map,
1068                 proxy: this.proxy,
1069                 zoom: null,
1070                 style: {
1071                     padding: '5px',
1072                     height: '20px'
1073                 }
1074             });
1075             this.startLocationCombo.on(
1076                     "select", function(combo, record, index) {
1077                 
1078                 this.startLocationXML = record.data.xml;
1079 
1080             }, this);
1081             
1082 
1083             /**
1084              * STOP POINT (B)
1085              */
1086             this.endLocationCombo = new framework.form.GeocoderOpenLSComboBox({
1087                 //fieldLabel: OpenLayers.i18n('B'),
1088                 emptyText: this.emptyTextStop,
1089                 loadingText: this.emptyTextSearch,
1090                 width: 100,
1091                 listWidth: 200,
1092                 srs: this.srs,
1093                 map: this.map,
1094                 proxy: this.proxy,
1095                 zoom: null,
1096                 style: {
1097                     padding: '5px',
1098                     height: '20px'
1099                 }
1100             });
1101             this.endLocationCombo.on("select", function(combo, record, index) {
1102                 
1103                 this.stopLocationXML = record.data.xml;
1104 
1105             }, this);
1106             
1107                     
1108             /**
1109              * FIRST STEP POINT (1)
1110              */
1111              this.via1LocationCombo = new framework.form.GeocoderOpenLSComboBox({
1112                 //fieldLabel: OpenLayers.i18n('B'),
1113                 emptyText: this.emptyTextPointOne,
1114                 loadingText: this.emptyTextSearch,
1115                 width: 100,
1116                 listWidth: 200,
1117                 srs: this.srs,
1118                 map: this.map,
1119                 proxy: this.proxy,
1120                 zoom: null,
1121                 style: {
1122                     padding: '5px',
1123                     height: '20px'
1124                 }
1125             });
1126             this.via1LocationCombo.on("select", function(combo, record, index) {
1127                 
1128                 this.via1LocationXML = record.data.xml;
1129 
1130             }, this);           
1131             
1132  
1133              /**
1134              * SECOND STEP POINT (2)
1135              */    
1136              this.via2LocationCombo = new framework.form.GeocoderOpenLSComboBox({
1137                 //fieldLabel: OpenLayers.i18n('B'),
1138                 emptyText: this.emptyTextPointTwo,
1139                 loadingText: this.emptyTextSearch,
1140                 width: 100,
1141                 listWidth: 200,
1142                 srs: this.srs,
1143                 map: this.map,
1144                 proxy: this.proxy,
1145                 zoom: null,
1146                 style: {
1147                     padding: '5px',
1148                     height: '20px'
1149                 }
1150             });
1151             this.via2LocationCombo.on("select", function(combo, record, index) {
1152                 
1153                 this.via2LocationXML = record.data.xml;
1154 
1155             }, this); 
1156             
1157             
1158             
1159             
1160         }
1161 
1162         /**
1163         *  Render functions for computation result in the rounting panel (this.routingResultPanel2)
1164         *  @private
1165         */
1166         function renderInstruction(value, meta, record) {
1167 
1168             var stringRow = '';
1169             switch (record.data.poi_result_type) {
1170                case 'start':
1171                    meta.css = 'start-cell2';
1172                    stringRow = String.format(
1173                     '<b>{0}</b><br />{1}',
1174                     value, "Partenza");
1175                break;
1176                case 'stop':
1177                    meta.css = 'stop-cell2';
1178                    stringRow = String.format(
1179                     '<b>{0}</b><br />{1}',
1180                     value, "Arrivo");
1181                break;
1182                case 'via1':
1183                    meta.css = 'via1-cell2';
1184                    stringRow = String.format(
1185                     '<b>{0}</b><br />{1}',
1186                     value, "Prima tappa");
1187                break;
1188                case 'via2':
1189                    meta.css = 'via2-cell2';
1190                    stringRow = String.format(
1191                     '<b>{0}</b><br />{1}',
1192                     value, "Seconda tappa");
1193                break;               
1194                default:
1195                    stringRow = String.format(
1196                     '<b>{0}</b><br />distanza {1} {2}',
1197                     value, record.data.distance_value, record.data.distance_uom);
1198             }
1199               
1200             return stringRow;
1201             
1202         }
1203         ;
1204 
1205         /**
1206          * Create items of routing panel for openls routing
1207          */ 
1208         if (this.routingServiceType === 'openls') {
1209  
1210             // Create routing result panel
1211             this.routingResultPanel = new Ext.Panel({
1212                 border: false,
1213                 html: '',
1214                 bodyStyle: 'padding: 30px; padding-top: 0px;font-size: 0.8em;'
1215             });
1216             
1217             //setting proxy url if exist
1218             if (this.proxy)
1219                 var sUrl = this.proxy + escape(this.routingServiceURL);
1220             else
1221                 var sUrl = this.routingServiceURL;
1222             
1223             // create geocode store
1224             this.geocoderStore = new Ext.data.Store({
1225                 proxy: new Ext.data.HttpProxy({
1226                     url: sUrl,
1227                     method: 'POST'
1228                 }),
1229                 fields: [
1230                     {name: 'totalTime'},
1231                     {name: 'totalDistance_uom'},
1232                     {name: 'totalDistance_value', type: "number"},
1233                     {name: 'totalBoundingBox'},
1234                     {name: 'totalRouteGeometry'},
1235                     {name: 'duration'},
1236                     {name: 'description'},
1237                     {name: 'instruction'},
1238                     {name: 'distance_uom'},
1239                     {name: 'distance_value', type: "number"},
1240                     {name: "routeInstructionGeometry"},
1241                     {name: "boundingBox"},
1242                     {name: "poi_result_text"},
1243                     {name: "poi_result_xml"},
1244                     {name: "poi_result_type"},
1245                     {name: "poi_result_lon", type: "number"},
1246                     {name: "poi_result_lat", type: "number"},
1247                     {name: "msg_error"}
1248                 ],
1249                 listeners: {
1250                     exception: function(proxy, exception, operation) {
1251                         
1252                         this.routingResultPanel.setVisible(true);
1253                         this.routingResultPanel2.setVisible(false);
1254                         this.routingResultPanel3.setVisible(false);
1255                         this.routingResultPanel4.setVisible(false);
1256                         this.routingResultPanel5.setVisible(false);
1257 
1258                         this.routingResultPanel.html = this.textMsgErrorService;
1259                         if (this.routingResultPanel.body) {
1260                             this.routingResultPanel.body.update(this.routingResultPanel.html);
1261                         }
1262                         
1263                     },
1264                     scope: this
1265 
1266                 },
1267                 reader: new framework.data.RoutingOpenLS_XLSReader()
1268             });
1269             
1270             //add event geocode store
1271             this.geocoderStore.on(
1272                 'load', function(store) {
1273 
1274                         if (store.data.items[0].data.msg_error) {
1275                             this.messageError(store.data.items[0].data.msg_error);
1276                         }
1277                         else if (store.data.items[0].data.poi_result_text) {                    
1278                             this.resultPoi();  //alternative point result (did you mean)
1279                         }
1280                         else {
1281                             this.drawRoute();                        
1282                         }
1283 
1284                         this.fireEvent('routingcomputed', this);
1285 
1286              }, this);
1287                        
1288             // create the GridPanel (Route Instruction)
1289             this.routingResultPanel2 = new Ext.grid.GridPanel({
1290                 autoExpandColumn: 'instruction',
1291                 store: this.geocoderStore,
1292                 columns: [
1293                     new Ext.grid.RowNumberer({width: 30}), {
1294                         id: 'instruction',
1295                         dataIndex: 'instruction',
1296                         width: 420,
1297                         renderer: renderInstruction
1298                     }
1299                 ],
1300                 sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
1301                 enableHdMenu: false,
1302                 defaults: {
1303                     sortable: false,
1304                     menuDisabled: true,
1305                     width: 100
1306                 },
1307                 stripeRows: false,
1308                 autoWidth: true,
1309                 autoHeight: true,
1310                 title: this.titlePath,
1311                 // config options for stateful behavior
1312                 stateful: true,
1313                 stateId: 'grid',
1314                 hidden: true
1315             });
1316 
1317             // event row select Grid Panel (Route Instruction)        
1318             this.routingResultPanel2.getSelectionModel().on('rowselect', function(sm, rowIdx, r) {
1319 
1320                 if (this.routingPointStepFeature) {
1321                     this.routingLayer.removeFeatures([this.routingPointStepFeature]);
1322                 }
1323 
1324                 var pointList = [];
1325 
1326                 var num_poi = r.data.routeInstructionGeometry.length;
1327                 var newPoint = null;
1328                 for (var i = 0; i < num_poi; i++) {
1329                     newPoint = new OpenLayers.Geometry.Point(r.data.routeInstructionGeometry[i][0], r.data.routeInstructionGeometry[i][1]);
1330                     newPoint.transform(this.routingProjection,
1331                             this.map.getProjectionObject());
1332                     pointList.push(newPoint);
1333                 }
1334 
1335                 var img = this.pathImgStep + (r.id + 1) + '.' + this.typeImgStep;
1336                 var vectorStyleStep = {
1337                     graphicZIndex: 100,
1338                     externalGraphic: img,
1339                     graphicWidth: 13,
1340                     graphicHeight: 18,
1341                     graphicYOffset: -18,
1342                     graphicOpacity: 1
1343                 };
1344 
1345                 var pointStep = new OpenLayers.Geometry.Point(pointList[0].x, pointList[0].y);
1346 
1347                 this.routingPointStepFeature = new OpenLayers.Feature.Vector(
1348                         pointStep, null, vectorStyleStep);
1349 
1350                 this.routingPointStepFeature.text = r.data.instruction;
1351                 
1352                 if(!this.comeFromSavedMap)
1353                     this.routingLayer.addFeatures([this.routingPointStepFeature]);
1354 
1355                 this.selectCtrl = new OpenLayers.Control.SelectFeature([this.routingLayer], {
1356                     toggle: true,
1357                     clickout: true
1358                 });
1359 
1360                 this.map.addControl(this.selectCtrl);
1361                 this.selectCtrl.activate();        
1362                                  
1363                 this.map.zoomToExtent(this.routingPointStepFeature.geometry.bounds);
1364                 this.map.zoomTo(12);
1365 
1366 
1367             }, this);
1368 
1369 
1370             // create the GridPanel for did you mean.
1371             this.routingResultPanel3 = new Ext.grid.GridPanel({
1372                 autoExpandColumn: 'poi_result_text',
1373                 store: this.geocoderStore,
1374                 columns: [
1375                     {
1376                         width: 35, 
1377                         dataIndex: 'poi_result_type',
1378                         renderer: function(value, meta) { 
1379                           switch (value) {
1380         	                 case 'start':
1381         	                     meta.css = 'start-cell';
1382         	                     break;
1383         	                 case 'stop':
1384         	                     meta.css = 'stop-cell';
1385         	                     break;
1386                              case 'via1':
1387         	                     meta.css = 'via1-cell';
1388         	                     break;
1389                              case 'via2':
1390         	                     meta.css = 'via2-cell';
1391         	                     break;
1392                           }       
1393                         }
1394                     },                    
1395                     {
1396                         id: 'poi_result_text',
1397                         dataIndex: 'poi_result_text',
1398                         width: 500
1399                     }
1400                 ],
1401                 sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
1402                 enableHdMenu: false,
1403                 defaults: {
1404                     sortable: false,
1405                     menuDisabled: true
1406                 },
1407                 viewConfig: {
1408                     forceFit: true,
1409             //      Return CSS class to apply to rows depending upon data values
1410                     getRowClass: function(record, index) {
1411                         var type = record.get('poi_result_type');
1412                         if (type === 'start') {
1413                             return 'row-start';
1414                         } else if (type === 'stop') {
1415                             return 'row-stop';
1416                         } else if (type === 'via1') {
1417                             return 'row-via1';
1418                         } else if (type === 'via2') {
1419                             return 'row-via2';
1420                         }
1421                     }
1422                 },
1423                 stripeRows: false,
1424                 autoWidth: true,
1425                 autoHeight: true,
1426                 title: 'Forse cercavi...',
1427                 // config options for stateful behavior
1428                 stateful: true,
1429                 stateId: 'grid',
1430                 hidden: true
1431             });
1432             
1433             
1434             // event row select Grid Panel (Did you mean)        
1435             this.routingResultPanel3.getSelectionModel().on('rowselect', function(sm, rowIdx, r) {
1436                 
1437                 if (r.data.poi_result_type === "start") {
1438                     //strip HTML tags from string 
1439                     var div = document.createElement("div");
1440                     div.innerHTML = r.data.poi_result_text;
1441                     var text = div.textContent || div.innerText || "";
1442                         
1443                     this.startLocationCombo.setValue(text);
1444                     this.startLocationXML = r.data.poi_result_xml;
1445                    // this.startCombo = null;
1446                 }
1447                 else if (r.data.poi_result_type === "stop") {
1448                     //strip HTML tags from string 
1449                     var div = document.createElement("div");
1450                     div.innerHTML = r.data.poi_result_text;
1451                     var text = div.textContent || div.innerText || "";
1452                    
1453                     this.endLocationCombo.setValue(text);
1454                     this.stopLocationXML = r.data.poi_result_xml;
1455                    // this.startCombo = null;
1456                 }
1457                 else if (r.data.poi_result_type === "via1") {
1458                     //strip HTML tags from string 
1459                     var div = document.createElement("div");
1460                     div.innerHTML = r.data.poi_result_text;
1461                     var text = div.textContent || div.innerText || "";
1462                    
1463                     this.via1LocationCombo.setValue(text);
1464                     this.via1LocationXML = r.data.poi_result_xml;
1465                    // this.startCombo = null;
1466                 }
1467                 else if (r.data.poi_result_type === "via2") {
1468                     //strip HTML tags from string 
1469                     var div = document.createElement("div");
1470                     div.innerHTML = r.data.poi_result_text;
1471                     var text = div.textContent || div.innerText || "";
1472                    
1473                     this.via2LocationCombo.setValue(text);
1474                     this.via2LocationXML = r.data.poi_result_xml;
1475                    // this.startCombo = null;
1476                 }
1477                 
1478 
1479 
1480             }, this);  
1481             
1482             // Create routing result panel for Google
1483             this.routingResultPanel4 = new Ext.Panel({
1484                 border: false,
1485                 html: '',
1486                 bodyStyle: 'padding: 30px; padding-top: 0px;font-size: 0.8em;'
1487             });
1488             
1489             // Create panel presenting the link for search poi on route
1490             this.routingResultPanel5 = new Ext.Panel({
1491                 border: false,
1492                 hidden: true,
1493                 bodyStyle: 'padding: 30px; padding-top: 0px;font-size: 0.8em;',
1494                 items: [{
1495                             xtype: 'box',
1496                             cls: 'boxSearchPOI',
1497                             autoEl: {id: 'userId'},
1498                             html: '<div class="popupSearchPOI">Cosa c\'è vicino al percorso?<br>(in metri)</div>',
1499                             width: 'auto'
1500                         },{
1501                             id: 'poiRadiusBuffer',
1502                             xtype: 'textfield',
1503                             cls: 'fieldSearchPOIRadius',
1504                             //hidden: hiddenPanelSearch,
1505                             //fieldLabel: 'Comune',
1506                             name: 'poiradius',
1507                             value: '100',
1508                             width: 100,
1509                             allowBlank: true
1510                         },{
1511                             id: 'poiBtnSearchPOIRadius',
1512                             xtype: 'button',
1513                             cls: 'btnSearchPOIRadius',
1514                             text: '    ',
1515                             handler : function(){
1516 
1517                                 var comboPoi = Ext.getCmp('comboPoi');
1518 
1519                                 var points = this.geocoderStore.data.items[0].data.totalRouteGeometry
1520 
1521                                 var line = '';
1522 
1523                                 var position;
1524 
1525                                 for (var i = 0; i < points.length; i++) {
1526                                     position = new OpenLayers.LonLat(points[i][0], points[i][1]);
1527                                     // Reproject (if required)
1528                                     position.transform(
1529                                             new OpenLayers.Projection("EPSG:3003"),
1530                                             new OpenLayers.Projection("EPSG:4326")
1531                                             );
1532                                     if (line.length === 0) {
1533                                         line += '[';
1534                                     } else {
1535                                         line += ',';
1536                                     }
1537                                     line += '{x:' + position.lon + ',y:' + position.lat + '}';
1538                                 };                                        
1539                                 if (line.length > 0) {
1540                                     line += ']';
1541                                 };
1542                                 
1543                                 var panelsearch = Ext.getCmp('idPanelSearch');
1544                                 panelsearch.selectItem(2);
1545                                 comboPoi.store.baseParams.radius = Ext.getCmp('poiRadiusBuffer').getValue();
1546                                 comboPoi.store.baseParams.path = line;
1547                                 var searchText = comboPoi.getValue();
1548                                 comboPoi.layer.destroyFeatures();
1549                                 this.drawRoute();
1550                                 comboPoi.destroyPreviousFeatures = false;
1551                                 comboPoi.focus();    //                                       
1552                                 comboPoi.setValue(searchText);
1553                                 comboPoi.doQuery(searchText,true);
1554                                 comboPoi.clearBaseParams(comboPoi.store);
1555 
1556                             },
1557                             scope: this
1558                         }]
1559             });
1560             
1561             this.items = [
1562                 {
1563                     layout: 'form',
1564                     cls: "formRouting",
1565                     border: false,
1566                     labelWidth: 10,
1567                     hidden: this.printMode,
1568                     bodyStyle: 'padding:30px;margin-bottom: 0px;background-color: #f1f1f1;',
1569                     items: [
1570                         {
1571                             layout: 'column',
1572                             border: false,
1573                             bodyStyle: 'background:transparent;',
1574                             items: [
1575                                 {
1576                                     xtype: 'radiogroup',
1577                                     fieldLabel: 'Auto Layout',
1578                                     cls: 'typeRouting',
1579                                     items: [
1580                                         {boxLabel: this.labelFastest, name: 'route-preference', inputValue: "Fastest", checked: this.routePreference === 'Fastest'},
1581                                         {boxLabel: this.labelShortest, name: 'route-preference', inputValue: "Shortest", checked: this.routePreference === 'Shortest'},
1582                                         {boxLabel: this.labelPedestrian, name: 'route-preference', inputValue: "Pedestrian", checked: this.routePreference === 'Pedestrian'}
1583                                     ]
1584                                 }
1585                             ]
1586                         },
1587                         {
1588                             layout: 'column',
1589                             border: false,
1590                             bodyStyle: 'background:transparent;',
1591                             defaults: {
1592                                 layout: 'form',
1593                                 border: false,
1594                                 labelWidth: 10
1595                             },
1596                             items: [
1597                                 {
1598                                     bodyStyle: 'background:transparent;',
1599                                     html: '<img src="' + this.ImgStartForm + '">'
1600                                 },
1601                                 {
1602                                     bodyStyle: 'background:transparent;',
1603                                     columnWidth: 1,
1604                                     defaults: {
1605                                         anchor: '100%'
1606                                     },
1607                                     items: [
1608                                         this.startLocationCombo
1609                                     ]
1610                                 }
1611                             ]
1612                         },
1613                         {
1614                             layout: 'column',
1615                             columnWidth: 1,
1616                             border: false,
1617                             bodyStyle: 'background:transparent;',
1618                             items: [
1619                                 {
1620                                     bodyStyle: 'background:transparent;border:none;width: 42px;',
1621                                     width:42,
1622                                     html: ' '
1623                                 },
1624                                 {
1625                                     xtype: 'button',
1626                                     //iconCls: 'gxp-icon-buttonInvSearchRouting',
1627                                     cls: 'buttonAddPoint',
1628                                     width:120,
1629                                     text: this.textButtonAddPoint,
1630                                     handler: function() {    
1631                                         // verifica se la prima tappa è non visibile
1632                                         if (this.items.items[0].items.items[3].isVisible() === false) {
1633                                            // aggiunge il combo della prima tappa
1634                                            this.items.items[0].items.items[3].show();
1635                                            // se la seconda tappa è visibile disattiva il pulsante di aggiunta tappa 
1636                                            if (this.items.items[0].items.items[4].isVisible() === true)
1637                                                this.items.items[0].items.items[2].items.items[1].disable();
1638                                         }
1639                                         // verifica se la seconda tappa è non visibile
1640                                         else if (this.items.items[0].items.items[4].isVisible() === false) {
1641                                            // aggiunge il combo della seconda tappa e disattiva il pulsante di aggiunta tappa
1642                                            this.items.items[0].items.items[4].show();
1643                                            this.items.items[0].items.items[2].items.items[1].disable();
1644                                         }
1645                                         
1646                                     },
1647                                     scope: this
1648                                 },
1649                                 {
1650                                     xtype: 'button',
1651                                     iconCls: 'gxp-icon-buttonInvSearchRouting',
1652                                     cls: 'buttonInvSearchRouting',
1653                                     width:17,
1654                                     height:16,
1655                                     tooltip: this.textButtonInvSearch,
1656                                     handler: function() {  
1657                                         this.invertRoute();
1658                                         this.routePreference = this.getForm().items.items[0].getValue().initialConfig.inputValue;
1659                                         this.getItinerary();
1660                                     },
1661                                     scope: this
1662                                 }
1663                             ]
1664                         },
1665                         {
1666                             layout: 'column',
1667                             border: false,
1668                             bodyStyle: 'background:transparent;padding-bottom: 10px',
1669                             hidden: true,
1670                             defaults: {
1671                                 layout: 'form',
1672                                 border: false,
1673                                 labelWidth: 10
1674                             },
1675                             items: [
1676                                 {
1677                                     bodyStyle: 'background:transparent;',
1678                                     html: '<img src="' + this.ImgPointOneForm + '">'
1679                                 },
1680                                 {
1681                                     bodyStyle: 'background:transparent;',
1682                                     columnWidth: 1,
1683                                     defaults: {
1684                                         anchor: '100%'
1685                                     },
1686                                     items: [
1687                                         this.via1LocationCombo
1688                                     ]
1689                                 },
1690                                 {
1691                                     xtype: 'button',
1692                                     iconCls: 'gxp-icon-buttonHiddenRoutingPoint',
1693                                     cls: 'buttonHiddenPoint',
1694                                     width:16,
1695                                     height:15,
1696                                     tooltip: this.textButtonHiddenPointOne,
1697                                     handler: function() {  
1698                                 
1699                                       // verifica se la seconda tappa è visibile
1700                                       if (this.items.items[0].items.items[4].isVisible() === true) {
1701                                           
1702                                             // inverte i valori della prima e seconda tappa e toglie la seconda tappa.
1703 
1704                                             this.via1LocationCombo.setValue(this.via2LocationCombo.value);
1705                                             this.via1LocationXML = this.via2LocationXML;      
1706                                             
1707                                             this.items.items[0].items.items[4].hide();
1708                                             this.items.items[0].items.items[2].items.items[1].enable();
1709                                             this.via2LocationCombo.setValue("");
1710                                             this.via2LocationXML = null;   
1711 
1712                                       }
1713                                       else {
1714                                             // toglie la prima tappa
1715                                             this.items.items[0].items.items[3].hide();
1716                                             this.items.items[0].items.items[2].items.items[1].enable();
1717                                             
1718                                             this.via1LocationCombo.setValue("");
1719                                             this.via1LocationXML = null;  
1720                                       }
1721                                     },
1722                                     scope: this
1723                                 }
1724                             ]
1725                         },
1726                         {
1727                             layout: 'column',
1728                             border: false,
1729                             bodyStyle: 'background:transparent;padding-bottom: 10px',
1730                             hidden: true,
1731                             defaults: {
1732                                 layout: 'form',
1733                                 border: false,
1734                                 labelWidth: 10
1735                             },
1736                             items: [
1737                                 {
1738                                     bodyStyle: 'background:transparent;',
1739                                     html: '<img src="' + this.ImgPointTwoForm + '">'
1740                                 },
1741                                 {
1742                                     bodyStyle: 'background:transparent;',
1743                                     columnWidth: 1,
1744                                     defaults: {
1745                                         anchor: '100%'
1746                                     },
1747                                     items: [
1748                                         this.via2LocationCombo
1749                                     ]
1750                                 },
1751                                 {
1752                                     xtype: 'button',
1753                                     iconCls: 'gxp-icon-buttonHiddenRoutingPoint',
1754                                     cls: 'buttonHiddenPoint',
1755                                     width:16,
1756                                     height:15,
1757                                     tooltip: this.textButtonHiddenPointTwo,
1758                                     handler: function() { 
1759                                         //toglie la seconda tappa
1760                                         this.items.items[0].items.items[4].hide();
1761                                         this.items.items[0].items.items[2].items.items[1].enable();
1762                                         
1763                                         this.via2LocationCombo.setValue("");
1764                                         this.via2LocationXML = null;  
1765                                     },
1766                                     scope: this
1767                                 }
1768                             ]
1769                         },
1770                         {
1771                             layout: 'column',
1772                             border: false,
1773                             bodyStyle: 'background:transparent;padding-bottom: 10px',
1774                             defaults: {
1775                                 layout: 'form',
1776                                 border: false,
1777                                 labelWidth: 10
1778                             },
1779                             items: [
1780                                 {
1781                                     bodyStyle: 'background:transparent;',
1782                                     html: '<img src="' + this.ImgStopForm + '">'
1783                                 },
1784                                 {
1785                                     bodyStyle: 'background:transparent;',
1786                                     columnWidth: 1,
1787                                     defaults: {
1788                                         anchor: '100%'
1789                                     },
1790                                     items: [
1791                                         this.endLocationCombo
1792                                     ]
1793                                 }
1794                             ]
1795                         },
1796                         {
1797                             columnWidth: 1,
1798                             border: false,
1799                             bodyStyle: 'background:transparent;',
1800                             items: [
1801                                 {
1802                                     xtype: 'button',
1803                                     cls: 'buttonSearchRouting',
1804                                     text: this.textButtonSearch,
1805                                     handler: function() {  
1806                                         this.routePreference = this.getForm().items.items[0].getValue().initialConfig.inputValue;
1807                                         this.getItinerary();
1808                                     },
1809                                     scope: this
1810                                 }
1811                             ]
1812                         }
1813                     ]
1814                 },
1815                 {
1816                     border: false,
1817                     cls: 'routingResultPanel',
1818                     items: [
1819                         this.routingResultPanel
1820                     ]
1821                 },
1822                 {
1823                     border: false,
1824                     cls: 'routingResultPanel2',
1825                     bodyStyle: 'padding:30px;padding-top:0px;',
1826                     columnWidth: 1,
1827                     defaults: {
1828                       anchor: '100%'
1829                     },
1830                     items: [
1831                         this.routingResultPanel2
1832                     ]
1833                 },
1834                 {
1835                     border: false,
1836                     bodyStyle: 'padding:30px;padding-top:0px;',
1837                     columnWidth: 1,
1838                     defaults: {
1839                       anchor: '100%'
1840                     },
1841                     items: [
1842                         this.routingResultPanel3
1843                     ]
1844                 },
1845                 {
1846                     border: false,
1847                     cls: 'routingResultPanel',
1848                     items: [
1849                         this.routingResultPanel5
1850                     ]
1851                 },{
1852                     border: false,
1853                     cls: 'routingResultPanel',
1854                     items: [
1855                         this.routingResultPanel4
1856                     ]
1857                 }
1858 
1859             ];
1860         }
1861          /**
1862          * Create items of routing panel for cloudmade routing
1863          */ 
1864         else {  
1865 
1866             // Create routing result panel
1867             this.routingResultPanel = new Ext.Panel({
1868                 border: false,
1869                 html: '',
1870                 bodyStyle: 'padding:5px 5px 5px 5px;'
1871             });
1872 
1873 
1874             // Set default location string
1875             if (!this.startLocationCombo.locationString) {
1876                 this.startLocationCombo.locationString = '47.25976,9.58423';
1877             }
1878             if (!this.endLocationCombo.locationString) {
1879                 this.endLocationCombo.locationString = '47.26117,9.59882';
1880             }
1881 
1882             this.items = [
1883                 {
1884                     layout: 'form',
1885                     border: false,
1886                     labelWidth: 10,
1887                     items: [
1888                         {
1889                             layout: 'column',
1890                             border: false,
1891                             defaults: {
1892                                 layout: 'form',
1893                                 border: false,
1894                                 labelWidth: 10,
1895                                 bodyStyle: 'padding:5px 0px 0px 5px'
1896                             },
1897                             items: [
1898                                 {
1899                                     columnWidth: 0.75,
1900                                     defaults: {
1901                                         anchor: '100%'
1902                                     },
1903                                     items: [
1904                                         this.startLocationCombo
1905                                     ]
1906                                 },
1907                                 {
1908                                     columnWidth: 0.25,
1909                                     items: [
1910                                         {
1911                                             xtype: 'button',
1912                                             text: OpenLayers.i18n('Get Point'),
1913                                             handler: function(button, event) {
1914                                                 this.routingPointDrawControl.type = 'GetStartPoint';
1915                                                 this.routingPointDrawControl.activate();
1916                                             },
1917                                             scope: this
1918                                         }
1919                                     ]
1920                                 }
1921                             ]
1922                         },
1923                         {
1924                             layout: 'column',
1925                             border: false,
1926                             defaults: {
1927                                 layout: 'form',
1928                                 border: false,
1929                                 labelWidth: 10,
1930                                 bodyStyle: 'padding:0px 0px 0px 5px;'
1931                             },
1932                             items: [
1933                                 {
1934                                     columnWidth: 0.75,
1935                                     defaults: {
1936                                         anchor: '100%'
1937                                     },
1938                                     items: [
1939                                         this.endLocationCombo
1940                                     ]
1941                                 },
1942                                 {
1943                                     columnWidth: 0.25,
1944                                     items: [
1945                                         {
1946                                             xtype: 'button',
1947                                             text: OpenLayers.i18n('Get Point'),
1948                                             handler: function(button, event) {
1949                                                 this.routingPointDrawControl.type = 'GetEndPoint';
1950                                                 this.routingPointDrawControl.activate();
1951                                             },
1952                                             scope: this
1953                                         }
1954                                     ]
1955                                 }
1956                             ]
1957                         }
1958                     ]
1959                 },
1960                 {
1961                     layout: 'column',
1962                     border: false,
1963                     items: [
1964                         {
1965                             columnWidth: 1,
1966                             border: false,
1967                             bodyCfg: {tag: 'center'},
1968                             items: [
1969                                 {
1970                                     xtype: 'button',
1971                                     text: OpenLayers.i18n('Compute itinerary'),
1972                                     handler: function() {                                
1973                                         this.getItinerary();
1974                                     },
1975                                     scope: this
1976                                 }
1977                             ]
1978                         }
1979                     ]
1980 
1981                 },
1982                 {
1983                     border: false,
1984                     items: [
1985                         this.routingResultPanel
1986                     ]
1987                 }
1988 
1989             ];
1990         }
1991 
1992         this.addEvents(
1993                 /** api: event[routingcomputed]
1994                  *  Fires when a routing has been computed
1995                  *
1996                  *  Listener arguments:
1997                  *  * comp - :class:`framework.widgets.RoutingPanel`` This component.
1998                  */
1999                 'routingcomputed',
2000                 /** api: event[beforeroutingcomputed]
2001                  *  Fires when before a routing is computed
2002                  *
2003                  *  Listener arguments:
2004                  *  * comp - :class:`framework.widgets.RoutingPanel`` This component.
2005                  */
2006                 'beforeroutingcomputed');
2007 
2008 
2009         framework.widgets.RoutingPanel.superclass.initComponent.call(this);
2010          
2011         if(this.xmlRequest && this.xmlRequest.length > 0){
2012             this.comeFromSavedMap = true;
2013             if(this.printMode == true){
2014                 this.showGoogleItinerary = false;
2015                 this.showPoiSearch = false;
2016             }
2017             this.routingResultPanel.html = '<div class="loading"><span class="gxp-icon-loading"></span><p>'+this.textMsgRounting+'</p></div>';
2018             if (this.routingResultPanel.body) {
2019                 this.routingResultPanel.body.update(this.routingResultPanel.html);
2020             }
2021             this.routingResultPanel.setVisible(true);
2022             this.geocoderStore.baseParams["xmlRequest"] = this.xmlRequest;
2023             this.geocoderStore.load();
2024             this.expand();
2025 
2026             this.startLocationXML = null;
2027             this.stopLocationXML = null;
2028             this.via1LocationXML = null;
2029             this.via2LocationXML = null;
2030         }
2031     },
2032     
2033     /**
2034     *  Invert path routing
2035     *  
2036     *  @private
2037     */  
2038     invertRoute: function() {
2039         
2040         // inverte il punto di partenza e il punto di arrivo
2041         var tempValueCombo = this.startLocationCombo.value;
2042         this.startLocationCombo.setValue(this.endLocationCombo.value);
2043         this.endLocationCombo.setValue(tempValueCombo);
2044         
2045         var tempLocationXML = this.startLocationXML;
2046         this.startLocationXML = this.stopLocationXML;
2047         this.stopLocationXML = tempLocationXML;
2048         
2049         // verifica se la seconda tappa è visibile e inverte i valori delle due tappe
2050         if (this.items.items[0].items.items[4].isVisible() === true) {
2051             
2052             var tempValueCombo = this.via1LocationCombo.value;
2053             this.via1LocationCombo.setValue(this.via2LocationCombo.value);
2054             this.via2LocationCombo.setValue(tempValueCombo);
2055 
2056             var tempLocationXML = this.via1LocationXML;
2057             this.via1LocationXML = this.via2LocationXML;
2058             this.via2LocationXML = tempLocationXML;         
2059             
2060         }
2061         
2062         
2063     },
2064     
2065     /**
2066     *  afterRender override.
2067     *  @private
2068     */
2069     afterRender: function() {
2070         framework.widgets.RoutingPanel.superclass.afterRender.call(this);
2071 
2072 
2073         // Create routing layer
2074         if (!this.routingLayer) {
2075             this.routingLayer = new OpenLayers.Layer.Vector("Routing", {styleMap: this.vectorStyle});
2076             /*
2077             // create popup on "featureselected"
2078             this.routingLayer.events.on({
2079                 featureselected: function(e) {
2080                     if (e.feature.text !== 'undefined') {
2081                         createPopup(e.feature);
2082                     }
2083                 }
2084             });
2085             
2086             this.selectCtrl = new OpenLayers.Control.SelectFeature([this.routingLayer], {
2087                 toggle: true,
2088                 clickout: true
2089             });
2090 
2091             this.map.addControl(this.selectCtrl);
2092             this.selectCtrl.activate();*/
2093             
2094         }
2095         this.map.addLayer(this.routingLayer);
2096 
2097         // Create point draw control
2098         this.routingPointDrawControl = new OpenLayers.Control.DrawFeature(this.routingLayer, OpenLayers.Handler.Point);
2099         this.map.addControl(this.routingPointDrawControl);
2100         this.routingPointDrawControl.events.on({"featureadded": function(events) {
2101                 var featureLocation = null;
2102                 if (this.routingPointDrawControl.type == 'GetStartPoint') {
2103                     if (this.routingStartFeature) {
2104                         this.routingLayer.removeFeatures([this.routingStartFeature]);
2105                         this.routingStartFeature = null;
2106                     }
2107                     this.routingStartFeature = events.feature;
2108                     featureLocation = this.routingStartFeature.geometry.clone();
2109                     featureLocation.transform(this.map.getProjectionObject(), this.routingProjection);
2110                     this.startLocationCombo.locationString = featureLocation.y + ',' + featureLocation.x;
2111                     this.startLocationCombo.emptyText = OpenLayers.i18n('Position: ') + Math.round(featureLocation.y * 100000) / 100000 + ',' + Math.round(featureLocation.x * 100000) / 100000;
2112                     this.startLocationCombo.clearValue();
2113                 }
2114                 if (this.routingPointDrawControl.type == 'GetEndPoint') {
2115                     if (this.routingEndFeature) {
2116                         this.routingLayer.removeFeatures([this.routingEndFeature]);
2117                         this.routingEndFeature = null;
2118                     }
2119                     this.routingEndFeature = events.feature;
2120                     featureLocation = this.routingEndFeature.geometry.clone();
2121                     featureLocation.transform(this.map.getProjectionObject(), this.routingProjection);
2122                     this.endLocationCombo.locationString = featureLocation.y + ',' + featureLocation.x;
2123                     this.endLocationCombo.emptyText = OpenLayers.i18n('Position: ') + Math.round(featureLocation.y * 100000) / 100000 + ',' + Math.round(featureLocation.x * 100000) / 100000;
2124                     this.endLocationCombo.clearValue();
2125                 }
2126                 this.routingPointDrawControl.deactivate();
2127             },
2128             scope: this
2129         }); 
2130         // Use the permalink
2131         if (this.readPermalink) {
2132             var parameters = OpenLayers.Util.getParameters();
2133             this.setPermalink(parameters);
2134         }
2135     }
2136     ,
2137 
2138     /**
2139     *  Create the permalink.
2140     *  (only cloudmade service)
2141     *   
2142     *  @private
2143     *  @param boolean Defines if the complete URL is generated or only the parameters KVP
2144     */
2145     getPermalink: function(complete) {
2146         var permalink;
2147         if (complete) {
2148             permalink = window.location.href;
2149             if (OpenLayers.String.contains(permalink, '?')) {
2150                 var end = permalink.indexOf('?');
2151                 permalink = permalink.substring(0, end);
2152             }
2153             permalink = permalink + "?";
2154         } else {
2155             permalink = '';
2156         }
2157 
2158         permalink = permalink + "routingReadPermalink=" + this.readPermalink;
2159         permalink = permalink + "&routingRecenterMap=" + this.routingRecenterMap;
2160 
2161         if (this.startLocationCombo.locationString && this.routingPathFeature) {
2162             permalink = permalink + "&routingStartLocationString=" + this.startLocationCombo.locationString;
2163         }
2164         if (this.endLocationCombo.locationString && this.routingPathFeature) {
2165             permalink = permalink + "&routingEndLocationString=" + this.endLocationCombo.locationString;
2166         }
2167         if (this.startLocationCombo.value) {
2168             permalink = permalink + "&routingStartLocationValue=" + this.startLocationCombo.value;
2169         }
2170         if (this.endLocationCombo.value) {
2171             permalink = permalink + "&routingEndLocationValue=" + this.endLocationCombo.value;
2172         }
2173         if (this.startLocationCombo.emptyText.indexOf(OpenLayers.i18n('Position: ')) > -1) {
2174             permalink = permalink + "&routingStartLocationEmptyText=" + this.startLocationCombo.emptyText;
2175         }
2176         if (this.endLocationCombo.emptyText.indexOf(OpenLayers.i18n('Position: ')) > -1) {
2177             permalink = permalink + "&routingEndLocationEmptyText=" + this.endLocationCombo.emptyText;
2178         }
2179         if (this.map && !this.routingRecenterMap) {
2180             permalink = permalink + "&routingeasting=" + this.map.getCenter().lon;
2181             permalink = permalink + "&routingnorthing=" + this.map.getCenter().lat;
2182             permalink = permalink + "&routingzoom=" + this.map.getZoom();
2183         }
2184         return permalink;
2185     }
2186     ,
2187 
2188     /**
2189     *   Set the permalink according to the url parameters
2190     *   (only cloudmade service)
2191     *  
2192     *  @private
2193     *  @param {Object} parameters URL paramaters.
2194     */
2195     setPermalink: function(parameters) {
2196         if (parameters.routingReadPermalink) {
2197             this.readPermalink = this.stringToBoolean(parameters.routingReadPermalink);
2198         }
2199         if (parameters.routingRecenterMap) {
2200             this.routingRecenterMap = this.stringToBoolean(parameters.routingRecenterMap);
2201         }
2202         if (parameters.routingStartLocationString) {
2203             this.startLocationCombo.locationString = parameters.routingStartLocationString[0] + "," + parameters.routingStartLocationString[1];
2204         }
2205         if (parameters.routingEndLocationString) {
2206             this.endLocationCombo.locationString = parameters.routingEndLocationString[0] + "," + parameters.routingEndLocationString[1];
2207         }
2208         if (parameters.routingStartLocationString && parameters.routingEndLocationString) {
2209             this.getItinerary();
2210         }
2211         if (parameters.routingeasting && parameters.routingnorthing) {
2212             var position = new OpenLayers.LonLat(parseFloat(parameters.routingeasting), parseFloat(parameters.routingnorthing));
2213             if (this.map) {
2214                 this.map.setCenter(position);
2215             }
2216         }
2217         if (parameters.routingzoom) {
2218             if (this.map) {
2219                 this.map.zoomTo(parseInt(parameters.routingzoom, 10));
2220             }
2221         }
2222         if (parameters.routingStartLocationValue) {
2223             this.startLocationCombo.setValue(parameters.routingStartLocationValue);
2224         }
2225         if (parameters.routingEndLocationValue) {
2226             this.endLocationCombo.setValue(parameters.routingEndLocationValue);
2227         }
2228         if (parameters.routingStartLocationEmptyText) {
2229             this.startLocationCombo.emptyText = parameters.routingStartLocationEmptyText.toString();
2230         }
2231         if (parameters.routingEndLocationEmptyText) {
2232             this.endLocationCombo.emptyText = parameters.routingEndLocationEmptyText.toString();
2233         }
2234     },
2235 
2236     /**
2237     *   Transform a string (true, false, yes, no 1 or 0) to a boolean
2238     *  
2239     *  @private
2240     *  @param string.
2241     */
2242     stringToBoolean: function(string) {
2243         switch (string.toLowerCase()) {
2244             case "true":
2245             case "yes":
2246             case "1":
2247                 return true;
2248             case "false":
2249             case "no":
2250             case "0":
2251             case null:
2252                 return false;
2253             default:
2254                 return Boolean(string);
2255         }
2256     },
2257             
2258     /**
2259     *   Compute the itinerary and assign the results
2260     *  
2261     *  @private
2262     */
2263     getItinerary: function() {
2264         /**
2265          * rounting service OpenLS
2266          */
2267         if (this.routingServiceType === 'openls') {
2268 
2269             this.routingResultPanel.setVisible(true);
2270             this.routingResultPanel2.setVisible(false);
2271             this.routingResultPanel3.setVisible(false);
2272             this.routingResultPanel4.setVisible(false);
2273             this.routingResultPanel5.setVisible(false);
2274             
2275             this.routingResultPanel2.getSelectionModel().clearSelections();
2276             this.routingResultPanel3.getSelectionModel().clearSelections();
2277             
2278            
2279             this.fireEvent('beforeroutingcomputed', this);
2280             this.routingResultPanel.html = '<div class="loading"><span class="gxp-icon-loading"></span><p>'+this.textMsgRounting+'</p></div>';
2281             if (this.routingResultPanel.body) {
2282                 this.routingResultPanel.body.update(this.routingResultPanel.html);
2283             }
2284 
2285             if (this.startLocationCombo.lastSelectionText 
2286                 && this.endLocationCombo.lastSelectionText
2287                 && (!this.items.items[0].items.items[3].isVisible() || (this.items.items[0].items.items[3].isVisible() && this.via1LocationCombo.lastSelectionText))
2288                 && (!this.items.items[0].items.items[4].isVisible() || (this.items.items[0].items.items[4].isVisible() && this.via2LocationCombo.lastSelectionText))) {
2289                    
2290                 
2291                     var start = '<Address xmlns="http://www.opengis.net/xls" addressee="" countryCode="IT">'+
2292                             '<freeFormAddress>' + this.startLocationCombo.lastSelectionText.replace("(", "").replace(")", "") + 
2293                             '</freeFormAddress>'+
2294                             '</Address>';
2295 
2296                     if (this.startLocationXML) {
2297                         start = this.startLocationXML;
2298                     }
2299 
2300 
2301                     var stop = '<Address xmlns="http://www.opengis.net/xls" addressee="" countryCode="IT">'+
2302                             '<freeFormAddress>' + this.endLocationCombo.lastSelectionText.replace("(", "").replace(")", "") + 
2303                             '</freeFormAddress>'+
2304                             '</Address>';
2305 
2306                     if (this.stopLocationXML) {
2307                         stop = this.stopLocationXML;
2308                     }
2309 
2310                     var via1 = '';
2311 
2312                     if (this.items.items[0].items.items[3].isVisible()) {
2313                         via1 = '<Address xmlns="http://www.opengis.net/xls" addressee="" countryCode="IT">'+
2314                             '<freeFormAddress>' + this.via1LocationCombo.lastSelectionText.replace("(", "").replace(")", "") + 
2315                             '</freeFormAddress>'+
2316                             '</Address>';
2317 
2318                         if (this.via1LocationXML) {
2319                             via1 = this.via1LocationXML;
2320                         }
2321 
2322                         via1 = '<ViaPoint>'+via1+'</ViaPoint>';
2323                     }
2324 
2325                     var via2 = '';
2326 
2327                     if (this.items.items[0].items.items[4].isVisible()) {
2328                         via2 = '<Address xmlns="http://www.opengis.net/xls" addressee="" countryCode="IT">'+
2329                             '<freeFormAddress>' + this.via2LocationCombo.lastSelectionText.replace("(", "").replace(")", "") + 
2330                             '</freeFormAddress>'+
2331                             '</Address>';
2332 
2333 
2334                         if (this.via2LocationXML) {
2335                             via2 = this.via2LocationXML;
2336                         }
2337 
2338                         via2 = '<ViaPoint>'+via2+'</ViaPoint>';
2339                     }
2340 
2341 
2342                     if (Ext.isString(this.srs)) {
2343                         this.srs = new OpenLayers.Projection(this.srs);
2344                     }
2345 
2346                     this.xmlRequest = '<ControllerRequest xmlns="http://www.corenet.it/followmeplus" xmlns:xls="http://www.opengis.net/xls">' +
2347                             '<DetermineRouteRequest distanceUnit="' + this.distanceUnit + '" xmlns="http://www.opengis.net/xls">' +
2348                             '<RoutePlan>' +
2349                             '<RoutePreference>' + this.routePreference + '</RoutePreference>' +
2350                             '<WayPointList>' +
2351                             '<StartPoint>' +                      
2352                             start +                    
2353                             '</StartPoint>' +
2354                             via1 +
2355                             via2 +
2356                             '<EndPoint>' +
2357                             stop +    
2358                             '</EndPoint>' +
2359                             '</WayPointList>' +
2360                             '</RoutePlan>' +
2361                             '</DetermineRouteRequest>' +
2362                             '<EPSGOutput>' + this.epsgOutput + '</EPSGOutput>' +
2363                             '<Language>' + this.language + '</Language>' +
2364                             '<FormatType>' + this.formatType + '</FormatType>' +
2365                             '</ControllerRequest>';
2366 
2367                 if (this.proxy) {
2368                         var sUrl = this.proxy + escape(this.routingServiceURL)
2369                         + '?xmlRequest=' + this.xmlRequest
2370                         + '&exactStreetName=' + this.exactStreetName;
2371                 }
2372                 else {
2373                     var sUrl = this.routingServiceURL
2374                         + '?xmlRequest=' + this.xmlRequest
2375                         + '&exactStreetName=' + this.exactStreetName;
2376                 }
2377 
2378 
2379                 this.geocoderStore.baseParams["xmlRequest"] = this.xmlRequest;
2380 
2381                 this.geocoderStore.load();
2382                 this.expand();
2383                           
2384                 this.startLocationXML = null;
2385                 this.stopLocationXML = null;
2386                 this.via1LocationXML = null;
2387                 this.via2LocationXML = null;
2388                         
2389             }
2390             else {
2391                 this.routingResultPanel.body.update(this.textMsgNoText);
2392             }
2393         }
2394         /**
2395          * Rountig service Cloud made
2396          */
2397         else if (this.routingServiceType === 'cloudmade') {
2398 
2399             this.fireEvent('beforeroutingcomputed', this);
2400             this.routingResultPanel.html = OpenLayers.i18n('Computation ongoing....');
2401             if (this.routingResultPanel.body) {
2402                 this.routingResultPanel.body.update(this.routingResultPanel.html);
2403             }
2404             //http://routes.cloudmade.com/BC9A493B41014CAABB98F0471D759707/api/0.3/47.25976,9.58423,47.26117,9.59882/car/shortest.js
2405             var newUrl = this.startLocationCombo.locationString + ',' + this.endLocationCombo.locationString;
2406             newUrl = newUrl + "/" + this.route_typeCloudmade + ".js?lang=" + this.lang;
2407             this.proxy = new Ext.data.ScriptTagProxy({
2408                 url: this.routingServiceURL + this.cloudmadeKey + "/api/0.3/" + newUrl,
2409                 nocache: false
2410             });
2411             this.routingStore = new Ext.data.Store({
2412                 proxy: this.proxy,
2413                 reader: new Ext.data.JsonReader({
2414                     root: 'version',
2415                     fields: [
2416                         {
2417                             name: 'total_length'
2418                         }
2419                     ]
2420 
2421                 })
2422             });
2423 
2424             this.routingStore.on(
2425                     'load', function(store) {
2426                 this.routingVersionCloudmade = store.reader.jsonData.version;
2427                 this.routingStatusCloudmade = store.reader.jsonData.status;
2428                 if (store.reader.jsonData.status_message) {
2429                     this.routingStatusMessageCloudmade = store.reader.jsonData.status_message;
2430                 }
2431                 if (store.reader.jsonData.route_summary) {
2432                     this.routingRouteSummaryCloudmade = store.reader.jsonData.route_summary;
2433                 }
2434                 if (store.reader.jsonData.route_geometry) {
2435                     this.routingRouteGeometryCloudmade = store.reader.jsonData.route_geometry;
2436                 }
2437                 if (store.reader.jsonData.route_instructions) {
2438                     this.routingRouteInstructionsCloudmade = store.reader.jsonData.route_instructions;
2439                 }
2440                 if (this.routingStatusCloudmade == '0') {
2441                     this.drawRoute();
2442                     var googleLinks = ''
2443                     if (this.showGoogleItinerary) {
2444                         googleLinks = this.googleLink(this.startLocationCombo.locationString, this.endLocationCombo.locationString);
2445                     }
2446                     this.routingResultPanel.html = OpenLayers.i18n('Total length: ') + Math.round(this.routingRouteSummaryCloudmade.total_distance / 1000) + ' [km]<br>' + googleLinks;
2447                     if (this.routingResultPanel.body) {
2448                         this.routingResultPanel.body.update(this.routingResultPanel.html);
2449                     }
2450                 } else {
2451                     this.routingResultPanel.html = this.routingStatusMessageCloudmade;
2452                     if (this.routingResultPanel.body) {
2453                         this.routingResultPanel.body.update(this.routingResultPanel.html);
2454                     }
2455                 }
2456                 this.fireEvent('routingcomputed', this);
2457             }, this);
2458             this.routingStore.load();
2459         } else {
2460             alert('Routing service: ' + this.routingServiceType + ' not supported. Patch welcome !');
2461         }
2462     },
2463     
2464     /**
2465     *  Clear the itinerary the itinerary and assign the results
2466     *  
2467     *  @private
2468     */
2469     clearItinerary: function() {
2470         if (this.routingPathFeature) {
2471             this.routingLayer.removeFeatures([this.routingPathFeature]);
2472         }
2473         this.startLocationCombo.clearValue();
2474         this.endLocationCombo.clearValue();
2475         if (this.routingStartFeature) {
2476             this.routingLayer.removeFeatures([this.routingStartFeature]);
2477             this.routingStartFeature = null;
2478         }
2479         if (this.routingEndFeature) {
2480             this.routingLayer.removeFeatures([this.routingEndFeature]);
2481             this.routingEndFeature = null;
2482         }
2483         this.routingResultPanel.html = '';
2484         this.routingResultPanel.body.update(this.routingResultPanel.html);
2485     },
2486             
2487     /**
2488     *  Transform time string to array
2489     *  
2490     *  @private
2491     *  @param string
2492     */            
2493     timeString: function (time) {
2494 
2495         var string = "";
2496 
2497         
2498         if (time["hours"] > 0) 
2499             string += time["hours"] + " ore "; 
2500         if (time["minutes"] > 0) 
2501             string += time["minutes"] + " minuti "; 
2502        /* if (time["seconds"] > 0) 
2503             string += time["seconds"] + " secondi "; */
2504 
2505         return string;
2506       
2507     },   
2508          
2509     /**
2510     *  Draw the route in the map
2511     *  
2512     *  @private
2513     */ 
2514     drawRoute: function() {
2515         function removePopup(){
2516             if (this.popupAddr) {
2517                     this.popupAddr.close();
2518                     this.popupAddr.destroy();	
2519             }
2520 
2521         };
2522 
2523         function createPopup(feature) {
2524             removePopup();
2525             this.popupAddr = new framework.plugins.PopUp({
2526                 //title: 'Ricerca indirizzo',
2527                 //map: this.map,
2528                 location: feature,
2529                 width:200,
2530                 border: false,
2531                 html: '<div class="popupAddr">'+feature.text+'</div>',
2532                 maximizable: false,
2533                 collapsible: false
2534             });
2535             this.popupAddr.show();	
2536         };   
2537         
2538          //remove marker and popup
2539         if(!this.comeFromSavedMap){
2540             this.routingLayer.destroyFeatures();
2541              if(top.popupAddr){
2542                 top.popupAddr.close();
2543                 top.popupAddr.destroy();
2544              } 
2545         }
2546         
2547         this.map.searchName = this.searchName;
2548         
2549         var pointList = [];
2550         var lineList = [];
2551         
2552         var textResultPanel = '';
2553 
2554         if (this.routingServiceType === 'openls') {
2555             
2556            
2557             /**
2558              *   LINEA DEL PERCORSO STRADALE
2559              */
2560             
2561             var num_point = this.geocoderStore.data.items[0].data.totalRouteGeometry.length;
2562             var newPoint = null;
2563             for (var i = 0; i < num_point; i++) {
2564                 newPoint = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[0].data.totalRouteGeometry[i][0], this.geocoderStore.data.items[0].data.totalRouteGeometry[i][1]);
2565                 newPoint.transform(this.routingProjection,
2566                         this.map.getProjectionObject());
2567                 pointList.push(newPoint);
2568             }
2569             
2570              
2571             /**
2572              *  CREAZIONE MARKER DI PARTENZA
2573              */
2574             var first = this.geocoderStore.data.first();
2575             var newPointA = new OpenLayers.Geometry.Point(first.data.routeInstructionGeometry[0][0], first.data.routeInstructionGeometry[0][1]);
2576             newPointA.transform(this.routingProjection,
2577                 this.map.getProjectionObject());
2578                 
2579             var pointA = new OpenLayers.Geometry.Point(newPointA.x, newPointA.y);
2580             this.routingStartFeature = new OpenLayers.Feature.Vector(pointA, null, this.vectorStyleA);
2581             this.routingStartFeature.text = this.startLocationCombo.lastSelectionText;
2582             
2583             /**
2584              *  CREAZIONE MARKER TAPPE INTERMEDIE
2585              */
2586             var step1 = this.geocoderStore.find('description', 'step2');
2587             if (step1 == -1)  step1 = this.geocoderStore.find('description', 'step2-fromPOI');
2588             if (step1 > -1) {
2589                 var newPoint1 = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[step1].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[step1].data.routeInstructionGeometry[0][1]);
2590                 newPoint1.transform(this.routingProjection,
2591                     this.map.getProjectionObject());
2592                             
2593                 var pointVia1 = new OpenLayers.Geometry.Point(newPoint1.x, newPoint1.y);
2594                 this.routingVia1Feature = new OpenLayers.Feature.Vector(pointVia1, null, this.vectorStyle1);
2595                 this.routingVia1Feature.text = this.via1LocationCombo.lastSelectionText;
2596             }
2597             
2598             var step2 = this.geocoderStore.find('description', 'step3');
2599             if (step2 == -1)  step2 = this.geocoderStore.find('description', 'step3-fromPOI');
2600             if (step2 > -1) {
2601                 var newPoint2 = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[step2].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[step2].data.routeInstructionGeometry[0][1]);
2602                 newPoint2.transform(this.routingProjection,
2603                     this.map.getProjectionObject());
2604                 
2605                 var pointVia2 = new OpenLayers.Geometry.Point(newPoint2.x, newPoint2.y);
2606                 this.routingVia2Feature = new OpenLayers.Feature.Vector(pointVia2, null, this.vectorStyle2);
2607                 this.routingVia2Feature.text = this.via2LocationCombo.lastSelectionText;
2608             }
2609             
2610             /**
2611              *  CREAZIONE MARKER DI ARRIVO
2612              */
2613             var last = this.geocoderStore.data.last();
2614             var newPointB = new OpenLayers.Geometry.Point(last.data.routeInstructionGeometry[0][0], last.data.routeInstructionGeometry[0][1]);
2615             newPointB.transform(this.routingProjection,
2616                 this.map.getProjectionObject());
2617                 
2618             var pointB = new OpenLayers.Geometry.Point(newPointB.x, newPointB.y);
2619             this.routingEndFeature = new OpenLayers.Feature.Vector(pointB, null, this.vectorStyleB);
2620             this.routingEndFeature.text = this.endLocationCombo.lastSelectionText;
2621             
2622             /**
2623              *  LINEA TRA TOPONIMO E PUNTO STRADALE PIU' VICINO (PARTENZA)
2624              */
2625             
2626             var fromPOI = this.geocoderStore.find('description', 'step1-fromPOI');
2627             if (fromPOI > -1) {
2628                                
2629                 // Primo punto stradale
2630                 newPointB = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[2].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[2].data.routeInstructionGeometry[0][1]);
2631                 newPointB.transform(this.routingProjection,
2632                     this.map.getProjectionObject());
2633                     
2634                 var newLine = new OpenLayers.Geometry.LineString([pointA,newPointB]);
2635    
2636                 lineList.push(newLine);
2637    
2638                 
2639             }
2640             
2641             /**
2642              *  LINEA TRA PUNTO STRADALE PIU' VICINO E TOPONIMO (ARRIVO O PRIMA TAPPA)
2643              */
2644             var toPOI = this.geocoderStore.find('description', 'step1-toPOI');
2645             if (toPOI > -1) {
2646                 
2647                 var newPoint = null;
2648                 newPointA = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[toPOI+1].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[toPOI+1].data.routeInstructionGeometry[0][1]);
2649                 newPointA.transform(this.routingProjection,
2650                     this.map.getProjectionObject());  
2651                             
2652                 newPointB = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[toPOI].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[toPOI].data.routeInstructionGeometry[0][1]);
2653                 newPointB.transform(this.routingProjection,
2654                 this.map.getProjectionObject());
2655 
2656                 var newLine = new OpenLayers.Geometry.LineString([newPointA,newPointB]);
2657                 lineList.push(newLine);
2658    
2659                 
2660             }   
2661             
2662            /**
2663              *  LINEA TRA PUNTO STRADALE PIU' VICINO E TOPONIMO (ARRIVO O SECONDA TAPPA)
2664              */
2665             var toPOI = this.geocoderStore.find('description', 'step2-toPOI');
2666             if (toPOI > -1) {
2667                 
2668                 var newPoint = null;
2669                 newPointA = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[toPOI+1].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[toPOI+1].data.routeInstructionGeometry[0][1]);
2670                 newPointA.transform(this.routingProjection,
2671                     this.map.getProjectionObject());  
2672                             
2673                 newPointB = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[toPOI].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[toPOI].data.routeInstructionGeometry[0][1]);
2674                 newPointB.transform(this.routingProjection,
2675                 this.map.getProjectionObject());
2676 
2677                 var newLine = new OpenLayers.Geometry.LineString([newPointA,newPointB]);
2678                 lineList.push(newLine);
2679    
2680                 
2681             }  
2682             
2683             /**
2684              *  LINEA TRA PUNTO STRADALE PIU' VICINO E TOPONIMO (ARRIVO DOPO SECONDA TAPPA)
2685              */
2686             var toPOI = this.geocoderStore.find('description', 'step3-toPOI');
2687             if (toPOI > -1) {
2688                 
2689                 var newPoint = null;
2690                 newPointA = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[toPOI+1].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[toPOI+1].data.routeInstructionGeometry[0][1]);
2691                 newPointA.transform(this.routingProjection,
2692                     this.map.getProjectionObject());  
2693                             
2694                 newPointB = new OpenLayers.Geometry.Point(this.geocoderStore.data.items[toPOI].data.routeInstructionGeometry[0][0], this.geocoderStore.data.items[toPOI].data.routeInstructionGeometry[0][1]);
2695                 newPointB.transform(this.routingProjection,
2696                 this.map.getProjectionObject());
2697 
2698                 var newLine = new OpenLayers.Geometry.LineString([newPointA,newPointB]);
2699                 lineList.push(newLine);
2700    
2701                 
2702             }  
2703             
2704             this.routingPathFeaturePOI = new OpenLayers.Feature.Vector(
2705                 new OpenLayers.Geometry.MultiLineString(lineList), null, this.routingStylePOI);
2706             
2707             if(!this.endLocationCombo.lastSelectionText){
2708                 this.endLocationCombo.lastSelectionText = this.geocoderStore.data.items[this.geocoderStore.data.items.length - 1].data.instruction;
2709                 this.endLocationCombo.lastSelectionText = this.endLocationCombo.lastSelectionText.replace('<b>','').replace('</b>','');
2710             }
2711             textResultPanel = "<b>" + this.textTitleResultPath + " " + this.endLocationCombo.lastSelectionText + "</b>" +
2712                 "<br /><small>" + 
2713                 this.geocoderStore.data.items[0].data.totalDistance_uom + " " + this.geocoderStore.data.items[0].data.totalDistance_value +
2714                 " - circa " + 
2715                 this.timeString(this.geocoderStore.data.items[0].data.totalTime) + ' (' + this['label'+this.routePreference]+')' +
2716                 "</small>";
2717         
2718             this.routingResultPanel2.setVisible(true);
2719             this.routingResultPanel3.setVisible(false);
2720             
2721              
2722             
2723             if (this.showGoogleItinerary) {
2724                try{
2725                     var start = this.startLocationCombo.store.data.items[0].data.lat + "," + this.startLocationCombo.store.data.items[0].data.lon;
2726                     var end = this.endLocationCombo.store.data.items[0].data.lat + "," + this.endLocationCombo.store.data.items[0].data.lon; 
2727                     var googleLinks = this.googleLink(start, end);
2728                     this.routingResultPanel4.setVisible(true);
2729                     this.routingResultPanel4.body.update(googleLinks); 
2730                }catch(error){
2731                    //do nothing
2732                }
2733 
2734             }
2735         
2736             if (this.showPoiSearch && ((this.geocoderStore.data.items[0].data.totalDistance_uom !== 'KM') || ( (this.geocoderStore.data.items[0].data.totalDistance_uom === 'KM') && (this.geocoderStore.data.items[0].data.totalDistance_value <= this.searchKmLimit)))){
2737 //            if (this.geocoderStore.data.items[0].data.totalDistance_value <= this.searchKmLimit) {
2738                 console.log('riga 2738 - ' + this.showPoiSearch);
2739                 this.routingResultPanel5.setVisible(true);
2740             }
2741 
2742         }
2743         else if (this.routingServiceType === 'cloudmade') {
2744             var num_poi = this.routingRouteGeometryCloudmade.length;
2745             var newPoint = null;
2746             for (var i = 0; i < num_poi; i++) {
2747                 newPoint = new OpenLayers.Geometry.Point(this.routingRouteGeometryCloudmade[i][1],
2748                         this.routingRouteGeometryCloudmade[i][0]);
2749                 newPoint.transform(this.routingProjection,
2750                         this.map.getProjectionObject());
2751                 pointList.push(newPoint);
2752             }
2753             
2754             var point1 = new OpenLayers.Geometry.Point(pointList[0].x, pointList[0].y);
2755             var point2 = new OpenLayers.Geometry.Point(pointList[num_poi - 1].x, pointList[num_poi - 1].y);
2756 
2757             this.routingStartFeature = new OpenLayers.Feature.Vector(point1, null, this.vectorStyleA);
2758             this.routingEndFeature = new OpenLayers.Feature.Vector(point2, null, this.vectorStyleB);
2759 
2760             this.routingStartFeature.text = this.startLocationCombo.lastSelectionText;
2761             this.routingEndFeature.text = this.endLocationCombo.lastSelectionText;
2762             
2763             textResultPanel = "<b>" + this.textTitleResultPath + " " + this.endLocationCombo.lastSelectionText + "</b>";
2764         }
2765 
2766 
2767         this.routingPathFeature = new OpenLayers.Feature.Vector(
2768                 new OpenLayers.Geometry.LineString(pointList), null, this.routingStyle);
2769         
2770         if(!this.comeFromSavedMap){
2771             if (this.routingPathFeaturePOI)
2772                 this.routingLayer.addFeatures([this.routingPathFeaturePOI]);
2773 
2774             this.routingLayer.addFeatures([this.routingPathFeature, this.routingStartFeature, this.routingEndFeature]);
2775 
2776             if (this.routingVia1Feature)
2777                 this.routingLayer.addFeatures([this.routingVia1Feature]);
2778 
2779             if (this.routingVia2Feature)
2780                 this.routingLayer.addFeatures([this.routingVia2Feature]);
2781             
2782             this.routingLayer.events.on({
2783                 featureselected: function(e) {
2784                     if (e.feature.text !== 'undefined') {
2785                         createPopup(e.feature);
2786                     }
2787                 }
2788             });
2789             
2790             this.selectCtrl = new OpenLayers.Control.SelectFeature([this.routingLayer], {
2791                 toggle: true,
2792                 clickout: true
2793             });
2794 
2795             this.map.addControl(this.selectCtrl);
2796             this.selectCtrl.activate();
2797         }
2798         
2799         if (this.routingRecenterMap && !this.comeFromSavedMap) {
2800             this.map.zoomToExtent(this.routingPathFeature.geometry.bounds);
2801         }             
2802         
2803         if(this.showPoiSearch && (this.routingServiceType === 'openls') && (this.map.zoom > this.searchZoomLimit)) {// todo questo if deve essere calcolato sulla lunghezza del percorso ... meglio se configurabile!!!!!
2804             console.log('riga 2804 - ' + this.showPoiSearch);
2805             this.routingResultPanel5.setVisible(true);
2806         }
2807 
2808         this.routingResultPanel.body.update(textResultPanel);
2809         this.comeFromSavedMap = false;
2810              
2811         // remove popup
2812        // removePopup();
2813         
2814 
2815     },
2816     
2817      /**
2818     *  Generate link to get poi on route
2819     *  
2820     *  @private
2821     */   
2822    
2823    poiLink: function(){
2824         return '<a href="http://maps.google.com"> Vedi punti di interesse nel percorso</a>';
2825    },
2826             
2827     /**
2828     *  Generate Google Maps Link panel for result routing search
2829     *  
2830     *  @private
2831     *  @param string start
2832     *  @param string stop
2833     */   
2834     googleLink: function(start, stop) {
2835         
2836         var googleLinks = 
2837             '<h2>'+this.googleTitle+'</h2>'
2838             + '<ul>';
2839 
2840             googleLinks += '<li>'
2841                    +'<a href="http://maps.google.com/maps?source=s_d'
2842                    + '&saddr=' + start 
2843                    + '&daddr=' + stop 
2844                    + '&dirflg=a" target="_blank">'
2845                    + this.googleItineraryCar 
2846                    + '</a>'
2847                    + '</li>';
2848            
2849            googleLinks += '<li>'
2850                    + '<a href="http://maps.google.com/maps?source=s_d'
2851                    + '&saddr=' + start 
2852                    + '&daddr=' + stop
2853                    + '&dirflg=w" target="_blank">'     
2854                    + this.googleItineraryFoot 
2855                    + '</a>'
2856                    + '</li>';
2857            
2858            googleLinks += '<li>'
2859                    + '<a href="http://maps.google.com/maps?source=s_d'
2860                    + '&saddr=' + start
2861                    + '&daddr=' + stop
2862                    + '&dirflg=r" target="_blank">' 
2863                    + this.googleItineraryTransport 
2864                    + '</a>'
2865                    + '</li>';  
2866             
2867             googleLinks += '</ul>';
2868            
2869          return googleLinks;
2870         
2871     },     
2872            
2873     /**
2874     *  Enable panel for result alternative points (did you mean)
2875     *  
2876     *  @private
2877     */ 
2878     resultPoi: function() {
2879 
2880         if (this.routingServiceType === 'openls') {
2881                         
2882             this.routingResultPanel.setVisible(false);
2883             this.routingResultPanel2.setVisible(false);
2884             this.routingResultPanel3.setVisible(true);
2885             this.routingResultPanel4.setVisible(false);
2886             this.routingResultPanel5.setVisible(false);
2887 
2888         }
2889         
2890 
2891     },
2892             
2893     /**
2894     *  Enable panel for message error
2895     *  
2896     *  @private
2897     *  @param string message text
2898     */ 
2899     messageError: function(msg) {
2900             /**
2901             * 1: result not found
2902             */
2903             if (msg === 1)
2904                 this.routingResultPanel.html = this.msgNoFound;
2905             if (this.routingResultPanel.body) {
2906                 this.routingResultPanel.body.update(this.routingResultPanel.html);
2907             }
2908             
2909             this.routingResultPanel.setVisible(true);
2910             this.routingResultPanel2.setVisible(false);
2911             this.routingResultPanel3.setVisible(false);  
2912         
2913     }
2914     
2915 
2916 });
2917 
2918 /** api: xtype = framework_routingpanel */
2919 Ext.reg('framework_routingpanel', framework.widgets.RoutingPanel);