123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import {createDrawFeature} from "./drawFeature"
- let drawShapeMap = new Map();
- function drawPoint(color,map){
- let option = {
- type:'Point',
- pointColor:color
- }
- let shape = new createDrawFeature(option,map)
- drawShapeMap.set('drawShape', shape)
- shape.addInteraction()
- }
- function drawLine(color,map){
- let option = {
- type:'LineString',
- lineColor:color
- }
- // if (!drawShapeMap.get('drawShape')) {
- // let shape = new createDrawFeature(option,map)
- // drawShapeMap.set('drawShape', shape)
- // shape.addInteraction()
- // }
- let shape = new createDrawFeature(option,map)
- drawShapeMap.set('drawShape', shape)
- shape.addInteraction()
- }
- function closeDrawShape() {
- if (drawShapeMap.get('drawShape')) {
- let shape = drawShapeMap.get('drawShape')
- shape.closeInteraction()
- shape.clearShapes()
- return shape.getData()
- }
- }
- export default{drawPoint,drawLine,closeDrawShape}
|