<br><br>On Wednesday, October 5, 2011, Jachym Cepicky <<a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a>> wrote:<br>> Hi,<br>><br>> it probably would be nice to have ExtJS-like possibility to initialize objects (I would start with layers).<br>
><br>> Now, you *have* to create instance of OpenLayers.Layer and than the object can be added to map<br>><br>> map.addLayer(new OpenLayers.Layer.WMS(name,url, params, options));<br>><br>> What do you think about a option, that you would have to submit object-like definition only:<br>
><br>> map addLayer({<br>> CLASS_NAME: "OpenLayers.Layer.WMS",<br>> name: "my name",<br>> params: {<br>> layers: "0",<br>> version: "1.3.0"<br>
> },<br>> options: {<br>> isBaseLayer: false<br>> }<br>> });<br>><br>> It should not be too complicated to put such method in OpenLayers.Map object.<br>
><br>> What do you think, shall I write some proposal-patch, or do all agree, that it is not needed at all?<br><br>The problem is that our layer constructors don't have the same signature. E.g. Layer.WMS receives four args, while Layer.WMTS receives one arg only. Until we generalize 1-arg constructors I would personally not bother adding lazy instantiation. Just my current viewport.<br>
<br>-- <br>Eric Lemoine<br><br>Camptocamp France SAS<br>Savoie Technolac, BP 352<br>73377 Le Bourget du Lac, Cedex<br><br>Tel : 00 33 4 79 44 44 96<br>Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com">http://www.camptocamp.com</a><br><br>