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  * @namespace framework.plugins
 13  */
 14 Ext.ns("framework.plugins");
 15 
 16 /** 
 17  * Box for routing panel
 18  * @name_ RASViewer
 19  * @class Visual container 
 20  * @constructor
 21  *  @extends <a target="_blank" href="http://gxp.opengeo.org/master/doc/lib/plugins/Tool.html">gxp.plugins.Tool</a>
 22  */
 23 framework.plugins.BoxRouting = Ext.extend(gxp.plugins.Tool, 
 24 /** 
 25  * @lends framework.plugins.BoxRouting.prototype 
 26  */
 27 {
 28    
 29     /**
 30     * framework_boxrouting plugin type.
 31     * @public
 32     * @type String
 33     */
 34     ptype: "framework_boxrouting",
 35     
 36     /**
 37      * Target link to the father object.
 38      * @public
 39      * @type Object
 40      */
 41     target: null,
 42     
 43     /**
 44     * Geocoding type. Per default: 'cloudmade'. Can also be 'geonames' or 'openls'.
 45     * 
 46     * @public
 47     * @type string
 48     */
 49     geocodingType: 'cloudmade',
 50     
 51     /**
 52     * Type of routing service used for the computation. Per default: 'cloudmade'. Can also be 'openls'.
 53     * 
 54     * @public
 55     * @type string
 56     */
 57     routingServiceType: 'cloudmade',
 58     
 59     /**
 60     * Type of routing service used for the computation. Per default: 'http://routes.cloudmade.com/'.
 61     * Can also be 'http://webgis.regione.sardegna.it/followmeplus/ControllerServletToponimi'
 62     * 
 63     * @public
 64     * @type string
 65     */
 66     routingServiceURL: 'http://routes.cloudmade.com/',
 67     
 68     /**
 69     * Type of Spatial Reference used for the computation. Per default: 'EPSG:4326'
 70     * 
 71     * @public
 72     * @type string
 73     */
 74     srs: 'EPSG:4326',
 75     
 76     /**
 77     * Type of EPSG used for the computation. Per default: '4326'
 78     * 
 79     * @public
 80     * @type string
 81     */
 82     epsgOutput: '4326',
 83     
 84     /**
 85     * Type of routing Projection used for the computation. 
 86     * Per default: 'new OpenLayers.Projection("EPSG:4326")'
 87     * 
 88     * @public
 89     * @type {Object} OpenLayers.Projection
 90     */
 91     routingProjection: new OpenLayers.Projection("EPSG:4326"),
 92     
 93     /**
 94     * Proxy to make the search request
 95     * 
 96     * @public
 97     * @type string
 98     */
 99     proxy: null,
100     
101     /**
102     * Layer Vector for routing. Default null.
103     * 
104     * @public
105     * @type {Object} new OpenLayers.Layer.Vector
106     */
107    routingLayer: null,
108    
109     /**
110     * The query parameter for the user entered search text (openls routing)
111     * 
112     * @public
113     * @type string
114     */
115     xmlRequest: '',
116     
117      /**
118     * Route preferenze for openls routing. Default "Fastest". 
119     * Shortest - Percorso più corto (default)
120     * Fastest - Percorso più veloce
121     * Pedestrian - Percorso a piedi
122     *      
123     * @public
124     * @type string
125     */
126     routePreference: 'Fastest',
127     
128     /**
129     * Normal mode and print mode have different views. 
130     *      
131     * @public
132     * @type string
133     */
134     printMode: false,
135    
136     /**
137     * Private init Component override.
138     * @private
139     * @param {Object} target link to the father object
140     */ 
141     init: function(target) {
142         this.target = target;
143         var routingpanel = new framework.widgets.RoutingPanel(Ext.apply({
144             map: target.mapPanel.map,
145             cloudmadeKey: '187a9f341f70406a8064d07a30e5695c',
146             geocodingType: this.geocodingType,
147             routingServiceType: this.routingServiceType,
148             routingServiceURL: this.routingServiceURL,
149             proxy: this.proxy,
150             srs: this.srs,
151             epsgOutput: this.epsgOutput,
152             routingProjection: this.routingProjection,
153             routingLayer: this.routingLayer,
154             routePreference: this.routePreference,
155             xmlRequest: this.xmlRequest,
156             printMode: this.printMode,
157             listeners: {
158                 routingcomputed: function() {
159                     //alert('Computation done');
160                 },
161                 beforeroutingcomputed: function() {
162                     //alert('Before computation');
163                 }
164             }
165         }, this.outputConfig));
166 
167         this.routingpanel = routingpanel;
168 
169         return framework.plugins.BoxRouting.superclass.init.apply(this, arguments);
170     },
171     
172     /** Description.
173      * @public
174      * @param {Object} config configuration object
175      */
176     addOutput: function(config) {
177         return framework.plugins.BoxRouting.superclass.addOutput.call(this, this.routingpanel);
178     }
179 
180 });
181 
182 Ext.preg(framework.plugins.BoxRouting.prototype.ptype, framework.plugins.BoxRouting);
183 
184