openlayers ol ext如何排除变换上的功能

openlayers ol ext如何排除变换上的功能,openlayers,Openlayers,我有一个绘图工具,它使用ol-ext的转换交互。有没有办法从转换中排除某些形状?例如,我想排除转换线字符串 transformInteraction = new interaction.Transform({ features: this.props.drawnShapes, // null at initialization layers: map.getLayers().getArray().filter(l => l.get("transfor

我有一个绘图工具,它使用ol-ext的转换交互。有没有办法从转换中排除某些形状?例如,我想排除转换线字符串

    transformInteraction = new interaction.Transform({
        features: this.props.drawnShapes, // null at initialization
        layers: map.getLayers().getArray().filter(l => l.get("transformable")),
        hitTolerance: 5,
        translateFeature: true,
        translate: true,
        keepAspectRatio: events.condition.shiftKeyOnly,
        rotate: true
    });

或者有没有办法在初始化后设置可转换的功能?

您只需要在
ol.interaction.Transform
对象构造函数中使用
过滤器
键。的源代码摘录向您展示了如何使用它限制作业排除行

var interaction=new ol.interaction.Transform(
{addCondition:ol.events.condition.shiftKeyOnly,
//过滤器:函数(f,l){返回f.getGeometry().getType()==='Polygon';},
//图层:[矢量],
耐受性:2,
translateFeature:$(“#translateFeature”).prop('checked'),
比例:$(“#比例”).prop('checked'),
旋转:$(“#旋转”).prop('checked'),
KeepSpectRatio:$(“#KeepSpectRatio”).prop('checked')?ol.events.condition.always:未定义,
翻译:$(“#翻译”).prop('checked'),
拉伸:$(“#拉伸”).prop('选中')
});

谢谢。看起来我需要更新到3.0.0。我现在在1.3.3上。