Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/GeoExt/lib/GeoExt/widgets/tips/ZoomSliderTip.js @ 76

Revision 76, 2.3 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/**
2 * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
3 *
4 * Published under the BSD license.
5 * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
6 * of the license.
7 */
8
9/**
10 * @requires GeoExt/widgets/tips/SliderTip.js
11 */
12
13/** api: (extends)
14 *  GeoExt/widgets/tips/SliderTip.js
15 */
16
17/** api: (define)
18 *  module = GeoExt
19 *  class = ZoomSliderTip
20 *  base_link = `Ext.Tip <http://dev.sencha.com/deploy/dev/docs/?class=Ext.Tip>`_
21 */
22Ext.namespace("GeoExt");
23
24/** api: example
25 *  Sample code to create a slider tip to display scale and resolution:
26 *
27 *  .. code-block:: javascript
28 *     
29 *      var slider = new GeoExt.ZoomSlider({
30 *          renderTo: document.body,
31 *          width: 200,
32 *          map: map,
33 *          plugins: new GeoExt.ZoomSliderTip({
34 *              template: "Scale: 1 : {scale}<br>Resolution: {resolution}"
35 *          })
36 *      });
37 */
38
39/** api: constructor
40 *  .. class:: ZoomSliderTip(config)
41 *   
42 *      Create a slider tip displaying :class:`GeoExt.ZoomSlider` values.
43 */
44GeoExt.ZoomSliderTip = Ext.extend(GeoExt.SliderTip, {
45   
46    /** api: config[template]
47     *  ``String``
48     *  Template for the tip. Can be customized using the following keywords in
49     *  curly braces:
50     * 
51     *  * ``zoom`` - the zoom level
52     *  * ``resolution`` - the resolution
53     *  * ``scale`` - the scale denominator
54     */
55    template: '<div>Zoom Level: {zoom}</div>' +
56        '<div>Resolution: {resolution}</div>' +
57        '<div>Scale: 1 : {scale}</div>',
58   
59    /** private: property[compiledTemplate]
60     *  ``Ext.Template``
61     *  The template compiled from the ``template`` string on init.
62     */
63    compiledTemplate: null,
64   
65    /** private: method[init]
66     *  Called to initialize the plugin.
67     */
68    init: function(slider) {
69        this.compiledTemplate = new Ext.Template(this.template);
70        GeoExt.ZoomSliderTip.superclass.init.call(this, slider);
71    },
72   
73    /** private: method[getText]
74     *  :param slider: ``Ext.Slider`` The slider this tip is attached to.
75     */
76    getText: function(thumb) {
77        var data = {
78            zoom: thumb.value,
79            resolution: this.slider.getResolution(),
80            scale: Math.round(this.slider.getScale()) 
81        };
82        return this.compiledTemplate.apply(data);
83    }
84});
Note: See TracBrowser for help on using the repository browser.