1 | |
---|
2 | .. currentmodule:: GeoExt |
---|
3 | |
---|
4 | :class:`GeoExt.LayerOpacitySlider` |
---|
5 | ================================================================================ |
---|
6 | |
---|
7 | |
---|
8 | .. cssclass:: meta |
---|
9 | |
---|
10 | |
---|
11 | Extends |
---|
12 | * `Ext.Slider <http://dev.sencha.com/deploy/dev/docs/?class=Ext.Slider>`_ |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | xtype |
---|
18 | ``gx_opacityslider`` |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | .. class:: LayerOpacitySlider(config) |
---|
24 | |
---|
25 | Create a slider for controlling a layer's opacity. |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | Example Use |
---|
30 | ----------- |
---|
31 | |
---|
32 | Sample code to render a slider outside the map viewport: |
---|
33 | |
---|
34 | .. code-block:: javascript |
---|
35 | |
---|
36 | var slider = new GeoExt.LayerOpacitySlider({ |
---|
37 | renderTo: document.body, |
---|
38 | width: 200, |
---|
39 | layer: layer |
---|
40 | }); |
---|
41 | |
---|
42 | Sample code to add a slider to a map panel: |
---|
43 | |
---|
44 | .. code-block:: javascript |
---|
45 | |
---|
46 | var layer = new OpenLayers.Layer.WMS( |
---|
47 | "Global Imagery", |
---|
48 | "http://maps.opengeo.org/geowebcache/service/wms", |
---|
49 | {layers: "bluemarble"} |
---|
50 | ); |
---|
51 | var panel = new GeoExt.MapPanel({ |
---|
52 | renderTo: document.body, |
---|
53 | height: 300, |
---|
54 | width: 400, |
---|
55 | map: { |
---|
56 | controls: [new OpenLayers.Control.Navigation()] |
---|
57 | }, |
---|
58 | layers: [layer], |
---|
59 | extent: [-5, 35, 15, 55], |
---|
60 | items: [{ |
---|
61 | xtype: "gx_opacityslider", |
---|
62 | layer: layer, |
---|
63 | aggressive: true, |
---|
64 | vertical: true, |
---|
65 | height: 100, |
---|
66 | x: 10, |
---|
67 | y: 20 |
---|
68 | }] |
---|
69 | }); |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | Config Options |
---|
75 | -------------- |
---|
76 | |
---|
77 | Configuration properties in addition to |
---|
78 | those listed for `Ext.Slider <http://dev.sencha.com/deploy/dev/docs/?class=Ext.Slider>`_. |
---|
79 | |
---|
80 | |
---|
81 | .. describe:: aggressive |
---|
82 | |
---|
83 | ``Boolean`` |
---|
84 | If set to true, the opacity is changed as soon as the thumb is moved. |
---|
85 | Otherwise when the thumb is released (default). |
---|
86 | |
---|
87 | .. describe:: changeVisibility |
---|
88 | |
---|
89 | ``Boolean`` |
---|
90 | If set to true, the layer's visibility is handled by the |
---|
91 | slider, the slider makes the layer invisible when its |
---|
92 | value is changed to the min value, and makes the layer |
---|
93 | visible again when its value goes from the min value |
---|
94 | to some other value. The layer passed to the constructor |
---|
95 | must be visible, as its visibility is fully handled by |
---|
96 | the slider. Defaults to false. |
---|
97 | |
---|
98 | .. describe:: changeVisibilityDelay |
---|
99 | |
---|
100 | ``Number`` Time in milliseconds before changing the layer's visibility. |
---|
101 | If the value changes again within that time, the layer's visibility |
---|
102 | change does not occur. Only applicable if changeVisibility is true. |
---|
103 | Defaults to 5. |
---|
104 | |
---|
105 | .. describe:: complementaryLayer |
---|
106 | |
---|
107 | ``OpenLayers.Layer`` or :class:`GeoExt.data.LayerRecord` |
---|
108 | If provided, a layer that will be made invisible (its visibility is |
---|
109 | set to false) when the slider value is set to its max value. If this |
---|
110 | slider is used to fade visibility between to layers, setting |
---|
111 | ``complementaryLayer`` and ``changeVisibility`` will make sure that |
---|
112 | only visible tiles are loaded when the slider is set to its min or max |
---|
113 | value. (optional) |
---|
114 | |
---|
115 | .. describe:: delay |
---|
116 | |
---|
117 | ``Number`` Time in milliseconds before setting the opacity value to the |
---|
118 | layer. If the value change again within that time, the original value |
---|
119 | is not set. Only applicable if aggressive is true. |
---|
120 | |
---|
121 | .. describe:: inverse |
---|
122 | |
---|
123 | ``Boolean`` |
---|
124 | If true, we will work with transparency instead of with opacity. |
---|
125 | Defaults to false. |
---|
126 | |
---|
127 | .. describe:: layer |
---|
128 | |
---|
129 | ``OpenLayers.Layer`` or :class:`GeoExt.data.LayerRecord` |
---|
130 | The layer this slider changes the opacity of. (required) |
---|
131 | |
---|
132 | .. describe:: value |
---|
133 | |
---|
134 | ``Number`` |
---|
135 | The value to initialize the slider with. This value is |
---|
136 | taken into account only if the layer's opacity is null. |
---|
137 | If the layer's opacity is null and this value is not |
---|
138 | defined in the config object then the slider initializes |
---|
139 | it to the max value. |
---|
140 | |
---|
141 | |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | Public Methods |
---|
147 | -------------- |
---|
148 | |
---|
149 | Public methods in addition to those |
---|
150 | listed for `Ext.Slider <http://dev.sencha.com/deploy/dev/docs/?class=Ext.Slider>`_. |
---|
151 | |
---|
152 | |
---|
153 | .. method:: LayerOpacitySlider.setLayer |
---|
154 | |
---|
155 | :param layer: ``OpenLayers.Layer`` or :class:`GeoExt.data.LayerRecord` |
---|
156 | |
---|
157 | Bind a new layer to the opacity slider. |
---|
158 | |
---|
159 | |
---|
160 | |
---|
161 | |
---|
162 | |
---|