<br><br>On Wednesday, October 5, 2011, Jachym Cepicky &lt;<a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; it probably would be nice to have ExtJS-like possibility to initialize objects (I would start with layers).<br>
&gt;<br>&gt; Now, you *have* to create instance of OpenLayers.Layer and than the object can be added to map<br>&gt;<br>&gt; map.addLayer(new OpenLayers.Layer.WMS(name,url, params, options));<br>&gt;<br>&gt; What do you think about a option, that you would have to submit object-like definition only:<br>
&gt;<br>&gt; map addLayer({<br>&gt;        CLASS_NAME: &quot;OpenLayers.Layer.WMS&quot;,<br>&gt;        name: &quot;my name&quot;,<br>&gt;        params: {<br>&gt;                        layers: &quot;0&quot;,<br>&gt;                        version: &quot;1.3.0&quot;<br>
&gt;                },<br>&gt;        options: {<br>&gt;                        isBaseLayer: false<br>&gt;                }<br>&gt;        });<br>&gt;<br>&gt; It should not be too complicated to put such method in OpenLayers.Map object.<br>
&gt;<br>&gt; 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&#39;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>