向 ol3-sidebar 添加控件

问题描述

我正在尝试将控制按钮添加到我的侧边栏会话之一,但我不知道如何在 openlayers 中执行此操作。我想放在侧边栏中的控件是“ol-ext”扩展名的 printDialog。我将发布我尝试使用的代码,这是在传单中制作的。我感谢可能的帮助

HTML - 我要插入控件的会话的 Div

<div class="sidebar-pane" id="print">
                <h1 class="sidebar-header">Impressão<span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
        <p>Clique no botão a seguir para iniciar a Impressão</p>
        <br>
        <!-- place where I want to put the control -->
</div>

JS

var printControl = new ol.control.PrintDialog();
        printControl.setSize('A4');
        printControl.setorientation('landscape');
        printControl.setMargin(15);
        map.addControl(printControl);

        //attempt to insert the button
        var htmlObject1 = printControl.getContainer();
        var a1 = document.getElementById('print')
        function setParent(el,newParent){
            newParent.appendChild(el);
        }
        setParent(htmlObject1,a1);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)