Skip to content

PolygonEntity (Polygon Entity Vector Data)

Create and manage polygon Entity objects.

Constructor

ts
new ge3d.feature.PolygonEntity(options?: {}): PolygonEntity

Parameters (StyleOptions)

ParameterTypeDefaultDescription
fillBooleantrueWhether to fill
materialTypeString"GeColor"Fill type, options:
materialParameters*-Determined by specific
materialCesium.MaterialProperty | Cesium.ColorCesium.Color.WHITEMaterial used for filling, overrides materialType and material parameters when specified
colorString | Cesium.Color"#3388ff"Color
opacityNumber1.0Opacity, range 0.0-1.0
randomColorBooleanfalseWhether to use random color
stRotationNumber0Polygon texture angle (radians), 0 is north, counterclockwise
stRotationDegreeNumber0Polygon texture angle (degrees, 0-360), mutually exclusive with stRotation
outlineBooleanfalseWhether to have outline
outlineWidthNumber1Outline width
outlineColorString | Cesium.Color"#ffffff"Outline color
outlineOpacityNumber0.6Outline opacity
outlineStylePolylineEntity.StyleOptions-Complete custom style for outline, overrides outlineWidth, outlineColor and other parameters
distanceDisplayConditionBoolean | Cesium.DistanceDisplayConditionfalseWhether to display by distance or specify at what distance from camera this will be displayed
distanceDisplayCondition_farNumber100000Maximum distance
distanceDisplayCondition_nearNumber0Minimum distance
heightNumber0Elevation, height of polygon relative to ellipsoid surface
heightReferenceCesium.HeightReferenceCesium.HeightReference.NONEProperty specifying what the height is relative to
diffHeightNumber100Height difference (corridor's own height), mutually exclusive with extrudedHeight
extrudedHeightnumber-Specify height of extruded surface relative to ellipsoid
extrudedHeightReferenceCesium.HeightReferenceCesium.HeightReference.NONEProperty specifying what the extruded height is relative to
granularitynumberCesium.Math.RADIANS_PER_DEGREESpecify angular distance between each latitude and longitude point
closeTopBoolean | booleantrueWhen false, leave top of extruded polygon open
closeBottomBoolean | booleantrueWhen false, leave bottom of extruded polygon open
arcTypeCesium.ArcTypeCesium.ArcType.GEODESICLine type that polygon edges must follow
hasShadowsBooleanfalseWhether to cast shadows
shadowsCesium.ShadowModeCesium.ShadowMode.DISABLEDSpecify whether polygon casts or receives shadows from light sources
clampToGroundStringfalseWhether to clamp to ground
perPositionHeightbooleanfalseSpecify whether to use height of each position. Same as clampToGround, opposite to clampToGround
classificationTypeCesium.ClassificationTypeCesium.ClassificationType.BOTHSpecify coverage type when clamped to ground, whether only terrain, 3dtiles, or both
zIndexNumber0Z-order, specify zIndex for sorting ground geometry. Only effective when polygon is constant and no height or extruded height is specified
bufferNumber-Buffer coordinates to expand by radius specified by buffer, unit: meters. Used for building individualization to expand points for easy mouse picking
setHeightNumber | Number[]0Specify coordinate height value, or array to specify height of each point (commonly used in layer configuration)
addHeightNumber | Number[]0Height value added to existing coordinates, or array to specify height added to each point (commonly used in layer configuration)
highlightPolygonEntity.StyleOptions-Highlight style on hover or click (type:'click'), can also be toggled via openHighlight/closeHighlight methods after creating Graphic
labelLabelEntity.StyleOptions-Support for additional text display
label.positionString | 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.showAllBoolean-For MultiPolygon and MultiLineString, whether to display all annotations, default only displays on surface or line with maximum coordinates

Properties

PropertyTypeDescription
_layeranyBelonging layer
_eventsanyBound events. Pass data through callback methods
centerOfMassanyPolygon center
areanumberArea
attranyInput attribute information
centeranyCenter point coordinates (Cartesian coordinates)
distancenumberPolygon length
entityGraphicanySpecific type object of Cesium internal object corresponding to vector data
hasEditbooleanWhether editable
isAddedbooleanWhether added to layer
isDestroybooleanWhether destroyed
isEditinganyWhether in editing state
labelanyAdditional label text object
minOuterRectanglevoidMinimum outer rectangle
showanyShow/hide state
styleanyStyle information

Methods

MethodParametersReturn ValueDescription
addEventListener(types: any, fn: any, context?: any)thisEvent binding
clear()voidClear elements
destroy(noDel?: boolean)voidDestroy elements
flyTo(options?: any)undefined | PolygonEntityFly to view angle where data is located
getCenterOfMass()anyInternal center point coordinates of enclosed surface
getCoordinates(noAlt?: undefined, closure?: undefined)any[][]Get latitude and longitude coordinates
getPositions()anyPosition coordinate array (Cartesian coordinates), can pass LatLngPoint array object or Cesium.PolygonHierarchy when assigning
getPositionsShow()anyActually displayed coordinate array (Cartesian coordinates), when plotting, positions may correspond to control point coordinates or CallbackProperty properties
removeEventListener(types: any, fn: any, context?: any)thisRemove event binding
setOpacity(value: number)voidSet opacity
setOptions(options: { attr: any; position: any; positions: any; style: any })thisSet Options parameters
setPositions(value: any)voidSet coordinates
setStyle(newStyle: any)thisSet style
toGeoJSON(options: any)objectConvert to geojson
toWKT(options: any)anyConvert to wkt