@@ -531,10 +531,11 @@ export class ServerGeometry {
531531 ) {
532532 let ilen = icomponents . length ;
533533 for ( let i = 0 ; i < ilen ; i ++ ) {
534- let partPointsCount = icomponents [ i ] . getVertices ( ) . length ;
534+ const vertices = icomponents [ i ] . getVertices ( ) ;
535+ let partPointsCount = vertices . length ;
535536 parts . push ( partPointsCount ) ;
536537 for ( let j = 0 ; j < partPointsCount ; j ++ ) {
537- points . push ( new Point ( icomponents [ i ] . getVertices ( ) [ j ] . x , icomponents [ i ] . getVertices ( ) [ j ] . y ) ) ;
538+ points . push ( new Point ( vertices [ j ] . x , vertices [ j ] . y ) ) ;
538539 }
539540 }
540541 //这里className不是多点就全部是算线
@@ -546,40 +547,38 @@ export class ServerGeometry {
546547 linearRingOfPolygon = polygon . components ,
547548 linearRingOfPolygonLen = linearRingOfPolygon . length ;
548549 for ( let j = 0 ; j < linearRingOfPolygonLen ; j ++ ) {
549- let partPointsCount = linearRingOfPolygon [ j ] . getVertices ( ) . length + 1 ;
550+ const vertices = linearRingOfPolygon [ j ] . getVertices ( ) ;
551+ const partPointsCount = vertices . length + 1 ;
550552 parts . push ( partPointsCount ) ;
551553 for ( let k = 0 ; k < partPointsCount - 1 ; k ++ ) {
552- points . push (
553- new Point (
554- linearRingOfPolygon [ j ] . getVertices ( ) [ k ] . x ,
555- linearRingOfPolygon [ j ] . getVertices ( ) [ k ] . y
556- )
557- ) ;
554+ points . push ( new Point ( vertices [ k ] . x , vertices [ k ] . y ) ) ;
558555 }
559556 points . push (
560- new Point ( linearRingOfPolygon [ j ] . getVertices ( ) [ 0 ] . x , linearRingOfPolygon [ j ] . getVertices ( ) [ 0 ] . y )
557+ new Point ( vertices [ 0 ] . x , vertices [ 0 ] . y )
561558 ) ;
562559 }
563560 }
564561 type = GeometryType . REGION ;
565562 } else if ( geometry instanceof Polygon ) {
566563 let ilen = icomponents . length ;
567564 for ( let i = 0 ; i < ilen ; i ++ ) {
568- let partPointsCount = icomponents [ i ] . getVertices ( ) . length + 1 ;
565+ const vertices = icomponents [ i ] . getVertices ( ) ;
566+ let partPointsCount = vertices . length + 1 ;
569567 parts . push ( partPointsCount ) ;
570568 for ( let j = 0 ; j < partPointsCount - 1 ; j ++ ) {
571- points . push ( new Point ( icomponents [ i ] . getVertices ( ) [ j ] . x , icomponents [ i ] . getVertices ( ) [ j ] . y ) ) ;
569+ points . push ( new Point ( vertices [ j ] . x , vertices [ j ] . y ) ) ;
572570 }
573- points . push ( new Point ( icomponents [ i ] . getVertices ( ) [ 0 ] . x , icomponents [ i ] . getVertices ( ) [ 0 ] . y ) ) ;
571+ points . push ( new Point ( vertices [ 0 ] . x , vertices [ 0 ] . y ) ) ;
574572 }
575573 type = GeometryType . REGION ;
576574 } else {
577- let geometryVerticesCount = geometry . getVertices ( ) . length ;
575+ const vertices = geometry . getVertices ( ) ;
576+ let geometryVerticesCount = vertices . length ;
578577 for ( let j = 0 ; j < geometryVerticesCount ; j ++ ) {
579- points . push ( new Point ( geometry . getVertices ( ) [ j ] . x , geometry . getVertices ( ) [ j ] . y ) ) ;
578+ points . push ( new Point ( vertices [ j ] . x , vertices [ j ] . y ) ) ;
580579 }
581580 if ( geometry instanceof LinearRing ) {
582- points . push ( new Point ( geometry . getVertices ( ) [ 0 ] . x , geometry . getVertices ( ) [ 0 ] . y ) ) ;
581+ points . push ( new Point ( vertices [ 0 ] . x , vertices [ 0 ] . y ) ) ;
583582 geometryVerticesCount ++ ;
584583 }
585584 parts . push ( geometryVerticesCount ) ;
0 commit comments