Appearance
RectanglePrimitive (Rectangle Primitive Vector Object)
Rectangle primitive vector object.
Constructor
ts
new ge3d.feature.RectanglePrimitive(options?: any): RectanglePrimitiveParameters
StyleOptions
| Parameter | Type | Default | Description |
|---|---|---|---|
| materialType | String | "Color" | Fill material type, options: MaterialType |
| material | Material | - | Material used for filling |
| color | String/Cesium.Color | "#3388ff" | Color |
| opacity | Number | 1.0 | Opacity, range 0.0-1.0 |
| image | String | - | URL of texture when using texture mapping |
| outline | Boolean | false | Whether to have outline |
| outlineColor | String/Cesium.Color | "#ffffff" | Outline color |
| outlineOpacity | Number | 0.6 | Outline opacity |
| height | Number | 0 | Elevation, height of rectangle relative to ellipsoid surface |
| diffHeight | Number | 100 | Height difference (corridor's own height), mutually exclusive with extrudedHeight |
| extrudedHeight | number | - | Specify height of extruded surface relative to ellipsoid |
| rotation | Number | 0 | Rotation angle (radians), 0 is north, counterclockwise |
| rotationDegree | Number | 0 | Rotation angle (degrees, 0-360), mutually exclusive with rotation |
| stRotation | Number | 0 | Rectangle texture angle (radians), 0 is north, counterclockwise |
| stRotationDegree | Number | 0 | Rectangle texture angle (degrees, 0-360), mutually exclusive with stRotation |
| hasShadows | Boolean | false | Whether to cast shadows |
| shadows | Cesium.ShadowMode | Cesium.ShadowMode.DISABLED | Specify whether object casts or receives shadows from light sources |
| clampToGround | Boolean | false | Whether to clamp to ground |
| classificationType | Cesium.ClassificationType | Cesium.ClassificationType.BOTH | Specify coverage type when clamped to ground |
| classification | Boolean | false | Whether it is ClassificationPrimitive |
| setHeight | Number | 0 | Specify coordinate height value (commonly used in layer configuration) |
| addHeight | Number | 0 | Height value added to existing coordinates (commonly used in layer configuration) |
| label | LabelPrimitive.StyleOptions | - | Support for additional text display |
Constructor Parameters
| Parameter | Type | Description |
|---|---|---|
| positions | LatLngPoint[]/Cesium.Cartesian3[] | Coordinate position |
| rectangle | Cesium.Rectangle/Cesium.PositionProperty | Rectangle extent, mutually exclusive with positions |
| style | RectanglePrimitive.StyleOptions | Style information |
| attr | Object | Additional attribute information, can add any attributes |
Properties
| Property | Type | Description |
|---|---|---|
| area | number | Area (unit: square meters) |
| attr | any | Attribute information |
| center | any | Center point coordinates (Cartesian coordinates) |
| centerOfLine | any | Center point coordinates of edge line |
| centerPoint | LatLngPoint | Center point coordinates (latitude and longitude coordinates) |
| distance | number | Distance (unit: meters) |
| id | any | Object id identifier |
| isAdded | boolean | Whether added to layer |
| isDestroy | boolean | Whether destroyed |
| label | any | Additional label text object |
| name | any | Name (can be repeated) |
| points | LatLngPoint[] | Position coordinate array |
| rectangle | Rectangle | Rectangle boundary corresponding to coordinate data |
| show | any | Show/hide state |
| style | any | Style information |
Methods
addEventListener
Add feature events
ts
addEventListener(types: any, fn: any, context?: any): thisclampToGround
Asynchronously calculate and update coordinates for ground clamping (or model clamping)
ts
clampToGround(options?: any): BillboardPrimitiveclear
Clear features
ts
clear(): voidcloseHighlight
Clear selected highlight
ts
closeHighlight(): voiddestroy
Destroy features
ts
destroy(noDel?: boolean): voidflyTo
Fly to view angle where data is located
ts
flyTo(options?: any): undefined | BillboardPrimitivegetCenterOfMass
Internal center point coordinates of enclosed surface
ts
getCenterOfMass(): anygetCoordinates
Position coordinates (array object), example [ [123.123456,32.654321,198.7], [111.123456,22.654321,50.7] ]
ts
getCoordinates(noAlt?: boolean): any[][]getPositions
Position coordinates (Cartesian coordinates), can pass LatLngPoint object when assigning
ts
getPositions(): anyonce
Event that is destroyed after being executed once
ts
once(types: any, fn: any, context?: any): thisisInPoly
Determine if point is inside polygon formed by current object's coordinate points
ts
isInPoly(position: any): booleanremoveEventListener
Remove feature events
ts
removeEventListener(types: any, fn: any, context?: any): thissetOptions
Set options parameters
ts
setOptions(options: { attr: any; position: any; positions: any; style: any }): thissetPositions
Set position coordinates (Cartesian coordinates), can pass LatLngPoint object when assigning
ts
setPositions(value: any): voidsetStyle
Set style information
ts
setStyle(newStyle: any): thistoGeoJSON
Convert to GeoJSON data
ts
toGeoJSON(options: any): objecttoWKT
Convert to WKT data
ts
toWKT(options: any): anyremove
Remove object
ts
remove(): void