Skip to content

Commit

Permalink
DrawTool support add custom Coordinate vertex (#2391)
Browse files Browse the repository at this point in the history
* DrawTool support add custom Coordinate vertex

* spec

* fix WMSTileLayer doc typo

* export BBOXUtil
  • Loading branch information
deyihu authored Aug 6, 2024
1 parent 011dc66 commit add03b1
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 69 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import * as Util from './core/util/index';
import * as DomUtil from './core/util/dom';
import * as StringUtil from './core/util/strings';
import * as MapboxUtil from './core/mapbox';
import * as BBOXUtil from './core/util/bbox';

import * as MicroTask from './core/MicroTask';
export { Util, DomUtil, StringUtil, MapboxUtil, MicroTask };
export { Util, DomUtil, StringUtil, MapboxUtil, MicroTask, BBOXUtil };

export { default as LRUCache } from './core/util/LRUCache';
export { default as Ajax } from './core/Ajax';
Expand Down
4 changes: 2 additions & 2 deletions src/layer/tile/WMSTileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import TileLayer, { TileLayerOptionsType } from './TileLayer';
* @property options.layers - Comma-separated list of WMS layers to show.
* @property [options.styles=''] - Comma-separated list of WMS styles.
* @property [options.format=image/jpeg] - WMS image format (use `'image/png'` for layers with transparency).
* @property [options.transparent=false] - Version of the WMS service to use
* @property [options.version=1.1.1] - size of the tile image
* @property [options.transparent=false] - Is the tile transparent
* @property [options.version=1.1.1] - Version of the WMS service to use
* @property [options.crs=null] - Coordinate Reference System to use for the WMS requests, defaults to map CRS. Don't change this if you're not sure what it means.
* @property [options.uppercase=false] - If `true`, WMS request parameter keys will be uppercase.
* @property [options.detectRetina=false] - If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
Expand Down
31 changes: 31 additions & 0 deletions src/map/tool/DrawTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,37 @@ class DrawTool extends MapTool {
return this;
}

/**
* 添加一个自定义的坐标点
* @english
* add a custom Coordinate
* @param {Coordinate} coordinate - coordinate
* @return this
*/
addCoordinate(coordinate: Coordinate) {
if (!this.isEnabled()) {
return this;
}
const map = this.getMap();
if (!map) {
return this;
}
coordinate = new Coordinate(coordinate);
const eventParam = map._parseEventFromCoord(coordinate);
this._clickHandler(eventParam);
return this;
}

/**
* 获取临时的Geometry
* @english
* get temp Geometry
* @return Geometry
*/
getTempGeometry() {
return this._geometry;
}

}

DrawTool.mergeOptions(options);
Expand Down
Loading

0 comments on commit add03b1

Please sign in to comment.