@@ -6,7 +6,7 @@ import Rectangle from '../../geometry/Rectangle';
6
6
import LineString from '../../geometry/LineString' ;
7
7
import Polygon from '../../geometry/Polygon' ;
8
8
import Point from '../../geo/Point' ;
9
- import { WithNull } from "../../types/typings" ;
9
+ import { WithNull } from "../../types/typings" ;
10
10
11
11
// 有中心点的图形的共同方法
12
12
const CenterPointRenderer = {
@@ -19,7 +19,7 @@ const CenterPointRenderer = {
19
19
export type CenterPointRendererType = typeof CenterPointRenderer ;
20
20
21
21
declare module '../../geometry/Marker' {
22
- interface Marker extends CenterPointRendererType { }
22
+ interface Marker extends CenterPointRendererType { }
23
23
}
24
24
25
25
/**
@@ -131,6 +131,23 @@ const PolyRenderer = {
131
131
points = l ? [ curretPoint ] : [ ] ;
132
132
const previous = l > 1 ? l - 2 : l - 1 ;
133
133
rotations = l ? [ [ coords [ previous ] ? map . _prjToPointAtRes ( coords [ previous ] , glRes ) : curretPoint , curretPoint ] ] : [ ] ;
134
+ } else if ( placement === 'vertex-firstlast' ) {
135
+ points = [ ] ;
136
+ rotations = [ ] ;
137
+ const coords = this . _getPrjCoordinates ( ) ;
138
+ const l = coords . length ;
139
+ if ( l ) {
140
+ //first
141
+ const point0 = map . _prjToPointAtRes ( coords [ 0 ] , glRes )
142
+ points = [ point0 ] ;
143
+ if ( l > 1 ) {
144
+ rotations = [ [ point0 , map . _prjToPointAtRes ( coords [ 1 ] , glRes ) ] ] ;
145
+ const point1 = map . _prjToPointAtRes ( coords [ l - 1 ] , glRes ) ;
146
+ points . push ( point1 ) ;
147
+ const previous = l > 1 ? l - 2 : l - 1 ;
148
+ rotations . push ( [ map . _prjToPointAtRes ( coords [ previous ] , glRes ) , point1 ] ) ;
149
+ }
150
+ }
134
151
} else {
135
152
const center = this . getCenter ( ) ;
136
153
if ( ! center ) {
0 commit comments