-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
25,143 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ILayer } from '@antv/l7'; | ||
import DrawFeature from './draw_feature'; | ||
|
||
export default class DrawCircle extends DrawFeature { | ||
private center: [number, number]; | ||
private drawCircleLayer: ILayer; | ||
protected onDragStart() { | ||
// @ts-ignore | ||
this.scene.map.dragdrag.disable(); | ||
} | ||
protected onDragging() { | ||
return; | ||
} | ||
|
||
protected onDragEnd() { | ||
return; | ||
} | ||
|
||
protected onClick() { | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,40 @@ | ||
import { Scene } from '@antv/l7'; | ||
import { Feature, FeatureCollection } from '@turf/helpers'; | ||
import DrawSource from '../source'; | ||
|
||
export interface IDrawOption { | ||
data: FeatureCollection; | ||
} | ||
|
||
export type DrawStatus = 'Drawing' | 'Selected' | 'Edit' | 'Finish'; | ||
|
||
export default abstract class DrawFeature { | ||
private source: DrawSource; | ||
constructor(options: IDrawOption) { | ||
private scene: Scene; | ||
constructor(scene: Scene, options: IDrawOption) { | ||
const { data } = options; | ||
this.scene = scene; | ||
this.source = new DrawSource(data); | ||
} | ||
|
||
protected onDragStart() { | ||
throw new Error('not imp'); | ||
public enable() { | ||
this.scene.on('dragstart', this.onDragStart); | ||
this.scene.on('drag', this.onDragging); | ||
this.scene.on('dragend', this.onDragEnd); | ||
this.scene.on('click', this.onClick); | ||
} | ||
|
||
protected onDragging() { | ||
throw new Error('not imp'); | ||
public disable() { | ||
this.scene.off('dragstart', this.onDragStart); | ||
this.scene.off('drag', this.onDragging); | ||
this.scene.off('dragend', this.onDragEnd); | ||
this.scene.off('click', this.onClick); | ||
} | ||
|
||
protected onDragEnd() { | ||
throw new Error('not imp'); | ||
} | ||
protected abstract onDragStart(): any; | ||
|
||
protected onClick() { | ||
throw new Error('not imp'); | ||
} | ||
protected abstract onDragging(): any; | ||
|
||
protected abstract onDragEnd(): any; | ||
|
||
protected abstract onClick(): any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.