maptalks.geosplit
v0.1.2
Published
A tool to split Polygon or Line whith one or more lines.
Downloads
3
Readme
maptalks.geosplit
A tool to split Polygon or Line whith one or more lines.
Examples
DEMO
Install
- Install with npm:
npm install maptalks.geosplit
. - Install with yarn:
yarn add maptalks.geosplit
. - Download from dist directory.
- Use jsdelivr CDN:
https://cdn.jsdelivr.net/npm/maptalks.geosplit/dist/maptalks.geosplit.min.js
Usage
As a plugin, maptalks.geosplit
must be loaded after maptalks.js
in browsers. You can also use 'import { GeoSplit } from "maptalks.geosplit"
when developing with webpack.
<!-- ... -->
<script src="https://cdn.jsdelivr.net/npm/maptalks.geosplit/dist/maptalks.geosplit.min.js"></script>
<!-- ... -->
const ms = new maptalks.GeoSplit() // use GeoSplit API, targets is not necessary parameters and if no targets user will choose geometry on the map. Get details in API Reference.
API Reference
new maptalks.GeoSplit()
// new maptalks.GeoSplit({ deleteTargets: false })
- options
- deleteTargets boolean decide if targets lines will be removed, default is true
- colorHit String the color of symbol when geo hit
- colorChosen String the color of symbol when geo chosen
split(geometry, targets)
targets can be one line or lines-array
submit(callback)
callback can get two attr, the result and deals which be remove in task
cancel()
remove()
Contributing
We welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.
Develop
The only source file is index.js
.
It is written in ES6, transpiled by babel and tested with mocha and expect.js.
Scripts
- Install dependencies
$ npm install
- Watch source changes and generate runnable bundle repeatedly
$ gulp watch
- Package and generate minified bundles to dist directory
$ gulp minify
- Lint
$ npm run lint