0.1.0 • Published 2 years ago

ol-rectangle-draw v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ol-rectangle-draw

ol-rectangle-draw nodejs blog

这是一个openlayers矩形绘制补充包。

This is an openlayers rectangle drawing supplement package.

中文文档

Run Simple Demo

$ git clone https://github.com/SuperYesifang/ol-rectangle-draw.git
$ cd ol-rectangle-draw
$ npm run serve

Usage

new RectangleDraw(Draw, Polygon, options?)

1. Use CDN

<script src="https://raw.githubusercontent.com/SuperYesifang/ol-rectangle-draw/master/dist/RectangleDraw.cdn.js"></script>
<script>
const draw = new RectangleDraw(ol.interaction.Draw, ol.geom.Polygon, {
  //...Draw constructor options
});

map.addInteraction(draw);
</script>

2. Use ESM

import Draw from "ol/interaction/Draw";
import Polygon from "ol/geom/Polygon";
import RectangleDraw from "ol-rectangle-draw";

const draw = new RectangleDraw(Draw, Polygon, {
  //...Draw constructor options
})

map.addInteraction(draw);

Options

proptypedescription
DrawDrawopenlayers Draw interaction constructor.
PolygonPolygonopenlayers Polygon geometry constructor.
optionsobjectDraw consturctor options (without type and geometryFunction)