[OpenLayers-Dev] Control outside map (re #445)

Ludwig Max Brinckmann ludwigbrinckmann at gmail.com
Wed Jan 17 05:24:25 EST 2007


Thanks, that seems much happier.
Ludwig


On 1/17/07, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl> wrote:
>
> Have you tried this syntax:
>
> overview = new OpenLayers.Control.OverviewMap({div: $('controls')});
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>
>
> --------- Oorspronkelijk bericht --------
> Van: Ludwig Max Brinckmann <ludwigbrinckmann at gmail.com>
> Naar: dev at openlayers.org <dev at openlayers.org>
> Onderwerp: [OpenLayers-Dev] Control outside map (re #445)
> Datum: 17/01/07 08:05
>
> > Ticket #445 promises a way of easily putting controls outside the main
> map
> -- a great help if there is more than just very simple mouse interaction
> since that seems to confuse many browsers.The way I understand it, to
> utilise this one, I have to pass in the id of the div where the control is
> supposed to be located when creating the control, such as
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; overview = new
> OpenLayers.Control.OverviewMap({div :
> &#39;controls&#39;});&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> map.addControl(overview);However, when running this it gives me the
> following exception:
> > Error: this.div.appendChild is not a functionSource File:
>
> http://localhost/javascripts/openlayers/lib/OpenLayers/Control/OverviewMap.js
> > Line: 117Is there a working example (with current svn head) someone
> could
> point me to? I am actually not that keen on this particular control, I am
> looking for a working starting point for my own control, so any control
> would do.
> > LudwigThe full script:&lt;html
> xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&nbsp;
> &lt;head&gt;&nbsp;&nbsp;&nbsp; &lt;style
> type=&quot;text/css&quot;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> #map
> {
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> width:
> 80%;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> height: 100%;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; top:
> 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left:
> 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> position: absolute;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #controls
> {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width:
> 20%;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> position: absolute;
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top:
> 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> right:
> 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> height:
> 100%;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;
> &lt;/style&gt;&nbsp;&nbsp;&nbsp; &lt;script
>
> src=&quot;/javascripts/openlayers/lib/OpenLayers.js&quot;&gt;&lt;/script&gt;&nbsp;&nbsp;&nbsp;
> &lt;script type=&quot;text/javascript&quot;&gt;
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &lt;!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function
> init(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> var map = new OpenLayers.Map(&#39;map&#39;);&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp; boundary = new
> OpenLayers.Layer.WMS.Untiled(&#39;Boundary&#39;, &nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp; &quot;
> > http://localhost/cgi-bin/yunnanserver?&quot;, {layers:
>
> &quot;Watersheds&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> transparent: &quot;false&quot;, format:&quot;image/png&quot; }
> );&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> boundary.setVisibility
> (true);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> map.addLayers
> > ([boundary]);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; overview = new
> OpenLayers.Control.OverviewMap({div :
> &#39;controls&#39;});&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> map.addControl(overview);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bounds =
> new
> OpenLayers.Bounds(-180,-90,180,90);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> map.zoomToExtent
> > (bounds);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;
> &lt;/script&gt;&nbsp; &lt;/head&gt;&nbsp; &lt;body
> onload=&quot;init()&quot;&gt;&nbsp;&nbsp;&nbsp; &lt;div
> id=&quot;controls&quot;&gt;&lt;/div&gt;&nbsp;&nbsp;&nbsp; &lt;div
> id=&quot;map&quot;&gt;&lt;/div&gt;&nbsp; &lt;/body&gt;
> > &lt;/html&gt;
> >
> >
> >
> >
> >
> > _______________________________________________
> > Dev mailing list
> > Dev at openlayers.org
> > http://openlayers.org/mailman/listinfo/dev
> >
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20070117/2dd2182c/attachment.html


More information about the Dev mailing list