feat: 移除geometry.ts
							parent
							
								
									32c0247870
								
							
						
					
					
						commit
						bd13f1ce4b
					
				| @ -0,0 +1,47 @@ | |||||||
|  | /* | ||||||
|  |  * @Author: cbwu 504-wuchengbo@htsdfp.com | ||||||
|  |  * @Date: 2024-04-11 09:26:56 | ||||||
|  |  * @LastEditors: cbwu | ||||||
|  |  * @LastEditTime: 2024-04-11 13:26:25 | ||||||
|  |  * @Description: 封装的Polygon对象 | ||||||
|  |  */ | ||||||
|  | import { | ||||||
|  |   Entity, | ||||||
|  |   Cartesian3, | ||||||
|  |   Color, | ||||||
|  |   CallbackProperty, | ||||||
|  |   Property, | ||||||
|  |   PolygonGraphics, | ||||||
|  | } from 'cesium' | ||||||
|  | import { BaseGeometry } from './baseGeometry' | ||||||
|  | import { type EntityOptions } from './pointEntity' | ||||||
|  | export class PolygonEntity extends BaseGeometry { | ||||||
|  |   static ID: number = 0 | ||||||
|  |   //   positions: Cartesian3[] = []
 | ||||||
|  |   controlPointsID: string[] = [] | ||||||
|  |   options: EntityOptions = { | ||||||
|  |     id: 'Polygon' + String(PolygonEntity.ID), | ||||||
|  |     name: 'Polygon' + String(PolygonEntity.ID + 1), | ||||||
|  |     show: true, | ||||||
|  |     width: 2, | ||||||
|  |     color: Color.RED, | ||||||
|  |     fillColor: Color.RED.withAlpha(0.5), | ||||||
|  |     fill: true, | ||||||
|  |   } | ||||||
|  |   constructor(ptArr: Cartesian3[] | Property, options?: EntityOptions) { | ||||||
|  |     super() | ||||||
|  |     this.options = { ...this.options, ...options } | ||||||
|  |     this.geometry = new Entity({ | ||||||
|  |       show: this.options.show, | ||||||
|  |       name: this.options.name, | ||||||
|  |       polygon: { | ||||||
|  |         hierarchy: ptArr, | ||||||
|  |         material: this.options.fillColor, //填充颜色
 | ||||||
|  |         fill: this.options.fill, //是否填充
 | ||||||
|  |         outlineWidth: this.options.width, //线宽
 | ||||||
|  |         outlineColor: this.options.color, //线颜色
 | ||||||
|  |       }, | ||||||
|  |     }) | ||||||
|  |     PolygonEntity.ID++ | ||||||
|  |   } | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in New Issue