【问题标题】:Drag a feature POLYGON OL3拖动要素 POLYGON OL3
【发布时间】:2015-04-22 07:30:27
【问题描述】:

我试图找到代码来拖动多边形(不是修改)....OL3

多边形由代码创建(bbox 用于打印区域)。

任何人都可以在这里编码吗?

    var format = new ol.format.WKT();
    var feature = format.readFeature(wkt2);

    selectInteraction = new ol.interaction.Select({style: styles});
    map.addInteraction(selectInteraction);
    selectInteraction.getFeatures().push(feature);
    modifyInteraction = new ol.interaction.DragAndDrop({
        features: selectInteraction.getFeatures()
    });
    map.addInteraction(modifyInteraction);


    vector = new ol.layer.Vector({ 
        style: styles,
        source: new ol.source.Vector({
            features: [feature]
        })
    });
    map.getLayers().insertAt(1000, vector);

【问题讨论】:

    标签: openlayers-3


    【解决方案1】:

    在此处查看拖动功能示例:http://openlayers.org/en/v3.4.0/examples/drag-features.html

    还有关于翻译交互的工作正在进行中,请参阅:https://github.com/openlayers/ol3/pull/3250

    【讨论】:

      【解决方案2】:

      这个名为Transform Interaction 的扩展可以很好地拖动。它还支持旋转、拉伸和缩放。绝对值得一看!

      【讨论】:

        猜你喜欢
        • 2018-09-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-06
        • 2010-10-09
        • 1970-01-01
        相关资源
        最近更新 更多