Appearance
PolygonEntity (Polygon Entity Vector Data)
Create and manage polygon Entity objects.
Constructor
ts
new ge3d.feature.PolygonEntity(options?: {}): PolygonEntityParameters (StyleOptions)
| Parameter | Type | Default | Description |
|---|---|---|---|
| fill | Boolean | true | Whether to fill |
| materialType | String | "GeColor" | Fill type, options: |
| materialParameters | * | - | Determined by specific |
| material | Cesium.MaterialProperty | Cesium.Color | Cesium.Color.WHITE | Material used for filling, overrides materialType and material parameters when specified |
| color | String | Cesium.Color | "#3388ff" | Color |
| opacity | Number | 1.0 | Opacity, range 0.0-1.0 |
| randomColor | Boolean | false | Whether to use random color |
| stRotation | Number | 0 | Polygon texture angle (radians), 0 is north, counterclockwise |
| stRotationDegree | Number | 0 | Polygon texture angle (degrees, 0-360), mutually exclusive with stRotation |
| outline | Boolean | false | Whether to have outline |
| outlineWidth | Number | 1 | Outline width |
| outlineColor | String | Cesium.Color | "#ffffff" | Outline color |
| outlineOpacity | Number | 0.6 | Outline opacity |
| outlineStyle | PolylineEntity.StyleOptions | - | Complete custom style for outline, overrides outlineWidth, outlineColor and other parameters |
| distanceDisplayCondition | Boolean | Cesium.DistanceDisplayCondition | false | Whether to display by distance or specify at what distance from camera this will be displayed |
| distanceDisplayCondition_far | Number | 100000 | Maximum distance |
| distanceDisplayCondition_near | Number | 0 | Minimum distance |
| height | Number | 0 | Elevation, height of polygon relative to ellipsoid surface |
| heightReference | Cesium.HeightReference | Cesium.HeightReference.NONE | Property specifying what the height is relative to |
| diffHeight | Number | 100 | Height difference (corridor's own height), mutually exclusive with extrudedHeight |
| extrudedHeight | number | - | Specify height of extruded surface relative to ellipsoid |
| extrudedHeightReference | Cesium.HeightReference | Cesium.HeightReference.NONE | Property specifying what the extruded height is relative to |
| granularity | number | Cesium.Math.RADIANS_PER_DEGREE | Specify angular distance between each latitude and longitude point |
| closeTop | Boolean | boolean | true | When false, leave top of extruded polygon open |
| closeBottom | Boolean | boolean | true | When false, leave bottom of extruded polygon open |
| arcType | Cesium.ArcType | Cesium.ArcType.GEODESIC | Line type that polygon edges must follow |
| hasShadows | Boolean | false | Whether to cast shadows |
| shadows | Cesium.ShadowMode | Cesium.ShadowMode.DISABLED | Specify whether polygon casts or receives shadows from light sources |
| clampToGround | String | false | Whether to clamp to ground |
| perPositionHeight | boolean | false | Specify whether to use height of each position. Same as clampToGround, opposite to clampToGround |
| classificationType | Cesium.ClassificationType | Cesium.ClassificationType.BOTH | Specify coverage type when clamped to ground, whether only terrain, 3dtiles, or both |
| zIndex | Number | 0 | Z-order, specify zIndex for sorting ground geometry. Only effective when polygon is constant and no height or extruded height is specified |
| buffer | Number | - | Buffer coordinates to expand by radius specified by buffer, unit: meters. Used for building individualization to expand points for easy mouse picking |
| setHeight | Number | Number[] | 0 | Specify coordinate height value, or array to specify height of each point (commonly used in layer configuration) |
| addHeight | Number | Number[] | 0 | Height value added to existing coordinates, or array to specify height added to each point (commonly used in layer configuration) |
| highlight | PolygonEntity.StyleOptions | - | Highlight style on hover or click (type:'click'), can also be toggled via openHighlight/closeHighlight methods after creating Graphic |
| label | LabelEntity.StyleOptions | - | Support for additional text display |
| label.position | String | LatLngPoint | - | Text position, default is center property value of vector object itself. Support 'center': internal center point coordinates of enclosed surface, '{xxxx}' configure attribute field, or directly specify coordinate values |
| label.showAll | Boolean | - | For MultiPolygon and MultiLineString, whether to display all annotations, default only displays on surface or line with maximum coordinates |
Properties
| Property | Type | Description |
|---|---|---|
| _layer | any | Belonging layer |
| _events | any | Bound events. Pass data through callback methods |
| centerOfMass | any | Polygon center |
| area | number | Area |
| attr | any | Input attribute information |
| center | any | Center point coordinates (Cartesian coordinates) |
| distance | number | Polygon length |
| entityGraphic | any | Specific type object of Cesium internal object corresponding to vector data |
| hasEdit | boolean | Whether editable |
| isAdded | boolean | Whether added to layer |
| isDestroy | boolean | Whether destroyed |
| isEditing | any | Whether in editing state |
| label | any | Additional label text object |
| minOuterRectangle | void | Minimum outer rectangle |
| show | any | Show/hide state |
| style | any | Style information |
Methods
| Method | Parameters | Return Value | Description |
|---|---|---|---|
| addEventListener | (types: any, fn: any, context?: any) | this | Event binding |
| clear | () | void | Clear elements |
| destroy | (noDel?: boolean) | void | Destroy elements |
| flyTo | (options?: any) | undefined | PolygonEntity | Fly to view angle where data is located |
| getCenterOfMass | () | any | Internal center point coordinates of enclosed surface |
| getCoordinates | (noAlt?: undefined, closure?: undefined) | any[][] | Get latitude and longitude coordinates |
| getPositions | () | any | Position coordinate array (Cartesian coordinates), can pass LatLngPoint array object or Cesium.PolygonHierarchy when assigning |
| getPositionsShow | () | any | Actually displayed coordinate array (Cartesian coordinates), when plotting, positions may correspond to control point coordinates or CallbackProperty properties |
| removeEventListener | (types: any, fn: any, context?: any) | this | Remove event binding |
| setOpacity | (value: number) | void | Set opacity |
| setOptions | (options: { attr: any; position: any; positions: any; style: any }) | this | Set Options parameters |
| setPositions | (value: any) | void | Set coordinates |
| setStyle | (newStyle: any) | this | Set style |
| toGeoJSON | (options: any) | object | Convert to geojson |
| toWKT | (options: any) | any | Convert to wkt |