[Cartoweb-users] how to switch on layer from javascript
Pierre GIRAUD
pierre.giraud at camptocamp.com
Tue Sep 18 10:14:03 EDT 2007
If you need to switch on a layer while you recenter on a specific
feature in this layer, please note that you can also do this writing a
small and simple plugin using the FilterProvider interface. This might
be simplier than with the javascript approach.
Attached is a sample client-side plugin class code that we often use for
this purpose.
Hope this helps.
Regards
Pierre
--------------------
/**
* @package Tests
*/
class ClientFilterIdrecenter extends ClientPlugin
implements FilterProvider {
public function filterPostRequest(FilterRequestModifier $request) {
$id = $request->getValue('id_recenter_ids');
$layer = $request->getValue('id_recenter_layer');
$layers = $request->getValue('layers');
if ($id != "") {
// add the layer if not already selected
$layers[] = $layer;
$request->setValue('layers',$layers);
}
}
public function filterGetRequest(FilterRequestModifier $request) {}
}
---------------------
Oliver Christen wrote:
> "to switch on layer" ?
>
> you mean, display a layer when recentering ?
> you need to explicitely enable it with layer_select=layerid1
>
> regards
> Oliver
>> Hi,
>> I need to switch on layer from ObjectRecenter javascript,
>> how to do it please?
>>
>>
>>
>> function ObjectRecenter(Layer,Id) {
>>
>> $('id_recenter_layer').value = Layer;
>> $('id_recenter_ids').value = Id;
>> CartoWeb.trigger('Location.Recenter');
>>
>> thank you
>>
>> wochter
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
--
_________________________________________________________
Pierre GIRAUD
Géomaticien, Analyste
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com
More information about the Cartoweb-users
mailing list