0

我想将用户在绘制边界框时限制为特定大小,例如 1024 x 1024。如何在 Open Layers 3 (OL3) 中执行此操作?谢谢!

4

1 回答 1

0

您可以捕获 drawend 事件并进行相应的过滤。

  drawInteraction.on("drawend", function(e) {
    var feature = e.target.sketchFeature_;
    // allow or disallow here, not sure how you can do that.
  });

drawInteraction 是 type ol.interaction.Draw,您的交互几何类型ol.geom.GeometryType将是 Polygon。

于 2014-07-08T14:50:06.887 回答