mirror of
				https://github.com/ethan-zf/cesium-plot-js.git
				synced 2025-11-04 01:04:18 +00:00 
			
		
		
		
	fix: createGeometryFromData Polygon
This commit is contained in:
		
							parent
							
								
									4139d7d74a
								
							
						
					
					
						commit
						a9d0534b8a
					
				@ -870,6 +870,7 @@ export default class Base {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  createGraphic(points: CesiumTypeOnly.Cartesian3[]): CesiumTypeOnly.Cartesian3[] {
 | 
					  createGraphic(points: CesiumTypeOnly.Cartesian3[]): CesiumTypeOnly.Cartesian3[] {
 | 
				
			||||||
    //Abstract method that must be implemented by subclasses.
 | 
					    //Abstract method that must be implemented by subclasses.
 | 
				
			||||||
    return [new this.cesium.Cartesian3()];
 | 
					    // return [new this.cesium.Cartesian3()];
 | 
				
			||||||
 | 
						return points;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -51,6 +51,13 @@ export default class Polygon extends Base {
 | 
				
			|||||||
    this.drawPolygon();
 | 
					    this.drawPolygon();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  createGraphic(positions: Cartesian3[]) {
 | 
				
			||||||
 | 
					    const lnglatPoints = positions.map(this.cartesianToLnglat);
 | 
				
			||||||
 | 
					    const coords = lnglatPoints.flat();
 | 
				
			||||||
 | 
					    const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(coords);
 | 
				
			||||||
 | 
					    return cartesianPoints;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getPoints() {
 | 
					  getPoints() {
 | 
				
			||||||
    return this.points;
 | 
					    return this.points;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user