This commit is contained in:
sakitam-fdd 2018-01-05 18:42:42 +08:00
parent 7d06246d15
commit f6cb994d56

View File

@ -11,6 +11,7 @@ class PlotPolygon extends maptalks.Polygon {
super(options)
this.type = 'PlotPolygon'
this._coordinates = []
this._points = []
if (coordinates) {
this.setPoints(coordinates)
}
@ -29,7 +30,7 @@ class PlotPolygon extends maptalks.Polygon {
* @private
*/
_generate () {
this.setCoordinates(this._coordinates)
this.setCoordinates(this._points)
}
getCoordinates () {
@ -37,12 +38,20 @@ class PlotPolygon extends maptalks.Polygon {
}
setPoints (coordinates) {
this._coordinates = !coordinates ? [] : coordinates
if (this._coordinates.length >= 1) {
this._points = !coordinates ? [] : coordinates
if (this._points.length >= 1) {
this._generate()
}
}
/**
* 获取控制点
* @returns {Array|*}
*/
getPoints () {
return this._points
}
_exportGeoJSONGeometry () {
const coordinates = Coordinate.toNumberArrays([this.getShell()])
return {