@itwin/core-common 4.0.0-dev.8 → 4.0.0-dev.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -1
- package/lib/cjs/AmbientOcclusion.d.ts +49 -49
- package/lib/cjs/AmbientOcclusion.js +55 -55
- package/lib/cjs/AnalysisStyle.d.ts +134 -134
- package/lib/cjs/AnalysisStyle.js +165 -165
- package/lib/cjs/AnalysisStyle.js.map +1 -1
- package/lib/cjs/Atmosphere.d.ts +99 -0
- package/lib/cjs/Atmosphere.d.ts.map +1 -0
- package/lib/cjs/Atmosphere.js +134 -0
- package/lib/cjs/Atmosphere.js.map +1 -0
- package/lib/cjs/AuthorizationClient.d.ts +17 -17
- package/lib/cjs/AuthorizationClient.js +9 -9
- package/lib/cjs/BackendTypes.d.ts +13 -12
- package/lib/cjs/BackendTypes.d.ts.map +1 -1
- package/lib/cjs/BackendTypes.js +9 -9
- package/lib/cjs/BackendTypes.js.map +1 -1
- package/lib/cjs/BackgroundMapProvider.d.ts +51 -51
- package/lib/cjs/BackgroundMapProvider.d.ts.map +1 -1
- package/lib/cjs/BackgroundMapProvider.js +67 -68
- package/lib/cjs/BackgroundMapProvider.js.map +1 -1
- package/lib/cjs/BackgroundMapSettings.d.ts +136 -136
- package/lib/cjs/BackgroundMapSettings.d.ts.map +1 -1
- package/lib/cjs/BackgroundMapSettings.js +154 -156
- package/lib/cjs/BackgroundMapSettings.js.map +1 -1
- package/lib/cjs/Base64EncodedString.d.ts +32 -32
- package/lib/cjs/Base64EncodedString.d.ts.map +1 -1
- package/lib/cjs/Base64EncodedString.js +66 -66
- package/lib/cjs/Base64EncodedString.js.map +1 -1
- package/lib/cjs/BlobReader.d.ts +31 -31
- package/lib/cjs/BlobReader.js +84 -84
- package/lib/cjs/BriefcaseTypes.d.ts +191 -189
- package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
- package/lib/cjs/BriefcaseTypes.js +95 -95
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/Camera.d.ts +42 -42
- package/lib/cjs/Camera.js +62 -62
- package/lib/cjs/Camera.js.map +1 -1
- package/lib/cjs/ChangedElements.d.ts +85 -85
- package/lib/cjs/ChangedElements.js +23 -23
- package/lib/cjs/ChangedEntities.d.ts +45 -45
- package/lib/cjs/ChangedEntities.d.ts.map +1 -1
- package/lib/cjs/ChangedEntities.js +9 -9
- package/lib/cjs/ChangesetProps.d.ts +98 -98
- package/lib/cjs/ChangesetProps.d.ts.map +1 -1
- package/lib/cjs/ChangesetProps.js +22 -22
- package/lib/cjs/ClipStyle.d.ts +89 -89
- package/lib/cjs/ClipStyle.js +121 -123
- package/lib/cjs/ClipStyle.js.map +1 -1
- package/lib/cjs/Code.d.ts +277 -277
- package/lib/cjs/Code.d.ts.map +1 -1
- package/lib/cjs/Code.js +268 -269
- package/lib/cjs/Code.js.map +1 -1
- package/lib/cjs/ColorByName.d.ts +161 -161
- package/lib/cjs/ColorByName.js +169 -169
- package/lib/cjs/ColorDef.d.ts +210 -208
- package/lib/cjs/ColorDef.d.ts.map +1 -1
- package/lib/cjs/ColorDef.js +572 -571
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/CommonLoggerCategory.d.ts +18 -18
- package/lib/cjs/CommonLoggerCategory.js +26 -26
- package/lib/cjs/ConcurrentQuery.d.ts +421 -421
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ConcurrentQuery.js +552 -552
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/ContextRealityModel.d.ts +303 -303
- package/lib/cjs/ContextRealityModel.js +371 -373
- package/lib/cjs/ContextRealityModel.js.map +1 -1
- package/lib/cjs/DisplayStyleSettings.d.ts +593 -588
- package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleSettings.js +990 -985
- package/lib/cjs/DisplayStyleSettings.js.map +1 -1
- package/lib/cjs/ECSchemaProps.d.ts +39 -39
- package/lib/cjs/ECSchemaProps.js +9 -9
- package/lib/cjs/ECSqlReader.d.ts +72 -70
- package/lib/cjs/ECSqlReader.d.ts.map +1 -1
- package/lib/cjs/ECSqlReader.js +297 -280
- package/lib/cjs/ECSqlReader.js.map +1 -1
- package/lib/cjs/ECSqlTypes.d.ts +128 -128
- package/lib/cjs/ECSqlTypes.js +189 -189
- package/lib/cjs/ElementMesh.d.ts +39 -39
- package/lib/cjs/ElementMesh.js +56 -56
- package/lib/cjs/ElementProps.d.ts +483 -483
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js +99 -99
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/EmphasizeElementsProps.d.ts +55 -55
- package/lib/cjs/EmphasizeElementsProps.js +25 -25
- package/lib/cjs/EntityProps.d.ts +177 -177
- package/lib/cjs/EntityProps.d.ts.map +1 -1
- package/lib/cjs/EntityProps.js +113 -113
- package/lib/cjs/EntityReference.d.ts +51 -51
- package/lib/cjs/EntityReference.d.ts.map +1 -1
- package/lib/cjs/EntityReference.js +56 -56
- package/lib/cjs/Environment.d.ts +74 -61
- package/lib/cjs/Environment.d.ts.map +1 -1
- package/lib/cjs/Environment.js +78 -73
- package/lib/cjs/Environment.js.map +1 -1
- package/lib/cjs/FeatureIndex.d.ts +39 -39
- package/lib/cjs/FeatureIndex.js +63 -63
- package/lib/cjs/FeatureIndex.js.map +1 -1
- package/lib/cjs/FeatureSymbology.d.ts +449 -444
- package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/FeatureSymbology.js +618 -614
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/FeatureTable.d.ts +248 -141
- package/lib/cjs/FeatureTable.d.ts.map +1 -1
- package/lib/cjs/FeatureTable.js +470 -278
- package/lib/cjs/FeatureTable.js.map +1 -1
- package/lib/cjs/Fonts.d.ts +51 -51
- package/lib/cjs/Fonts.d.ts.map +1 -1
- package/lib/cjs/Fonts.js +53 -53
- package/lib/cjs/Frustum.d.ts +114 -114
- package/lib/cjs/Frustum.js +292 -292
- package/lib/cjs/GeoCoordinateServices.d.ts +123 -119
- package/lib/cjs/GeoCoordinateServices.d.ts.map +1 -1
- package/lib/cjs/GeoCoordinateServices.js +81 -80
- package/lib/cjs/GeoCoordinateServices.js.map +1 -1
- package/lib/cjs/GeometryContainment.d.ts +28 -28
- package/lib/cjs/GeometryContainment.js +9 -9
- package/lib/cjs/GeometryParams.d.ts +130 -130
- package/lib/cjs/GeometryParams.js +174 -174
- package/lib/cjs/GeometrySummary.d.ts +45 -45
- package/lib/cjs/GeometrySummary.js +23 -23
- package/lib/cjs/Gradient.d.ts +139 -139
- package/lib/cjs/Gradient.js +453 -455
- package/lib/cjs/Gradient.js.map +1 -1
- package/lib/cjs/GraphicParams.d.ts +58 -58
- package/lib/cjs/GraphicParams.js +85 -85
- package/lib/cjs/GraphicParams.js.map +1 -1
- package/lib/cjs/GroundPlane.d.ts +52 -52
- package/lib/cjs/GroundPlane.d.ts.map +1 -1
- package/lib/cjs/GroundPlane.js +63 -64
- package/lib/cjs/GroundPlane.js.map +1 -1
- package/lib/cjs/HSLColor.d.ts +20 -20
- package/lib/cjs/HSLColor.js +32 -32
- package/lib/cjs/HSLColor.js.map +1 -1
- package/lib/cjs/HSVColor.d.ts +30 -30
- package/lib/cjs/HSVColor.js +59 -59
- package/lib/cjs/HSVColor.js.map +1 -1
- package/lib/cjs/HiddenLine.d.ts +97 -97
- package/lib/cjs/HiddenLine.js +160 -162
- package/lib/cjs/HiddenLine.js.map +1 -1
- package/lib/cjs/Hilite.d.ts +50 -50
- package/lib/cjs/Hilite.js +64 -64
- package/lib/cjs/Hilite.js.map +1 -1
- package/lib/cjs/IModel.d.ts +358 -359
- package/lib/cjs/IModel.d.ts.map +1 -1
- package/lib/cjs/IModel.js +347 -347
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/IModelError.d.ts +42 -42
- package/lib/cjs/IModelError.d.ts.map +1 -1
- package/lib/cjs/IModelError.js +71 -71
- package/lib/cjs/IModelVersion.d.ts +68 -68
- package/lib/cjs/IModelVersion.d.ts.map +1 -1
- package/lib/cjs/IModelVersion.js +79 -79
- package/lib/cjs/Image.d.ts +86 -86
- package/lib/cjs/Image.js +128 -128
- package/lib/cjs/Image.js.map +1 -1
- package/lib/cjs/IpcAppProps.d.ts +141 -141
- package/lib/cjs/IpcAppProps.js +23 -23
- package/lib/cjs/LightSettings.d.ts +224 -224
- package/lib/cjs/LightSettings.js +304 -309
- package/lib/cjs/LightSettings.js.map +1 -1
- package/lib/cjs/LinePixels.d.ts +34 -34
- package/lib/cjs/LinePixels.js +42 -42
- package/lib/cjs/Localization.d.ts +117 -113
- package/lib/cjs/Localization.d.ts.map +1 -1
- package/lib/cjs/Localization.js +33 -33
- package/lib/cjs/Localization.js.map +1 -1
- package/lib/cjs/MapImagerySettings.d.ts +62 -62
- package/lib/cjs/MapImagerySettings.d.ts.map +1 -1
- package/lib/cjs/MapImagerySettings.js +80 -80
- package/lib/cjs/MapImagerySettings.js.map +1 -1
- package/lib/cjs/MapLayerSettings.d.ts +272 -272
- package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
- package/lib/cjs/MapLayerSettings.js +407 -411
- package/lib/cjs/MapLayerSettings.js.map +1 -1
- package/lib/cjs/MassProperties.d.ts +64 -64
- package/lib/cjs/MassProperties.js +23 -23
- package/lib/cjs/MaterialProps.d.ts +153 -153
- package/lib/cjs/MaterialProps.d.ts.map +1 -1
- package/lib/cjs/MaterialProps.js +35 -35
- package/lib/cjs/ModelClipGroup.d.ts +67 -67
- package/lib/cjs/ModelClipGroup.js +96 -98
- package/lib/cjs/ModelClipGroup.js.map +1 -1
- package/lib/cjs/ModelGeometryChanges.d.ts +107 -107
- package/lib/cjs/ModelGeometryChanges.d.ts.map +1 -1
- package/lib/cjs/ModelGeometryChanges.js +83 -83
- package/lib/cjs/ModelProps.d.ts +67 -67
- package/lib/cjs/ModelProps.js +9 -9
- package/lib/cjs/NativeAppProps.d.ts +122 -122
- package/lib/cjs/NativeAppProps.d.ts.map +1 -1
- package/lib/cjs/NativeAppProps.js +30 -30
- package/lib/cjs/OctEncodedNormal.d.ts +33 -33
- package/lib/cjs/OctEncodedNormal.js +98 -98
- package/lib/cjs/PlanProjectionSettings.d.ts +47 -47
- package/lib/cjs/PlanProjectionSettings.js +63 -63
- package/lib/cjs/PlanProjectionSettings.js.map +1 -1
- package/lib/cjs/PlanarClipMask.d.ts +177 -177
- package/lib/cjs/PlanarClipMask.js +136 -136
- package/lib/cjs/PlanarClipMask.js.map +1 -1
- package/lib/cjs/QPoint.d.ts +479 -479
- package/lib/cjs/QPoint.js +824 -826
- package/lib/cjs/QPoint.js.map +1 -1
- package/lib/cjs/RealityDataAccessProps.d.ts +41 -41
- package/lib/cjs/RealityDataAccessProps.js +19 -19
- package/lib/cjs/RealityModelDisplaySettings.d.ts +183 -183
- package/lib/cjs/RealityModelDisplaySettings.d.ts.map +1 -1
- package/lib/cjs/RealityModelDisplaySettings.js +141 -142
- package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
- package/lib/cjs/Render.d.ts +89 -89
- package/lib/cjs/Render.js +177 -177
- package/lib/cjs/RenderMaterial.d.ts +58 -58
- package/lib/cjs/RenderMaterial.js +75 -76
- package/lib/cjs/RenderMaterial.js.map +1 -1
- package/lib/cjs/RenderSchedule.d.ts +543 -543
- package/lib/cjs/RenderSchedule.js +992 -1002
- package/lib/cjs/RenderSchedule.js.map +1 -1
- package/lib/cjs/RenderTexture.d.ts +70 -70
- package/lib/cjs/RenderTexture.d.ts.map +1 -1
- package/lib/cjs/RenderTexture.js +59 -59
- package/lib/cjs/RenderTexture.js.map +1 -1
- package/lib/cjs/RgbColor.d.ts +47 -47
- package/lib/cjs/RgbColor.js +77 -77
- package/lib/cjs/RpcInterface.d.ts +40 -33
- package/lib/cjs/RpcInterface.d.ts.map +1 -1
- package/lib/cjs/RpcInterface.js +137 -137
- package/lib/cjs/RpcInterface.js.map +1 -1
- package/lib/cjs/RpcManager.d.ts +40 -40
- package/lib/cjs/RpcManager.js +55 -55
- package/lib/cjs/RpcManager.js.map +1 -1
- package/lib/cjs/SessionProps.d.ts +16 -16
- package/lib/cjs/SessionProps.js +9 -9
- package/lib/cjs/SkyBox.d.ts +217 -215
- package/lib/cjs/SkyBox.d.ts.map +1 -1
- package/lib/cjs/SkyBox.js +209 -210
- package/lib/cjs/SkyBox.js.map +1 -1
- package/lib/cjs/Snapping.d.ts +49 -49
- package/lib/cjs/Snapping.js +9 -9
- package/lib/cjs/SolarCalculate.d.ts +27 -27
- package/lib/cjs/SolarCalculate.js +211 -211
- package/lib/cjs/SolarShadows.d.ts +35 -35
- package/lib/cjs/SolarShadows.js +61 -62
- package/lib/cjs/SolarShadows.js.map +1 -1
- package/lib/cjs/SpatialClassification.d.ts +208 -208
- package/lib/cjs/SpatialClassification.js +339 -340
- package/lib/cjs/SpatialClassification.js.map +1 -1
- package/lib/cjs/SubCategoryAppearance.d.ts +91 -91
- package/lib/cjs/SubCategoryAppearance.js +96 -96
- package/lib/cjs/SubCategoryAppearance.js.map +1 -1
- package/lib/cjs/SubCategoryOverride.d.ts +46 -46
- package/lib/cjs/SubCategoryOverride.js +104 -104
- package/lib/cjs/SubCategoryOverride.js.map +1 -1
- package/lib/cjs/TerrainSettings.d.ts +82 -82
- package/lib/cjs/TerrainSettings.d.ts.map +1 -1
- package/lib/cjs/TerrainSettings.js +100 -102
- package/lib/cjs/TerrainSettings.js.map +1 -1
- package/lib/cjs/TextureMapping.d.ts +151 -118
- package/lib/cjs/TextureMapping.d.ts.map +1 -1
- package/lib/cjs/TextureMapping.js +180 -174
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/TextureProps.d.ts +65 -65
- package/lib/cjs/TextureProps.js +28 -28
- package/lib/cjs/ThematicDisplay.d.ts +230 -230
- package/lib/cjs/ThematicDisplay.js +343 -344
- package/lib/cjs/ThematicDisplay.js.map +1 -1
- package/lib/cjs/Thumbnail.d.ts +26 -26
- package/lib/cjs/Thumbnail.js +9 -9
- package/lib/cjs/TileProps.d.ts +88 -82
- package/lib/cjs/TileProps.d.ts.map +1 -1
- package/lib/cjs/TileProps.js +29 -29
- package/lib/cjs/TileProps.js.map +1 -1
- package/lib/cjs/Tween.d.ts +191 -191
- package/lib/cjs/Tween.d.ts.map +1 -1
- package/lib/cjs/Tween.js +570 -570
- package/lib/cjs/TxnAction.d.ts +21 -21
- package/lib/cjs/TxnAction.js +29 -29
- package/lib/cjs/ViewDetails.d.ts +125 -125
- package/lib/cjs/ViewDetails.js +166 -166
- package/lib/cjs/ViewDetails.js.map +1 -1
- package/lib/cjs/ViewFlags.d.ts +287 -287
- package/lib/cjs/ViewFlags.d.ts.map +1 -1
- package/lib/cjs/ViewFlags.js +367 -368
- package/lib/cjs/ViewFlags.js.map +1 -1
- package/lib/cjs/ViewProps.d.ts +205 -205
- package/lib/cjs/ViewProps.js +9 -9
- package/lib/cjs/WhiteOnWhiteReversalSettings.d.ts +36 -36
- package/lib/cjs/WhiteOnWhiteReversalSettings.js +37 -37
- package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/cjs/core-common.d.ts +244 -244
- package/lib/cjs/core-common.d.ts.map +1 -1
- package/lib/cjs/core-common.js +264 -260
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/domains/FunctionalElementProps.d.ts +11 -11
- package/lib/cjs/domains/FunctionalElementProps.js +9 -9
- package/lib/cjs/domains/GenericElementProps.d.ts +18 -18
- package/lib/cjs/domains/GenericElementProps.js +9 -9
- package/lib/cjs/geometry/AdditionalTransform.d.ts +84 -84
- package/lib/cjs/geometry/AdditionalTransform.js +85 -85
- package/lib/cjs/geometry/AreaPattern.d.ts +82 -82
- package/lib/cjs/geometry/AreaPattern.js +203 -204
- package/lib/cjs/geometry/AreaPattern.js.map +1 -1
- package/lib/cjs/geometry/BoundingSphere.d.ts +27 -27
- package/lib/cjs/geometry/BoundingSphere.js +44 -44
- package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
- package/lib/cjs/geometry/Cartographic.d.ts +137 -137
- package/lib/cjs/geometry/Cartographic.js +345 -345
- package/lib/cjs/geometry/Cartographic.js.map +1 -1
- package/lib/cjs/geometry/CoordinateReferenceSystem.d.ts +269 -269
- package/lib/cjs/geometry/CoordinateReferenceSystem.d.ts.map +1 -1
- package/lib/cjs/geometry/CoordinateReferenceSystem.js +260 -261
- package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.d.ts +402 -402
- package/lib/cjs/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +1719 -1719
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometryFB.d.ts +2372 -2372
- package/lib/cjs/geometry/ElementGeometryFB.js +3814 -3814
- package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.d.ts +83 -81
- package/lib/cjs/geometry/FrustumPlanes.d.ts.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.js +227 -193
- package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
- package/lib/cjs/geometry/GeodeticDatum.d.ts +409 -409
- package/lib/cjs/geometry/GeodeticDatum.d.ts.map +1 -1
- package/lib/cjs/geometry/GeodeticDatum.js +400 -401
- package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
- package/lib/cjs/geometry/GeodeticEllipsoid.d.ts +72 -72
- package/lib/cjs/geometry/GeodeticEllipsoid.js +71 -72
- package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/cjs/geometry/GeometryStream.d.ts +347 -347
- package/lib/cjs/geometry/GeometryStream.d.ts.map +1 -1
- package/lib/cjs/geometry/GeometryStream.js +468 -469
- package/lib/cjs/geometry/GeometryStream.js.map +1 -1
- package/lib/cjs/geometry/ImageGraphic.d.ts +74 -74
- package/lib/cjs/geometry/ImageGraphic.d.ts.map +1 -1
- package/lib/cjs/geometry/ImageGraphic.js +98 -98
- package/lib/cjs/geometry/LineStyle.d.ts +71 -71
- package/lib/cjs/geometry/LineStyle.js +129 -129
- package/lib/cjs/geometry/Placement.d.ts +95 -95
- package/lib/cjs/geometry/Placement.d.ts.map +1 -1
- package/lib/cjs/geometry/Placement.js +131 -131
- package/lib/cjs/geometry/Projection.d.ts +251 -251
- package/lib/cjs/geometry/Projection.d.ts.map +1 -1
- package/lib/cjs/geometry/Projection.js +198 -198
- package/lib/cjs/geometry/Projection.js.map +1 -1
- package/lib/cjs/geometry/TextString.d.ts +55 -55
- package/lib/cjs/geometry/TextString.js +65 -65
- package/lib/cjs/geometry/TextString.js.map +1 -1
- package/lib/cjs/ipc/IpcSession.d.ts +23 -23
- package/lib/cjs/ipc/IpcSession.js +27 -27
- package/lib/cjs/ipc/IpcSocket.d.ts +96 -96
- package/lib/cjs/ipc/IpcSocket.d.ts.map +1 -1
- package/lib/cjs/ipc/IpcSocket.js +16 -16
- package/lib/cjs/ipc/IpcWebSocket.d.ts +60 -61
- package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js +148 -151
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.d.ts +15 -15
- package/lib/cjs/ipc/IpcWebSocketTransport.js +160 -160
- package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.d.ts +32 -32
- package/lib/cjs/rpc/DevToolsRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.js +52 -48
- package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +99 -99
- package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +122 -122
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.d.ts +49 -61
- package/lib/cjs/rpc/IModelTileRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js +79 -96
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.d.ts +23 -23
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +48 -48
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/TestRpcManager.d.ts +20 -20
- package/lib/cjs/rpc/TestRpcManager.js +40 -40
- package/lib/cjs/rpc/WipRpcInterface.d.ts +29 -29
- package/lib/cjs/rpc/WipRpcInterface.js +40 -40
- package/lib/cjs/rpc/WipRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.d.ts +111 -111
- package/lib/cjs/rpc/core/RpcConfiguration.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js +191 -191
- package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts +90 -90
- package/lib/cjs/rpc/core/RpcConstants.js +109 -109
- package/lib/cjs/rpc/core/RpcControl.d.ts +54 -54
- package/lib/cjs/rpc/core/RpcControl.js +150 -145
- package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.d.ts +89 -89
- package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +256 -258
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.d.ts +35 -35
- package/lib/cjs/rpc/core/RpcMarshaling.js +156 -156
- package/lib/cjs/rpc/core/RpcOperation.d.ts +67 -67
- package/lib/cjs/rpc/core/RpcOperation.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcOperation.js +135 -134
- package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPendingQueue.d.ts +21 -21
- package/lib/cjs/rpc/core/RpcPendingQueue.js +94 -95
- package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.d.ts +132 -132
- package/lib/cjs/rpc/core/RpcProtocol.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.js +127 -127
- package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.d.ts +68 -68
- package/lib/cjs/rpc/core/RpcPush.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.js +127 -127
- package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRegistry.d.ts +48 -48
- package/lib/cjs/rpc/core/RpcRegistry.js +198 -199
- package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.d.ts +186 -186
- package/lib/cjs/rpc/core/RpcRequest.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.js +478 -478
- package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequestContext.d.ts +14 -14
- package/lib/cjs/rpc/core/RpcRequestContext.js +2 -2
- package/lib/cjs/rpc/core/RpcRoutingToken.d.ts +12 -12
- package/lib/cjs/rpc/core/RpcRoutingToken.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.js +24 -24
- package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.d.ts +10 -10
- package/lib/cjs/rpc/core/RpcSessionInvocation.js +60 -60
- package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.d.ts +48 -46
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.d.ts.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +76 -73
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.d.ts +33 -33
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +141 -143
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/OpenAPI.d.ts +140 -140
- package/lib/cjs/rpc/web/OpenAPI.js +60 -60
- package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.d.ts +35 -35
- package/lib/cjs/rpc/web/RpcMultipart.js +50 -50
- package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcLogging.d.ts +28 -28
- package/lib/cjs/rpc/web/WebAppRpcLogging.js +140 -140
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +89 -89
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js +116 -116
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.d.ts +67 -67
- package/lib/cjs/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js +239 -239
- package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts +32 -32
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js +373 -373
- package/lib/cjs/tile/B3dmTileIO.d.ts +19 -19
- package/lib/cjs/tile/B3dmTileIO.js +66 -66
- package/lib/cjs/tile/B3dmTileIO.js.map +1 -1
- package/lib/cjs/tile/CompositeTileIO.d.ts +15 -15
- package/lib/cjs/tile/CompositeTileIO.js +26 -26
- package/lib/cjs/tile/CompositeTileIO.js.map +1 -1
- package/lib/cjs/tile/ElementGraphics.d.ts +145 -145
- package/lib/cjs/tile/ElementGraphics.d.ts.map +1 -1
- package/lib/cjs/tile/ElementGraphics.js +9 -9
- package/lib/cjs/tile/GltfTileIO.d.ts +45 -45
- package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
- package/lib/cjs/tile/GltfTileIO.js +109 -109
- package/lib/cjs/tile/GltfTileIO.js.map +1 -1
- package/lib/cjs/tile/I3dmTileIO.d.ts +20 -20
- package/lib/cjs/tile/I3dmTileIO.js +40 -40
- package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.d.ts +77 -75
- package/lib/cjs/tile/IModelTileIO.d.ts.map +1 -1
- package/lib/cjs/tile/IModelTileIO.js +97 -95
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/cjs/tile/PntsTileIO.d.ts +17 -17
- package/lib/cjs/tile/PntsTileIO.js +26 -26
- package/lib/cjs/tile/PntsTileIO.js.map +1 -1
- package/lib/cjs/tile/TileIO.d.ts +66 -66
- package/lib/cjs/tile/TileIO.js +118 -118
- package/lib/cjs/tile/TileMetadata.d.ts +228 -228
- package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
- package/lib/cjs/tile/TileMetadata.js +675 -676
- package/lib/cjs/tile/TileMetadata.js.map +1 -1
- package/lib/cjs/tile/Tileset3dSchema.d.ts +97 -0
- package/lib/cjs/tile/Tileset3dSchema.d.ts.map +1 -0
- package/lib/cjs/tile/Tileset3dSchema.js +10 -0
- package/lib/cjs/tile/Tileset3dSchema.js.map +1 -0
- package/lib/esm/AmbientOcclusion.d.ts +49 -49
- package/lib/esm/AmbientOcclusion.js +52 -52
- package/lib/esm/AnalysisStyle.d.ts +134 -134
- package/lib/esm/AnalysisStyle.js +160 -159
- package/lib/esm/AnalysisStyle.js.map +1 -1
- package/lib/esm/Atmosphere.d.ts +99 -0
- package/lib/esm/Atmosphere.d.ts.map +1 -0
- package/lib/esm/Atmosphere.js +131 -0
- package/lib/esm/Atmosphere.js.map +1 -0
- package/lib/esm/AuthorizationClient.d.ts +17 -17
- package/lib/esm/AuthorizationClient.js +8 -8
- package/lib/esm/BackendTypes.d.ts +13 -12
- package/lib/esm/BackendTypes.d.ts.map +1 -1
- package/lib/esm/BackendTypes.js +8 -8
- package/lib/esm/BackendTypes.js.map +1 -1
- package/lib/esm/BackgroundMapProvider.d.ts +51 -51
- package/lib/esm/BackgroundMapProvider.d.ts.map +1 -1
- package/lib/esm/BackgroundMapProvider.js +63 -64
- package/lib/esm/BackgroundMapProvider.js.map +1 -1
- package/lib/esm/BackgroundMapSettings.d.ts +136 -136
- package/lib/esm/BackgroundMapSettings.d.ts.map +1 -1
- package/lib/esm/BackgroundMapSettings.js +150 -152
- package/lib/esm/BackgroundMapSettings.js.map +1 -1
- package/lib/esm/Base64EncodedString.d.ts +32 -32
- package/lib/esm/Base64EncodedString.d.ts.map +1 -1
- package/lib/esm/Base64EncodedString.js +63 -63
- package/lib/esm/Base64EncodedString.js.map +1 -1
- package/lib/esm/BlobReader.d.ts +31 -31
- package/lib/esm/BlobReader.js +79 -79
- package/lib/esm/BriefcaseTypes.d.ts +191 -189
- package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
- package/lib/esm/BriefcaseTypes.js +92 -92
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/Camera.d.ts +42 -42
- package/lib/esm/Camera.js +58 -58
- package/lib/esm/Camera.js.map +1 -1
- package/lib/esm/ChangedElements.d.ts +85 -85
- package/lib/esm/ChangedElements.js +20 -20
- package/lib/esm/ChangedEntities.d.ts +45 -45
- package/lib/esm/ChangedEntities.d.ts.map +1 -1
- package/lib/esm/ChangedEntities.js +8 -8
- package/lib/esm/ChangesetProps.d.ts +98 -98
- package/lib/esm/ChangesetProps.d.ts.map +1 -1
- package/lib/esm/ChangesetProps.js +19 -19
- package/lib/esm/ClipStyle.d.ts +89 -89
- package/lib/esm/ClipStyle.js +118 -118
- package/lib/esm/ClipStyle.js.map +1 -1
- package/lib/esm/Code.d.ts +277 -277
- package/lib/esm/Code.d.ts.map +1 -1
- package/lib/esm/Code.js +263 -264
- package/lib/esm/Code.js.map +1 -1
- package/lib/esm/ColorByName.d.ts +161 -161
- package/lib/esm/ColorByName.js +166 -166
- package/lib/esm/ColorDef.d.ts +210 -208
- package/lib/esm/ColorDef.d.ts.map +1 -1
- package/lib/esm/ColorDef.js +569 -567
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/CommonLoggerCategory.d.ts +18 -18
- package/lib/esm/CommonLoggerCategory.js +23 -23
- package/lib/esm/ConcurrentQuery.d.ts +421 -421
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
- package/lib/esm/ConcurrentQuery.js +545 -545
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ContextRealityModel.d.ts +303 -303
- package/lib/esm/ContextRealityModel.js +366 -368
- package/lib/esm/ContextRealityModel.js.map +1 -1
- package/lib/esm/DisplayStyleSettings.d.ts +593 -588
- package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/esm/DisplayStyleSettings.js +985 -980
- package/lib/esm/DisplayStyleSettings.js.map +1 -1
- package/lib/esm/ECSchemaProps.d.ts +39 -39
- package/lib/esm/ECSchemaProps.js +8 -8
- package/lib/esm/ECSqlReader.d.ts +72 -70
- package/lib/esm/ECSqlReader.d.ts.map +1 -1
- package/lib/esm/ECSqlReader.js +293 -275
- package/lib/esm/ECSqlReader.js.map +1 -1
- package/lib/esm/ECSqlTypes.d.ts +128 -128
- package/lib/esm/ECSqlTypes.js +185 -185
- package/lib/esm/ElementMesh.d.ts +39 -39
- package/lib/esm/ElementMesh.js +52 -52
- package/lib/esm/ElementProps.d.ts +483 -483
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js +93 -92
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/EmphasizeElementsProps.d.ts +55 -55
- package/lib/esm/EmphasizeElementsProps.js +22 -22
- package/lib/esm/EntityProps.d.ts +177 -177
- package/lib/esm/EntityProps.d.ts.map +1 -1
- package/lib/esm/EntityProps.js +108 -108
- package/lib/esm/EntityReference.d.ts +51 -51
- package/lib/esm/EntityReference.d.ts.map +1 -1
- package/lib/esm/EntityReference.js +52 -52
- package/lib/esm/Environment.d.ts +74 -61
- package/lib/esm/Environment.d.ts.map +1 -1
- package/lib/esm/Environment.js +75 -69
- package/lib/esm/Environment.js.map +1 -1
- package/lib/esm/FeatureIndex.d.ts +39 -39
- package/lib/esm/FeatureIndex.js +57 -57
- package/lib/esm/FeatureIndex.js.map +1 -1
- package/lib/esm/FeatureSymbology.d.ts +449 -444
- package/lib/esm/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/FeatureSymbology.js +615 -609
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/FeatureTable.d.ts +248 -141
- package/lib/esm/FeatureTable.d.ts.map +1 -1
- package/lib/esm/FeatureTable.js +462 -272
- package/lib/esm/FeatureTable.js.map +1 -1
- package/lib/esm/Fonts.d.ts +51 -51
- package/lib/esm/Fonts.d.ts.map +1 -1
- package/lib/esm/Fonts.js +49 -49
- package/lib/esm/Frustum.d.ts +114 -114
- package/lib/esm/Frustum.js +288 -288
- package/lib/esm/GeoCoordinateServices.d.ts +123 -119
- package/lib/esm/GeoCoordinateServices.d.ts.map +1 -1
- package/lib/esm/GeoCoordinateServices.js +77 -76
- package/lib/esm/GeoCoordinateServices.js.map +1 -1
- package/lib/esm/GeometryContainment.d.ts +28 -28
- package/lib/esm/GeometryContainment.js +8 -8
- package/lib/esm/GeometryParams.d.ts +130 -130
- package/lib/esm/GeometryParams.js +170 -170
- package/lib/esm/GeometrySummary.d.ts +45 -45
- package/lib/esm/GeometrySummary.js +20 -20
- package/lib/esm/Gradient.d.ts +139 -139
- package/lib/esm/Gradient.js +450 -452
- package/lib/esm/Gradient.js.map +1 -1
- package/lib/esm/GraphicParams.d.ts +58 -58
- package/lib/esm/GraphicParams.js +81 -81
- package/lib/esm/GraphicParams.js.map +1 -1
- package/lib/esm/GroundPlane.d.ts +52 -52
- package/lib/esm/GroundPlane.d.ts.map +1 -1
- package/lib/esm/GroundPlane.js +60 -60
- package/lib/esm/GroundPlane.js.map +1 -1
- package/lib/esm/HSLColor.d.ts +20 -20
- package/lib/esm/HSLColor.js +28 -28
- package/lib/esm/HSLColor.js.map +1 -1
- package/lib/esm/HSVColor.d.ts +30 -30
- package/lib/esm/HSVColor.js +55 -55
- package/lib/esm/HSVColor.js.map +1 -1
- package/lib/esm/HiddenLine.d.ts +97 -97
- package/lib/esm/HiddenLine.js +157 -159
- package/lib/esm/HiddenLine.js.map +1 -1
- package/lib/esm/Hilite.d.ts +50 -50
- package/lib/esm/Hilite.js +61 -61
- package/lib/esm/Hilite.js.map +1 -1
- package/lib/esm/IModel.d.ts +358 -359
- package/lib/esm/IModel.d.ts.map +1 -1
- package/lib/esm/IModel.js +343 -342
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/IModelError.d.ts +42 -42
- package/lib/esm/IModelError.d.ts.map +1 -1
- package/lib/esm/IModelError.js +56 -56
- package/lib/esm/IModelVersion.d.ts +68 -68
- package/lib/esm/IModelVersion.d.ts.map +1 -1
- package/lib/esm/IModelVersion.js +75 -75
- package/lib/esm/Image.d.ts +86 -86
- package/lib/esm/Image.js +120 -120
- package/lib/esm/Image.js.map +1 -1
- package/lib/esm/IpcAppProps.d.ts +141 -141
- package/lib/esm/IpcAppProps.js +19 -19
- package/lib/esm/LightSettings.d.ts +224 -224
- package/lib/esm/LightSettings.js +297 -301
- package/lib/esm/LightSettings.js.map +1 -1
- package/lib/esm/LinePixels.d.ts +34 -34
- package/lib/esm/LinePixels.js +39 -39
- package/lib/esm/Localization.d.ts +117 -113
- package/lib/esm/Localization.d.ts.map +1 -1
- package/lib/esm/Localization.js +29 -29
- package/lib/esm/Localization.js.map +1 -1
- package/lib/esm/MapImagerySettings.d.ts +62 -62
- package/lib/esm/MapImagerySettings.d.ts.map +1 -1
- package/lib/esm/MapImagerySettings.js +76 -76
- package/lib/esm/MapImagerySettings.js.map +1 -1
- package/lib/esm/MapLayerSettings.d.ts +272 -272
- package/lib/esm/MapLayerSettings.d.ts.map +1 -1
- package/lib/esm/MapLayerSettings.js +399 -403
- package/lib/esm/MapLayerSettings.js.map +1 -1
- package/lib/esm/MassProperties.d.ts +64 -64
- package/lib/esm/MassProperties.js +20 -20
- package/lib/esm/MaterialProps.d.ts +153 -153
- package/lib/esm/MaterialProps.d.ts.map +1 -1
- package/lib/esm/MaterialProps.js +32 -32
- package/lib/esm/ModelClipGroup.d.ts +67 -67
- package/lib/esm/ModelClipGroup.js +91 -93
- package/lib/esm/ModelClipGroup.js.map +1 -1
- package/lib/esm/ModelGeometryChanges.d.ts +107 -107
- package/lib/esm/ModelGeometryChanges.d.ts.map +1 -1
- package/lib/esm/ModelGeometryChanges.js +80 -80
- package/lib/esm/ModelProps.d.ts +67 -67
- package/lib/esm/ModelProps.js +8 -8
- package/lib/esm/NativeAppProps.d.ts +122 -122
- package/lib/esm/NativeAppProps.d.ts.map +1 -1
- package/lib/esm/NativeAppProps.js +27 -27
- package/lib/esm/OctEncodedNormal.d.ts +33 -33
- package/lib/esm/OctEncodedNormal.js +93 -93
- package/lib/esm/PlanProjectionSettings.d.ts +47 -47
- package/lib/esm/PlanProjectionSettings.js +59 -59
- package/lib/esm/PlanProjectionSettings.js.map +1 -1
- package/lib/esm/PlanarClipMask.d.ts +177 -177
- package/lib/esm/PlanarClipMask.js +133 -132
- package/lib/esm/PlanarClipMask.js.map +1 -1
- package/lib/esm/QPoint.d.ts +479 -479
- package/lib/esm/QPoint.js +813 -815
- package/lib/esm/QPoint.js.map +1 -1
- package/lib/esm/RealityDataAccessProps.d.ts +41 -41
- package/lib/esm/RealityDataAccessProps.js +16 -16
- package/lib/esm/RealityModelDisplaySettings.d.ts +183 -183
- package/lib/esm/RealityModelDisplaySettings.d.ts.map +1 -1
- package/lib/esm/RealityModelDisplaySettings.js +138 -137
- package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
- package/lib/esm/Render.d.ts +89 -89
- package/lib/esm/Render.js +165 -165
- package/lib/esm/RenderMaterial.d.ts +58 -58
- package/lib/esm/RenderMaterial.js +71 -72
- package/lib/esm/RenderMaterial.js.map +1 -1
- package/lib/esm/RenderSchedule.d.ts +543 -543
- package/lib/esm/RenderSchedule.js +989 -999
- package/lib/esm/RenderSchedule.js.map +1 -1
- package/lib/esm/RenderTexture.d.ts +70 -70
- package/lib/esm/RenderTexture.d.ts.map +1 -1
- package/lib/esm/RenderTexture.js +55 -55
- package/lib/esm/RenderTexture.js.map +1 -1
- package/lib/esm/RgbColor.d.ts +47 -47
- package/lib/esm/RgbColor.js +73 -73
- package/lib/esm/RpcInterface.d.ts +40 -33
- package/lib/esm/RpcInterface.d.ts.map +1 -1
- package/lib/esm/RpcInterface.js +133 -133
- package/lib/esm/RpcInterface.js.map +1 -1
- package/lib/esm/RpcManager.d.ts +40 -40
- package/lib/esm/RpcManager.js +51 -51
- package/lib/esm/RpcManager.js.map +1 -1
- package/lib/esm/SessionProps.d.ts +16 -16
- package/lib/esm/SessionProps.js +8 -8
- package/lib/esm/SkyBox.d.ts +217 -215
- package/lib/esm/SkyBox.d.ts.map +1 -1
- package/lib/esm/SkyBox.js +204 -203
- package/lib/esm/SkyBox.js.map +1 -1
- package/lib/esm/Snapping.d.ts +49 -49
- package/lib/esm/Snapping.js +8 -8
- package/lib/esm/SolarCalculate.d.ts +27 -27
- package/lib/esm/SolarCalculate.js +204 -204
- package/lib/esm/SolarShadows.d.ts +35 -35
- package/lib/esm/SolarShadows.js +58 -58
- package/lib/esm/SolarShadows.js.map +1 -1
- package/lib/esm/SpatialClassification.d.ts +208 -208
- package/lib/esm/SpatialClassification.js +333 -334
- package/lib/esm/SpatialClassification.js.map +1 -1
- package/lib/esm/SubCategoryAppearance.d.ts +91 -91
- package/lib/esm/SubCategoryAppearance.js +93 -92
- package/lib/esm/SubCategoryAppearance.js.map +1 -1
- package/lib/esm/SubCategoryOverride.d.ts +46 -46
- package/lib/esm/SubCategoryOverride.js +101 -100
- package/lib/esm/SubCategoryOverride.js.map +1 -1
- package/lib/esm/TerrainSettings.d.ts +82 -82
- package/lib/esm/TerrainSettings.d.ts.map +1 -1
- package/lib/esm/TerrainSettings.js +96 -98
- package/lib/esm/TerrainSettings.js.map +1 -1
- package/lib/esm/TextureMapping.d.ts +151 -118
- package/lib/esm/TextureMapping.d.ts.map +1 -1
- package/lib/esm/TextureMapping.js +176 -170
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/TextureProps.d.ts +65 -65
- package/lib/esm/TextureProps.js +25 -25
- package/lib/esm/ThematicDisplay.d.ts +230 -230
- package/lib/esm/ThematicDisplay.js +337 -337
- package/lib/esm/ThematicDisplay.js.map +1 -1
- package/lib/esm/Thumbnail.d.ts +26 -26
- package/lib/esm/Thumbnail.js +8 -8
- package/lib/esm/TileProps.d.ts +88 -82
- package/lib/esm/TileProps.d.ts.map +1 -1
- package/lib/esm/TileProps.js +25 -25
- package/lib/esm/TileProps.js.map +1 -1
- package/lib/esm/Tween.d.ts +191 -191
- package/lib/esm/Tween.d.ts.map +1 -1
- package/lib/esm/Tween.js +565 -565
- package/lib/esm/TxnAction.d.ts +21 -21
- package/lib/esm/TxnAction.js +26 -26
- package/lib/esm/ViewDetails.d.ts +125 -125
- package/lib/esm/ViewDetails.js +162 -161
- package/lib/esm/ViewDetails.js.map +1 -1
- package/lib/esm/ViewFlags.d.ts +287 -287
- package/lib/esm/ViewFlags.d.ts.map +1 -1
- package/lib/esm/ViewFlags.js +364 -364
- package/lib/esm/ViewFlags.js.map +1 -1
- package/lib/esm/ViewProps.d.ts +205 -205
- package/lib/esm/ViewProps.js +8 -8
- package/lib/esm/WhiteOnWhiteReversalSettings.d.ts +36 -36
- package/lib/esm/WhiteOnWhiteReversalSettings.js +34 -33
- package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/esm/core-common.d.ts +244 -244
- package/lib/esm/core-common.d.ts.map +1 -1
- package/lib/esm/core-common.js +248 -248
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/domains/FunctionalElementProps.d.ts +11 -11
- package/lib/esm/domains/FunctionalElementProps.js +8 -8
- package/lib/esm/domains/GenericElementProps.d.ts +18 -18
- package/lib/esm/domains/GenericElementProps.js +8 -8
- package/lib/esm/geometry/AdditionalTransform.d.ts +84 -84
- package/lib/esm/geometry/AdditionalTransform.js +80 -80
- package/lib/esm/geometry/AreaPattern.d.ts +82 -82
- package/lib/esm/geometry/AreaPattern.js +200 -201
- package/lib/esm/geometry/AreaPattern.js.map +1 -1
- package/lib/esm/geometry/BoundingSphere.d.ts +27 -27
- package/lib/esm/geometry/BoundingSphere.js +40 -40
- package/lib/esm/geometry/BoundingSphere.js.map +1 -1
- package/lib/esm/geometry/Cartographic.d.ts +137 -137
- package/lib/esm/geometry/Cartographic.js +341 -340
- package/lib/esm/geometry/Cartographic.js.map +1 -1
- package/lib/esm/geometry/CoordinateReferenceSystem.d.ts +269 -269
- package/lib/esm/geometry/CoordinateReferenceSystem.d.ts.map +1 -1
- package/lib/esm/geometry/CoordinateReferenceSystem.js +253 -254
- package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.d.ts +402 -402
- package/lib/esm/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +1716 -1716
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/ElementGeometryFB.d.ts +2372 -2372
- package/lib/esm/geometry/ElementGeometryFB.js +3811 -3811
- package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.d.ts +83 -81
- package/lib/esm/geometry/FrustumPlanes.d.ts.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.js +223 -189
- package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
- package/lib/esm/geometry/GeodeticDatum.d.ts +409 -409
- package/lib/esm/geometry/GeodeticDatum.d.ts.map +1 -1
- package/lib/esm/geometry/GeodeticDatum.js +389 -390
- package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
- package/lib/esm/geometry/GeodeticEllipsoid.d.ts +72 -72
- package/lib/esm/geometry/GeodeticEllipsoid.js +67 -68
- package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
- package/lib/esm/geometry/GeometryStream.d.ts +347 -347
- package/lib/esm/geometry/GeometryStream.d.ts.map +1 -1
- package/lib/esm/geometry/GeometryStream.js +463 -464
- package/lib/esm/geometry/GeometryStream.js.map +1 -1
- package/lib/esm/geometry/ImageGraphic.d.ts +74 -74
- package/lib/esm/geometry/ImageGraphic.d.ts.map +1 -1
- package/lib/esm/geometry/ImageGraphic.js +93 -93
- package/lib/esm/geometry/LineStyle.d.ts +71 -71
- package/lib/esm/geometry/LineStyle.js +126 -126
- package/lib/esm/geometry/Placement.d.ts +95 -95
- package/lib/esm/geometry/Placement.d.ts.map +1 -1
- package/lib/esm/geometry/Placement.js +126 -126
- package/lib/esm/geometry/Projection.d.ts +251 -251
- package/lib/esm/geometry/Projection.d.ts.map +1 -1
- package/lib/esm/geometry/Projection.js +192 -192
- package/lib/esm/geometry/Projection.js.map +1 -1
- package/lib/esm/geometry/TextString.d.ts +55 -55
- package/lib/esm/geometry/TextString.js +61 -61
- package/lib/esm/geometry/TextString.js.map +1 -1
- package/lib/esm/ipc/IpcSession.d.ts +23 -23
- package/lib/esm/ipc/IpcSession.js +23 -23
- package/lib/esm/ipc/IpcSocket.d.ts +96 -96
- package/lib/esm/ipc/IpcSocket.d.ts.map +1 -1
- package/lib/esm/ipc/IpcSocket.js +12 -12
- package/lib/esm/ipc/IpcWebSocket.d.ts +60 -61
- package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js +143 -145
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.d.ts +15 -15
- package/lib/esm/ipc/IpcWebSocketTransport.js +156 -156
- package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.d.ts +32 -32
- package/lib/esm/rpc/DevToolsRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.js +49 -44
- package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.d.ts +99 -99
- package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +118 -117
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.d.ts +49 -61
- package/lib/esm/rpc/IModelTileRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js +76 -92
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.d.ts +23 -23
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js +45 -44
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/esm/rpc/TestRpcManager.d.ts +20 -20
- package/lib/esm/rpc/TestRpcManager.js +36 -36
- package/lib/esm/rpc/WipRpcInterface.d.ts +29 -29
- package/lib/esm/rpc/WipRpcInterface.js +37 -36
- package/lib/esm/rpc/WipRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.d.ts +111 -111
- package/lib/esm/rpc/core/RpcConfiguration.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js +185 -184
- package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts +90 -90
- package/lib/esm/rpc/core/RpcConstants.js +106 -106
- package/lib/esm/rpc/core/RpcControl.d.ts +54 -54
- package/lib/esm/rpc/core/RpcControl.js +144 -138
- package/lib/esm/rpc/core/RpcControl.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.d.ts +89 -89
- package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +253 -254
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.d.ts +35 -35
- package/lib/esm/rpc/core/RpcMarshaling.js +152 -152
- package/lib/esm/rpc/core/RpcOperation.d.ts +67 -67
- package/lib/esm/rpc/core/RpcOperation.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcOperation.js +130 -129
- package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
- package/lib/esm/rpc/core/RpcPendingQueue.d.ts +21 -21
- package/lib/esm/rpc/core/RpcPendingQueue.js +90 -91
- package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.d.ts +132 -132
- package/lib/esm/rpc/core/RpcProtocol.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.js +124 -123
- package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/esm/rpc/core/RpcPush.d.ts +68 -68
- package/lib/esm/rpc/core/RpcPush.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcPush.js +121 -119
- package/lib/esm/rpc/core/RpcPush.js.map +1 -1
- package/lib/esm/rpc/core/RpcRegistry.d.ts +48 -48
- package/lib/esm/rpc/core/RpcRegistry.js +194 -195
- package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.d.ts +186 -186
- package/lib/esm/rpc/core/RpcRequest.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.js +474 -473
- package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequestContext.d.ts +14 -14
- package/lib/esm/rpc/core/RpcRequestContext.js +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.d.ts +12 -12
- package/lib/esm/rpc/core/RpcRoutingToken.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.js +21 -20
- package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.d.ts +10 -10
- package/lib/esm/rpc/core/RpcSessionInvocation.js +56 -56
- package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcManager.d.ts +48 -46
- package/lib/esm/rpc/web/BentleyCloudRpcManager.d.ts.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js +72 -68
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.d.ts +33 -33
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +137 -139
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/OpenAPI.d.ts +140 -140
- package/lib/esm/rpc/web/OpenAPI.js +56 -56
- package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.d.ts +35 -35
- package/lib/esm/rpc/web/RpcMultipart.js +47 -46
- package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcLogging.d.ts +28 -28
- package/lib/esm/rpc/web/WebAppRpcLogging.js +136 -136
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +89 -89
- package/lib/esm/rpc/web/WebAppRpcProtocol.js +112 -112
- package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.d.ts +67 -67
- package/lib/esm/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js +236 -235
- package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts +32 -32
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.js +369 -369
- package/lib/esm/tile/B3dmTileIO.d.ts +19 -19
- package/lib/esm/tile/B3dmTileIO.js +62 -62
- package/lib/esm/tile/B3dmTileIO.js.map +1 -1
- package/lib/esm/tile/CompositeTileIO.d.ts +15 -15
- package/lib/esm/tile/CompositeTileIO.js +22 -22
- package/lib/esm/tile/CompositeTileIO.js.map +1 -1
- package/lib/esm/tile/ElementGraphics.d.ts +145 -145
- package/lib/esm/tile/ElementGraphics.d.ts.map +1 -1
- package/lib/esm/tile/ElementGraphics.js +8 -8
- package/lib/esm/tile/GltfTileIO.d.ts +45 -45
- package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
- package/lib/esm/tile/GltfTileIO.js +105 -105
- package/lib/esm/tile/GltfTileIO.js.map +1 -1
- package/lib/esm/tile/I3dmTileIO.d.ts +20 -20
- package/lib/esm/tile/I3dmTileIO.js +36 -36
- package/lib/esm/tile/I3dmTileIO.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.d.ts +77 -75
- package/lib/esm/tile/IModelTileIO.d.ts.map +1 -1
- package/lib/esm/tile/IModelTileIO.js +93 -90
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/tile/PntsTileIO.d.ts +17 -17
- package/lib/esm/tile/PntsTileIO.js +22 -22
- package/lib/esm/tile/PntsTileIO.js.map +1 -1
- package/lib/esm/tile/TileIO.d.ts +66 -66
- package/lib/esm/tile/TileIO.js +110 -110
- package/lib/esm/tile/TileMetadata.d.ts +228 -228
- package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
- package/lib/esm/tile/TileMetadata.js +660 -661
- package/lib/esm/tile/TileMetadata.js.map +1 -1
- package/lib/esm/tile/Tileset3dSchema.d.ts +97 -0
- package/lib/esm/tile/Tileset3dSchema.d.ts.map +1 -0
- package/lib/esm/tile/Tileset3dSchema.js +9 -0
- package/lib/esm/tile/Tileset3dSchema.js.map +1 -0
- package/package.json +14 -14
- package/lib/cjs/CloudStorage.d.ts +0 -63
- package/lib/cjs/CloudStorage.d.ts.map +0 -1
- package/lib/cjs/CloudStorage.js +0 -114
- package/lib/cjs/CloudStorage.js.map +0 -1
- package/lib/cjs/CloudStorageTileCache.d.ts +0 -28
- package/lib/cjs/CloudStorageTileCache.d.ts.map +0 -1
- package/lib/cjs/CloudStorageTileCache.js +0 -67
- package/lib/cjs/CloudStorageTileCache.js.map +0 -1
- package/lib/esm/CloudStorage.d.ts +0 -63
- package/lib/esm/CloudStorage.d.ts.map +0 -1
- package/lib/esm/CloudStorage.js +0 -110
- package/lib/esm/CloudStorage.js.map +0 -1
- package/lib/esm/CloudStorageTileCache.d.ts +0 -28
- package/lib/esm/CloudStorageTileCache.d.ts.map +0 -1
- package/lib/esm/CloudStorageTileCache.js +0 -63
- package/lib/esm/CloudStorageTileCache.js.map +0 -1
|
@@ -1,1720 +1,1720 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElementGeometry = exports.BRepGeometryOperation = exports.ElementGeometryOpcode = void 0;
|
|
4
|
-
/*---------------------------------------------------------------------------------------------
|
|
5
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
-
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
/** @packageDocumentation
|
|
9
|
-
* @module Geometry
|
|
10
|
-
*/
|
|
11
|
-
const flatbuffers_1 = require("flatbuffers");
|
|
12
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
|
-
const core_geometry_1 = require("@itwin/core-geometry");
|
|
14
|
-
const ElementGeometryFB_1 = require("./ElementGeometryFB");
|
|
15
|
-
const Base64EncodedString_1 = require("../Base64EncodedString");
|
|
16
|
-
const TextString_1 = require("./TextString");
|
|
17
|
-
const ColorDef_1 = require("../ColorDef");
|
|
18
|
-
const GeometryParams_1 = require("../GeometryParams");
|
|
19
|
-
const Gradient_1 = require("../Gradient");
|
|
20
|
-
const ThematicDisplay_1 = require("../ThematicDisplay");
|
|
21
|
-
const AreaPattern_1 = require("./AreaPattern");
|
|
22
|
-
const GeometryStream_1 = require("./GeometryStream");
|
|
23
|
-
const ImageGraphic_1 = require("./ImageGraphic");
|
|
24
|
-
const LineStyle_1 = require("./LineStyle");
|
|
25
|
-
const Placement_1 = require("./Placement");
|
|
26
|
-
const ElementProps_1 = require("../ElementProps");
|
|
27
|
-
/** Specifies the type of an entry in a geometry stream.
|
|
28
|
-
* @see [[ElementGeometryDataEntry.opcode]].
|
|
29
|
-
* @public
|
|
30
|
-
* @extensions
|
|
31
|
-
*/
|
|
32
|
-
var ElementGeometryOpcode;
|
|
33
|
-
(function (ElementGeometryOpcode) {
|
|
34
|
-
/** Local range of the next geometric primitive in the geometry stream. */
|
|
35
|
-
ElementGeometryOpcode[ElementGeometryOpcode["SubGraphicRange"] = 2] = "SubGraphicRange";
|
|
36
|
-
/** A reference to a [GeometryPart]($backend). */
|
|
37
|
-
ElementGeometryOpcode[ElementGeometryOpcode["PartReference"] = 3] = "PartReference";
|
|
38
|
-
/** Sets symbology for subsequent geometry to override [SubCategory]($backend) appearance */
|
|
39
|
-
ElementGeometryOpcode[ElementGeometryOpcode["BasicSymbology"] = 4] = "BasicSymbology";
|
|
40
|
-
/** A line, line string, shape, or point string (automatic simplification of a [CurvePrimitive]($core-geometry) or [CurveCollection]($core-geometry)) */
|
|
41
|
-
ElementGeometryOpcode[ElementGeometryOpcode["PointPrimitive"] = 5] = "PointPrimitive";
|
|
42
|
-
/** A 2d line, line string, shape, or point string (automatic simplification of a [CurvePrimitive]($core-geometry) or [CurveCollection]($core-geometry)) */
|
|
43
|
-
ElementGeometryOpcode[ElementGeometryOpcode["PointPrimitive2d"] = 6] = "PointPrimitive2d";
|
|
44
|
-
/** Arc or ellipse (automatic simplification of a [CurvePrimitive]($core-geometry) or [CurveCollection]($core-geometry)) */
|
|
45
|
-
ElementGeometryOpcode[ElementGeometryOpcode["ArcPrimitive"] = 7] = "ArcPrimitive";
|
|
46
|
-
/** [CurveCollection]($core-geometry) */
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
48
|
-
ElementGeometryOpcode[ElementGeometryOpcode["CurveCollection"] = 8] = "CurveCollection";
|
|
49
|
-
/** [Polyface]($core-geometry) */
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
51
|
-
ElementGeometryOpcode[ElementGeometryOpcode["Polyface"] = 9] = "Polyface";
|
|
52
|
-
/** [CurvePrimitive]($core-geometry) */
|
|
53
|
-
ElementGeometryOpcode[ElementGeometryOpcode["CurvePrimitive"] = 10] = "CurvePrimitive";
|
|
54
|
-
/** [SolidPrimitive]($core-geometry) */
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
56
|
-
ElementGeometryOpcode[ElementGeometryOpcode["SolidPrimitive"] = 11] = "SolidPrimitive";
|
|
57
|
-
/** [BSplineSurface3d]($core-geometry) */
|
|
58
|
-
ElementGeometryOpcode[ElementGeometryOpcode["BsplineSurface"] = 12] = "BsplineSurface";
|
|
59
|
-
/** Opaque and [[Gradient]] fills. */
|
|
60
|
-
ElementGeometryOpcode[ElementGeometryOpcode["Fill"] = 19] = "Fill";
|
|
61
|
-
/** Hatch, cross-hatch, or [[AreaPattern]]. */
|
|
62
|
-
ElementGeometryOpcode[ElementGeometryOpcode["Pattern"] = 20] = "Pattern";
|
|
63
|
-
/** [[RenderMaterial]] */
|
|
64
|
-
ElementGeometryOpcode[ElementGeometryOpcode["Material"] = 21] = "Material";
|
|
65
|
-
/** [[TextString]] */
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
67
|
-
ElementGeometryOpcode[ElementGeometryOpcode["TextString"] = 22] = "TextString";
|
|
68
|
-
/** Specifies line style overrides as a [[LineStyle.Modifier]] */
|
|
69
|
-
ElementGeometryOpcode[ElementGeometryOpcode["LineStyleModifiers"] = 23] = "LineStyleModifiers";
|
|
70
|
-
/** Boundary represention solid, sheet, or wire body as a [[BRepEntity.DataProps]] */
|
|
71
|
-
ElementGeometryOpcode[ElementGeometryOpcode["BRep"] = 25] = "BRep";
|
|
72
|
-
/** Small single-tile raster image as an [[ImageGraphic]] */
|
|
73
|
-
ElementGeometryOpcode[ElementGeometryOpcode["Image"] = 28] = "Image";
|
|
74
|
-
})(ElementGeometryOpcode = exports.ElementGeometryOpcode || (exports.ElementGeometryOpcode = {}));
|
|
75
|
-
/** Values for [[BRepGeometryCreate.operation]]
|
|
76
|
-
* @alpha
|
|
77
|
-
*/
|
|
78
|
-
var BRepGeometryOperation;
|
|
79
|
-
(function (BRepGeometryOperation) {
|
|
80
|
-
/** Unite target (first entry) with one or more tool entities. */
|
|
81
|
-
BRepGeometryOperation[BRepGeometryOperation["Unite"] = 0] = "Unite";
|
|
82
|
-
/** Subtract one or more tool entities from target entity (first entry) */
|
|
83
|
-
BRepGeometryOperation[BRepGeometryOperation["Subtract"] = 1] = "Subtract";
|
|
84
|
-
/** Intersect target (first entry) with one or more tool entities */
|
|
85
|
-
BRepGeometryOperation[BRepGeometryOperation["Intersect"] = 2] = "Intersect";
|
|
86
|
-
/** Sew the given set of surfaces together by joining those that share edges in common */
|
|
87
|
-
BRepGeometryOperation[BRepGeometryOperation["Sew"] = 3] = "Sew";
|
|
88
|
-
/** Create a cut in the target (first entry) using a planar region (second entry) and optional depth */
|
|
89
|
-
BRepGeometryOperation[BRepGeometryOperation["Cut"] = 4] = "Cut";
|
|
90
|
-
/** Create a pad or pocket in the target (first entry) using a planar region (second entry) */
|
|
91
|
-
BRepGeometryOperation[BRepGeometryOperation["Emboss"] = 5] = "Emboss";
|
|
92
|
-
/** Create a solid from a surface by offsetting using the specified forward and backward distances */
|
|
93
|
-
BRepGeometryOperation[BRepGeometryOperation["Thicken"] = 6] = "Thicken";
|
|
94
|
-
/** Create a shelled solid by offsetting all faces by the supplied distance */
|
|
95
|
-
BRepGeometryOperation[BRepGeometryOperation["Hollow"] = 7] = "Hollow";
|
|
96
|
-
/** Create a solid or surface by sweeping a planar profile (first entry) along a path (second entry) */
|
|
97
|
-
BRepGeometryOperation[BRepGeometryOperation["Sweep"] = 8] = "Sweep";
|
|
98
|
-
/** Create a solid or surface by lofting through a set of paths or regions */
|
|
99
|
-
BRepGeometryOperation[BRepGeometryOperation["Loft"] = 9] = "Loft";
|
|
100
|
-
/** Create a solid or sheet with all non-smooth/non-laminar edges rounded */
|
|
101
|
-
BRepGeometryOperation[BRepGeometryOperation["Round"] = 10] = "Round";
|
|
102
|
-
/** Offset all faces of a solid or sheet target by the supplied distance. */
|
|
103
|
-
BRepGeometryOperation[BRepGeometryOperation["Offset"] = 11] = "Offset";
|
|
104
|
-
})(BRepGeometryOperation = exports.BRepGeometryOperation || (exports.BRepGeometryOperation = {}));
|
|
105
|
-
/** Provides utility functions for working with [[ElementGeometryDataEntry]].
|
|
106
|
-
* @alpha
|
|
107
|
-
*/
|
|
108
|
-
var ElementGeometry;
|
|
109
|
-
(function (ElementGeometry) {
|
|
110
|
-
/** [[ElementGeometry.Builder]] is a helper class for populating a [[ElementGeometryDataEntry]] array needed to create a [[GeometricElement]] or [[GeometryPart]]. */
|
|
111
|
-
class Builder {
|
|
112
|
-
constructor() {
|
|
113
|
-
/** GeometryStream entries */
|
|
114
|
-
this.entries = [];
|
|
115
|
-
}
|
|
116
|
-
/** Current placement transform, converts local coordinate (placement relative) input to world */
|
|
117
|
-
get localToWorld() { return this._localToWorld; }
|
|
118
|
-
/** Current inverse placement transform, converts world coordinate input to local (placement relative) */
|
|
119
|
-
get worldToLocal() { return this._worldToLocal; }
|
|
120
|
-
/** Supply optional local to world transform. Used to transform world coordinate input relative to element placement.
|
|
121
|
-
* For a [[GeometricElement]]'s placement to be meaningful, world coordinate geometry should never be appended to an element with an identity placement.
|
|
122
|
-
* Can be called with undefined or identity transform to start appending geometry supplied in local coordinates again.
|
|
123
|
-
*/
|
|
124
|
-
setLocalToWorld(localToWorld) {
|
|
125
|
-
this._localToWorld = (undefined === localToWorld || localToWorld.isIdentity ? undefined : localToWorld.clone());
|
|
126
|
-
this._worldToLocal = (undefined === this._localToWorld ? undefined : this._localToWorld.inverse());
|
|
127
|
-
}
|
|
128
|
-
/** Supply local to world transform from a Point3d and optional YawPitchRollAngles.
|
|
129
|
-
* @see [[Placement3d]]
|
|
130
|
-
*/
|
|
131
|
-
setLocalToWorld3d(origin, angles = core_geometry_1.YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {
|
|
132
|
-
this.setLocalToWorld(core_geometry_1.Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));
|
|
133
|
-
}
|
|
134
|
-
/** Supply local to world transform from a Point2d and optional Angle.
|
|
135
|
-
* @see [[Placement2d]]
|
|
136
|
-
*/
|
|
137
|
-
setLocalToWorld2d(origin, angle = core_geometry_1.Angle.createDegrees(0.0)) {
|
|
138
|
-
this.setLocalToWorld(core_geometry_1.Transform.createOriginAndMatrix(core_geometry_1.Point3d.createFrom(origin), core_geometry_1.Matrix3d.createRotationAroundVector(core_geometry_1.Vector3d.unitZ(), angle)));
|
|
139
|
-
}
|
|
140
|
-
/** Supply local to world transform from a PlacementProps2d or PlacementProps3d.
|
|
141
|
-
* @see [[PlacementProps]]
|
|
142
|
-
*/
|
|
143
|
-
setLocalToWorldFromPlacement(props) {
|
|
144
|
-
const placement = (0, ElementProps_1.isPlacement2dProps)(props) ? Placement_1.Placement2d.fromJSON(props) : Placement_1.Placement3d.fromJSON(props);
|
|
145
|
-
this.setLocalToWorld(placement.transform);
|
|
146
|
-
}
|
|
147
|
-
/** Compute angles suitable for passing to [[setLocalToWorld3d]] from an array of 3d points. */
|
|
148
|
-
static placementAnglesFromPoints(pts, defaultUp, result) {
|
|
149
|
-
const angles = result ? result : new core_geometry_1.YawPitchRollAngles();
|
|
150
|
-
const zVec = defaultUp ? defaultUp.clone() : core_geometry_1.Vector3d.unitZ();
|
|
151
|
-
const matrix = core_geometry_1.Matrix3d.createRigidHeadsUp(zVec);
|
|
152
|
-
core_geometry_1.YawPitchRollAngles.createFromMatrix3d(matrix, angles);
|
|
153
|
-
if (pts.length < 2 || pts[0].isAlmostEqual(pts[1]))
|
|
154
|
-
return angles;
|
|
155
|
-
// Check if points have a well defined normal to use instead of defaultUp...
|
|
156
|
-
const frameTransform = core_geometry_1.FrameBuilder.createFrameToDistantPoints(pts);
|
|
157
|
-
if (undefined !== frameTransform) {
|
|
158
|
-
const plane = core_geometry_1.Plane3dByOriginAndUnitNormal.create(pts[0], frameTransform.matrix.getColumn(2));
|
|
159
|
-
if (undefined !== plane && core_geometry_1.Point3dArray.isCloseToPlane(pts, plane))
|
|
160
|
-
zVec.setFrom(plane.getNormalRef());
|
|
161
|
-
}
|
|
162
|
-
const xVec = core_geometry_1.Vector3d.createStartEnd(pts[0], pts[1]);
|
|
163
|
-
if (xVec.isParallelTo(zVec, true))
|
|
164
|
-
return angles;
|
|
165
|
-
const yVec = xVec.unitCrossProduct(zVec);
|
|
166
|
-
if (undefined === yVec)
|
|
167
|
-
return angles;
|
|
168
|
-
core_geometry_1.Matrix3d.createColumns(xVec, yVec, zVec, matrix);
|
|
169
|
-
if (undefined === core_geometry_1.Matrix3d.createRigidFromMatrix3d(matrix, undefined, matrix))
|
|
170
|
-
return angles;
|
|
171
|
-
core_geometry_1.YawPitchRollAngles.createFromMatrix3d(matrix, angles);
|
|
172
|
-
return angles;
|
|
173
|
-
}
|
|
174
|
-
/** Compute angle suitable for passing to [[setLocalToWorld2d]] from an array of xy plane points. */
|
|
175
|
-
static placementAngleFromPoints(pts, result) {
|
|
176
|
-
const angles = ElementGeometry.Builder.placementAnglesFromPoints(pts);
|
|
177
|
-
if (undefined === result)
|
|
178
|
-
return angles.yaw;
|
|
179
|
-
result.setFrom(angles.yaw);
|
|
180
|
-
return result;
|
|
181
|
-
}
|
|
182
|
-
/** Store local ranges for all subsequent geometry appended. Can improve performance of range testing for elements with a GeometryStream
|
|
183
|
-
* containing more than one [[GeometryQuery]] differentiable by range. Not useful for a single [[GeometryQuery]] as its range and that of the [[GeometricElement]] are the same.
|
|
184
|
-
* Ignored when defining a [[GeometryPart]] and not needed when only appending [[GeometryPart]] instances to a [[GeometricElement]] as these store their own range.
|
|
185
|
-
*/
|
|
186
|
-
appendGeometryRanges() {
|
|
187
|
-
const entry = fromSubGraphicRange(core_geometry_1.Range3d.create()); // Computed on backend, just need opcode...
|
|
188
|
-
if (undefined === entry)
|
|
189
|
-
return false;
|
|
190
|
-
this.entries.push(entry);
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
/** Change [[GeometryParams]] for subsequent geometry.
|
|
194
|
-
* It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherits the symbology of their instance for anything not explicitly overridden.
|
|
195
|
-
*/
|
|
196
|
-
appendGeometryParamsChange(geomParams) {
|
|
197
|
-
return appendGeometryParams(geomParams, this.entries, this._worldToLocal);
|
|
198
|
-
}
|
|
199
|
-
/** Append a [[GeometryQuery]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array */
|
|
200
|
-
appendGeometryQuery(geometry) {
|
|
201
|
-
const entry = ElementGeometry.fromGeometryQuery(geometry, this._worldToLocal);
|
|
202
|
-
if (undefined === entry)
|
|
203
|
-
return false;
|
|
204
|
-
this.entries.push(entry);
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
/** Append a [[TextString]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array */
|
|
208
|
-
appendTextString(text) {
|
|
209
|
-
const entry = ElementGeometry.fromTextString(text.toJSON(), this._worldToLocal);
|
|
210
|
-
if (undefined === entry)
|
|
211
|
-
return false;
|
|
212
|
-
this.entries.push(entry);
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
/** Append a [[ImageGraphic]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array */
|
|
216
|
-
appendImageGraphic(image) {
|
|
217
|
-
const entry = ElementGeometry.fromImageGraphic(image.toJSON(), this._worldToLocal);
|
|
218
|
-
if (undefined === entry)
|
|
219
|
-
return false;
|
|
220
|
-
this.entries.push(entry);
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
/** Append a [[BRepEntity.DataProps]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array.
|
|
224
|
-
* Provided for compatibility with GeometryStreamBuilder only.
|
|
225
|
-
* Backend code should use IModelDb.createBRepGeometry to create a brep [[ElementGeometryDataEntry]] directly.
|
|
226
|
-
*/
|
|
227
|
-
appendBRepData(brep) {
|
|
228
|
-
const entry = ElementGeometry.fromBRep(brep, this._worldToLocal);
|
|
229
|
-
if (undefined === entry)
|
|
230
|
-
return false;
|
|
231
|
-
this.entries.push(entry);
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
/** Append a [[GeometryPart]] instance with relative transform to the [[ElementGeometryDataEntry]] array for creating a [[GeometricElement]].
|
|
235
|
-
* Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
|
|
236
|
-
*/
|
|
237
|
-
appendGeometryPart(partId, partTransform) {
|
|
238
|
-
const entry = ElementGeometry.fromGeometryPart(partId, partTransform, this._worldToLocal);
|
|
239
|
-
if (undefined === entry)
|
|
240
|
-
return false;
|
|
241
|
-
this.entries.push(entry);
|
|
242
|
-
return true;
|
|
243
|
-
}
|
|
244
|
-
/** Append a [[GeometryPart]] instance with relative position, orientation, and scale to the [[ElementGeometryDataEntry]] array for creating a [[GeometricElement3d]].
|
|
245
|
-
* Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
|
|
246
|
-
*/
|
|
247
|
-
appendGeometryPart3d(partId, instanceOrigin, instanceRotation, instanceScale) {
|
|
248
|
-
const partTransform = core_geometry_1.Transform.createOriginAndMatrix(instanceOrigin, instanceRotation ? instanceRotation.toMatrix3d() : core_geometry_1.Matrix3d.createIdentity());
|
|
249
|
-
if (undefined !== instanceScale)
|
|
250
|
-
partTransform.matrix.scaleColumnsInPlace(instanceScale, instanceScale, instanceScale);
|
|
251
|
-
return this.appendGeometryPart(partId, partTransform);
|
|
252
|
-
}
|
|
253
|
-
/** Append a [[GeometryPart]] instance with relative position, orientation, and scale to the [[ElementGeometryDataEntry]] array for creating a [[GeometricElement2d]].
|
|
254
|
-
* Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
|
|
255
|
-
*/
|
|
256
|
-
appendGeometryPart2d(partId, instanceOrigin, instanceRotation, instanceScale) {
|
|
257
|
-
return this.appendGeometryPart3d(partId, instanceOrigin ? core_geometry_1.Point3d.createFrom(instanceOrigin) : undefined, instanceRotation ? new core_geometry_1.YawPitchRollAngles(instanceRotation) : undefined, instanceScale);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
ElementGeometry.Builder = Builder;
|
|
261
|
-
class IteratorEntry {
|
|
262
|
-
constructor(geomParams, localToWorld, applyLocalToWorld) {
|
|
263
|
-
this.geomParams = geomParams;
|
|
264
|
-
this.localToWorld = localToWorld;
|
|
265
|
-
this._applyLocalToWorld = applyLocalToWorld ? !localToWorld.isIdentity : false;
|
|
266
|
-
}
|
|
267
|
-
get value() { return this._value; }
|
|
268
|
-
set value(value) { this._value = value; }
|
|
269
|
-
get outputTransform() {
|
|
270
|
-
return this._applyLocalToWorld ? this.localToWorld : undefined;
|
|
271
|
-
}
|
|
272
|
-
/** Return the [[GeometryQuery]] representation for the current entry */
|
|
273
|
-
toGeometryQuery() {
|
|
274
|
-
return toGeometryQuery(this.value, this.outputTransform);
|
|
275
|
-
}
|
|
276
|
-
/** Return the [[BRepEntity.DataProps]] representation for the current entry for checking brep type and face attachments. */
|
|
277
|
-
toBRepData(wantBRepData = false) {
|
|
278
|
-
return toBRep(this.value, wantBRepData, this.outputTransform);
|
|
279
|
-
}
|
|
280
|
-
/** Return the [[TextString]] representation for the current entry */
|
|
281
|
-
toTextString() {
|
|
282
|
-
const props = toTextString(this.value, this.outputTransform);
|
|
283
|
-
return (undefined !== props ? new TextString_1.TextString(props) : undefined);
|
|
284
|
-
}
|
|
285
|
-
/** Return the [[ImageGraphic]] representation for the current entry */
|
|
286
|
-
toImageGraphic() {
|
|
287
|
-
const props = toImageGraphic(this.value, this.outputTransform);
|
|
288
|
-
return (undefined !== props ? ImageGraphic_1.ImageGraphic.fromJSON(props) : undefined);
|
|
289
|
-
}
|
|
290
|
-
/** Return the GeometryPart information for the current entry */
|
|
291
|
-
toGeometryPart(partToLocal, partToWorld) {
|
|
292
|
-
if (undefined === partToLocal && undefined !== partToWorld)
|
|
293
|
-
partToLocal = core_geometry_1.Transform.createIdentity();
|
|
294
|
-
const partId = toGeometryPart(this.value, partToLocal);
|
|
295
|
-
if (undefined === partId || undefined === partToLocal || undefined === partToWorld)
|
|
296
|
-
return partId;
|
|
297
|
-
if (undefined !== this.localToWorld)
|
|
298
|
-
this.localToWorld.multiplyTransformTransform(partToLocal, partToWorld);
|
|
299
|
-
return partId;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
ElementGeometry.IteratorEntry = IteratorEntry;
|
|
303
|
-
/** [[ElementGeometry.Iterator]] is a helper class for iterating a [[ElementGeometryDataEntry]] array.
|
|
304
|
-
* Each [[ElementGeometryDataEntry]] returned by the iterator represents exactly one displayable entry.
|
|
305
|
-
*/
|
|
306
|
-
class Iterator {
|
|
307
|
-
/** Construct a new Iterator given a [[ElementGeometryInfo]] from either a [[GeometricElement3d]], [[GeometricElement2d]], or [[GeometryPart]].
|
|
308
|
-
* Supply the optional [[GeometryParams]] and localToWorld transform to iterate a [[GeometryPart]] in the context of a [[GeometricElement]] reference.
|
|
309
|
-
*/
|
|
310
|
-
constructor(info, categoryOrGeometryParams, localToWorld) {
|
|
311
|
-
/** Current entry position */
|
|
312
|
-
this._index = 0;
|
|
313
|
-
/** Whether deserialized entry data is returned in world or local coordinates */
|
|
314
|
-
this._applyLocalToWorld = false;
|
|
315
|
-
this.entryArray = info.entryArray;
|
|
316
|
-
this.viewIndependent = info.viewIndependent;
|
|
317
|
-
this.brepsPresent = info.brepsPresent;
|
|
318
|
-
if (undefined !== info.categoryId)
|
|
319
|
-
categoryOrGeometryParams = info.categoryId;
|
|
320
|
-
if (undefined !== categoryOrGeometryParams)
|
|
321
|
-
this._appearance = typeof categoryOrGeometryParams === "string" ? new GeometryParams_1.GeometryParams(categoryOrGeometryParams) : categoryOrGeometryParams;
|
|
322
|
-
else
|
|
323
|
-
this._appearance = new GeometryParams_1.GeometryParams(core_bentley_1.Id64.invalid);
|
|
324
|
-
if (undefined !== info.sourceToWorld)
|
|
325
|
-
localToWorld = ElementGeometry.toTransform(info.sourceToWorld);
|
|
326
|
-
if (undefined !== localToWorld)
|
|
327
|
-
this._localToWorld = localToWorld;
|
|
328
|
-
else
|
|
329
|
-
this._localToWorld = core_geometry_1.Transform.createIdentity();
|
|
330
|
-
const orgAng = core_geometry_1.YawPitchRollAngles.tryFromTransform(this._localToWorld);
|
|
331
|
-
if (undefined === orgAng.angles)
|
|
332
|
-
orgAng.angles = core_geometry_1.YawPitchRollAngles.createDegrees(0, 0, 0);
|
|
333
|
-
let bbox = (undefined !== info.bbox ? ElementGeometry.toElementAlignedBox3d(info.bbox) : undefined);
|
|
334
|
-
if (undefined === bbox)
|
|
335
|
-
bbox = core_geometry_1.Range3d.createNull();
|
|
336
|
-
this.placement = new Placement_1.Placement3d(orgAng.origin, orgAng.angles, bbox);
|
|
337
|
-
}
|
|
338
|
-
/** Call to return deserialized entry data in world coordinates */
|
|
339
|
-
requestWorldCoordinates() {
|
|
340
|
-
this._applyLocalToWorld = !this._localToWorld.isIdentity;
|
|
341
|
-
}
|
|
342
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
343
|
-
get entry() {
|
|
344
|
-
if (undefined === this._entry)
|
|
345
|
-
this._entry = new IteratorEntry(this._appearance, this._localToWorld, this._applyLocalToWorld);
|
|
346
|
-
return this._entry;
|
|
347
|
-
}
|
|
348
|
-
/** Advance to next displayable opcode (geometric entry or geometry part) while updating the current [[GeometryParams]] from appearance related opcodes. */
|
|
349
|
-
next() {
|
|
350
|
-
while (this._index < this.entryArray.length) {
|
|
351
|
-
const value = this.entryArray[this._index++];
|
|
352
|
-
if (ElementGeometry.isAppearanceEntry(value)) {
|
|
353
|
-
const localToWorld = (this._applyLocalToWorld ? this._localToWorld : undefined);
|
|
354
|
-
ElementGeometry.updateGeometryParams(value, this.entry.geomParams, localToWorld);
|
|
355
|
-
}
|
|
356
|
-
else if (ElementGeometryOpcode.SubGraphicRange === value.opcode) {
|
|
357
|
-
// NOTE: localRange remains valid until the next sub-range entry is encountered...
|
|
358
|
-
this.entry.localRange = ElementGeometry.toSubGraphicRange(value);
|
|
359
|
-
}
|
|
360
|
-
else if (ElementGeometryOpcode.PartReference === value.opcode) {
|
|
361
|
-
this.entry.value = value;
|
|
362
|
-
return { value: this.entry, done: false };
|
|
363
|
-
}
|
|
364
|
-
else if (ElementGeometry.isGeometricEntry(value)) {
|
|
365
|
-
this.entry.value = value;
|
|
366
|
-
return { value: this.entry, done: false };
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
return { value: this.entry, done: true };
|
|
370
|
-
}
|
|
371
|
-
[Symbol.iterator]() {
|
|
372
|
-
return this;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
ElementGeometry.Iterator = Iterator;
|
|
376
|
-
/** Return whether the supplied entry can be represented as a [[GeometryQuery]] */
|
|
377
|
-
function isGeometryQueryEntry(entry) {
|
|
378
|
-
switch (entry.opcode) {
|
|
379
|
-
case ElementGeometryOpcode.PointPrimitive:
|
|
380
|
-
case ElementGeometryOpcode.PointPrimitive2d:
|
|
381
|
-
case ElementGeometryOpcode.ArcPrimitive:
|
|
382
|
-
case ElementGeometryOpcode.CurveCollection:
|
|
383
|
-
case ElementGeometryOpcode.Polyface:
|
|
384
|
-
case ElementGeometryOpcode.CurvePrimitive:
|
|
385
|
-
case ElementGeometryOpcode.SolidPrimitive:
|
|
386
|
-
case ElementGeometryOpcode.BsplineSurface:
|
|
387
|
-
return true;
|
|
388
|
-
default:
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
ElementGeometry.isGeometryQueryEntry = isGeometryQueryEntry;
|
|
393
|
-
/** Return whether the supplied entry is displayable geometry [[GeometryQuery]], [[BRepEntity.DataProps]], [[TextString]], or [[ImageGraphic]] */
|
|
394
|
-
function isGeometricEntry(entry) {
|
|
395
|
-
switch (entry.opcode) {
|
|
396
|
-
case ElementGeometryOpcode.BRep:
|
|
397
|
-
case ElementGeometryOpcode.TextString:
|
|
398
|
-
case ElementGeometryOpcode.Image:
|
|
399
|
-
return true;
|
|
400
|
-
default:
|
|
401
|
-
return isGeometryQueryEntry(entry);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
ElementGeometry.isGeometricEntry = isGeometricEntry;
|
|
405
|
-
/** Return whether the supplied entry is geometric or a part reference */
|
|
406
|
-
function isDisplayableEntry(entry) {
|
|
407
|
-
switch (entry.opcode) {
|
|
408
|
-
case ElementGeometryOpcode.PartReference:
|
|
409
|
-
return true;
|
|
410
|
-
default:
|
|
411
|
-
return isGeometricEntry(entry);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
ElementGeometry.isDisplayableEntry = isDisplayableEntry;
|
|
415
|
-
/** Return whether the supplied entry represents appearance information */
|
|
416
|
-
function isAppearanceEntry(entry) {
|
|
417
|
-
switch (entry.opcode) {
|
|
418
|
-
case ElementGeometryOpcode.BasicSymbology:
|
|
419
|
-
case ElementGeometryOpcode.Fill:
|
|
420
|
-
case ElementGeometryOpcode.Pattern:
|
|
421
|
-
case ElementGeometryOpcode.Material:
|
|
422
|
-
case ElementGeometryOpcode.LineStyleModifiers:
|
|
423
|
-
return true;
|
|
424
|
-
default:
|
|
425
|
-
return false;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
ElementGeometry.isAppearanceEntry = isAppearanceEntry;
|
|
429
|
-
/** Return whether the supplied entry represents a single open curve or path */
|
|
430
|
-
function isCurve(entry) {
|
|
431
|
-
switch (entry.opcode) {
|
|
432
|
-
case ElementGeometryOpcode.PointPrimitive: {
|
|
433
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
434
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
435
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open === ppfb.boundary());
|
|
436
|
-
}
|
|
437
|
-
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
438
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
439
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
440
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open === ppfb.boundary());
|
|
441
|
-
}
|
|
442
|
-
case ElementGeometryOpcode.ArcPrimitive: {
|
|
443
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
444
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
445
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open === ppfb.boundary());
|
|
446
|
-
}
|
|
447
|
-
case ElementGeometryOpcode.CurvePrimitive: {
|
|
448
|
-
// should never be a point string or closed bcurve...
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
case ElementGeometryOpcode.CurveCollection: {
|
|
452
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
453
|
-
if (undefined === geom || Array.isArray(geom))
|
|
454
|
-
return false;
|
|
455
|
-
return ("curveCollection" === geom.geometryCategory && !geom.isAnyRegionType);
|
|
456
|
-
}
|
|
457
|
-
default:
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
ElementGeometry.isCurve = isCurve;
|
|
462
|
-
/** Return whether the supplied entry represents a loop, planar region, open polyface, or sheet body */
|
|
463
|
-
function isSurface(entry) {
|
|
464
|
-
switch (entry.opcode) {
|
|
465
|
-
case ElementGeometryOpcode.PointPrimitive: {
|
|
466
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
467
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
468
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary());
|
|
469
|
-
}
|
|
470
|
-
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
471
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
472
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
473
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary());
|
|
474
|
-
}
|
|
475
|
-
case ElementGeometryOpcode.ArcPrimitive: {
|
|
476
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
477
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
478
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary());
|
|
479
|
-
}
|
|
480
|
-
case ElementGeometryOpcode.CurvePrimitive: {
|
|
481
|
-
// should never be a closed bcurve...
|
|
482
|
-
return false;
|
|
483
|
-
}
|
|
484
|
-
case ElementGeometryOpcode.CurveCollection: {
|
|
485
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
486
|
-
if (undefined === geom || Array.isArray(geom))
|
|
487
|
-
return false;
|
|
488
|
-
return ("curveCollection" === geom.geometryCategory && geom.isAnyRegionType);
|
|
489
|
-
}
|
|
490
|
-
case ElementGeometryOpcode.SolidPrimitive: {
|
|
491
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
492
|
-
if (undefined === geom || Array.isArray(geom))
|
|
493
|
-
return false;
|
|
494
|
-
return ("solid" === geom.geometryCategory && !geom.isClosedVolume);
|
|
495
|
-
}
|
|
496
|
-
case ElementGeometryOpcode.Polyface: {
|
|
497
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
498
|
-
if (undefined === geom || Array.isArray(geom))
|
|
499
|
-
return false;
|
|
500
|
-
if ("polyface" !== geom.geometryCategory)
|
|
501
|
-
return false;
|
|
502
|
-
const polyface = geom;
|
|
503
|
-
switch (polyface.expectedClosure) {
|
|
504
|
-
case 0:
|
|
505
|
-
return !core_geometry_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface);
|
|
506
|
-
case 1:
|
|
507
|
-
return true;
|
|
508
|
-
case 2:
|
|
509
|
-
default:
|
|
510
|
-
return false;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
case ElementGeometryOpcode.BsplineSurface: {
|
|
514
|
-
// never treated as a solid even if closed/periodic in u/v...
|
|
515
|
-
return true;
|
|
516
|
-
}
|
|
517
|
-
case ElementGeometryOpcode.BRep: {
|
|
518
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
519
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
520
|
-
return (ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet === ppfb.brepType());
|
|
521
|
-
}
|
|
522
|
-
default:
|
|
523
|
-
return false;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
ElementGeometry.isSurface = isSurface;
|
|
527
|
-
/** Return whether the supplied entry represents a capped solid, closed polyface, or solid body */
|
|
528
|
-
function isSolid(entry) {
|
|
529
|
-
switch (entry.opcode) {
|
|
530
|
-
case ElementGeometryOpcode.SolidPrimitive: {
|
|
531
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
532
|
-
if (undefined === geom || Array.isArray(geom))
|
|
533
|
-
return false;
|
|
534
|
-
return ("solid" === geom.geometryCategory && geom.isClosedVolume);
|
|
535
|
-
}
|
|
536
|
-
case ElementGeometryOpcode.Polyface: {
|
|
537
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
538
|
-
if (undefined === geom || Array.isArray(geom))
|
|
539
|
-
return false;
|
|
540
|
-
if ("polyface" !== geom.geometryCategory)
|
|
541
|
-
return false;
|
|
542
|
-
const polyface = geom;
|
|
543
|
-
switch (polyface.expectedClosure) {
|
|
544
|
-
case 0:
|
|
545
|
-
return core_geometry_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface);
|
|
546
|
-
case 2:
|
|
547
|
-
return true;
|
|
548
|
-
case 1:
|
|
549
|
-
default:
|
|
550
|
-
return false;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
case ElementGeometryOpcode.BRep: {
|
|
554
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
555
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
556
|
-
return (ElementGeometryFB_1.EGFBAccessors.BRepType.Solid === ppfb.brepType());
|
|
557
|
-
}
|
|
558
|
-
default:
|
|
559
|
-
return false;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
ElementGeometry.isSolid = isSolid;
|
|
563
|
-
/** Return the body type that would be used to represent the supplied entry */
|
|
564
|
-
function getBRepEntityType(entry) {
|
|
565
|
-
switch (entry.opcode) {
|
|
566
|
-
case ElementGeometryOpcode.PointPrimitive: {
|
|
567
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
568
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
569
|
-
if (ElementGeometryFB_1.EGFBAccessors.BoundaryType.None === ppfb.boundary())
|
|
570
|
-
return undefined;
|
|
571
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
572
|
-
}
|
|
573
|
-
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
574
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
575
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
576
|
-
if (ElementGeometryFB_1.EGFBAccessors.BoundaryType.None === ppfb.boundary())
|
|
577
|
-
return undefined;
|
|
578
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
579
|
-
}
|
|
580
|
-
case ElementGeometryOpcode.ArcPrimitive: {
|
|
581
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
582
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
583
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
584
|
-
}
|
|
585
|
-
case ElementGeometryOpcode.CurvePrimitive: {
|
|
586
|
-
// should never be a point string or closed bcurve...
|
|
587
|
-
return GeometryStream_1.BRepEntity.Type.Wire;
|
|
588
|
-
}
|
|
589
|
-
case ElementGeometryOpcode.CurveCollection: {
|
|
590
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
591
|
-
if (undefined === geom || Array.isArray(geom))
|
|
592
|
-
return undefined;
|
|
593
|
-
if ("curveCollection" !== geom.geometryCategory)
|
|
594
|
-
return undefined;
|
|
595
|
-
const curves = geom;
|
|
596
|
-
return (curves.isAnyRegionType ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
597
|
-
}
|
|
598
|
-
case ElementGeometryOpcode.SolidPrimitive: {
|
|
599
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
600
|
-
if (undefined === geom || Array.isArray(geom))
|
|
601
|
-
return undefined;
|
|
602
|
-
if ("solid" !== geom.geometryCategory)
|
|
603
|
-
return undefined;
|
|
604
|
-
const solid = geom;
|
|
605
|
-
return (solid.isClosedVolume ? GeometryStream_1.BRepEntity.Type.Solid : GeometryStream_1.BRepEntity.Type.Sheet);
|
|
606
|
-
}
|
|
607
|
-
case ElementGeometryOpcode.BsplineSurface: {
|
|
608
|
-
// always a surface...
|
|
609
|
-
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
610
|
-
}
|
|
611
|
-
case ElementGeometryOpcode.Polyface: {
|
|
612
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
613
|
-
if (undefined === geom || Array.isArray(geom))
|
|
614
|
-
return undefined;
|
|
615
|
-
if ("polyface" !== geom.geometryCategory)
|
|
616
|
-
return undefined;
|
|
617
|
-
const polyface = geom;
|
|
618
|
-
switch (polyface.expectedClosure) {
|
|
619
|
-
case 0:
|
|
620
|
-
return core_geometry_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface) ? GeometryStream_1.BRepEntity.Type.Solid : GeometryStream_1.BRepEntity.Type.Sheet;
|
|
621
|
-
case 1:
|
|
622
|
-
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
623
|
-
case 2:
|
|
624
|
-
return GeometryStream_1.BRepEntity.Type.Solid;
|
|
625
|
-
default:
|
|
626
|
-
return undefined;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
case ElementGeometryOpcode.BRep: {
|
|
630
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
631
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
632
|
-
switch (ppfb.brepType()) {
|
|
633
|
-
case ElementGeometryFB_1.EGFBAccessors.BRepType.Wire:
|
|
634
|
-
return GeometryStream_1.BRepEntity.Type.Wire; // always be persisted as a curve type...
|
|
635
|
-
case ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet:
|
|
636
|
-
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
637
|
-
case ElementGeometryFB_1.EGFBAccessors.BRepType.Solid:
|
|
638
|
-
return GeometryStream_1.BRepEntity.Type.Solid;
|
|
639
|
-
default:
|
|
640
|
-
return undefined;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
default:
|
|
644
|
-
return undefined;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
ElementGeometry.getBRepEntityType = getBRepEntityType;
|
|
648
|
-
/** Return entry as a [[GeometryQuery]] */
|
|
649
|
-
function toGeometryQuery(entry, localToWorld) {
|
|
650
|
-
if (!isGeometryQueryEntry(entry))
|
|
651
|
-
return undefined;
|
|
652
|
-
switch (entry.opcode) {
|
|
653
|
-
case ElementGeometryOpcode.PointPrimitive: {
|
|
654
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
655
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
656
|
-
const pts = [];
|
|
657
|
-
for (let i = 0; i < ppfb.coordsLength(); i++)
|
|
658
|
-
pts.push(core_geometry_1.Point3d.create(ppfb.coords(i).x(), ppfb.coords(i).y(), ppfb.coords(i).z()));
|
|
659
|
-
if (0 === pts.length)
|
|
660
|
-
return undefined;
|
|
661
|
-
if (undefined !== localToWorld)
|
|
662
|
-
localToWorld.multiplyPoint3dArrayInPlace(pts);
|
|
663
|
-
switch (ppfb.boundary()) {
|
|
664
|
-
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open:
|
|
665
|
-
return core_geometry_1.LineString3d.createPoints(pts);
|
|
666
|
-
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed:
|
|
667
|
-
return core_geometry_1.Loop.createPolygon(pts);
|
|
668
|
-
default:
|
|
669
|
-
return core_geometry_1.PointString3d.createPoints(pts);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
673
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
674
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
675
|
-
const pts = [];
|
|
676
|
-
for (let i = 0; i < ppfb.coordsLength(); i++)
|
|
677
|
-
pts.push(core_geometry_1.Point3d.create(ppfb.coords(i).x(), ppfb.coords(i).y()));
|
|
678
|
-
if (0 === pts.length)
|
|
679
|
-
return undefined;
|
|
680
|
-
if (undefined !== localToWorld)
|
|
681
|
-
localToWorld.multiplyPoint3dArrayInPlace(pts);
|
|
682
|
-
switch (ppfb.boundary()) {
|
|
683
|
-
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open:
|
|
684
|
-
return core_geometry_1.LineString3d.createPoints(pts);
|
|
685
|
-
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed:
|
|
686
|
-
return core_geometry_1.Loop.createPolygon(pts);
|
|
687
|
-
default:
|
|
688
|
-
return core_geometry_1.PointString3d.createPoints(pts);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
case ElementGeometryOpcode.ArcPrimitive: {
|
|
692
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
693
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
694
|
-
const center = core_geometry_1.Point3d.create(ppfb.center().x(), ppfb.center().y(), ppfb.center().z());
|
|
695
|
-
const vector0 = core_geometry_1.Vector3d.create(ppfb.vector0().x(), ppfb.vector0().y(), ppfb.vector0().z());
|
|
696
|
-
const vector90 = core_geometry_1.Vector3d.create(ppfb.vector90().x(), ppfb.vector90().y(), ppfb.vector90().z());
|
|
697
|
-
const arc = core_geometry_1.Arc3d.create(center, vector0, vector90, core_geometry_1.AngleSweep.createStartSweepRadians(ppfb.start(), ppfb.sweep()));
|
|
698
|
-
if (undefined !== localToWorld && !arc.tryTransformInPlace(localToWorld))
|
|
699
|
-
return undefined;
|
|
700
|
-
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? core_geometry_1.Loop.create(arc) : arc);
|
|
701
|
-
}
|
|
702
|
-
case ElementGeometryOpcode.CurvePrimitive:
|
|
703
|
-
case ElementGeometryOpcode.CurveCollection:
|
|
704
|
-
case ElementGeometryOpcode.SolidPrimitive:
|
|
705
|
-
case ElementGeometryOpcode.BsplineSurface:
|
|
706
|
-
case ElementGeometryOpcode.Polyface:
|
|
707
|
-
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
708
|
-
if (undefined === geom || Array.isArray(geom))
|
|
709
|
-
return undefined; // Should always be a single entry not an array...
|
|
710
|
-
if (undefined !== localToWorld && !geom.tryTransformInPlace(localToWorld))
|
|
711
|
-
return undefined;
|
|
712
|
-
return geom;
|
|
713
|
-
default:
|
|
714
|
-
return undefined; // Not a GeometryQuery, need to be handled explicitly...
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
ElementGeometry.toGeometryQuery = toGeometryQuery;
|
|
718
|
-
/** Create entry from a [[GeometryQuery]] */
|
|
719
|
-
function fromGeometryQuery(geom, worldToLocal) {
|
|
720
|
-
let opcode;
|
|
721
|
-
switch (geom.geometryCategory) {
|
|
722
|
-
case "bsurf":
|
|
723
|
-
opcode = ElementGeometryOpcode.BsplineSurface;
|
|
724
|
-
break;
|
|
725
|
-
case "curveCollection":
|
|
726
|
-
opcode = ElementGeometryOpcode.CurveCollection;
|
|
727
|
-
break;
|
|
728
|
-
case "curvePrimitive":
|
|
729
|
-
case "pointCollection":
|
|
730
|
-
opcode = ElementGeometryOpcode.CurvePrimitive;
|
|
731
|
-
break;
|
|
732
|
-
case "polyface":
|
|
733
|
-
opcode = ElementGeometryOpcode.Polyface;
|
|
734
|
-
break;
|
|
735
|
-
case "solid":
|
|
736
|
-
opcode = ElementGeometryOpcode.SolidPrimitive;
|
|
737
|
-
break;
|
|
738
|
-
default:
|
|
739
|
-
return undefined;
|
|
740
|
-
}
|
|
741
|
-
if (undefined !== worldToLocal) {
|
|
742
|
-
const localGeom = geom.cloneTransformed(worldToLocal);
|
|
743
|
-
if (undefined === localGeom)
|
|
744
|
-
return undefined;
|
|
745
|
-
geom = localGeom;
|
|
746
|
-
}
|
|
747
|
-
const data = core_geometry_1.BentleyGeometryFlatBuffer.geometryToBytes(geom, true);
|
|
748
|
-
if (undefined === data)
|
|
749
|
-
return undefined;
|
|
750
|
-
return { opcode, data };
|
|
751
|
-
}
|
|
752
|
-
ElementGeometry.fromGeometryQuery = fromGeometryQuery;
|
|
753
|
-
/** Return entry as a [[TextString]] */
|
|
754
|
-
function toTextString(entry, localToWorld) {
|
|
755
|
-
if (ElementGeometryOpcode.TextString !== entry.opcode)
|
|
756
|
-
return undefined;
|
|
757
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
758
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.TextString.getRootAsTextString(buffer);
|
|
759
|
-
const style = ppfb.style();
|
|
760
|
-
if (null === style)
|
|
761
|
-
return undefined;
|
|
762
|
-
const text = ppfb.text();
|
|
763
|
-
const props = { text: (null !== text ? text : ""), font: style.fontId(), height: style.height() };
|
|
764
|
-
props.widthFactor = style.widthFactor();
|
|
765
|
-
props.bold = style.isBold();
|
|
766
|
-
props.italic = style.isItalic();
|
|
767
|
-
props.underline = style.isUnderlined();
|
|
768
|
-
const transform = ppfb.transform();
|
|
769
|
-
if (null !== transform) {
|
|
770
|
-
props.origin = core_geometry_1.Point3d.create(transform.form3d03(), transform.form3d13(), transform.form3d23());
|
|
771
|
-
props.rotation = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(core_geometry_1.Matrix3d.createRowValues(transform.form3d00(), transform.form3d01(), transform.form3d02(), transform.form3d10(), transform.form3d11(), transform.form3d12(), transform.form3d20(), transform.form3d21(), transform.form3d22()));
|
|
772
|
-
}
|
|
773
|
-
if (undefined === localToWorld)
|
|
774
|
-
return props;
|
|
775
|
-
const textString = new TextString_1.TextString(props);
|
|
776
|
-
if (!textString.transformInPlace(localToWorld))
|
|
777
|
-
return undefined;
|
|
778
|
-
return textString.toJSON();
|
|
779
|
-
}
|
|
780
|
-
ElementGeometry.toTextString = toTextString;
|
|
781
|
-
/** Create entry from a [[TextString]] */
|
|
782
|
-
function fromTextString(text, worldToLocal) {
|
|
783
|
-
if (undefined !== worldToLocal) {
|
|
784
|
-
const localText = new TextString_1.TextString(text);
|
|
785
|
-
if (!localText.transformInPlace(worldToLocal))
|
|
786
|
-
return undefined;
|
|
787
|
-
text = localText.toJSON();
|
|
788
|
-
}
|
|
789
|
-
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
790
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.TextString;
|
|
791
|
-
const textOffset = fbb.createString(text.text);
|
|
792
|
-
const styleOffset = ElementGeometryFB_1.EGFBAccessors.TextStringStyle.createTextStringStyle(fbb, 1, 0, text.font, undefined === text.bold ? false : text.bold, undefined === text.italic ? false : text.italic, undefined === text.underline ? false : text.underline, text.height, undefined === text.widthFactor ? 1.0 : text.widthFactor);
|
|
793
|
-
builder.startTextString(fbb);
|
|
794
|
-
builder.addMajorVersion(fbb, 1);
|
|
795
|
-
builder.addMinorVersion(fbb, 0);
|
|
796
|
-
builder.addText(fbb, textOffset);
|
|
797
|
-
builder.addStyle(fbb, styleOffset);
|
|
798
|
-
if (undefined !== text.origin || undefined !== text.rotation) {
|
|
799
|
-
const origin = core_geometry_1.Point3d.fromJSON(text.origin);
|
|
800
|
-
const angles = core_geometry_1.YawPitchRollAngles.fromJSON(text.rotation);
|
|
801
|
-
const matrix = angles.toMatrix3d();
|
|
802
|
-
const coffs = matrix.coffs;
|
|
803
|
-
const transformOffset = ElementGeometryFB_1.EGFBAccessors.TextStringTransform.createTextStringTransform(fbb, coffs[0], coffs[1], coffs[2], origin.x, coffs[3], coffs[4], coffs[5], origin.y, coffs[6], coffs[7], coffs[8], origin.z);
|
|
804
|
-
builder.addTransform(fbb, transformOffset);
|
|
805
|
-
}
|
|
806
|
-
const mLoc = builder.endTextString(fbb);
|
|
807
|
-
fbb.finish(mLoc);
|
|
808
|
-
const data = fbb.asUint8Array();
|
|
809
|
-
return { opcode: ElementGeometryOpcode.TextString, data };
|
|
810
|
-
}
|
|
811
|
-
ElementGeometry.fromTextString = fromTextString;
|
|
812
|
-
/** Return entry as a [[ImageGraphic]] */
|
|
813
|
-
function toImageGraphic(entry, localToWorld) {
|
|
814
|
-
if (ElementGeometryOpcode.Image !== entry.opcode)
|
|
815
|
-
return undefined;
|
|
816
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
817
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.Image.getRootAsImage(buffer);
|
|
818
|
-
const textureLong = ppfb.textureId();
|
|
819
|
-
const textureId = core_bentley_1.Id64.fromUint32Pair(textureLong.low, textureLong.high);
|
|
820
|
-
const hasBorder = (1 === ppfb.drawBorder());
|
|
821
|
-
const corners = new ImageGraphic_1.ImageGraphicCorners(core_geometry_1.Point3d.createZero(), core_geometry_1.Point3d.createZero(), core_geometry_1.Point3d.createZero(), core_geometry_1.Point3d.createZero());
|
|
822
|
-
const corner0 = ppfb.tileCorner0();
|
|
823
|
-
const corner1 = ppfb.tileCorner1();
|
|
824
|
-
const corner2 = ppfb.tileCorner2();
|
|
825
|
-
const corner3 = ppfb.tileCorner3();
|
|
826
|
-
if (null !== corner0)
|
|
827
|
-
corners[0].setFrom(core_geometry_1.Point3d.create(corner0.x(), corner0.y(), corner0.z()));
|
|
828
|
-
if (null !== corner1)
|
|
829
|
-
corners[1].setFrom(core_geometry_1.Point3d.create(corner1.x(), corner1.y(), corner1.z()));
|
|
830
|
-
if (null !== corner2)
|
|
831
|
-
corners[2].setFrom(core_geometry_1.Point3d.create(corner2.x(), corner2.y(), corner2.z()));
|
|
832
|
-
if (null !== corner3)
|
|
833
|
-
corners[3].setFrom(core_geometry_1.Point3d.create(corner3.x(), corner3.y(), corner3.z()));
|
|
834
|
-
if (undefined !== localToWorld) {
|
|
835
|
-
localToWorld.multiplyXYAndZInPlace(corners[0]);
|
|
836
|
-
localToWorld.multiplyXYAndZInPlace(corners[1]);
|
|
837
|
-
localToWorld.multiplyXYAndZInPlace(corners[2]);
|
|
838
|
-
localToWorld.multiplyXYAndZInPlace(corners[3]);
|
|
839
|
-
}
|
|
840
|
-
return { corners: corners.toJSON(), textureId, hasBorder };
|
|
841
|
-
}
|
|
842
|
-
ElementGeometry.toImageGraphic = toImageGraphic;
|
|
843
|
-
/** Create entry from a [[ImageGraphic]] */
|
|
844
|
-
function fromImageGraphic(image, worldToLocal) {
|
|
845
|
-
if (undefined !== worldToLocal) {
|
|
846
|
-
const localImage = ImageGraphic_1.ImageGraphic.fromJSON(image).cloneTransformed(worldToLocal);
|
|
847
|
-
image = localImage.toJSON();
|
|
848
|
-
}
|
|
849
|
-
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
850
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.Image;
|
|
851
|
-
builder.startImage(fbb);
|
|
852
|
-
const textudeIdPair = core_bentley_1.Id64.getUint32Pair(image.textureId);
|
|
853
|
-
builder.addTextureId(fbb, flatbuffers_1.flatbuffers.Long.create(textudeIdPair.lower, textudeIdPair.upper));
|
|
854
|
-
builder.addDrawBorder(fbb, image.hasBorder ? 1 : 0);
|
|
855
|
-
const corners = ImageGraphic_1.ImageGraphicCorners.fromJSON(image.corners);
|
|
856
|
-
const cornerOffset0 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[0].x, corners[0].y, corners[0].z);
|
|
857
|
-
builder.addTileCorner0(fbb, cornerOffset0);
|
|
858
|
-
const cornerOffset1 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[1].x, corners[1].y, corners[1].z);
|
|
859
|
-
builder.addTileCorner1(fbb, cornerOffset1);
|
|
860
|
-
const cornerOffset2 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[2].x, corners[2].y, corners[2].z);
|
|
861
|
-
builder.addTileCorner2(fbb, cornerOffset2);
|
|
862
|
-
const cornerOffset3 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[3].x, corners[3].y, corners[3].z);
|
|
863
|
-
builder.addTileCorner3(fbb, cornerOffset3);
|
|
864
|
-
const mLoc = builder.endImage(fbb);
|
|
865
|
-
fbb.finish(mLoc);
|
|
866
|
-
const data = fbb.asUint8Array();
|
|
867
|
-
return { opcode: ElementGeometryOpcode.Image, data };
|
|
868
|
-
}
|
|
869
|
-
ElementGeometry.fromImageGraphic = fromImageGraphic;
|
|
870
|
-
/** Return entry as a [[BRepEntity.DataProps]] for checking brep type and face attachments. */
|
|
871
|
-
function toBRep(entry, wantBRepData = false, localToWorld) {
|
|
872
|
-
if (ElementGeometryOpcode.BRep !== entry.opcode)
|
|
873
|
-
return undefined;
|
|
874
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
875
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
876
|
-
const toBRepType = (typeFb) => {
|
|
877
|
-
switch (typeFb) {
|
|
878
|
-
case ElementGeometryFB_1.EGFBAccessors.BRepType.Wire:
|
|
879
|
-
return GeometryStream_1.BRepEntity.Type.Wire;
|
|
880
|
-
case ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet:
|
|
881
|
-
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
882
|
-
default:
|
|
883
|
-
return GeometryStream_1.BRepEntity.Type.Solid;
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
const type = toBRepType(ppfb.brepType());
|
|
887
|
-
let transform;
|
|
888
|
-
const entityTransform = ppfb.entityTransform();
|
|
889
|
-
if (null !== entityTransform)
|
|
890
|
-
transform = core_geometry_1.Transform.createRowValues(entityTransform.x00(), entityTransform.x01(), entityTransform.x02(), entityTransform.tx(), entityTransform.x10(), entityTransform.x11(), entityTransform.x12(), entityTransform.ty(), entityTransform.x20(), entityTransform.x21(), entityTransform.x22(), entityTransform.tz());
|
|
891
|
-
if (undefined !== localToWorld) {
|
|
892
|
-
if (undefined !== transform)
|
|
893
|
-
transform.multiplyTransformTransform(localToWorld, transform);
|
|
894
|
-
else
|
|
895
|
-
transform = localToWorld;
|
|
896
|
-
}
|
|
897
|
-
const faceSymbLen = ppfb.symbologyLength();
|
|
898
|
-
let faceSymbology;
|
|
899
|
-
if (0 !== faceSymbLen) {
|
|
900
|
-
const faceSymbPropsArray = [];
|
|
901
|
-
for (let index = 0; index < faceSymbLen; ++index) {
|
|
902
|
-
const faceSymbFb = ppfb.symbology(index);
|
|
903
|
-
const faceSymbProps = {};
|
|
904
|
-
if (null !== faceSymbFb) {
|
|
905
|
-
if (1 === faceSymbFb.useColor())
|
|
906
|
-
faceSymbProps.color = faceSymbFb.color();
|
|
907
|
-
if (1 === faceSymbFb.useMaterial())
|
|
908
|
-
faceSymbProps.materialId = core_bentley_1.Id64.fromUint32Pair(faceSymbFb.materialId().low, faceSymbFb.materialId().high);
|
|
909
|
-
faceSymbProps.transparency = faceSymbFb.transparency();
|
|
910
|
-
}
|
|
911
|
-
faceSymbPropsArray.push(faceSymbProps);
|
|
912
|
-
}
|
|
913
|
-
faceSymbology = faceSymbPropsArray;
|
|
914
|
-
}
|
|
915
|
-
let data;
|
|
916
|
-
const entityData = ppfb.entityDataArray();
|
|
917
|
-
if (wantBRepData && null !== entityData)
|
|
918
|
-
data = Base64EncodedString_1.Base64EncodedString.fromUint8Array(entityData);
|
|
919
|
-
return { data, type, transform: transform
|
|
920
|
-
}
|
|
921
|
-
ElementGeometry.toBRep = toBRep;
|
|
922
|
-
/** Create entry from a [[BRepEntity.DataProps]]. Provided for compatibility with GeometryStreamBuilder only. */
|
|
923
|
-
function fromBRep(brep, worldToLocal) {
|
|
924
|
-
if (undefined !== worldToLocal) {
|
|
925
|
-
const entityTrans = core_geometry_1.Transform.fromJSON(brep.transform);
|
|
926
|
-
const localTrans = entityTrans.multiplyTransformTransform(worldToLocal);
|
|
927
|
-
brep = {
|
|
928
|
-
data: brep.data,
|
|
929
|
-
type: brep.type,
|
|
930
|
-
transform: localTrans.isIdentity ? undefined : localTrans.toJSON(),
|
|
931
|
-
faceSymbology: brep.faceSymbology,
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
935
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.BRepData;
|
|
936
|
-
let dataOffset;
|
|
937
|
-
let faceSymbOffset;
|
|
938
|
-
if (undefined !== brep.data) {
|
|
939
|
-
const entityData = Base64EncodedString_1.Base64EncodedString.toUint8Array(brep.data);
|
|
940
|
-
if (entityData.length === 0)
|
|
941
|
-
return undefined;
|
|
942
|
-
dataOffset = builder.createEntityDataVector(fbb, entityData);
|
|
943
|
-
}
|
|
944
|
-
if (undefined !== brep.faceSymbology) {
|
|
945
|
-
builder.startSymbologyVector(fbb, brep.faceSymbology.length);
|
|
946
|
-
for (let i = brep.faceSymbology.length - 1; i >= 0; i--) {
|
|
947
|
-
const symb = brep.faceSymbology[i];
|
|
948
|
-
const materialIdPair = core_bentley_1.Id64.getUint32Pair(symb.materialId ? symb.materialId : core_bentley_1.Id64.invalid);
|
|
949
|
-
const matLong = flatbuffers_1.flatbuffers.Long.create(materialIdPair.lower, materialIdPair.upper);
|
|
950
|
-
ElementGeometryFB_1.EGFBAccessors.FaceSymbology.createFaceSymbology(fbb, symb.color ? 1 : 0, symb.materialId ? 1 : 0, symb.color ? symb.color : 0, matLong, symb.transparency ? symb.transparency : 0, 0, 0);
|
|
951
|
-
}
|
|
952
|
-
faceSymbOffset = fbb.endVector();
|
|
953
|
-
}
|
|
954
|
-
builder.startBRepData(fbb);
|
|
955
|
-
const toEGFBBRepType = (type) => {
|
|
956
|
-
switch (type) {
|
|
957
|
-
case GeometryStream_1.BRepEntity.Type.Wire:
|
|
958
|
-
return ElementGeometryFB_1.EGFBAccessors.BRepType.Wire;
|
|
959
|
-
case GeometryStream_1.BRepEntity.Type.Sheet:
|
|
960
|
-
return ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet;
|
|
961
|
-
default:
|
|
962
|
-
return ElementGeometryFB_1.EGFBAccessors.BRepType.Solid;
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
if (undefined !== brep.type)
|
|
966
|
-
builder.addBrepType(fbb, toEGFBBRepType(brep.type));
|
|
967
|
-
if (undefined !== brep.transform) {
|
|
968
|
-
const transform = core_geometry_1.Transform.fromJSON(brep.transform);
|
|
969
|
-
const transformOffset = ElementGeometryFB_1.EGFBAccessors.Transform.createTransform(fbb, transform.matrix.coffs[0], transform.matrix.coffs[1], transform.matrix.coffs[2], transform.origin.x, transform.matrix.coffs[3], transform.matrix.coffs[4], transform.matrix.coffs[5], transform.origin.y, transform.matrix.coffs[6], transform.matrix.coffs[7], transform.matrix.coffs[8], transform.origin.z);
|
|
970
|
-
builder.addEntityTransform(fbb, transformOffset);
|
|
971
|
-
}
|
|
972
|
-
if (undefined !== dataOffset)
|
|
973
|
-
builder.addEntityData(fbb, dataOffset);
|
|
974
|
-
if (undefined !== faceSymbOffset)
|
|
975
|
-
builder.addSymbology(fbb, faceSymbOffset);
|
|
976
|
-
const mLoc = builder.endBRepData(fbb);
|
|
977
|
-
fbb.finish(mLoc);
|
|
978
|
-
const data = fbb.asUint8Array();
|
|
979
|
-
return { opcode: ElementGeometryOpcode.BRep, data };
|
|
980
|
-
}
|
|
981
|
-
ElementGeometry.fromBRep = fromBRep;
|
|
982
|
-
/** Apply transform directly to ElementGeometryDataEntry for a BRep */
|
|
983
|
-
function transformBRep(entry, inputTransform) {
|
|
984
|
-
if (ElementGeometryOpcode.BRep !== entry.opcode)
|
|
985
|
-
return false;
|
|
986
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
987
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
988
|
-
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
989
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.BRepData;
|
|
990
|
-
const entityData = ppfb.entityDataArray();
|
|
991
|
-
const dataOffset = (null !== entityData ? builder.createEntityDataVector(fbb, entityData) : undefined);
|
|
992
|
-
let faceSymbOffset;
|
|
993
|
-
const faceSymbLen = ppfb.symbologyLength();
|
|
994
|
-
if (0 !== faceSymbLen) {
|
|
995
|
-
builder.startSymbologyVector(fbb, faceSymbLen);
|
|
996
|
-
for (let i = faceSymbLen - 1; i >= 0; i--) {
|
|
997
|
-
const faceSymbFb = ppfb.symbology(i);
|
|
998
|
-
if (null === faceSymbFb)
|
|
999
|
-
continue;
|
|
1000
|
-
ElementGeometryFB_1.EGFBAccessors.FaceSymbology.createFaceSymbology(fbb, faceSymbFb.useColor(), faceSymbFb.useMaterial(), faceSymbFb.color(), faceSymbFb.materialId(), faceSymbFb.transparency(), 0, 0);
|
|
1001
|
-
}
|
|
1002
|
-
faceSymbOffset = fbb.endVector();
|
|
1003
|
-
}
|
|
1004
|
-
builder.startBRepData(fbb);
|
|
1005
|
-
builder.addBrepType(fbb, ppfb.brepType());
|
|
1006
|
-
let transform;
|
|
1007
|
-
const entityTransform = ppfb.entityTransform();
|
|
1008
|
-
if (null !== entityTransform)
|
|
1009
|
-
transform = core_geometry_1.Transform.createRowValues(entityTransform.x00(), entityTransform.x01(), entityTransform.x02(), entityTransform.tx(), entityTransform.x10(), entityTransform.x11(), entityTransform.x12(), entityTransform.ty(), entityTransform.x20(), entityTransform.x21(), entityTransform.x22(), entityTransform.tz());
|
|
1010
|
-
if (undefined !== transform)
|
|
1011
|
-
transform.multiplyTransformTransform(inputTransform, transform);
|
|
1012
|
-
else
|
|
1013
|
-
transform = inputTransform;
|
|
1014
|
-
const transformOffset = ElementGeometryFB_1.EGFBAccessors.Transform.createTransform(fbb, transform.matrix.coffs[0], transform.matrix.coffs[1], transform.matrix.coffs[2], transform.origin.x, transform.matrix.coffs[3], transform.matrix.coffs[4], transform.matrix.coffs[5], transform.origin.y, transform.matrix.coffs[6], transform.matrix.coffs[7], transform.matrix.coffs[8], transform.origin.z);
|
|
1015
|
-
builder.addEntityTransform(fbb, transformOffset);
|
|
1016
|
-
if (undefined !== dataOffset)
|
|
1017
|
-
builder.addEntityData(fbb, dataOffset);
|
|
1018
|
-
if (undefined !== faceSymbOffset)
|
|
1019
|
-
builder.addSymbology(fbb, faceSymbOffset);
|
|
1020
|
-
const mLoc = builder.endBRepData(fbb);
|
|
1021
|
-
fbb.finish(mLoc);
|
|
1022
|
-
entry.data = fbb.asUint8Array();
|
|
1023
|
-
return true;
|
|
1024
|
-
}
|
|
1025
|
-
ElementGeometry.transformBRep = transformBRep;
|
|
1026
|
-
/** @internal */
|
|
1027
|
-
let StyleMod;
|
|
1028
|
-
(function (StyleMod) {
|
|
1029
|
-
StyleMod[StyleMod["Scale"] = 1] = "Scale";
|
|
1030
|
-
StyleMod[StyleMod["DashScale"] = 2] = "DashScale";
|
|
1031
|
-
StyleMod[StyleMod["GapScale"] = 4] = "GapScale";
|
|
1032
|
-
StyleMod[StyleMod["StartWidth"] = 8] = "StartWidth";
|
|
1033
|
-
StyleMod[StyleMod["EndWidth"] = 16] = "EndWidth";
|
|
1034
|
-
StyleMod[StyleMod["DistPhase"] = 32] = "DistPhase";
|
|
1035
|
-
StyleMod[StyleMod["FractPhase"] = 64] = "FractPhase";
|
|
1036
|
-
StyleMod[StyleMod["CenterPhase"] = 128] = "CenterPhase";
|
|
1037
|
-
StyleMod[StyleMod["Normal"] = 256] = "Normal";
|
|
1038
|
-
StyleMod[StyleMod["Rotation"] = 512] = "Rotation";
|
|
1039
|
-
StyleMod[StyleMod["PhysicalWidth"] = 8192] = "PhysicalWidth";
|
|
1040
|
-
StyleMod[StyleMod["SegMode"] = 1073741824] = "SegMode";
|
|
1041
|
-
StyleMod[StyleMod["NoSegMode"] = 2147483648] = "NoSegMode";
|
|
1042
|
-
})(StyleMod || (StyleMod = {}));
|
|
1043
|
-
/** Update the supplied [[GeometryParams]] from an entry with appearance information */
|
|
1044
|
-
function updateGeometryParams(entry, geomParams, localToWorld) {
|
|
1045
|
-
if (!isAppearanceEntry(entry))
|
|
1046
|
-
return false;
|
|
1047
|
-
let changed = false;
|
|
1048
|
-
switch (entry.opcode) {
|
|
1049
|
-
case ElementGeometryOpcode.BasicSymbology: {
|
|
1050
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1051
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.BasicSymbology.getRootAsBasicSymbology(buffer);
|
|
1052
|
-
const subcatLong = ppfb.subCategoryId();
|
|
1053
|
-
let subcatId = core_bentley_1.Id64.fromUint32Pair(subcatLong.low, subcatLong.high);
|
|
1054
|
-
if (core_bentley_1.Id64.isInvalid(subcatId))
|
|
1055
|
-
subcatId = geomParams.subCategoryId; // Preserve current sub-category if not explicitly stored...
|
|
1056
|
-
if (core_bentley_1.Id64.isValid(subcatId)) {
|
|
1057
|
-
geomParams.setSubCategoryId(subcatId); // Reset to sub-category appearance...
|
|
1058
|
-
changed = true;
|
|
1059
|
-
}
|
|
1060
|
-
if (ppfb.useColor()) {
|
|
1061
|
-
const lineColor = ColorDef_1.ColorDef.fromTbgr(ppfb.color());
|
|
1062
|
-
if (undefined === geomParams.lineColor || !lineColor.equals(geomParams.lineColor)) {
|
|
1063
|
-
geomParams.lineColor = lineColor;
|
|
1064
|
-
changed = true;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
if (ppfb.useWeight()) {
|
|
1068
|
-
const weight = ppfb.weight();
|
|
1069
|
-
if (undefined === geomParams.weight || weight !== geomParams.weight) {
|
|
1070
|
-
geomParams.weight = weight;
|
|
1071
|
-
changed = true;
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
if (ppfb.useStyle()) {
|
|
1075
|
-
const styleLong = ppfb.lineStyleId();
|
|
1076
|
-
const styleId = core_bentley_1.Id64.fromUint32Pair(styleLong.low, styleLong.high);
|
|
1077
|
-
if (undefined === geomParams.styleInfo || styleId !== geomParams.styleInfo.styleId) {
|
|
1078
|
-
geomParams.styleInfo = new LineStyle_1.LineStyle.Info(styleId);
|
|
1079
|
-
changed = true;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
const transparency = ppfb.transparency();
|
|
1083
|
-
if (transparency !== (undefined !== geomParams.elmTransparency ? geomParams.elmTransparency : 0)) {
|
|
1084
|
-
geomParams.elmTransparency = transparency;
|
|
1085
|
-
changed = true;
|
|
1086
|
-
}
|
|
1087
|
-
const displayPriority = ppfb.displayPriority();
|
|
1088
|
-
if (displayPriority !== (undefined !== geomParams.elmPriority ? geomParams.elmPriority : 0)) {
|
|
1089
|
-
geomParams.elmPriority = displayPriority;
|
|
1090
|
-
changed = true;
|
|
1091
|
-
}
|
|
1092
|
-
const geometryClass = ppfb.geomClass();
|
|
1093
|
-
if (geometryClass !== (undefined !== geomParams.geometryClass ? geomParams.geometryClass : GeometryParams_1.GeometryClass.Primary)) {
|
|
1094
|
-
geomParams.geometryClass = geometryClass;
|
|
1095
|
-
changed = true;
|
|
1096
|
-
}
|
|
1097
|
-
return changed;
|
|
1098
|
-
}
|
|
1099
|
-
case ElementGeometryOpcode.LineStyleModifiers: {
|
|
1100
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1101
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.LineStyleModifiers.getRootAsLineStyleModifiers(buffer);
|
|
1102
|
-
const props = {};
|
|
1103
|
-
if (0 !== (ppfb.modifiers() & StyleMod.Scale))
|
|
1104
|
-
props.scale = ppfb.scale();
|
|
1105
|
-
if (0 !== (ppfb.modifiers() & StyleMod.GapScale))
|
|
1106
|
-
props.gapScale = ppfb.gapScale();
|
|
1107
|
-
if (0 !== (ppfb.modifiers() & StyleMod.DashScale))
|
|
1108
|
-
props.dashScale = ppfb.dashScale();
|
|
1109
|
-
if (0 !== (ppfb.modifiers() & StyleMod.StartWidth))
|
|
1110
|
-
props.startWidth = ppfb.startWidth();
|
|
1111
|
-
if (0 !== (ppfb.modifiers() & StyleMod.EndWidth))
|
|
1112
|
-
props.endWidth = ppfb.endWidth();
|
|
1113
|
-
if (0 !== (ppfb.modifiers() & StyleMod.DistPhase))
|
|
1114
|
-
props.distPhase = ppfb.distPhase();
|
|
1115
|
-
if (0 !== (ppfb.modifiers() & StyleMod.FractPhase))
|
|
1116
|
-
props.fractPhase = ppfb.fractPhase();
|
|
1117
|
-
if (0 !== (ppfb.modifiers() & StyleMod.CenterPhase))
|
|
1118
|
-
props.centerPhase = true;
|
|
1119
|
-
if (0 !== (ppfb.modifiers() & StyleMod.SegMode))
|
|
1120
|
-
props.segmentMode = true;
|
|
1121
|
-
else if (0 !== (ppfb.modifiers() & StyleMod.NoSegMode))
|
|
1122
|
-
props.segmentMode = false;
|
|
1123
|
-
if (0 !== (ppfb.modifiers() & StyleMod.PhysicalWidth))
|
|
1124
|
-
props.physicalWidth = true;
|
|
1125
|
-
if (0 !== (ppfb.modifiers() & StyleMod.Normal)) {
|
|
1126
|
-
const normal = ppfb.normal();
|
|
1127
|
-
if (null !== normal)
|
|
1128
|
-
props.normal = core_geometry_1.Vector3d.create(normal.x(), normal.y(), normal.z());
|
|
1129
|
-
}
|
|
1130
|
-
if (0 !== (ppfb.modifiers() & StyleMod.Rotation))
|
|
1131
|
-
props.rotation = core_geometry_1.YawPitchRollAngles.createDegrees(ppfb.yaw(), ppfb.pitch(), ppfb.roll());
|
|
1132
|
-
const styleMod = new LineStyle_1.LineStyle.Modifier(props);
|
|
1133
|
-
if (undefined !== localToWorld)
|
|
1134
|
-
styleMod.applyTransform(localToWorld);
|
|
1135
|
-
if (undefined === geomParams.styleInfo) {
|
|
1136
|
-
geomParams.styleInfo = new LineStyle_1.LineStyle.Info(core_bentley_1.Id64.invalid, styleMod);
|
|
1137
|
-
changed = true;
|
|
1138
|
-
}
|
|
1139
|
-
else if (undefined === geomParams.styleInfo.styleMod || !styleMod.equals(geomParams.styleInfo.styleMod)) {
|
|
1140
|
-
geomParams.styleInfo.styleMod = styleMod;
|
|
1141
|
-
changed = true;
|
|
1142
|
-
}
|
|
1143
|
-
return changed;
|
|
1144
|
-
}
|
|
1145
|
-
case ElementGeometryOpcode.Fill: {
|
|
1146
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1147
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.AreaFill.getRootAsAreaFill(buffer);
|
|
1148
|
-
const toFillDisplay = (fill) => {
|
|
1149
|
-
switch (fill) {
|
|
1150
|
-
case ElementGeometryFB_1.EGFBAccessors.FillDisplay.ByView:
|
|
1151
|
-
return GeometryParams_1.FillDisplay.ByView;
|
|
1152
|
-
case ElementGeometryFB_1.EGFBAccessors.FillDisplay.Always:
|
|
1153
|
-
return GeometryParams_1.FillDisplay.Always;
|
|
1154
|
-
case ElementGeometryFB_1.EGFBAccessors.FillDisplay.Blanking:
|
|
1155
|
-
return GeometryParams_1.FillDisplay.Blanking;
|
|
1156
|
-
default:
|
|
1157
|
-
return GeometryParams_1.FillDisplay.Never;
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
const fillDisplay = toFillDisplay(ppfb.fill());
|
|
1161
|
-
if (fillDisplay !== (undefined !== geomParams.fillDisplay ? geomParams.fillDisplay : GeometryParams_1.FillDisplay.Never)) {
|
|
1162
|
-
geomParams.fillDisplay = fillDisplay;
|
|
1163
|
-
changed = true;
|
|
1164
|
-
}
|
|
1165
|
-
if (GeometryParams_1.FillDisplay.Never === fillDisplay)
|
|
1166
|
-
return changed;
|
|
1167
|
-
const transparency = ppfb.transparency();
|
|
1168
|
-
if (transparency !== (undefined !== geomParams.fillTransparency ? geomParams.fillTransparency : 0)) {
|
|
1169
|
-
geomParams.fillTransparency = transparency;
|
|
1170
|
-
changed = true;
|
|
1171
|
-
}
|
|
1172
|
-
if (ElementGeometryFB_1.EGFBAccessors.GradientMode.None !== ppfb.mode()) {
|
|
1173
|
-
const toGradientMode = (mode) => {
|
|
1174
|
-
switch (mode) {
|
|
1175
|
-
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Linear:
|
|
1176
|
-
return Gradient_1.Gradient.Mode.Linear;
|
|
1177
|
-
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Curved:
|
|
1178
|
-
return Gradient_1.Gradient.Mode.Curved;
|
|
1179
|
-
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Cylindrical:
|
|
1180
|
-
return Gradient_1.Gradient.Mode.Cylindrical;
|
|
1181
|
-
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Spherical:
|
|
1182
|
-
return Gradient_1.Gradient.Mode.Spherical;
|
|
1183
|
-
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Hemispherical:
|
|
1184
|
-
return Gradient_1.Gradient.Mode.Hemispherical;
|
|
1185
|
-
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Thematic:
|
|
1186
|
-
return Gradient_1.Gradient.Mode.Thematic;
|
|
1187
|
-
default:
|
|
1188
|
-
return Gradient_1.Gradient.Mode.None;
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
const keys = [];
|
|
1192
|
-
const colors = ppfb.colorsArray();
|
|
1193
|
-
const values = ppfb.valuesArray();
|
|
1194
|
-
if (null !== colors && null !== values && colors.length === values.length) {
|
|
1195
|
-
for (let iKey = 0; iKey < colors.length; ++iKey)
|
|
1196
|
-
keys.push({ value: values[iKey], color: colors[iKey] });
|
|
1197
|
-
}
|
|
1198
|
-
const props = { mode: toGradientMode(ppfb.mode()), keys };
|
|
1199
|
-
const flags = ppfb.flags();
|
|
1200
|
-
const angle = ppfb.angle();
|
|
1201
|
-
const tint = ppfb.tint();
|
|
1202
|
-
const shift = ppfb.shift();
|
|
1203
|
-
props.flags = (0 !== flags ? flags : undefined);
|
|
1204
|
-
props.angle = (0 !== angle ? { radians: angle } : undefined);
|
|
1205
|
-
props.tint = (0 !== tint ? tint : undefined);
|
|
1206
|
-
props.shift = (0 !== shift ? shift : undefined);
|
|
1207
|
-
if (Gradient_1.Gradient.Mode.Thematic === props.mode) {
|
|
1208
|
-
const thematic = ppfb.thematicSettings();
|
|
1209
|
-
if (null !== thematic) {
|
|
1210
|
-
const tprops = {};
|
|
1211
|
-
const mode = thematic.mode();
|
|
1212
|
-
const stepCount = thematic.stepCount();
|
|
1213
|
-
const marginColor = thematic.marginColor();
|
|
1214
|
-
const colorScheme = thematic.colorScheme();
|
|
1215
|
-
tprops.mode = (0 !== mode ? mode : undefined);
|
|
1216
|
-
tprops.stepCount = (0 !== stepCount ? stepCount : undefined);
|
|
1217
|
-
tprops.marginColor = (0 !== marginColor ? marginColor : undefined);
|
|
1218
|
-
tprops.colorScheme = (0 !== colorScheme ? colorScheme : undefined);
|
|
1219
|
-
props.thematicSettings = tprops;
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
const gradient = Gradient_1.Gradient.Symb.fromJSON(props);
|
|
1223
|
-
if (undefined === geomParams.gradient || !gradient.equals(geomParams.gradient)) {
|
|
1224
|
-
geomParams.gradient = gradient;
|
|
1225
|
-
changed = true;
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
else if (0 !== ppfb.backgroundFill()) {
|
|
1229
|
-
const backgroundFill = (2 === ppfb.backgroundFill() ? GeometryParams_1.BackgroundFill.Outline : GeometryParams_1.BackgroundFill.Solid);
|
|
1230
|
-
if (backgroundFill !== geomParams.backgroundFill) {
|
|
1231
|
-
geomParams.backgroundFill = backgroundFill;
|
|
1232
|
-
changed = true;
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
else if (ppfb.useColor()) {
|
|
1236
|
-
const fillColor = ColorDef_1.ColorDef.fromTbgr(ppfb.color());
|
|
1237
|
-
if (undefined === geomParams.fillColor || !fillColor.equals(geomParams.fillColor)) {
|
|
1238
|
-
geomParams.fillColor = fillColor;
|
|
1239
|
-
changed = true;
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
return changed;
|
|
1243
|
-
}
|
|
1244
|
-
case ElementGeometryOpcode.Pattern: {
|
|
1245
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1246
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.AreaPattern.getRootAsAreaPattern(buffer);
|
|
1247
|
-
const props = {};
|
|
1248
|
-
const origin = ppfb.origin();
|
|
1249
|
-
if (null !== origin) {
|
|
1250
|
-
const point = core_geometry_1.Point3d.create(origin.x(), origin.y(), origin.z());
|
|
1251
|
-
if (!point.isAlmostZero)
|
|
1252
|
-
props.origin = point;
|
|
1253
|
-
}
|
|
1254
|
-
const rotation = ppfb.rotation();
|
|
1255
|
-
if (null !== rotation) {
|
|
1256
|
-
const angles = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(core_geometry_1.Matrix3d.createRowValues(rotation.x00(), rotation.x01(), rotation.x02(), rotation.x10(), rotation.x11(), rotation.x12(), rotation.x20(), rotation.x21(), rotation.x22()));
|
|
1257
|
-
if (undefined !== angles && !angles.isIdentity())
|
|
1258
|
-
props.rotation = angles;
|
|
1259
|
-
}
|
|
1260
|
-
const space1 = ppfb.space1();
|
|
1261
|
-
const space2 = ppfb.space2();
|
|
1262
|
-
const angle1 = ppfb.angle1();
|
|
1263
|
-
const angle2 = ppfb.angle2();
|
|
1264
|
-
const scale = ppfb.scale();
|
|
1265
|
-
props.space1 = (0 !== space1 ? space1 : undefined);
|
|
1266
|
-
props.space2 = (0 !== space2 ? space2 : undefined);
|
|
1267
|
-
props.angle1 = (0 !== angle1 ? { radians: angle1 } : undefined);
|
|
1268
|
-
props.angle2 = (0 !== angle2 ? { radians: angle2 } : undefined);
|
|
1269
|
-
props.scale = (0 !== scale ? scale : undefined);
|
|
1270
|
-
if (ppfb.useColor())
|
|
1271
|
-
props.color = ppfb.color();
|
|
1272
|
-
if (ppfb.useWeight())
|
|
1273
|
-
props.weight = ppfb.weight();
|
|
1274
|
-
props.invisibleBoundary = (1 === ppfb.invisibleBoundary() ? true : undefined);
|
|
1275
|
-
props.snappable = (1 === ppfb.snappable() ? true : undefined);
|
|
1276
|
-
const symbolId = core_bentley_1.Id64.fromUint32Pair(ppfb.symbolId().low, ppfb.symbolId().high);
|
|
1277
|
-
props.symbolId = (core_bentley_1.Id64.isValid(symbolId) ? symbolId : undefined);
|
|
1278
|
-
const nDefLines = ppfb.defLineLength();
|
|
1279
|
-
if (0 !== nDefLines) {
|
|
1280
|
-
const defLines = [];
|
|
1281
|
-
for (let iLine = 0; iLine < nDefLines; ++iLine) {
|
|
1282
|
-
const defLine = ppfb.defLine(iLine);
|
|
1283
|
-
if (!defLine)
|
|
1284
|
-
continue;
|
|
1285
|
-
const line = {};
|
|
1286
|
-
const angle = defLine.angle();
|
|
1287
|
-
line.angle = (0 !== angle ? { radians: defLine.angle() } : undefined);
|
|
1288
|
-
const through = defLine.through();
|
|
1289
|
-
if (through) {
|
|
1290
|
-
const thr = core_geometry_1.Point2d.create(through.x(), through.y());
|
|
1291
|
-
if (!thr.isAlmostZero)
|
|
1292
|
-
line.through = thr;
|
|
1293
|
-
}
|
|
1294
|
-
const offset = defLine.offset();
|
|
1295
|
-
if (offset) {
|
|
1296
|
-
const off = core_geometry_1.Point2d.create(offset.x(), offset.y());
|
|
1297
|
-
if (!off.isAlmostZero)
|
|
1298
|
-
line.offset = off;
|
|
1299
|
-
}
|
|
1300
|
-
const dashArray = defLine.dashesArray();
|
|
1301
|
-
if (0 !== defLine.dashesLength() && null !== dashArray) {
|
|
1302
|
-
const dashes = [];
|
|
1303
|
-
for (const value of dashArray) {
|
|
1304
|
-
dashes.push(value);
|
|
1305
|
-
}
|
|
1306
|
-
line.dashes = dashes;
|
|
1307
|
-
}
|
|
1308
|
-
defLines.push(line);
|
|
1309
|
-
}
|
|
1310
|
-
props.defLines = defLines;
|
|
1311
|
-
}
|
|
1312
|
-
const pattern = AreaPattern_1.AreaPattern.Params.fromJSON(props);
|
|
1313
|
-
if (undefined !== localToWorld)
|
|
1314
|
-
pattern.applyTransform(localToWorld);
|
|
1315
|
-
if (undefined === geomParams.pattern || !pattern.equals(geomParams.pattern)) {
|
|
1316
|
-
geomParams.pattern = pattern;
|
|
1317
|
-
changed = true;
|
|
1318
|
-
}
|
|
1319
|
-
return changed;
|
|
1320
|
-
}
|
|
1321
|
-
case ElementGeometryOpcode.Material: {
|
|
1322
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1323
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.Material.getRootAsMaterial(buffer);
|
|
1324
|
-
if (ppfb.useMaterial()) {
|
|
1325
|
-
const matLong = ppfb.materialId();
|
|
1326
|
-
const materialId = core_bentley_1.Id64.fromUint32Pair(matLong.low, matLong.high);
|
|
1327
|
-
if (undefined === geomParams.materialId || materialId !== geomParams.materialId) {
|
|
1328
|
-
geomParams.materialId = materialId;
|
|
1329
|
-
changed = true;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
return changed;
|
|
1333
|
-
}
|
|
1334
|
-
default:
|
|
1335
|
-
return changed;
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
ElementGeometry.updateGeometryParams = updateGeometryParams;
|
|
1339
|
-
/** Append entries to represent a [[GeometryParams]] */
|
|
1340
|
-
function appendGeometryParams(geomParams, entries, worldToLocal) {
|
|
1341
|
-
const fbbBas = new flatbuffers_1.flatbuffers.Builder();
|
|
1342
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.BasicSymbology;
|
|
1343
|
-
builder.startBasicSymbology(fbbBas);
|
|
1344
|
-
const subcatIdPair = core_bentley_1.Id64.getUint32Pair(geomParams.subCategoryId);
|
|
1345
|
-
builder.addSubCategoryId(fbbBas, flatbuffers_1.flatbuffers.Long.create(subcatIdPair.lower, subcatIdPair.upper));
|
|
1346
|
-
if (undefined !== geomParams.lineColor) {
|
|
1347
|
-
builder.addColor(fbbBas, geomParams.lineColor.tbgr);
|
|
1348
|
-
builder.addUseColor(fbbBas, 1);
|
|
1349
|
-
}
|
|
1350
|
-
if (undefined !== geomParams.weight) {
|
|
1351
|
-
builder.addWeight(fbbBas, geomParams.weight);
|
|
1352
|
-
builder.addUseWeight(fbbBas, 1);
|
|
1353
|
-
}
|
|
1354
|
-
if (undefined !== geomParams.styleInfo) {
|
|
1355
|
-
const styleIdPair = core_bentley_1.Id64.getUint32Pair(geomParams.styleInfo.styleId);
|
|
1356
|
-
builder.addLineStyleId(fbbBas, flatbuffers_1.flatbuffers.Long.create(styleIdPair.lower, styleIdPair.upper));
|
|
1357
|
-
builder.addUseStyle(fbbBas, 1);
|
|
1358
|
-
}
|
|
1359
|
-
if (undefined !== geomParams.elmTransparency && 0 !== geomParams.elmTransparency) {
|
|
1360
|
-
builder.addTransparency(fbbBas, geomParams.elmTransparency);
|
|
1361
|
-
}
|
|
1362
|
-
if (undefined !== geomParams.elmPriority && 0 !== geomParams.elmPriority) {
|
|
1363
|
-
builder.addDisplayPriority(fbbBas, geomParams.elmPriority);
|
|
1364
|
-
}
|
|
1365
|
-
if (undefined !== geomParams.geometryClass && GeometryParams_1.GeometryClass.Primary !== geomParams.geometryClass) {
|
|
1366
|
-
builder.addGeomClass(fbbBas, geomParams.geometryClass);
|
|
1367
|
-
}
|
|
1368
|
-
const mLoc = builder.endBasicSymbology(fbbBas);
|
|
1369
|
-
fbbBas.finish(mLoc);
|
|
1370
|
-
const data = fbbBas.asUint8Array();
|
|
1371
|
-
entries.push({ opcode: ElementGeometryOpcode.BasicSymbology, data });
|
|
1372
|
-
if (undefined !== geomParams.styleInfo && undefined !== geomParams.styleInfo.styleMod) {
|
|
1373
|
-
const fbbLS = new flatbuffers_1.flatbuffers.Builder();
|
|
1374
|
-
const builderLS = ElementGeometryFB_1.EGFBAccessors.LineStyleModifiers;
|
|
1375
|
-
builderLS.startLineStyleModifiers(fbbLS);
|
|
1376
|
-
let lsMods = geomParams.styleInfo.styleMod;
|
|
1377
|
-
if (undefined !== worldToLocal) {
|
|
1378
|
-
lsMods = new LineStyle_1.LineStyle.Modifier(lsMods);
|
|
1379
|
-
if (!lsMods.applyTransform(worldToLocal))
|
|
1380
|
-
return false;
|
|
1381
|
-
}
|
|
1382
|
-
let modifiers = 0;
|
|
1383
|
-
if (undefined !== lsMods.scale) {
|
|
1384
|
-
builderLS.addScale(fbbLS, lsMods.scale);
|
|
1385
|
-
modifiers |= StyleMod.Scale;
|
|
1386
|
-
}
|
|
1387
|
-
if (undefined !== lsMods.dashScale) {
|
|
1388
|
-
builderLS.addDashScale(fbbLS, lsMods.dashScale);
|
|
1389
|
-
modifiers |= StyleMod.DashScale;
|
|
1390
|
-
}
|
|
1391
|
-
if (undefined !== lsMods.gapScale) {
|
|
1392
|
-
builderLS.addGapScale(fbbLS, lsMods.gapScale);
|
|
1393
|
-
modifiers |= StyleMod.GapScale;
|
|
1394
|
-
}
|
|
1395
|
-
if (undefined !== lsMods.startWidth) {
|
|
1396
|
-
builderLS.addStartWidth(fbbLS, lsMods.startWidth);
|
|
1397
|
-
modifiers |= StyleMod.StartWidth;
|
|
1398
|
-
}
|
|
1399
|
-
if (undefined !== lsMods.endWidth) {
|
|
1400
|
-
builderLS.addEndWidth(fbbLS, lsMods.endWidth);
|
|
1401
|
-
modifiers |= StyleMod.EndWidth;
|
|
1402
|
-
}
|
|
1403
|
-
if (undefined !== lsMods.distPhase) {
|
|
1404
|
-
builderLS.addDistPhase(fbbLS, lsMods.distPhase);
|
|
1405
|
-
modifiers |= StyleMod.DistPhase;
|
|
1406
|
-
}
|
|
1407
|
-
if (undefined !== lsMods.fractPhase) {
|
|
1408
|
-
builderLS.addFractPhase(fbbLS, lsMods.fractPhase);
|
|
1409
|
-
modifiers |= StyleMod.FractPhase;
|
|
1410
|
-
}
|
|
1411
|
-
if (lsMods.centerPhase) {
|
|
1412
|
-
modifiers |= StyleMod.CenterPhase;
|
|
1413
|
-
}
|
|
1414
|
-
if (undefined !== lsMods.segmentMode) {
|
|
1415
|
-
modifiers |= (lsMods.segmentMode ? StyleMod.SegMode : StyleMod.NoSegMode);
|
|
1416
|
-
}
|
|
1417
|
-
if (lsMods.physicalWidth) {
|
|
1418
|
-
modifiers |= StyleMod.PhysicalWidth;
|
|
1419
|
-
}
|
|
1420
|
-
if (undefined !== lsMods.normal) {
|
|
1421
|
-
const normalOffset = ElementGeometryFB_1.EGFBAccessors.DVec3d.createDVec3d(fbbLS, lsMods.normal.x, lsMods.normal.y, lsMods.normal.z);
|
|
1422
|
-
builderLS.addNormal(fbbLS, normalOffset);
|
|
1423
|
-
modifiers |= StyleMod.Normal;
|
|
1424
|
-
}
|
|
1425
|
-
if (undefined !== lsMods.rotation) {
|
|
1426
|
-
builderLS.addYaw(fbbLS, lsMods.rotation.yaw.degrees);
|
|
1427
|
-
builderLS.addPitch(fbbLS, lsMods.rotation.pitch.degrees);
|
|
1428
|
-
builderLS.addRoll(fbbLS, lsMods.rotation.roll.degrees);
|
|
1429
|
-
modifiers |= StyleMod.Rotation;
|
|
1430
|
-
}
|
|
1431
|
-
builderLS.addModifiers(fbbLS, modifiers);
|
|
1432
|
-
const mLocLS = builderLS.endLineStyleModifiers(fbbLS);
|
|
1433
|
-
fbbLS.finish(mLocLS);
|
|
1434
|
-
const dataLS = fbbLS.asUint8Array();
|
|
1435
|
-
if (0 !== modifiers)
|
|
1436
|
-
entries.push({ opcode: ElementGeometryOpcode.LineStyleModifiers, data: dataLS });
|
|
1437
|
-
}
|
|
1438
|
-
if (undefined !== geomParams.fillDisplay && GeometryParams_1.FillDisplay.Never !== geomParams.fillDisplay) {
|
|
1439
|
-
const fbbFill = new flatbuffers_1.flatbuffers.Builder();
|
|
1440
|
-
const builderFill = ElementGeometryFB_1.EGFBAccessors.AreaFill;
|
|
1441
|
-
let keyValuesOff;
|
|
1442
|
-
let keyColorsOff;
|
|
1443
|
-
let thematicOffset;
|
|
1444
|
-
if (undefined !== geomParams.gradient) {
|
|
1445
|
-
const keyColors = [];
|
|
1446
|
-
const keyValues = [];
|
|
1447
|
-
for (const key of geomParams.gradient.keys) {
|
|
1448
|
-
keyColors.push(key.color.tbgr);
|
|
1449
|
-
keyValues.push(key.value);
|
|
1450
|
-
}
|
|
1451
|
-
keyValuesOff = builderFill.createValuesVector(fbbFill, keyValues);
|
|
1452
|
-
keyColorsOff = builderFill.createColorsVector(fbbFill, keyColors);
|
|
1453
|
-
if (Gradient_1.Gradient.Mode.Thematic === geomParams.gradient.mode && undefined !== geomParams.gradient.thematicSettings) {
|
|
1454
|
-
const thematic = geomParams.gradient.thematicSettings;
|
|
1455
|
-
const builderThematic = ElementGeometryFB_1.EGFBAccessors.ThematicSettings;
|
|
1456
|
-
builderThematic.startThematicSettings(fbbFill);
|
|
1457
|
-
builderThematic.addMode(fbbFill, thematic.mode);
|
|
1458
|
-
builderThematic.addStepCount(fbbFill, thematic.stepCount);
|
|
1459
|
-
builderThematic.addMarginColor(fbbFill, thematic.marginColor.tbgr);
|
|
1460
|
-
builderThematic.addColorScheme(fbbFill, thematic.colorScheme);
|
|
1461
|
-
const rangeOffset = ElementGeometryFB_1.EGFBAccessors.DRange1d.createDRange1d(fbbFill, ThematicDisplay_1.ThematicGradientSettings.contentRange, ThematicDisplay_1.ThematicGradientSettings.contentMax);
|
|
1462
|
-
builderThematic.addRange(fbbFill, rangeOffset);
|
|
1463
|
-
thematicOffset = builderThematic.endThematicSettings(fbbFill);
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
builderFill.startAreaFill(fbbFill);
|
|
1467
|
-
const toEGFBFillDisplay = (fill) => {
|
|
1468
|
-
switch (fill) {
|
|
1469
|
-
case GeometryParams_1.FillDisplay.ByView:
|
|
1470
|
-
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.ByView;
|
|
1471
|
-
case GeometryParams_1.FillDisplay.Always:
|
|
1472
|
-
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.Always;
|
|
1473
|
-
case GeometryParams_1.FillDisplay.Blanking:
|
|
1474
|
-
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.Blanking;
|
|
1475
|
-
default:
|
|
1476
|
-
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.None;
|
|
1477
|
-
}
|
|
1478
|
-
};
|
|
1479
|
-
builderFill.addFill(fbbFill, toEGFBFillDisplay(geomParams.fillDisplay));
|
|
1480
|
-
if (undefined !== geomParams.fillTransparency)
|
|
1481
|
-
builderFill.addTransparency(fbbFill, geomParams.fillTransparency);
|
|
1482
|
-
if (undefined !== geomParams.gradient) {
|
|
1483
|
-
const toEGFBGradientMode = (mode) => {
|
|
1484
|
-
switch (mode) {
|
|
1485
|
-
case Gradient_1.Gradient.Mode.Linear:
|
|
1486
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Linear;
|
|
1487
|
-
case Gradient_1.Gradient.Mode.Curved:
|
|
1488
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Curved;
|
|
1489
|
-
case Gradient_1.Gradient.Mode.Cylindrical:
|
|
1490
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Cylindrical;
|
|
1491
|
-
case Gradient_1.Gradient.Mode.Spherical:
|
|
1492
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Spherical;
|
|
1493
|
-
case Gradient_1.Gradient.Mode.Hemispherical:
|
|
1494
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Hemispherical;
|
|
1495
|
-
case Gradient_1.Gradient.Mode.Thematic:
|
|
1496
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Thematic;
|
|
1497
|
-
default:
|
|
1498
|
-
return ElementGeometryFB_1.EGFBAccessors.GradientMode.None;
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
builderFill.addMode(fbbFill, toEGFBGradientMode(geomParams.gradient.mode));
|
|
1502
|
-
builderFill.addFlags(fbbFill, geomParams.gradient.flags);
|
|
1503
|
-
builderFill.addShift(fbbFill, geomParams.gradient.shift);
|
|
1504
|
-
if (undefined !== geomParams.gradient.tint)
|
|
1505
|
-
builderFill.addTint(fbbFill, geomParams.gradient.tint);
|
|
1506
|
-
if (undefined !== geomParams.gradient.angle)
|
|
1507
|
-
builderFill.addAngle(fbbFill, geomParams.gradient.angle.radians);
|
|
1508
|
-
if (undefined !== keyValuesOff)
|
|
1509
|
-
builderFill.addValues(fbbFill, keyValuesOff);
|
|
1510
|
-
if (undefined !== keyColorsOff)
|
|
1511
|
-
builderFill.addColors(fbbFill, keyColorsOff);
|
|
1512
|
-
if (undefined !== thematicOffset)
|
|
1513
|
-
builderFill.addThematicSettings(fbbFill, thematicOffset);
|
|
1514
|
-
}
|
|
1515
|
-
else if (undefined !== geomParams.backgroundFill && GeometryParams_1.BackgroundFill.None !== geomParams.backgroundFill) {
|
|
1516
|
-
builderFill.addBackgroundFill(fbbFill, GeometryParams_1.BackgroundFill.Outline === geomParams.backgroundFill ? 2 : 1);
|
|
1517
|
-
}
|
|
1518
|
-
else if (undefined !== geomParams.fillColor) {
|
|
1519
|
-
builderFill.addColor(fbbFill, geomParams.fillColor.tbgr);
|
|
1520
|
-
builderFill.addUseColor(fbbFill, 1);
|
|
1521
|
-
}
|
|
1522
|
-
const mLocFill = builderFill.endAreaFill(fbbFill);
|
|
1523
|
-
fbbFill.finish(mLocFill);
|
|
1524
|
-
const dataFill = fbbFill.asUint8Array();
|
|
1525
|
-
entries.push({ opcode: ElementGeometryOpcode.Fill, data: dataFill });
|
|
1526
|
-
}
|
|
1527
|
-
if (undefined !== geomParams.pattern) {
|
|
1528
|
-
const fbbPat = new flatbuffers_1.flatbuffers.Builder();
|
|
1529
|
-
const builderPat = ElementGeometryFB_1.EGFBAccessors.AreaPattern;
|
|
1530
|
-
let pattern = geomParams.pattern;
|
|
1531
|
-
if (undefined !== worldToLocal) {
|
|
1532
|
-
pattern = pattern.clone();
|
|
1533
|
-
if (!pattern.applyTransform(worldToLocal))
|
|
1534
|
-
return false;
|
|
1535
|
-
}
|
|
1536
|
-
let defLineVecOffset;
|
|
1537
|
-
if (undefined !== pattern.defLines) {
|
|
1538
|
-
const defLines = pattern.defLines;
|
|
1539
|
-
const builderDefLines = ElementGeometryFB_1.EGFBAccessors.DwgHatchDefLine;
|
|
1540
|
-
const defLineOffsets = [];
|
|
1541
|
-
for (const line of defLines) {
|
|
1542
|
-
let dashOffset;
|
|
1543
|
-
if (undefined !== line.dashes)
|
|
1544
|
-
dashOffset = builderDefLines.createDashesVector(fbbPat, line.dashes);
|
|
1545
|
-
builderDefLines.startDwgHatchDefLine(fbbPat);
|
|
1546
|
-
if (undefined !== line.angle)
|
|
1547
|
-
builderDefLines.addAngle(fbbPat, line.angle.radians);
|
|
1548
|
-
// NOTE: Backend requires through and offset to be present...
|
|
1549
|
-
const throughOffset = ElementGeometryFB_1.EGFBAccessors.DPoint2d.createDPoint2d(fbbPat, undefined !== line.through ? line.through.x : 0, undefined !== line.through ? line.through.y : 0);
|
|
1550
|
-
builderDefLines.addThrough(fbbPat, throughOffset);
|
|
1551
|
-
const offsetOffset = ElementGeometryFB_1.EGFBAccessors.DPoint2d.createDPoint2d(fbbPat, undefined !== line.offset ? line.offset.x : 0, undefined !== line.offset ? line.offset.y : 0);
|
|
1552
|
-
builderDefLines.addOffset(fbbPat, offsetOffset);
|
|
1553
|
-
if (undefined !== dashOffset)
|
|
1554
|
-
builderDefLines.addDashes(fbbPat, dashOffset);
|
|
1555
|
-
defLineOffsets.push(builderDefLines.endDwgHatchDefLine(fbbPat));
|
|
1556
|
-
}
|
|
1557
|
-
if (0 !== defLineOffsets.length)
|
|
1558
|
-
defLineVecOffset = builderPat.createDefLineVector(fbbPat, defLineOffsets);
|
|
1559
|
-
}
|
|
1560
|
-
builderPat.startAreaPattern(fbbPat);
|
|
1561
|
-
if (undefined !== pattern.origin) {
|
|
1562
|
-
const originOffset = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbbPat, pattern.origin.x, pattern.origin.y, pattern.origin.z);
|
|
1563
|
-
builderPat.addOrigin(fbbPat, originOffset);
|
|
1564
|
-
}
|
|
1565
|
-
if (undefined !== pattern.rotation) {
|
|
1566
|
-
const matrix = pattern.rotation.toMatrix3d();
|
|
1567
|
-
const coffs = matrix.coffs;
|
|
1568
|
-
const rotationOffset = ElementGeometryFB_1.EGFBAccessors.RotMatrix.createRotMatrix(fbbPat, coffs[0], coffs[1], coffs[2], coffs[3], coffs[4], coffs[5], coffs[6], coffs[7], coffs[8]);
|
|
1569
|
-
builderPat.addRotation(fbbPat, rotationOffset);
|
|
1570
|
-
}
|
|
1571
|
-
if (undefined !== pattern.space1)
|
|
1572
|
-
builderPat.addSpace1(fbbPat, pattern.space1);
|
|
1573
|
-
if (undefined !== pattern.space2)
|
|
1574
|
-
builderPat.addSpace2(fbbPat, pattern.space2);
|
|
1575
|
-
if (undefined !== pattern.angle1)
|
|
1576
|
-
builderPat.addAngle1(fbbPat, pattern.angle1.radians);
|
|
1577
|
-
if (undefined !== pattern.angle2)
|
|
1578
|
-
builderPat.addAngle2(fbbPat, pattern.angle2.radians);
|
|
1579
|
-
if (undefined !== pattern.scale)
|
|
1580
|
-
builderPat.addScale(fbbPat, pattern.scale);
|
|
1581
|
-
if (undefined !== pattern.color) {
|
|
1582
|
-
builderPat.addColor(fbbPat, pattern.color.tbgr);
|
|
1583
|
-
builderPat.addUseColor(fbbPat, 1);
|
|
1584
|
-
}
|
|
1585
|
-
if (undefined !== pattern.weight) {
|
|
1586
|
-
builderPat.addWeight(fbbPat, pattern.weight);
|
|
1587
|
-
builderPat.addUseWeight(fbbPat, 1);
|
|
1588
|
-
}
|
|
1589
|
-
if (undefined !== pattern.invisibleBoundary && pattern.invisibleBoundary)
|
|
1590
|
-
builderPat.addInvisibleBoundary(fbbPat, 1);
|
|
1591
|
-
if (undefined !== pattern.snappable && pattern.snappable)
|
|
1592
|
-
builderPat.addSnappable(fbbPat, 1);
|
|
1593
|
-
if (undefined !== pattern.symbolId) {
|
|
1594
|
-
const symbolIdPair = core_bentley_1.Id64.getUint32Pair(pattern.symbolId);
|
|
1595
|
-
builderPat.addSymbolId(fbbPat, flatbuffers_1.flatbuffers.Long.create(symbolIdPair.lower, symbolIdPair.upper));
|
|
1596
|
-
}
|
|
1597
|
-
if (undefined !== defLineVecOffset)
|
|
1598
|
-
builderPat.addDefLine(fbbPat, defLineVecOffset);
|
|
1599
|
-
const mLocPat = builderPat.endAreaPattern(fbbPat);
|
|
1600
|
-
fbbPat.finish(mLocPat);
|
|
1601
|
-
const dataPat = fbbPat.asUint8Array();
|
|
1602
|
-
entries.push({ opcode: ElementGeometryOpcode.Pattern, data: dataPat });
|
|
1603
|
-
}
|
|
1604
|
-
if (undefined !== geomParams.materialId) {
|
|
1605
|
-
const fbbMat = new flatbuffers_1.flatbuffers.Builder();
|
|
1606
|
-
const builderMat = ElementGeometryFB_1.EGFBAccessors.Material;
|
|
1607
|
-
builderMat.startMaterial(fbbMat);
|
|
1608
|
-
const matIdPair = core_bentley_1.Id64.getUint32Pair(geomParams.materialId);
|
|
1609
|
-
builderMat.addMaterialId(fbbMat, flatbuffers_1.flatbuffers.Long.create(matIdPair.lower, matIdPair.upper));
|
|
1610
|
-
builderMat.addUseMaterial(fbbMat, 1);
|
|
1611
|
-
const mLocMat = builderMat.endMaterial(fbbMat);
|
|
1612
|
-
fbbMat.finish(mLocMat);
|
|
1613
|
-
const dataMat = fbbMat.asUint8Array();
|
|
1614
|
-
entries.push({ opcode: ElementGeometryOpcode.Material, data: dataMat });
|
|
1615
|
-
}
|
|
1616
|
-
return true;
|
|
1617
|
-
}
|
|
1618
|
-
ElementGeometry.appendGeometryParams = appendGeometryParams;
|
|
1619
|
-
/** Return entry as [[GeometryPart]] id and instance transform */
|
|
1620
|
-
function toGeometryPart(entry, partToElement) {
|
|
1621
|
-
if (ElementGeometryOpcode.PartReference !== entry.opcode)
|
|
1622
|
-
return undefined;
|
|
1623
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1624
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.GeometryPart.getRootAsGeometryPart(buffer);
|
|
1625
|
-
const partLong = ppfb.geomPartId();
|
|
1626
|
-
const partId = core_bentley_1.Id64.fromUint32Pair(partLong.low, partLong.high);
|
|
1627
|
-
if (undefined !== partToElement) {
|
|
1628
|
-
let origin;
|
|
1629
|
-
const originfb = ppfb.origin();
|
|
1630
|
-
if (null !== originfb)
|
|
1631
|
-
origin = core_geometry_1.Point3d.create(originfb.x(), originfb.y(), originfb.z());
|
|
1632
|
-
else
|
|
1633
|
-
origin = core_geometry_1.Point3d.createZero();
|
|
1634
|
-
const angles = core_geometry_1.YawPitchRollAngles.createDegrees(ppfb.yaw(), ppfb.pitch(), ppfb.roll());
|
|
1635
|
-
const matrix = angles.toMatrix3d();
|
|
1636
|
-
if (1.0 !== ppfb.scale())
|
|
1637
|
-
matrix.scaleColumnsInPlace(ppfb.scale(), ppfb.scale(), ppfb.scale());
|
|
1638
|
-
core_geometry_1.Transform.createOriginAndMatrix(origin, matrix, partToElement);
|
|
1639
|
-
}
|
|
1640
|
-
return partId;
|
|
1641
|
-
}
|
|
1642
|
-
ElementGeometry.toGeometryPart = toGeometryPart;
|
|
1643
|
-
/** Create entry from a [[GeometryPart]] id and instance transform */
|
|
1644
|
-
function fromGeometryPart(partId, partTransform, worldToLocal) {
|
|
1645
|
-
let partToElement = partTransform;
|
|
1646
|
-
if (undefined !== worldToLocal)
|
|
1647
|
-
partToElement = worldToLocal.multiplyTransformTransform(undefined !== partTransform ? partTransform : core_geometry_1.Transform.createIdentity());
|
|
1648
|
-
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
1649
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.GeometryPart;
|
|
1650
|
-
builder.startGeometryPart(fbb);
|
|
1651
|
-
const idPair = core_bentley_1.Id64.getUint32Pair(partId);
|
|
1652
|
-
builder.addGeomPartId(fbb, flatbuffers_1.flatbuffers.Long.create(idPair.lower, idPair.upper));
|
|
1653
|
-
if (undefined !== partToElement && !partToElement.isIdentity) {
|
|
1654
|
-
const originOffset = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, partToElement.origin.x, partToElement.origin.y, partToElement.origin.z);
|
|
1655
|
-
builder.addOrigin(fbb, originOffset);
|
|
1656
|
-
const angles = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(partToElement.matrix);
|
|
1657
|
-
if (undefined !== angles) {
|
|
1658
|
-
builder.addYaw(fbb, angles.yaw.degrees);
|
|
1659
|
-
builder.addPitch(fbb, angles.pitch.degrees);
|
|
1660
|
-
builder.addRoll(fbb, angles.roll.degrees);
|
|
1661
|
-
}
|
|
1662
|
-
const result = partToElement.matrix.factorRigidWithSignedScale();
|
|
1663
|
-
if (undefined !== result && result.scale > 0.0)
|
|
1664
|
-
builder.addScale(fbb, result.scale);
|
|
1665
|
-
}
|
|
1666
|
-
const mLoc = builder.endGeometryPart(fbb);
|
|
1667
|
-
fbb.finish(mLoc);
|
|
1668
|
-
const data = fbb.asUint8Array();
|
|
1669
|
-
return { opcode: ElementGeometryOpcode.PartReference, data };
|
|
1670
|
-
}
|
|
1671
|
-
ElementGeometry.fromGeometryPart = fromGeometryPart;
|
|
1672
|
-
/** Return entry as a [[ElementAlignedBox3d]] representing the local range of a geometric entry */
|
|
1673
|
-
function toSubGraphicRange(entry) {
|
|
1674
|
-
if (ElementGeometryOpcode.SubGraphicRange !== entry.opcode)
|
|
1675
|
-
return undefined;
|
|
1676
|
-
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1677
|
-
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
1678
|
-
if (2 !== ppfb.coordsLength())
|
|
1679
|
-
return undefined;
|
|
1680
|
-
const low = core_geometry_1.Point3d.create(ppfb.coords(0).x(), ppfb.coords(0).y(), ppfb.coords(0).z());
|
|
1681
|
-
const high = core_geometry_1.Point3d.create(ppfb.coords(1).x(), ppfb.coords(1).y(), ppfb.coords(1).z());
|
|
1682
|
-
return core_geometry_1.Range3d.create(low, high);
|
|
1683
|
-
}
|
|
1684
|
-
ElementGeometry.toSubGraphicRange = toSubGraphicRange;
|
|
1685
|
-
/** Create entry from a [[ElementAlignedBox3d]] to compute and store local ranges for subsequent geometric entries */
|
|
1686
|
-
function fromSubGraphicRange(bbox) {
|
|
1687
|
-
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
1688
|
-
const builder = ElementGeometryFB_1.EGFBAccessors.PointPrimitive;
|
|
1689
|
-
builder.startCoordsVector(fbb, 2);
|
|
1690
|
-
fbb.addFloat64(bbox.high.z);
|
|
1691
|
-
fbb.addFloat64(bbox.high.y);
|
|
1692
|
-
fbb.addFloat64(bbox.high.x);
|
|
1693
|
-
fbb.addFloat64(bbox.low.z);
|
|
1694
|
-
fbb.addFloat64(bbox.low.y);
|
|
1695
|
-
fbb.addFloat64(bbox.low.x);
|
|
1696
|
-
const offset = fbb.endVector();
|
|
1697
|
-
builder.startPointPrimitive(fbb);
|
|
1698
|
-
builder.addCoords(fbb, offset);
|
|
1699
|
-
const mLoc = builder.endPointPrimitive(fbb);
|
|
1700
|
-
fbb.finish(mLoc);
|
|
1701
|
-
const data = fbb.asUint8Array();
|
|
1702
|
-
return { opcode: ElementGeometryOpcode.SubGraphicRange, data };
|
|
1703
|
-
}
|
|
1704
|
-
ElementGeometry.fromSubGraphicRange = fromSubGraphicRange;
|
|
1705
|
-
/** Create [[Transform]] from row-major storage 4x3 Float64Array */
|
|
1706
|
-
function toTransform(sourceToWorld) {
|
|
1707
|
-
if (12 !== sourceToWorld.length)
|
|
1708
|
-
return undefined;
|
|
1709
|
-
return core_geometry_1.Transform.createRowValues(sourceToWorld[0], sourceToWorld[1], sourceToWorld[2], sourceToWorld[3], sourceToWorld[4], sourceToWorld[5], sourceToWorld[6], sourceToWorld[7], sourceToWorld[8], sourceToWorld[9], sourceToWorld[10], sourceToWorld[11]);
|
|
1710
|
-
}
|
|
1711
|
-
ElementGeometry.toTransform = toTransform;
|
|
1712
|
-
/** Create [[ElementAlignedBox3d]] from lowX, lowY, lowZ, highX, highY, highZ Float64Array */
|
|
1713
|
-
function toElementAlignedBox3d(bbox) {
|
|
1714
|
-
if (6 !== bbox.length)
|
|
1715
|
-
return undefined;
|
|
1716
|
-
return core_geometry_1.Range3d.fromFloat64Array(bbox);
|
|
1717
|
-
}
|
|
1718
|
-
ElementGeometry.toElementAlignedBox3d = toElementAlignedBox3d;
|
|
1719
|
-
})(ElementGeometry = exports.ElementGeometry || (exports.ElementGeometry = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElementGeometry = exports.BRepGeometryOperation = exports.ElementGeometryOpcode = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
/** @packageDocumentation
|
|
9
|
+
* @module Geometry
|
|
10
|
+
*/
|
|
11
|
+
const flatbuffers_1 = require("flatbuffers");
|
|
12
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
|
+
const core_geometry_1 = require("@itwin/core-geometry");
|
|
14
|
+
const ElementGeometryFB_1 = require("./ElementGeometryFB");
|
|
15
|
+
const Base64EncodedString_1 = require("../Base64EncodedString");
|
|
16
|
+
const TextString_1 = require("./TextString");
|
|
17
|
+
const ColorDef_1 = require("../ColorDef");
|
|
18
|
+
const GeometryParams_1 = require("../GeometryParams");
|
|
19
|
+
const Gradient_1 = require("../Gradient");
|
|
20
|
+
const ThematicDisplay_1 = require("../ThematicDisplay");
|
|
21
|
+
const AreaPattern_1 = require("./AreaPattern");
|
|
22
|
+
const GeometryStream_1 = require("./GeometryStream");
|
|
23
|
+
const ImageGraphic_1 = require("./ImageGraphic");
|
|
24
|
+
const LineStyle_1 = require("./LineStyle");
|
|
25
|
+
const Placement_1 = require("./Placement");
|
|
26
|
+
const ElementProps_1 = require("../ElementProps");
|
|
27
|
+
/** Specifies the type of an entry in a geometry stream.
|
|
28
|
+
* @see [[ElementGeometryDataEntry.opcode]].
|
|
29
|
+
* @public
|
|
30
|
+
* @extensions
|
|
31
|
+
*/
|
|
32
|
+
var ElementGeometryOpcode;
|
|
33
|
+
(function (ElementGeometryOpcode) {
|
|
34
|
+
/** Local range of the next geometric primitive in the geometry stream. */
|
|
35
|
+
ElementGeometryOpcode[ElementGeometryOpcode["SubGraphicRange"] = 2] = "SubGraphicRange";
|
|
36
|
+
/** A reference to a [GeometryPart]($backend). */
|
|
37
|
+
ElementGeometryOpcode[ElementGeometryOpcode["PartReference"] = 3] = "PartReference";
|
|
38
|
+
/** Sets symbology for subsequent geometry to override [SubCategory]($backend) appearance */
|
|
39
|
+
ElementGeometryOpcode[ElementGeometryOpcode["BasicSymbology"] = 4] = "BasicSymbology";
|
|
40
|
+
/** A line, line string, shape, or point string (automatic simplification of a [CurvePrimitive]($core-geometry) or [CurveCollection]($core-geometry)) */
|
|
41
|
+
ElementGeometryOpcode[ElementGeometryOpcode["PointPrimitive"] = 5] = "PointPrimitive";
|
|
42
|
+
/** A 2d line, line string, shape, or point string (automatic simplification of a [CurvePrimitive]($core-geometry) or [CurveCollection]($core-geometry)) */
|
|
43
|
+
ElementGeometryOpcode[ElementGeometryOpcode["PointPrimitive2d"] = 6] = "PointPrimitive2d";
|
|
44
|
+
/** Arc or ellipse (automatic simplification of a [CurvePrimitive]($core-geometry) or [CurveCollection]($core-geometry)) */
|
|
45
|
+
ElementGeometryOpcode[ElementGeometryOpcode["ArcPrimitive"] = 7] = "ArcPrimitive";
|
|
46
|
+
/** [CurveCollection]($core-geometry) */
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
48
|
+
ElementGeometryOpcode[ElementGeometryOpcode["CurveCollection"] = 8] = "CurveCollection";
|
|
49
|
+
/** [Polyface]($core-geometry) */
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
51
|
+
ElementGeometryOpcode[ElementGeometryOpcode["Polyface"] = 9] = "Polyface";
|
|
52
|
+
/** [CurvePrimitive]($core-geometry) */
|
|
53
|
+
ElementGeometryOpcode[ElementGeometryOpcode["CurvePrimitive"] = 10] = "CurvePrimitive";
|
|
54
|
+
/** [SolidPrimitive]($core-geometry) */
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
56
|
+
ElementGeometryOpcode[ElementGeometryOpcode["SolidPrimitive"] = 11] = "SolidPrimitive";
|
|
57
|
+
/** [BSplineSurface3d]($core-geometry) */
|
|
58
|
+
ElementGeometryOpcode[ElementGeometryOpcode["BsplineSurface"] = 12] = "BsplineSurface";
|
|
59
|
+
/** Opaque and [[Gradient]] fills. */
|
|
60
|
+
ElementGeometryOpcode[ElementGeometryOpcode["Fill"] = 19] = "Fill";
|
|
61
|
+
/** Hatch, cross-hatch, or [[AreaPattern]]. */
|
|
62
|
+
ElementGeometryOpcode[ElementGeometryOpcode["Pattern"] = 20] = "Pattern";
|
|
63
|
+
/** [[RenderMaterial]] */
|
|
64
|
+
ElementGeometryOpcode[ElementGeometryOpcode["Material"] = 21] = "Material";
|
|
65
|
+
/** [[TextString]] */
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
67
|
+
ElementGeometryOpcode[ElementGeometryOpcode["TextString"] = 22] = "TextString";
|
|
68
|
+
/** Specifies line style overrides as a [[LineStyle.Modifier]] */
|
|
69
|
+
ElementGeometryOpcode[ElementGeometryOpcode["LineStyleModifiers"] = 23] = "LineStyleModifiers";
|
|
70
|
+
/** Boundary represention solid, sheet, or wire body as a [[BRepEntity.DataProps]] */
|
|
71
|
+
ElementGeometryOpcode[ElementGeometryOpcode["BRep"] = 25] = "BRep";
|
|
72
|
+
/** Small single-tile raster image as an [[ImageGraphic]] */
|
|
73
|
+
ElementGeometryOpcode[ElementGeometryOpcode["Image"] = 28] = "Image";
|
|
74
|
+
})(ElementGeometryOpcode = exports.ElementGeometryOpcode || (exports.ElementGeometryOpcode = {}));
|
|
75
|
+
/** Values for [[BRepGeometryCreate.operation]]
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
var BRepGeometryOperation;
|
|
79
|
+
(function (BRepGeometryOperation) {
|
|
80
|
+
/** Unite target (first entry) with one or more tool entities. */
|
|
81
|
+
BRepGeometryOperation[BRepGeometryOperation["Unite"] = 0] = "Unite";
|
|
82
|
+
/** Subtract one or more tool entities from target entity (first entry) */
|
|
83
|
+
BRepGeometryOperation[BRepGeometryOperation["Subtract"] = 1] = "Subtract";
|
|
84
|
+
/** Intersect target (first entry) with one or more tool entities */
|
|
85
|
+
BRepGeometryOperation[BRepGeometryOperation["Intersect"] = 2] = "Intersect";
|
|
86
|
+
/** Sew the given set of surfaces together by joining those that share edges in common */
|
|
87
|
+
BRepGeometryOperation[BRepGeometryOperation["Sew"] = 3] = "Sew";
|
|
88
|
+
/** Create a cut in the target (first entry) using a planar region (second entry) and optional depth */
|
|
89
|
+
BRepGeometryOperation[BRepGeometryOperation["Cut"] = 4] = "Cut";
|
|
90
|
+
/** Create a pad or pocket in the target (first entry) using a planar region (second entry) */
|
|
91
|
+
BRepGeometryOperation[BRepGeometryOperation["Emboss"] = 5] = "Emboss";
|
|
92
|
+
/** Create a solid from a surface by offsetting using the specified forward and backward distances */
|
|
93
|
+
BRepGeometryOperation[BRepGeometryOperation["Thicken"] = 6] = "Thicken";
|
|
94
|
+
/** Create a shelled solid by offsetting all faces by the supplied distance */
|
|
95
|
+
BRepGeometryOperation[BRepGeometryOperation["Hollow"] = 7] = "Hollow";
|
|
96
|
+
/** Create a solid or surface by sweeping a planar profile (first entry) along a path (second entry) */
|
|
97
|
+
BRepGeometryOperation[BRepGeometryOperation["Sweep"] = 8] = "Sweep";
|
|
98
|
+
/** Create a solid or surface by lofting through a set of paths or regions */
|
|
99
|
+
BRepGeometryOperation[BRepGeometryOperation["Loft"] = 9] = "Loft";
|
|
100
|
+
/** Create a solid or sheet with all non-smooth/non-laminar edges rounded */
|
|
101
|
+
BRepGeometryOperation[BRepGeometryOperation["Round"] = 10] = "Round";
|
|
102
|
+
/** Offset all faces of a solid or sheet target by the supplied distance. */
|
|
103
|
+
BRepGeometryOperation[BRepGeometryOperation["Offset"] = 11] = "Offset";
|
|
104
|
+
})(BRepGeometryOperation = exports.BRepGeometryOperation || (exports.BRepGeometryOperation = {}));
|
|
105
|
+
/** Provides utility functions for working with [[ElementGeometryDataEntry]].
|
|
106
|
+
* @alpha
|
|
107
|
+
*/
|
|
108
|
+
var ElementGeometry;
|
|
109
|
+
(function (ElementGeometry) {
|
|
110
|
+
/** [[ElementGeometry.Builder]] is a helper class for populating a [[ElementGeometryDataEntry]] array needed to create a [[GeometricElement]] or [[GeometryPart]]. */
|
|
111
|
+
class Builder {
|
|
112
|
+
constructor() {
|
|
113
|
+
/** GeometryStream entries */
|
|
114
|
+
this.entries = [];
|
|
115
|
+
}
|
|
116
|
+
/** Current placement transform, converts local coordinate (placement relative) input to world */
|
|
117
|
+
get localToWorld() { return this._localToWorld; }
|
|
118
|
+
/** Current inverse placement transform, converts world coordinate input to local (placement relative) */
|
|
119
|
+
get worldToLocal() { return this._worldToLocal; }
|
|
120
|
+
/** Supply optional local to world transform. Used to transform world coordinate input relative to element placement.
|
|
121
|
+
* For a [[GeometricElement]]'s placement to be meaningful, world coordinate geometry should never be appended to an element with an identity placement.
|
|
122
|
+
* Can be called with undefined or identity transform to start appending geometry supplied in local coordinates again.
|
|
123
|
+
*/
|
|
124
|
+
setLocalToWorld(localToWorld) {
|
|
125
|
+
this._localToWorld = (undefined === localToWorld || localToWorld.isIdentity ? undefined : localToWorld.clone());
|
|
126
|
+
this._worldToLocal = (undefined === this._localToWorld ? undefined : this._localToWorld.inverse());
|
|
127
|
+
}
|
|
128
|
+
/** Supply local to world transform from a Point3d and optional YawPitchRollAngles.
|
|
129
|
+
* @see [[Placement3d]]
|
|
130
|
+
*/
|
|
131
|
+
setLocalToWorld3d(origin, angles = core_geometry_1.YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {
|
|
132
|
+
this.setLocalToWorld(core_geometry_1.Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));
|
|
133
|
+
}
|
|
134
|
+
/** Supply local to world transform from a Point2d and optional Angle.
|
|
135
|
+
* @see [[Placement2d]]
|
|
136
|
+
*/
|
|
137
|
+
setLocalToWorld2d(origin, angle = core_geometry_1.Angle.createDegrees(0.0)) {
|
|
138
|
+
this.setLocalToWorld(core_geometry_1.Transform.createOriginAndMatrix(core_geometry_1.Point3d.createFrom(origin), core_geometry_1.Matrix3d.createRotationAroundVector(core_geometry_1.Vector3d.unitZ(), angle)));
|
|
139
|
+
}
|
|
140
|
+
/** Supply local to world transform from a PlacementProps2d or PlacementProps3d.
|
|
141
|
+
* @see [[PlacementProps]]
|
|
142
|
+
*/
|
|
143
|
+
setLocalToWorldFromPlacement(props) {
|
|
144
|
+
const placement = (0, ElementProps_1.isPlacement2dProps)(props) ? Placement_1.Placement2d.fromJSON(props) : Placement_1.Placement3d.fromJSON(props);
|
|
145
|
+
this.setLocalToWorld(placement.transform);
|
|
146
|
+
}
|
|
147
|
+
/** Compute angles suitable for passing to [[setLocalToWorld3d]] from an array of 3d points. */
|
|
148
|
+
static placementAnglesFromPoints(pts, defaultUp, result) {
|
|
149
|
+
const angles = result ? result : new core_geometry_1.YawPitchRollAngles();
|
|
150
|
+
const zVec = defaultUp ? defaultUp.clone() : core_geometry_1.Vector3d.unitZ();
|
|
151
|
+
const matrix = core_geometry_1.Matrix3d.createRigidHeadsUp(zVec);
|
|
152
|
+
core_geometry_1.YawPitchRollAngles.createFromMatrix3d(matrix, angles);
|
|
153
|
+
if (pts.length < 2 || pts[0].isAlmostEqual(pts[1]))
|
|
154
|
+
return angles;
|
|
155
|
+
// Check if points have a well defined normal to use instead of defaultUp...
|
|
156
|
+
const frameTransform = core_geometry_1.FrameBuilder.createFrameToDistantPoints(pts);
|
|
157
|
+
if (undefined !== frameTransform) {
|
|
158
|
+
const plane = core_geometry_1.Plane3dByOriginAndUnitNormal.create(pts[0], frameTransform.matrix.getColumn(2));
|
|
159
|
+
if (undefined !== plane && core_geometry_1.Point3dArray.isCloseToPlane(pts, plane))
|
|
160
|
+
zVec.setFrom(plane.getNormalRef());
|
|
161
|
+
}
|
|
162
|
+
const xVec = core_geometry_1.Vector3d.createStartEnd(pts[0], pts[1]);
|
|
163
|
+
if (xVec.isParallelTo(zVec, true))
|
|
164
|
+
return angles;
|
|
165
|
+
const yVec = xVec.unitCrossProduct(zVec);
|
|
166
|
+
if (undefined === yVec)
|
|
167
|
+
return angles;
|
|
168
|
+
core_geometry_1.Matrix3d.createColumns(xVec, yVec, zVec, matrix);
|
|
169
|
+
if (undefined === core_geometry_1.Matrix3d.createRigidFromMatrix3d(matrix, undefined, matrix))
|
|
170
|
+
return angles;
|
|
171
|
+
core_geometry_1.YawPitchRollAngles.createFromMatrix3d(matrix, angles);
|
|
172
|
+
return angles;
|
|
173
|
+
}
|
|
174
|
+
/** Compute angle suitable for passing to [[setLocalToWorld2d]] from an array of xy plane points. */
|
|
175
|
+
static placementAngleFromPoints(pts, result) {
|
|
176
|
+
const angles = ElementGeometry.Builder.placementAnglesFromPoints(pts);
|
|
177
|
+
if (undefined === result)
|
|
178
|
+
return angles.yaw;
|
|
179
|
+
result.setFrom(angles.yaw);
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
/** Store local ranges for all subsequent geometry appended. Can improve performance of range testing for elements with a GeometryStream
|
|
183
|
+
* containing more than one [[GeometryQuery]] differentiable by range. Not useful for a single [[GeometryQuery]] as its range and that of the [[GeometricElement]] are the same.
|
|
184
|
+
* Ignored when defining a [[GeometryPart]] and not needed when only appending [[GeometryPart]] instances to a [[GeometricElement]] as these store their own range.
|
|
185
|
+
*/
|
|
186
|
+
appendGeometryRanges() {
|
|
187
|
+
const entry = fromSubGraphicRange(core_geometry_1.Range3d.create()); // Computed on backend, just need opcode...
|
|
188
|
+
if (undefined === entry)
|
|
189
|
+
return false;
|
|
190
|
+
this.entries.push(entry);
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
/** Change [[GeometryParams]] for subsequent geometry.
|
|
194
|
+
* It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherits the symbology of their instance for anything not explicitly overridden.
|
|
195
|
+
*/
|
|
196
|
+
appendGeometryParamsChange(geomParams) {
|
|
197
|
+
return appendGeometryParams(geomParams, this.entries, this._worldToLocal);
|
|
198
|
+
}
|
|
199
|
+
/** Append a [[GeometryQuery]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array */
|
|
200
|
+
appendGeometryQuery(geometry) {
|
|
201
|
+
const entry = ElementGeometry.fromGeometryQuery(geometry, this._worldToLocal);
|
|
202
|
+
if (undefined === entry)
|
|
203
|
+
return false;
|
|
204
|
+
this.entries.push(entry);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
/** Append a [[TextString]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array */
|
|
208
|
+
appendTextString(text) {
|
|
209
|
+
const entry = ElementGeometry.fromTextString(text.toJSON(), this._worldToLocal);
|
|
210
|
+
if (undefined === entry)
|
|
211
|
+
return false;
|
|
212
|
+
this.entries.push(entry);
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
/** Append a [[ImageGraphic]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array */
|
|
216
|
+
appendImageGraphic(image) {
|
|
217
|
+
const entry = ElementGeometry.fromImageGraphic(image.toJSON(), this._worldToLocal);
|
|
218
|
+
if (undefined === entry)
|
|
219
|
+
return false;
|
|
220
|
+
this.entries.push(entry);
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
/** Append a [[BRepEntity.DataProps]] supplied in either local or world coordinates to the [[ElementGeometryDataEntry]] array.
|
|
224
|
+
* Provided for compatibility with GeometryStreamBuilder only.
|
|
225
|
+
* Backend code should use IModelDb.createBRepGeometry to create a brep [[ElementGeometryDataEntry]] directly.
|
|
226
|
+
*/
|
|
227
|
+
appendBRepData(brep) {
|
|
228
|
+
const entry = ElementGeometry.fromBRep(brep, this._worldToLocal);
|
|
229
|
+
if (undefined === entry)
|
|
230
|
+
return false;
|
|
231
|
+
this.entries.push(entry);
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
/** Append a [[GeometryPart]] instance with relative transform to the [[ElementGeometryDataEntry]] array for creating a [[GeometricElement]].
|
|
235
|
+
* Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
|
|
236
|
+
*/
|
|
237
|
+
appendGeometryPart(partId, partTransform) {
|
|
238
|
+
const entry = ElementGeometry.fromGeometryPart(partId, partTransform, this._worldToLocal);
|
|
239
|
+
if (undefined === entry)
|
|
240
|
+
return false;
|
|
241
|
+
this.entries.push(entry);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
/** Append a [[GeometryPart]] instance with relative position, orientation, and scale to the [[ElementGeometryDataEntry]] array for creating a [[GeometricElement3d]].
|
|
245
|
+
* Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
|
|
246
|
+
*/
|
|
247
|
+
appendGeometryPart3d(partId, instanceOrigin, instanceRotation, instanceScale) {
|
|
248
|
+
const partTransform = core_geometry_1.Transform.createOriginAndMatrix(instanceOrigin, instanceRotation ? instanceRotation.toMatrix3d() : core_geometry_1.Matrix3d.createIdentity());
|
|
249
|
+
if (undefined !== instanceScale)
|
|
250
|
+
partTransform.matrix.scaleColumnsInPlace(instanceScale, instanceScale, instanceScale);
|
|
251
|
+
return this.appendGeometryPart(partId, partTransform);
|
|
252
|
+
}
|
|
253
|
+
/** Append a [[GeometryPart]] instance with relative position, orientation, and scale to the [[ElementGeometryDataEntry]] array for creating a [[GeometricElement2d]].
|
|
254
|
+
* Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.
|
|
255
|
+
*/
|
|
256
|
+
appendGeometryPart2d(partId, instanceOrigin, instanceRotation, instanceScale) {
|
|
257
|
+
return this.appendGeometryPart3d(partId, instanceOrigin ? core_geometry_1.Point3d.createFrom(instanceOrigin) : undefined, instanceRotation ? new core_geometry_1.YawPitchRollAngles(instanceRotation) : undefined, instanceScale);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
ElementGeometry.Builder = Builder;
|
|
261
|
+
class IteratorEntry {
|
|
262
|
+
constructor(geomParams, localToWorld, applyLocalToWorld) {
|
|
263
|
+
this.geomParams = geomParams;
|
|
264
|
+
this.localToWorld = localToWorld;
|
|
265
|
+
this._applyLocalToWorld = applyLocalToWorld ? !localToWorld.isIdentity : false;
|
|
266
|
+
}
|
|
267
|
+
get value() { return this._value; }
|
|
268
|
+
set value(value) { this._value = value; }
|
|
269
|
+
get outputTransform() {
|
|
270
|
+
return this._applyLocalToWorld ? this.localToWorld : undefined;
|
|
271
|
+
}
|
|
272
|
+
/** Return the [[GeometryQuery]] representation for the current entry */
|
|
273
|
+
toGeometryQuery() {
|
|
274
|
+
return toGeometryQuery(this.value, this.outputTransform);
|
|
275
|
+
}
|
|
276
|
+
/** Return the [[BRepEntity.DataProps]] representation for the current entry for checking brep type and face attachments. */
|
|
277
|
+
toBRepData(wantBRepData = false) {
|
|
278
|
+
return toBRep(this.value, wantBRepData, this.outputTransform);
|
|
279
|
+
}
|
|
280
|
+
/** Return the [[TextString]] representation for the current entry */
|
|
281
|
+
toTextString() {
|
|
282
|
+
const props = toTextString(this.value, this.outputTransform);
|
|
283
|
+
return (undefined !== props ? new TextString_1.TextString(props) : undefined);
|
|
284
|
+
}
|
|
285
|
+
/** Return the [[ImageGraphic]] representation for the current entry */
|
|
286
|
+
toImageGraphic() {
|
|
287
|
+
const props = toImageGraphic(this.value, this.outputTransform);
|
|
288
|
+
return (undefined !== props ? ImageGraphic_1.ImageGraphic.fromJSON(props) : undefined);
|
|
289
|
+
}
|
|
290
|
+
/** Return the GeometryPart information for the current entry */
|
|
291
|
+
toGeometryPart(partToLocal, partToWorld) {
|
|
292
|
+
if (undefined === partToLocal && undefined !== partToWorld)
|
|
293
|
+
partToLocal = core_geometry_1.Transform.createIdentity();
|
|
294
|
+
const partId = toGeometryPart(this.value, partToLocal);
|
|
295
|
+
if (undefined === partId || undefined === partToLocal || undefined === partToWorld)
|
|
296
|
+
return partId;
|
|
297
|
+
if (undefined !== this.localToWorld)
|
|
298
|
+
this.localToWorld.multiplyTransformTransform(partToLocal, partToWorld);
|
|
299
|
+
return partId;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
ElementGeometry.IteratorEntry = IteratorEntry;
|
|
303
|
+
/** [[ElementGeometry.Iterator]] is a helper class for iterating a [[ElementGeometryDataEntry]] array.
|
|
304
|
+
* Each [[ElementGeometryDataEntry]] returned by the iterator represents exactly one displayable entry.
|
|
305
|
+
*/
|
|
306
|
+
class Iterator {
|
|
307
|
+
/** Construct a new Iterator given a [[ElementGeometryInfo]] from either a [[GeometricElement3d]], [[GeometricElement2d]], or [[GeometryPart]].
|
|
308
|
+
* Supply the optional [[GeometryParams]] and localToWorld transform to iterate a [[GeometryPart]] in the context of a [[GeometricElement]] reference.
|
|
309
|
+
*/
|
|
310
|
+
constructor(info, categoryOrGeometryParams, localToWorld) {
|
|
311
|
+
/** Current entry position */
|
|
312
|
+
this._index = 0;
|
|
313
|
+
/** Whether deserialized entry data is returned in world or local coordinates */
|
|
314
|
+
this._applyLocalToWorld = false;
|
|
315
|
+
this.entryArray = info.entryArray;
|
|
316
|
+
this.viewIndependent = info.viewIndependent;
|
|
317
|
+
this.brepsPresent = info.brepsPresent;
|
|
318
|
+
if (undefined !== info.categoryId)
|
|
319
|
+
categoryOrGeometryParams = info.categoryId;
|
|
320
|
+
if (undefined !== categoryOrGeometryParams)
|
|
321
|
+
this._appearance = typeof categoryOrGeometryParams === "string" ? new GeometryParams_1.GeometryParams(categoryOrGeometryParams) : categoryOrGeometryParams;
|
|
322
|
+
else
|
|
323
|
+
this._appearance = new GeometryParams_1.GeometryParams(core_bentley_1.Id64.invalid);
|
|
324
|
+
if (undefined !== info.sourceToWorld)
|
|
325
|
+
localToWorld = ElementGeometry.toTransform(info.sourceToWorld);
|
|
326
|
+
if (undefined !== localToWorld)
|
|
327
|
+
this._localToWorld = localToWorld;
|
|
328
|
+
else
|
|
329
|
+
this._localToWorld = core_geometry_1.Transform.createIdentity();
|
|
330
|
+
const orgAng = core_geometry_1.YawPitchRollAngles.tryFromTransform(this._localToWorld);
|
|
331
|
+
if (undefined === orgAng.angles)
|
|
332
|
+
orgAng.angles = core_geometry_1.YawPitchRollAngles.createDegrees(0, 0, 0);
|
|
333
|
+
let bbox = (undefined !== info.bbox ? ElementGeometry.toElementAlignedBox3d(info.bbox) : undefined);
|
|
334
|
+
if (undefined === bbox)
|
|
335
|
+
bbox = core_geometry_1.Range3d.createNull();
|
|
336
|
+
this.placement = new Placement_1.Placement3d(orgAng.origin, orgAng.angles, bbox);
|
|
337
|
+
}
|
|
338
|
+
/** Call to return deserialized entry data in world coordinates */
|
|
339
|
+
requestWorldCoordinates() {
|
|
340
|
+
this._applyLocalToWorld = !this._localToWorld.isIdentity;
|
|
341
|
+
}
|
|
342
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
343
|
+
get entry() {
|
|
344
|
+
if (undefined === this._entry)
|
|
345
|
+
this._entry = new IteratorEntry(this._appearance, this._localToWorld, this._applyLocalToWorld);
|
|
346
|
+
return this._entry;
|
|
347
|
+
}
|
|
348
|
+
/** Advance to next displayable opcode (geometric entry or geometry part) while updating the current [[GeometryParams]] from appearance related opcodes. */
|
|
349
|
+
next() {
|
|
350
|
+
while (this._index < this.entryArray.length) {
|
|
351
|
+
const value = this.entryArray[this._index++];
|
|
352
|
+
if (ElementGeometry.isAppearanceEntry(value)) {
|
|
353
|
+
const localToWorld = (this._applyLocalToWorld ? this._localToWorld : undefined);
|
|
354
|
+
ElementGeometry.updateGeometryParams(value, this.entry.geomParams, localToWorld);
|
|
355
|
+
}
|
|
356
|
+
else if (ElementGeometryOpcode.SubGraphicRange === value.opcode) {
|
|
357
|
+
// NOTE: localRange remains valid until the next sub-range entry is encountered...
|
|
358
|
+
this.entry.localRange = ElementGeometry.toSubGraphicRange(value);
|
|
359
|
+
}
|
|
360
|
+
else if (ElementGeometryOpcode.PartReference === value.opcode) {
|
|
361
|
+
this.entry.value = value;
|
|
362
|
+
return { value: this.entry, done: false };
|
|
363
|
+
}
|
|
364
|
+
else if (ElementGeometry.isGeometricEntry(value)) {
|
|
365
|
+
this.entry.value = value;
|
|
366
|
+
return { value: this.entry, done: false };
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return { value: this.entry, done: true };
|
|
370
|
+
}
|
|
371
|
+
[Symbol.iterator]() {
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
ElementGeometry.Iterator = Iterator;
|
|
376
|
+
/** Return whether the supplied entry can be represented as a [[GeometryQuery]] */
|
|
377
|
+
function isGeometryQueryEntry(entry) {
|
|
378
|
+
switch (entry.opcode) {
|
|
379
|
+
case ElementGeometryOpcode.PointPrimitive:
|
|
380
|
+
case ElementGeometryOpcode.PointPrimitive2d:
|
|
381
|
+
case ElementGeometryOpcode.ArcPrimitive:
|
|
382
|
+
case ElementGeometryOpcode.CurveCollection:
|
|
383
|
+
case ElementGeometryOpcode.Polyface:
|
|
384
|
+
case ElementGeometryOpcode.CurvePrimitive:
|
|
385
|
+
case ElementGeometryOpcode.SolidPrimitive:
|
|
386
|
+
case ElementGeometryOpcode.BsplineSurface:
|
|
387
|
+
return true;
|
|
388
|
+
default:
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
ElementGeometry.isGeometryQueryEntry = isGeometryQueryEntry;
|
|
393
|
+
/** Return whether the supplied entry is displayable geometry [[GeometryQuery]], [[BRepEntity.DataProps]], [[TextString]], or [[ImageGraphic]] */
|
|
394
|
+
function isGeometricEntry(entry) {
|
|
395
|
+
switch (entry.opcode) {
|
|
396
|
+
case ElementGeometryOpcode.BRep:
|
|
397
|
+
case ElementGeometryOpcode.TextString:
|
|
398
|
+
case ElementGeometryOpcode.Image:
|
|
399
|
+
return true;
|
|
400
|
+
default:
|
|
401
|
+
return isGeometryQueryEntry(entry);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
ElementGeometry.isGeometricEntry = isGeometricEntry;
|
|
405
|
+
/** Return whether the supplied entry is geometric or a part reference */
|
|
406
|
+
function isDisplayableEntry(entry) {
|
|
407
|
+
switch (entry.opcode) {
|
|
408
|
+
case ElementGeometryOpcode.PartReference:
|
|
409
|
+
return true;
|
|
410
|
+
default:
|
|
411
|
+
return isGeometricEntry(entry);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
ElementGeometry.isDisplayableEntry = isDisplayableEntry;
|
|
415
|
+
/** Return whether the supplied entry represents appearance information */
|
|
416
|
+
function isAppearanceEntry(entry) {
|
|
417
|
+
switch (entry.opcode) {
|
|
418
|
+
case ElementGeometryOpcode.BasicSymbology:
|
|
419
|
+
case ElementGeometryOpcode.Fill:
|
|
420
|
+
case ElementGeometryOpcode.Pattern:
|
|
421
|
+
case ElementGeometryOpcode.Material:
|
|
422
|
+
case ElementGeometryOpcode.LineStyleModifiers:
|
|
423
|
+
return true;
|
|
424
|
+
default:
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
ElementGeometry.isAppearanceEntry = isAppearanceEntry;
|
|
429
|
+
/** Return whether the supplied entry represents a single open curve or path */
|
|
430
|
+
function isCurve(entry) {
|
|
431
|
+
switch (entry.opcode) {
|
|
432
|
+
case ElementGeometryOpcode.PointPrimitive: {
|
|
433
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
434
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
435
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open === ppfb.boundary());
|
|
436
|
+
}
|
|
437
|
+
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
438
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
439
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
440
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open === ppfb.boundary());
|
|
441
|
+
}
|
|
442
|
+
case ElementGeometryOpcode.ArcPrimitive: {
|
|
443
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
444
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
445
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open === ppfb.boundary());
|
|
446
|
+
}
|
|
447
|
+
case ElementGeometryOpcode.CurvePrimitive: {
|
|
448
|
+
// should never be a point string or closed bcurve...
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
case ElementGeometryOpcode.CurveCollection: {
|
|
452
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
453
|
+
if (undefined === geom || Array.isArray(geom))
|
|
454
|
+
return false;
|
|
455
|
+
return ("curveCollection" === geom.geometryCategory && !geom.isAnyRegionType);
|
|
456
|
+
}
|
|
457
|
+
default:
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
ElementGeometry.isCurve = isCurve;
|
|
462
|
+
/** Return whether the supplied entry represents a loop, planar region, open polyface, or sheet body */
|
|
463
|
+
function isSurface(entry) {
|
|
464
|
+
switch (entry.opcode) {
|
|
465
|
+
case ElementGeometryOpcode.PointPrimitive: {
|
|
466
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
467
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
468
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary());
|
|
469
|
+
}
|
|
470
|
+
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
471
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
472
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
473
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary());
|
|
474
|
+
}
|
|
475
|
+
case ElementGeometryOpcode.ArcPrimitive: {
|
|
476
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
477
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
478
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary());
|
|
479
|
+
}
|
|
480
|
+
case ElementGeometryOpcode.CurvePrimitive: {
|
|
481
|
+
// should never be a closed bcurve...
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
case ElementGeometryOpcode.CurveCollection: {
|
|
485
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
486
|
+
if (undefined === geom || Array.isArray(geom))
|
|
487
|
+
return false;
|
|
488
|
+
return ("curveCollection" === geom.geometryCategory && geom.isAnyRegionType);
|
|
489
|
+
}
|
|
490
|
+
case ElementGeometryOpcode.SolidPrimitive: {
|
|
491
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
492
|
+
if (undefined === geom || Array.isArray(geom))
|
|
493
|
+
return false;
|
|
494
|
+
return ("solid" === geom.geometryCategory && !geom.isClosedVolume);
|
|
495
|
+
}
|
|
496
|
+
case ElementGeometryOpcode.Polyface: {
|
|
497
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
498
|
+
if (undefined === geom || Array.isArray(geom))
|
|
499
|
+
return false;
|
|
500
|
+
if ("polyface" !== geom.geometryCategory)
|
|
501
|
+
return false;
|
|
502
|
+
const polyface = geom;
|
|
503
|
+
switch (polyface.expectedClosure) {
|
|
504
|
+
case 0:
|
|
505
|
+
return !core_geometry_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface);
|
|
506
|
+
case 1:
|
|
507
|
+
return true;
|
|
508
|
+
case 2:
|
|
509
|
+
default:
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
case ElementGeometryOpcode.BsplineSurface: {
|
|
514
|
+
// never treated as a solid even if closed/periodic in u/v...
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
case ElementGeometryOpcode.BRep: {
|
|
518
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
519
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
520
|
+
return (ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet === ppfb.brepType());
|
|
521
|
+
}
|
|
522
|
+
default:
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
ElementGeometry.isSurface = isSurface;
|
|
527
|
+
/** Return whether the supplied entry represents a capped solid, closed polyface, or solid body */
|
|
528
|
+
function isSolid(entry) {
|
|
529
|
+
switch (entry.opcode) {
|
|
530
|
+
case ElementGeometryOpcode.SolidPrimitive: {
|
|
531
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
532
|
+
if (undefined === geom || Array.isArray(geom))
|
|
533
|
+
return false;
|
|
534
|
+
return ("solid" === geom.geometryCategory && geom.isClosedVolume);
|
|
535
|
+
}
|
|
536
|
+
case ElementGeometryOpcode.Polyface: {
|
|
537
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
538
|
+
if (undefined === geom || Array.isArray(geom))
|
|
539
|
+
return false;
|
|
540
|
+
if ("polyface" !== geom.geometryCategory)
|
|
541
|
+
return false;
|
|
542
|
+
const polyface = geom;
|
|
543
|
+
switch (polyface.expectedClosure) {
|
|
544
|
+
case 0:
|
|
545
|
+
return core_geometry_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface);
|
|
546
|
+
case 2:
|
|
547
|
+
return true;
|
|
548
|
+
case 1:
|
|
549
|
+
default:
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
case ElementGeometryOpcode.BRep: {
|
|
554
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
555
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
556
|
+
return (ElementGeometryFB_1.EGFBAccessors.BRepType.Solid === ppfb.brepType());
|
|
557
|
+
}
|
|
558
|
+
default:
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
ElementGeometry.isSolid = isSolid;
|
|
563
|
+
/** Return the body type that would be used to represent the supplied entry */
|
|
564
|
+
function getBRepEntityType(entry) {
|
|
565
|
+
switch (entry.opcode) {
|
|
566
|
+
case ElementGeometryOpcode.PointPrimitive: {
|
|
567
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
568
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
569
|
+
if (ElementGeometryFB_1.EGFBAccessors.BoundaryType.None === ppfb.boundary())
|
|
570
|
+
return undefined;
|
|
571
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
572
|
+
}
|
|
573
|
+
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
574
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
575
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
576
|
+
if (ElementGeometryFB_1.EGFBAccessors.BoundaryType.None === ppfb.boundary())
|
|
577
|
+
return undefined;
|
|
578
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
579
|
+
}
|
|
580
|
+
case ElementGeometryOpcode.ArcPrimitive: {
|
|
581
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
582
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
583
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
584
|
+
}
|
|
585
|
+
case ElementGeometryOpcode.CurvePrimitive: {
|
|
586
|
+
// should never be a point string or closed bcurve...
|
|
587
|
+
return GeometryStream_1.BRepEntity.Type.Wire;
|
|
588
|
+
}
|
|
589
|
+
case ElementGeometryOpcode.CurveCollection: {
|
|
590
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
591
|
+
if (undefined === geom || Array.isArray(geom))
|
|
592
|
+
return undefined;
|
|
593
|
+
if ("curveCollection" !== geom.geometryCategory)
|
|
594
|
+
return undefined;
|
|
595
|
+
const curves = geom;
|
|
596
|
+
return (curves.isAnyRegionType ? GeometryStream_1.BRepEntity.Type.Sheet : GeometryStream_1.BRepEntity.Type.Wire);
|
|
597
|
+
}
|
|
598
|
+
case ElementGeometryOpcode.SolidPrimitive: {
|
|
599
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
600
|
+
if (undefined === geom || Array.isArray(geom))
|
|
601
|
+
return undefined;
|
|
602
|
+
if ("solid" !== geom.geometryCategory)
|
|
603
|
+
return undefined;
|
|
604
|
+
const solid = geom;
|
|
605
|
+
return (solid.isClosedVolume ? GeometryStream_1.BRepEntity.Type.Solid : GeometryStream_1.BRepEntity.Type.Sheet);
|
|
606
|
+
}
|
|
607
|
+
case ElementGeometryOpcode.BsplineSurface: {
|
|
608
|
+
// always a surface...
|
|
609
|
+
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
610
|
+
}
|
|
611
|
+
case ElementGeometryOpcode.Polyface: {
|
|
612
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
613
|
+
if (undefined === geom || Array.isArray(geom))
|
|
614
|
+
return undefined;
|
|
615
|
+
if ("polyface" !== geom.geometryCategory)
|
|
616
|
+
return undefined;
|
|
617
|
+
const polyface = geom;
|
|
618
|
+
switch (polyface.expectedClosure) {
|
|
619
|
+
case 0:
|
|
620
|
+
return core_geometry_1.PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface) ? GeometryStream_1.BRepEntity.Type.Solid : GeometryStream_1.BRepEntity.Type.Sheet;
|
|
621
|
+
case 1:
|
|
622
|
+
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
623
|
+
case 2:
|
|
624
|
+
return GeometryStream_1.BRepEntity.Type.Solid;
|
|
625
|
+
default:
|
|
626
|
+
return undefined;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
case ElementGeometryOpcode.BRep: {
|
|
630
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
631
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
632
|
+
switch (ppfb.brepType()) {
|
|
633
|
+
case ElementGeometryFB_1.EGFBAccessors.BRepType.Wire:
|
|
634
|
+
return GeometryStream_1.BRepEntity.Type.Wire; // always be persisted as a curve type...
|
|
635
|
+
case ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet:
|
|
636
|
+
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
637
|
+
case ElementGeometryFB_1.EGFBAccessors.BRepType.Solid:
|
|
638
|
+
return GeometryStream_1.BRepEntity.Type.Solid;
|
|
639
|
+
default:
|
|
640
|
+
return undefined;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
default:
|
|
644
|
+
return undefined;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
ElementGeometry.getBRepEntityType = getBRepEntityType;
|
|
648
|
+
/** Return entry as a [[GeometryQuery]] */
|
|
649
|
+
function toGeometryQuery(entry, localToWorld) {
|
|
650
|
+
if (!isGeometryQueryEntry(entry))
|
|
651
|
+
return undefined;
|
|
652
|
+
switch (entry.opcode) {
|
|
653
|
+
case ElementGeometryOpcode.PointPrimitive: {
|
|
654
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
655
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
656
|
+
const pts = [];
|
|
657
|
+
for (let i = 0; i < ppfb.coordsLength(); i++)
|
|
658
|
+
pts.push(core_geometry_1.Point3d.create(ppfb.coords(i).x(), ppfb.coords(i).y(), ppfb.coords(i).z()));
|
|
659
|
+
if (0 === pts.length)
|
|
660
|
+
return undefined;
|
|
661
|
+
if (undefined !== localToWorld)
|
|
662
|
+
localToWorld.multiplyPoint3dArrayInPlace(pts);
|
|
663
|
+
switch (ppfb.boundary()) {
|
|
664
|
+
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open:
|
|
665
|
+
return core_geometry_1.LineString3d.createPoints(pts);
|
|
666
|
+
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed:
|
|
667
|
+
return core_geometry_1.Loop.createPolygon(pts);
|
|
668
|
+
default:
|
|
669
|
+
return core_geometry_1.PointString3d.createPoints(pts);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
case ElementGeometryOpcode.PointPrimitive2d: {
|
|
673
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
674
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive2d.getRootAsPointPrimitive2d(buffer);
|
|
675
|
+
const pts = [];
|
|
676
|
+
for (let i = 0; i < ppfb.coordsLength(); i++)
|
|
677
|
+
pts.push(core_geometry_1.Point3d.create(ppfb.coords(i).x(), ppfb.coords(i).y()));
|
|
678
|
+
if (0 === pts.length)
|
|
679
|
+
return undefined;
|
|
680
|
+
if (undefined !== localToWorld)
|
|
681
|
+
localToWorld.multiplyPoint3dArrayInPlace(pts);
|
|
682
|
+
switch (ppfb.boundary()) {
|
|
683
|
+
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Open:
|
|
684
|
+
return core_geometry_1.LineString3d.createPoints(pts);
|
|
685
|
+
case ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed:
|
|
686
|
+
return core_geometry_1.Loop.createPolygon(pts);
|
|
687
|
+
default:
|
|
688
|
+
return core_geometry_1.PointString3d.createPoints(pts);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
case ElementGeometryOpcode.ArcPrimitive: {
|
|
692
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
693
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.ArcPrimitive.getRootAsArcPrimitive(buffer);
|
|
694
|
+
const center = core_geometry_1.Point3d.create(ppfb.center().x(), ppfb.center().y(), ppfb.center().z());
|
|
695
|
+
const vector0 = core_geometry_1.Vector3d.create(ppfb.vector0().x(), ppfb.vector0().y(), ppfb.vector0().z());
|
|
696
|
+
const vector90 = core_geometry_1.Vector3d.create(ppfb.vector90().x(), ppfb.vector90().y(), ppfb.vector90().z());
|
|
697
|
+
const arc = core_geometry_1.Arc3d.create(center, vector0, vector90, core_geometry_1.AngleSweep.createStartSweepRadians(ppfb.start(), ppfb.sweep()));
|
|
698
|
+
if (undefined !== localToWorld && !arc.tryTransformInPlace(localToWorld))
|
|
699
|
+
return undefined;
|
|
700
|
+
return (ElementGeometryFB_1.EGFBAccessors.BoundaryType.Closed === ppfb.boundary() ? core_geometry_1.Loop.create(arc) : arc);
|
|
701
|
+
}
|
|
702
|
+
case ElementGeometryOpcode.CurvePrimitive:
|
|
703
|
+
case ElementGeometryOpcode.CurveCollection:
|
|
704
|
+
case ElementGeometryOpcode.SolidPrimitive:
|
|
705
|
+
case ElementGeometryOpcode.BsplineSurface:
|
|
706
|
+
case ElementGeometryOpcode.Polyface:
|
|
707
|
+
const geom = core_geometry_1.BentleyGeometryFlatBuffer.bytesToGeometry(entry.data, true);
|
|
708
|
+
if (undefined === geom || Array.isArray(geom))
|
|
709
|
+
return undefined; // Should always be a single entry not an array...
|
|
710
|
+
if (undefined !== localToWorld && !geom.tryTransformInPlace(localToWorld))
|
|
711
|
+
return undefined;
|
|
712
|
+
return geom;
|
|
713
|
+
default:
|
|
714
|
+
return undefined; // Not a GeometryQuery, need to be handled explicitly...
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
ElementGeometry.toGeometryQuery = toGeometryQuery;
|
|
718
|
+
/** Create entry from a [[GeometryQuery]] */
|
|
719
|
+
function fromGeometryQuery(geom, worldToLocal) {
|
|
720
|
+
let opcode;
|
|
721
|
+
switch (geom.geometryCategory) {
|
|
722
|
+
case "bsurf":
|
|
723
|
+
opcode = ElementGeometryOpcode.BsplineSurface;
|
|
724
|
+
break;
|
|
725
|
+
case "curveCollection":
|
|
726
|
+
opcode = ElementGeometryOpcode.CurveCollection;
|
|
727
|
+
break;
|
|
728
|
+
case "curvePrimitive":
|
|
729
|
+
case "pointCollection":
|
|
730
|
+
opcode = ElementGeometryOpcode.CurvePrimitive;
|
|
731
|
+
break;
|
|
732
|
+
case "polyface":
|
|
733
|
+
opcode = ElementGeometryOpcode.Polyface;
|
|
734
|
+
break;
|
|
735
|
+
case "solid":
|
|
736
|
+
opcode = ElementGeometryOpcode.SolidPrimitive;
|
|
737
|
+
break;
|
|
738
|
+
default:
|
|
739
|
+
return undefined;
|
|
740
|
+
}
|
|
741
|
+
if (undefined !== worldToLocal) {
|
|
742
|
+
const localGeom = geom.cloneTransformed(worldToLocal);
|
|
743
|
+
if (undefined === localGeom)
|
|
744
|
+
return undefined;
|
|
745
|
+
geom = localGeom;
|
|
746
|
+
}
|
|
747
|
+
const data = core_geometry_1.BentleyGeometryFlatBuffer.geometryToBytes(geom, true);
|
|
748
|
+
if (undefined === data)
|
|
749
|
+
return undefined;
|
|
750
|
+
return { opcode, data };
|
|
751
|
+
}
|
|
752
|
+
ElementGeometry.fromGeometryQuery = fromGeometryQuery;
|
|
753
|
+
/** Return entry as a [[TextString]] */
|
|
754
|
+
function toTextString(entry, localToWorld) {
|
|
755
|
+
if (ElementGeometryOpcode.TextString !== entry.opcode)
|
|
756
|
+
return undefined;
|
|
757
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
758
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.TextString.getRootAsTextString(buffer);
|
|
759
|
+
const style = ppfb.style();
|
|
760
|
+
if (null === style)
|
|
761
|
+
return undefined;
|
|
762
|
+
const text = ppfb.text();
|
|
763
|
+
const props = { text: (null !== text ? text : ""), font: style.fontId(), height: style.height() };
|
|
764
|
+
props.widthFactor = style.widthFactor();
|
|
765
|
+
props.bold = style.isBold();
|
|
766
|
+
props.italic = style.isItalic();
|
|
767
|
+
props.underline = style.isUnderlined();
|
|
768
|
+
const transform = ppfb.transform();
|
|
769
|
+
if (null !== transform) {
|
|
770
|
+
props.origin = core_geometry_1.Point3d.create(transform.form3d03(), transform.form3d13(), transform.form3d23());
|
|
771
|
+
props.rotation = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(core_geometry_1.Matrix3d.createRowValues(transform.form3d00(), transform.form3d01(), transform.form3d02(), transform.form3d10(), transform.form3d11(), transform.form3d12(), transform.form3d20(), transform.form3d21(), transform.form3d22()));
|
|
772
|
+
}
|
|
773
|
+
if (undefined === localToWorld)
|
|
774
|
+
return props;
|
|
775
|
+
const textString = new TextString_1.TextString(props);
|
|
776
|
+
if (!textString.transformInPlace(localToWorld))
|
|
777
|
+
return undefined;
|
|
778
|
+
return textString.toJSON();
|
|
779
|
+
}
|
|
780
|
+
ElementGeometry.toTextString = toTextString;
|
|
781
|
+
/** Create entry from a [[TextString]] */
|
|
782
|
+
function fromTextString(text, worldToLocal) {
|
|
783
|
+
if (undefined !== worldToLocal) {
|
|
784
|
+
const localText = new TextString_1.TextString(text);
|
|
785
|
+
if (!localText.transformInPlace(worldToLocal))
|
|
786
|
+
return undefined;
|
|
787
|
+
text = localText.toJSON();
|
|
788
|
+
}
|
|
789
|
+
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
790
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.TextString;
|
|
791
|
+
const textOffset = fbb.createString(text.text);
|
|
792
|
+
const styleOffset = ElementGeometryFB_1.EGFBAccessors.TextStringStyle.createTextStringStyle(fbb, 1, 0, text.font, undefined === text.bold ? false : text.bold, undefined === text.italic ? false : text.italic, undefined === text.underline ? false : text.underline, text.height, undefined === text.widthFactor ? 1.0 : text.widthFactor);
|
|
793
|
+
builder.startTextString(fbb);
|
|
794
|
+
builder.addMajorVersion(fbb, 1);
|
|
795
|
+
builder.addMinorVersion(fbb, 0);
|
|
796
|
+
builder.addText(fbb, textOffset);
|
|
797
|
+
builder.addStyle(fbb, styleOffset);
|
|
798
|
+
if (undefined !== text.origin || undefined !== text.rotation) {
|
|
799
|
+
const origin = core_geometry_1.Point3d.fromJSON(text.origin);
|
|
800
|
+
const angles = core_geometry_1.YawPitchRollAngles.fromJSON(text.rotation);
|
|
801
|
+
const matrix = angles.toMatrix3d();
|
|
802
|
+
const coffs = matrix.coffs;
|
|
803
|
+
const transformOffset = ElementGeometryFB_1.EGFBAccessors.TextStringTransform.createTextStringTransform(fbb, coffs[0], coffs[1], coffs[2], origin.x, coffs[3], coffs[4], coffs[5], origin.y, coffs[6], coffs[7], coffs[8], origin.z);
|
|
804
|
+
builder.addTransform(fbb, transformOffset);
|
|
805
|
+
}
|
|
806
|
+
const mLoc = builder.endTextString(fbb);
|
|
807
|
+
fbb.finish(mLoc);
|
|
808
|
+
const data = fbb.asUint8Array();
|
|
809
|
+
return { opcode: ElementGeometryOpcode.TextString, data };
|
|
810
|
+
}
|
|
811
|
+
ElementGeometry.fromTextString = fromTextString;
|
|
812
|
+
/** Return entry as a [[ImageGraphic]] */
|
|
813
|
+
function toImageGraphic(entry, localToWorld) {
|
|
814
|
+
if (ElementGeometryOpcode.Image !== entry.opcode)
|
|
815
|
+
return undefined;
|
|
816
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
817
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.Image.getRootAsImage(buffer);
|
|
818
|
+
const textureLong = ppfb.textureId();
|
|
819
|
+
const textureId = core_bentley_1.Id64.fromUint32Pair(textureLong.low, textureLong.high);
|
|
820
|
+
const hasBorder = (1 === ppfb.drawBorder());
|
|
821
|
+
const corners = new ImageGraphic_1.ImageGraphicCorners(core_geometry_1.Point3d.createZero(), core_geometry_1.Point3d.createZero(), core_geometry_1.Point3d.createZero(), core_geometry_1.Point3d.createZero());
|
|
822
|
+
const corner0 = ppfb.tileCorner0();
|
|
823
|
+
const corner1 = ppfb.tileCorner1();
|
|
824
|
+
const corner2 = ppfb.tileCorner2();
|
|
825
|
+
const corner3 = ppfb.tileCorner3();
|
|
826
|
+
if (null !== corner0)
|
|
827
|
+
corners[0].setFrom(core_geometry_1.Point3d.create(corner0.x(), corner0.y(), corner0.z()));
|
|
828
|
+
if (null !== corner1)
|
|
829
|
+
corners[1].setFrom(core_geometry_1.Point3d.create(corner1.x(), corner1.y(), corner1.z()));
|
|
830
|
+
if (null !== corner2)
|
|
831
|
+
corners[2].setFrom(core_geometry_1.Point3d.create(corner2.x(), corner2.y(), corner2.z()));
|
|
832
|
+
if (null !== corner3)
|
|
833
|
+
corners[3].setFrom(core_geometry_1.Point3d.create(corner3.x(), corner3.y(), corner3.z()));
|
|
834
|
+
if (undefined !== localToWorld) {
|
|
835
|
+
localToWorld.multiplyXYAndZInPlace(corners[0]);
|
|
836
|
+
localToWorld.multiplyXYAndZInPlace(corners[1]);
|
|
837
|
+
localToWorld.multiplyXYAndZInPlace(corners[2]);
|
|
838
|
+
localToWorld.multiplyXYAndZInPlace(corners[3]);
|
|
839
|
+
}
|
|
840
|
+
return { corners: corners.toJSON(), textureId, hasBorder };
|
|
841
|
+
}
|
|
842
|
+
ElementGeometry.toImageGraphic = toImageGraphic;
|
|
843
|
+
/** Create entry from a [[ImageGraphic]] */
|
|
844
|
+
function fromImageGraphic(image, worldToLocal) {
|
|
845
|
+
if (undefined !== worldToLocal) {
|
|
846
|
+
const localImage = ImageGraphic_1.ImageGraphic.fromJSON(image).cloneTransformed(worldToLocal);
|
|
847
|
+
image = localImage.toJSON();
|
|
848
|
+
}
|
|
849
|
+
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
850
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.Image;
|
|
851
|
+
builder.startImage(fbb);
|
|
852
|
+
const textudeIdPair = core_bentley_1.Id64.getUint32Pair(image.textureId);
|
|
853
|
+
builder.addTextureId(fbb, flatbuffers_1.flatbuffers.Long.create(textudeIdPair.lower, textudeIdPair.upper));
|
|
854
|
+
builder.addDrawBorder(fbb, image.hasBorder ? 1 : 0);
|
|
855
|
+
const corners = ImageGraphic_1.ImageGraphicCorners.fromJSON(image.corners);
|
|
856
|
+
const cornerOffset0 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[0].x, corners[0].y, corners[0].z);
|
|
857
|
+
builder.addTileCorner0(fbb, cornerOffset0);
|
|
858
|
+
const cornerOffset1 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[1].x, corners[1].y, corners[1].z);
|
|
859
|
+
builder.addTileCorner1(fbb, cornerOffset1);
|
|
860
|
+
const cornerOffset2 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[2].x, corners[2].y, corners[2].z);
|
|
861
|
+
builder.addTileCorner2(fbb, cornerOffset2);
|
|
862
|
+
const cornerOffset3 = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, corners[3].x, corners[3].y, corners[3].z);
|
|
863
|
+
builder.addTileCorner3(fbb, cornerOffset3);
|
|
864
|
+
const mLoc = builder.endImage(fbb);
|
|
865
|
+
fbb.finish(mLoc);
|
|
866
|
+
const data = fbb.asUint8Array();
|
|
867
|
+
return { opcode: ElementGeometryOpcode.Image, data };
|
|
868
|
+
}
|
|
869
|
+
ElementGeometry.fromImageGraphic = fromImageGraphic;
|
|
870
|
+
/** Return entry as a [[BRepEntity.DataProps]] for checking brep type and face attachments. */
|
|
871
|
+
function toBRep(entry, wantBRepData = false, localToWorld) {
|
|
872
|
+
if (ElementGeometryOpcode.BRep !== entry.opcode)
|
|
873
|
+
return undefined;
|
|
874
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
875
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
876
|
+
const toBRepType = (typeFb) => {
|
|
877
|
+
switch (typeFb) {
|
|
878
|
+
case ElementGeometryFB_1.EGFBAccessors.BRepType.Wire:
|
|
879
|
+
return GeometryStream_1.BRepEntity.Type.Wire;
|
|
880
|
+
case ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet:
|
|
881
|
+
return GeometryStream_1.BRepEntity.Type.Sheet;
|
|
882
|
+
default:
|
|
883
|
+
return GeometryStream_1.BRepEntity.Type.Solid;
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
const type = toBRepType(ppfb.brepType());
|
|
887
|
+
let transform;
|
|
888
|
+
const entityTransform = ppfb.entityTransform();
|
|
889
|
+
if (null !== entityTransform)
|
|
890
|
+
transform = core_geometry_1.Transform.createRowValues(entityTransform.x00(), entityTransform.x01(), entityTransform.x02(), entityTransform.tx(), entityTransform.x10(), entityTransform.x11(), entityTransform.x12(), entityTransform.ty(), entityTransform.x20(), entityTransform.x21(), entityTransform.x22(), entityTransform.tz());
|
|
891
|
+
if (undefined !== localToWorld) {
|
|
892
|
+
if (undefined !== transform)
|
|
893
|
+
transform.multiplyTransformTransform(localToWorld, transform);
|
|
894
|
+
else
|
|
895
|
+
transform = localToWorld;
|
|
896
|
+
}
|
|
897
|
+
const faceSymbLen = ppfb.symbologyLength();
|
|
898
|
+
let faceSymbology;
|
|
899
|
+
if (0 !== faceSymbLen) {
|
|
900
|
+
const faceSymbPropsArray = [];
|
|
901
|
+
for (let index = 0; index < faceSymbLen; ++index) {
|
|
902
|
+
const faceSymbFb = ppfb.symbology(index);
|
|
903
|
+
const faceSymbProps = {};
|
|
904
|
+
if (null !== faceSymbFb) {
|
|
905
|
+
if (1 === faceSymbFb.useColor())
|
|
906
|
+
faceSymbProps.color = faceSymbFb.color();
|
|
907
|
+
if (1 === faceSymbFb.useMaterial())
|
|
908
|
+
faceSymbProps.materialId = core_bentley_1.Id64.fromUint32Pair(faceSymbFb.materialId().low, faceSymbFb.materialId().high);
|
|
909
|
+
faceSymbProps.transparency = faceSymbFb.transparency();
|
|
910
|
+
}
|
|
911
|
+
faceSymbPropsArray.push(faceSymbProps);
|
|
912
|
+
}
|
|
913
|
+
faceSymbology = faceSymbPropsArray;
|
|
914
|
+
}
|
|
915
|
+
let data;
|
|
916
|
+
const entityData = ppfb.entityDataArray();
|
|
917
|
+
if (wantBRepData && null !== entityData)
|
|
918
|
+
data = Base64EncodedString_1.Base64EncodedString.fromUint8Array(entityData);
|
|
919
|
+
return { data, type, transform: transform?.toJSON(), faceSymbology };
|
|
920
|
+
}
|
|
921
|
+
ElementGeometry.toBRep = toBRep;
|
|
922
|
+
/** Create entry from a [[BRepEntity.DataProps]]. Provided for compatibility with GeometryStreamBuilder only. */
|
|
923
|
+
function fromBRep(brep, worldToLocal) {
|
|
924
|
+
if (undefined !== worldToLocal) {
|
|
925
|
+
const entityTrans = core_geometry_1.Transform.fromJSON(brep.transform);
|
|
926
|
+
const localTrans = entityTrans.multiplyTransformTransform(worldToLocal);
|
|
927
|
+
brep = {
|
|
928
|
+
data: brep.data,
|
|
929
|
+
type: brep.type,
|
|
930
|
+
transform: localTrans.isIdentity ? undefined : localTrans.toJSON(),
|
|
931
|
+
faceSymbology: brep.faceSymbology,
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
935
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.BRepData;
|
|
936
|
+
let dataOffset;
|
|
937
|
+
let faceSymbOffset;
|
|
938
|
+
if (undefined !== brep.data) {
|
|
939
|
+
const entityData = Base64EncodedString_1.Base64EncodedString.toUint8Array(brep.data);
|
|
940
|
+
if (entityData.length === 0)
|
|
941
|
+
return undefined;
|
|
942
|
+
dataOffset = builder.createEntityDataVector(fbb, entityData);
|
|
943
|
+
}
|
|
944
|
+
if (undefined !== brep.faceSymbology) {
|
|
945
|
+
builder.startSymbologyVector(fbb, brep.faceSymbology.length);
|
|
946
|
+
for (let i = brep.faceSymbology.length - 1; i >= 0; i--) {
|
|
947
|
+
const symb = brep.faceSymbology[i];
|
|
948
|
+
const materialIdPair = core_bentley_1.Id64.getUint32Pair(symb.materialId ? symb.materialId : core_bentley_1.Id64.invalid);
|
|
949
|
+
const matLong = flatbuffers_1.flatbuffers.Long.create(materialIdPair.lower, materialIdPair.upper);
|
|
950
|
+
ElementGeometryFB_1.EGFBAccessors.FaceSymbology.createFaceSymbology(fbb, symb.color ? 1 : 0, symb.materialId ? 1 : 0, symb.color ? symb.color : 0, matLong, symb.transparency ? symb.transparency : 0, 0, 0);
|
|
951
|
+
}
|
|
952
|
+
faceSymbOffset = fbb.endVector();
|
|
953
|
+
}
|
|
954
|
+
builder.startBRepData(fbb);
|
|
955
|
+
const toEGFBBRepType = (type) => {
|
|
956
|
+
switch (type) {
|
|
957
|
+
case GeometryStream_1.BRepEntity.Type.Wire:
|
|
958
|
+
return ElementGeometryFB_1.EGFBAccessors.BRepType.Wire;
|
|
959
|
+
case GeometryStream_1.BRepEntity.Type.Sheet:
|
|
960
|
+
return ElementGeometryFB_1.EGFBAccessors.BRepType.Sheet;
|
|
961
|
+
default:
|
|
962
|
+
return ElementGeometryFB_1.EGFBAccessors.BRepType.Solid;
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
if (undefined !== brep.type)
|
|
966
|
+
builder.addBrepType(fbb, toEGFBBRepType(brep.type));
|
|
967
|
+
if (undefined !== brep.transform) {
|
|
968
|
+
const transform = core_geometry_1.Transform.fromJSON(brep.transform);
|
|
969
|
+
const transformOffset = ElementGeometryFB_1.EGFBAccessors.Transform.createTransform(fbb, transform.matrix.coffs[0], transform.matrix.coffs[1], transform.matrix.coffs[2], transform.origin.x, transform.matrix.coffs[3], transform.matrix.coffs[4], transform.matrix.coffs[5], transform.origin.y, transform.matrix.coffs[6], transform.matrix.coffs[7], transform.matrix.coffs[8], transform.origin.z);
|
|
970
|
+
builder.addEntityTransform(fbb, transformOffset);
|
|
971
|
+
}
|
|
972
|
+
if (undefined !== dataOffset)
|
|
973
|
+
builder.addEntityData(fbb, dataOffset);
|
|
974
|
+
if (undefined !== faceSymbOffset)
|
|
975
|
+
builder.addSymbology(fbb, faceSymbOffset);
|
|
976
|
+
const mLoc = builder.endBRepData(fbb);
|
|
977
|
+
fbb.finish(mLoc);
|
|
978
|
+
const data = fbb.asUint8Array();
|
|
979
|
+
return { opcode: ElementGeometryOpcode.BRep, data };
|
|
980
|
+
}
|
|
981
|
+
ElementGeometry.fromBRep = fromBRep;
|
|
982
|
+
/** Apply transform directly to ElementGeometryDataEntry for a BRep */
|
|
983
|
+
function transformBRep(entry, inputTransform) {
|
|
984
|
+
if (ElementGeometryOpcode.BRep !== entry.opcode)
|
|
985
|
+
return false;
|
|
986
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
987
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.BRepData.getRootAsBRepData(buffer);
|
|
988
|
+
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
989
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.BRepData;
|
|
990
|
+
const entityData = ppfb.entityDataArray();
|
|
991
|
+
const dataOffset = (null !== entityData ? builder.createEntityDataVector(fbb, entityData) : undefined);
|
|
992
|
+
let faceSymbOffset;
|
|
993
|
+
const faceSymbLen = ppfb.symbologyLength();
|
|
994
|
+
if (0 !== faceSymbLen) {
|
|
995
|
+
builder.startSymbologyVector(fbb, faceSymbLen);
|
|
996
|
+
for (let i = faceSymbLen - 1; i >= 0; i--) {
|
|
997
|
+
const faceSymbFb = ppfb.symbology(i);
|
|
998
|
+
if (null === faceSymbFb)
|
|
999
|
+
continue;
|
|
1000
|
+
ElementGeometryFB_1.EGFBAccessors.FaceSymbology.createFaceSymbology(fbb, faceSymbFb.useColor(), faceSymbFb.useMaterial(), faceSymbFb.color(), faceSymbFb.materialId(), faceSymbFb.transparency(), 0, 0);
|
|
1001
|
+
}
|
|
1002
|
+
faceSymbOffset = fbb.endVector();
|
|
1003
|
+
}
|
|
1004
|
+
builder.startBRepData(fbb);
|
|
1005
|
+
builder.addBrepType(fbb, ppfb.brepType());
|
|
1006
|
+
let transform;
|
|
1007
|
+
const entityTransform = ppfb.entityTransform();
|
|
1008
|
+
if (null !== entityTransform)
|
|
1009
|
+
transform = core_geometry_1.Transform.createRowValues(entityTransform.x00(), entityTransform.x01(), entityTransform.x02(), entityTransform.tx(), entityTransform.x10(), entityTransform.x11(), entityTransform.x12(), entityTransform.ty(), entityTransform.x20(), entityTransform.x21(), entityTransform.x22(), entityTransform.tz());
|
|
1010
|
+
if (undefined !== transform)
|
|
1011
|
+
transform.multiplyTransformTransform(inputTransform, transform);
|
|
1012
|
+
else
|
|
1013
|
+
transform = inputTransform;
|
|
1014
|
+
const transformOffset = ElementGeometryFB_1.EGFBAccessors.Transform.createTransform(fbb, transform.matrix.coffs[0], transform.matrix.coffs[1], transform.matrix.coffs[2], transform.origin.x, transform.matrix.coffs[3], transform.matrix.coffs[4], transform.matrix.coffs[5], transform.origin.y, transform.matrix.coffs[6], transform.matrix.coffs[7], transform.matrix.coffs[8], transform.origin.z);
|
|
1015
|
+
builder.addEntityTransform(fbb, transformOffset);
|
|
1016
|
+
if (undefined !== dataOffset)
|
|
1017
|
+
builder.addEntityData(fbb, dataOffset);
|
|
1018
|
+
if (undefined !== faceSymbOffset)
|
|
1019
|
+
builder.addSymbology(fbb, faceSymbOffset);
|
|
1020
|
+
const mLoc = builder.endBRepData(fbb);
|
|
1021
|
+
fbb.finish(mLoc);
|
|
1022
|
+
entry.data = fbb.asUint8Array();
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
ElementGeometry.transformBRep = transformBRep;
|
|
1026
|
+
/** @internal */
|
|
1027
|
+
let StyleMod;
|
|
1028
|
+
(function (StyleMod) {
|
|
1029
|
+
StyleMod[StyleMod["Scale"] = 1] = "Scale";
|
|
1030
|
+
StyleMod[StyleMod["DashScale"] = 2] = "DashScale";
|
|
1031
|
+
StyleMod[StyleMod["GapScale"] = 4] = "GapScale";
|
|
1032
|
+
StyleMod[StyleMod["StartWidth"] = 8] = "StartWidth";
|
|
1033
|
+
StyleMod[StyleMod["EndWidth"] = 16] = "EndWidth";
|
|
1034
|
+
StyleMod[StyleMod["DistPhase"] = 32] = "DistPhase";
|
|
1035
|
+
StyleMod[StyleMod["FractPhase"] = 64] = "FractPhase";
|
|
1036
|
+
StyleMod[StyleMod["CenterPhase"] = 128] = "CenterPhase";
|
|
1037
|
+
StyleMod[StyleMod["Normal"] = 256] = "Normal";
|
|
1038
|
+
StyleMod[StyleMod["Rotation"] = 512] = "Rotation";
|
|
1039
|
+
StyleMod[StyleMod["PhysicalWidth"] = 8192] = "PhysicalWidth";
|
|
1040
|
+
StyleMod[StyleMod["SegMode"] = 1073741824] = "SegMode";
|
|
1041
|
+
StyleMod[StyleMod["NoSegMode"] = 2147483648] = "NoSegMode";
|
|
1042
|
+
})(StyleMod || (StyleMod = {}));
|
|
1043
|
+
/** Update the supplied [[GeometryParams]] from an entry with appearance information */
|
|
1044
|
+
function updateGeometryParams(entry, geomParams, localToWorld) {
|
|
1045
|
+
if (!isAppearanceEntry(entry))
|
|
1046
|
+
return false;
|
|
1047
|
+
let changed = false;
|
|
1048
|
+
switch (entry.opcode) {
|
|
1049
|
+
case ElementGeometryOpcode.BasicSymbology: {
|
|
1050
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1051
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.BasicSymbology.getRootAsBasicSymbology(buffer);
|
|
1052
|
+
const subcatLong = ppfb.subCategoryId();
|
|
1053
|
+
let subcatId = core_bentley_1.Id64.fromUint32Pair(subcatLong.low, subcatLong.high);
|
|
1054
|
+
if (core_bentley_1.Id64.isInvalid(subcatId))
|
|
1055
|
+
subcatId = geomParams.subCategoryId; // Preserve current sub-category if not explicitly stored...
|
|
1056
|
+
if (core_bentley_1.Id64.isValid(subcatId)) {
|
|
1057
|
+
geomParams.setSubCategoryId(subcatId); // Reset to sub-category appearance...
|
|
1058
|
+
changed = true;
|
|
1059
|
+
}
|
|
1060
|
+
if (ppfb.useColor()) {
|
|
1061
|
+
const lineColor = ColorDef_1.ColorDef.fromTbgr(ppfb.color());
|
|
1062
|
+
if (undefined === geomParams.lineColor || !lineColor.equals(geomParams.lineColor)) {
|
|
1063
|
+
geomParams.lineColor = lineColor;
|
|
1064
|
+
changed = true;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
if (ppfb.useWeight()) {
|
|
1068
|
+
const weight = ppfb.weight();
|
|
1069
|
+
if (undefined === geomParams.weight || weight !== geomParams.weight) {
|
|
1070
|
+
geomParams.weight = weight;
|
|
1071
|
+
changed = true;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
if (ppfb.useStyle()) {
|
|
1075
|
+
const styleLong = ppfb.lineStyleId();
|
|
1076
|
+
const styleId = core_bentley_1.Id64.fromUint32Pair(styleLong.low, styleLong.high);
|
|
1077
|
+
if (undefined === geomParams.styleInfo || styleId !== geomParams.styleInfo.styleId) {
|
|
1078
|
+
geomParams.styleInfo = new LineStyle_1.LineStyle.Info(styleId);
|
|
1079
|
+
changed = true;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
const transparency = ppfb.transparency();
|
|
1083
|
+
if (transparency !== (undefined !== geomParams.elmTransparency ? geomParams.elmTransparency : 0)) {
|
|
1084
|
+
geomParams.elmTransparency = transparency;
|
|
1085
|
+
changed = true;
|
|
1086
|
+
}
|
|
1087
|
+
const displayPriority = ppfb.displayPriority();
|
|
1088
|
+
if (displayPriority !== (undefined !== geomParams.elmPriority ? geomParams.elmPriority : 0)) {
|
|
1089
|
+
geomParams.elmPriority = displayPriority;
|
|
1090
|
+
changed = true;
|
|
1091
|
+
}
|
|
1092
|
+
const geometryClass = ppfb.geomClass();
|
|
1093
|
+
if (geometryClass !== (undefined !== geomParams.geometryClass ? geomParams.geometryClass : GeometryParams_1.GeometryClass.Primary)) {
|
|
1094
|
+
geomParams.geometryClass = geometryClass;
|
|
1095
|
+
changed = true;
|
|
1096
|
+
}
|
|
1097
|
+
return changed;
|
|
1098
|
+
}
|
|
1099
|
+
case ElementGeometryOpcode.LineStyleModifiers: {
|
|
1100
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1101
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.LineStyleModifiers.getRootAsLineStyleModifiers(buffer);
|
|
1102
|
+
const props = {};
|
|
1103
|
+
if (0 !== (ppfb.modifiers() & StyleMod.Scale))
|
|
1104
|
+
props.scale = ppfb.scale();
|
|
1105
|
+
if (0 !== (ppfb.modifiers() & StyleMod.GapScale))
|
|
1106
|
+
props.gapScale = ppfb.gapScale();
|
|
1107
|
+
if (0 !== (ppfb.modifiers() & StyleMod.DashScale))
|
|
1108
|
+
props.dashScale = ppfb.dashScale();
|
|
1109
|
+
if (0 !== (ppfb.modifiers() & StyleMod.StartWidth))
|
|
1110
|
+
props.startWidth = ppfb.startWidth();
|
|
1111
|
+
if (0 !== (ppfb.modifiers() & StyleMod.EndWidth))
|
|
1112
|
+
props.endWidth = ppfb.endWidth();
|
|
1113
|
+
if (0 !== (ppfb.modifiers() & StyleMod.DistPhase))
|
|
1114
|
+
props.distPhase = ppfb.distPhase();
|
|
1115
|
+
if (0 !== (ppfb.modifiers() & StyleMod.FractPhase))
|
|
1116
|
+
props.fractPhase = ppfb.fractPhase();
|
|
1117
|
+
if (0 !== (ppfb.modifiers() & StyleMod.CenterPhase))
|
|
1118
|
+
props.centerPhase = true;
|
|
1119
|
+
if (0 !== (ppfb.modifiers() & StyleMod.SegMode))
|
|
1120
|
+
props.segmentMode = true;
|
|
1121
|
+
else if (0 !== (ppfb.modifiers() & StyleMod.NoSegMode))
|
|
1122
|
+
props.segmentMode = false;
|
|
1123
|
+
if (0 !== (ppfb.modifiers() & StyleMod.PhysicalWidth))
|
|
1124
|
+
props.physicalWidth = true;
|
|
1125
|
+
if (0 !== (ppfb.modifiers() & StyleMod.Normal)) {
|
|
1126
|
+
const normal = ppfb.normal();
|
|
1127
|
+
if (null !== normal)
|
|
1128
|
+
props.normal = core_geometry_1.Vector3d.create(normal.x(), normal.y(), normal.z());
|
|
1129
|
+
}
|
|
1130
|
+
if (0 !== (ppfb.modifiers() & StyleMod.Rotation))
|
|
1131
|
+
props.rotation = core_geometry_1.YawPitchRollAngles.createDegrees(ppfb.yaw(), ppfb.pitch(), ppfb.roll());
|
|
1132
|
+
const styleMod = new LineStyle_1.LineStyle.Modifier(props);
|
|
1133
|
+
if (undefined !== localToWorld)
|
|
1134
|
+
styleMod.applyTransform(localToWorld);
|
|
1135
|
+
if (undefined === geomParams.styleInfo) {
|
|
1136
|
+
geomParams.styleInfo = new LineStyle_1.LineStyle.Info(core_bentley_1.Id64.invalid, styleMod);
|
|
1137
|
+
changed = true;
|
|
1138
|
+
}
|
|
1139
|
+
else if (undefined === geomParams.styleInfo.styleMod || !styleMod.equals(geomParams.styleInfo.styleMod)) {
|
|
1140
|
+
geomParams.styleInfo.styleMod = styleMod;
|
|
1141
|
+
changed = true;
|
|
1142
|
+
}
|
|
1143
|
+
return changed;
|
|
1144
|
+
}
|
|
1145
|
+
case ElementGeometryOpcode.Fill: {
|
|
1146
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1147
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.AreaFill.getRootAsAreaFill(buffer);
|
|
1148
|
+
const toFillDisplay = (fill) => {
|
|
1149
|
+
switch (fill) {
|
|
1150
|
+
case ElementGeometryFB_1.EGFBAccessors.FillDisplay.ByView:
|
|
1151
|
+
return GeometryParams_1.FillDisplay.ByView;
|
|
1152
|
+
case ElementGeometryFB_1.EGFBAccessors.FillDisplay.Always:
|
|
1153
|
+
return GeometryParams_1.FillDisplay.Always;
|
|
1154
|
+
case ElementGeometryFB_1.EGFBAccessors.FillDisplay.Blanking:
|
|
1155
|
+
return GeometryParams_1.FillDisplay.Blanking;
|
|
1156
|
+
default:
|
|
1157
|
+
return GeometryParams_1.FillDisplay.Never;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
const fillDisplay = toFillDisplay(ppfb.fill());
|
|
1161
|
+
if (fillDisplay !== (undefined !== geomParams.fillDisplay ? geomParams.fillDisplay : GeometryParams_1.FillDisplay.Never)) {
|
|
1162
|
+
geomParams.fillDisplay = fillDisplay;
|
|
1163
|
+
changed = true;
|
|
1164
|
+
}
|
|
1165
|
+
if (GeometryParams_1.FillDisplay.Never === fillDisplay)
|
|
1166
|
+
return changed;
|
|
1167
|
+
const transparency = ppfb.transparency();
|
|
1168
|
+
if (transparency !== (undefined !== geomParams.fillTransparency ? geomParams.fillTransparency : 0)) {
|
|
1169
|
+
geomParams.fillTransparency = transparency;
|
|
1170
|
+
changed = true;
|
|
1171
|
+
}
|
|
1172
|
+
if (ElementGeometryFB_1.EGFBAccessors.GradientMode.None !== ppfb.mode()) {
|
|
1173
|
+
const toGradientMode = (mode) => {
|
|
1174
|
+
switch (mode) {
|
|
1175
|
+
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Linear:
|
|
1176
|
+
return Gradient_1.Gradient.Mode.Linear;
|
|
1177
|
+
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Curved:
|
|
1178
|
+
return Gradient_1.Gradient.Mode.Curved;
|
|
1179
|
+
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Cylindrical:
|
|
1180
|
+
return Gradient_1.Gradient.Mode.Cylindrical;
|
|
1181
|
+
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Spherical:
|
|
1182
|
+
return Gradient_1.Gradient.Mode.Spherical;
|
|
1183
|
+
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Hemispherical:
|
|
1184
|
+
return Gradient_1.Gradient.Mode.Hemispherical;
|
|
1185
|
+
case ElementGeometryFB_1.EGFBAccessors.GradientMode.Thematic:
|
|
1186
|
+
return Gradient_1.Gradient.Mode.Thematic;
|
|
1187
|
+
default:
|
|
1188
|
+
return Gradient_1.Gradient.Mode.None;
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
const keys = [];
|
|
1192
|
+
const colors = ppfb.colorsArray();
|
|
1193
|
+
const values = ppfb.valuesArray();
|
|
1194
|
+
if (null !== colors && null !== values && colors.length === values.length) {
|
|
1195
|
+
for (let iKey = 0; iKey < colors.length; ++iKey)
|
|
1196
|
+
keys.push({ value: values[iKey], color: colors[iKey] });
|
|
1197
|
+
}
|
|
1198
|
+
const props = { mode: toGradientMode(ppfb.mode()), keys };
|
|
1199
|
+
const flags = ppfb.flags();
|
|
1200
|
+
const angle = ppfb.angle();
|
|
1201
|
+
const tint = ppfb.tint();
|
|
1202
|
+
const shift = ppfb.shift();
|
|
1203
|
+
props.flags = (0 !== flags ? flags : undefined);
|
|
1204
|
+
props.angle = (0 !== angle ? { radians: angle } : undefined);
|
|
1205
|
+
props.tint = (0 !== tint ? tint : undefined);
|
|
1206
|
+
props.shift = (0 !== shift ? shift : undefined);
|
|
1207
|
+
if (Gradient_1.Gradient.Mode.Thematic === props.mode) {
|
|
1208
|
+
const thematic = ppfb.thematicSettings();
|
|
1209
|
+
if (null !== thematic) {
|
|
1210
|
+
const tprops = {};
|
|
1211
|
+
const mode = thematic.mode();
|
|
1212
|
+
const stepCount = thematic.stepCount();
|
|
1213
|
+
const marginColor = thematic.marginColor();
|
|
1214
|
+
const colorScheme = thematic.colorScheme();
|
|
1215
|
+
tprops.mode = (0 !== mode ? mode : undefined);
|
|
1216
|
+
tprops.stepCount = (0 !== stepCount ? stepCount : undefined);
|
|
1217
|
+
tprops.marginColor = (0 !== marginColor ? marginColor : undefined);
|
|
1218
|
+
tprops.colorScheme = (0 !== colorScheme ? colorScheme : undefined);
|
|
1219
|
+
props.thematicSettings = tprops;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
const gradient = Gradient_1.Gradient.Symb.fromJSON(props);
|
|
1223
|
+
if (undefined === geomParams.gradient || !gradient.equals(geomParams.gradient)) {
|
|
1224
|
+
geomParams.gradient = gradient;
|
|
1225
|
+
changed = true;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
else if (0 !== ppfb.backgroundFill()) {
|
|
1229
|
+
const backgroundFill = (2 === ppfb.backgroundFill() ? GeometryParams_1.BackgroundFill.Outline : GeometryParams_1.BackgroundFill.Solid);
|
|
1230
|
+
if (backgroundFill !== geomParams.backgroundFill) {
|
|
1231
|
+
geomParams.backgroundFill = backgroundFill;
|
|
1232
|
+
changed = true;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
else if (ppfb.useColor()) {
|
|
1236
|
+
const fillColor = ColorDef_1.ColorDef.fromTbgr(ppfb.color());
|
|
1237
|
+
if (undefined === geomParams.fillColor || !fillColor.equals(geomParams.fillColor)) {
|
|
1238
|
+
geomParams.fillColor = fillColor;
|
|
1239
|
+
changed = true;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return changed;
|
|
1243
|
+
}
|
|
1244
|
+
case ElementGeometryOpcode.Pattern: {
|
|
1245
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1246
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.AreaPattern.getRootAsAreaPattern(buffer);
|
|
1247
|
+
const props = {};
|
|
1248
|
+
const origin = ppfb.origin();
|
|
1249
|
+
if (null !== origin) {
|
|
1250
|
+
const point = core_geometry_1.Point3d.create(origin.x(), origin.y(), origin.z());
|
|
1251
|
+
if (!point.isAlmostZero)
|
|
1252
|
+
props.origin = point;
|
|
1253
|
+
}
|
|
1254
|
+
const rotation = ppfb.rotation();
|
|
1255
|
+
if (null !== rotation) {
|
|
1256
|
+
const angles = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(core_geometry_1.Matrix3d.createRowValues(rotation.x00(), rotation.x01(), rotation.x02(), rotation.x10(), rotation.x11(), rotation.x12(), rotation.x20(), rotation.x21(), rotation.x22()));
|
|
1257
|
+
if (undefined !== angles && !angles.isIdentity())
|
|
1258
|
+
props.rotation = angles;
|
|
1259
|
+
}
|
|
1260
|
+
const space1 = ppfb.space1();
|
|
1261
|
+
const space2 = ppfb.space2();
|
|
1262
|
+
const angle1 = ppfb.angle1();
|
|
1263
|
+
const angle2 = ppfb.angle2();
|
|
1264
|
+
const scale = ppfb.scale();
|
|
1265
|
+
props.space1 = (0 !== space1 ? space1 : undefined);
|
|
1266
|
+
props.space2 = (0 !== space2 ? space2 : undefined);
|
|
1267
|
+
props.angle1 = (0 !== angle1 ? { radians: angle1 } : undefined);
|
|
1268
|
+
props.angle2 = (0 !== angle2 ? { radians: angle2 } : undefined);
|
|
1269
|
+
props.scale = (0 !== scale ? scale : undefined);
|
|
1270
|
+
if (ppfb.useColor())
|
|
1271
|
+
props.color = ppfb.color();
|
|
1272
|
+
if (ppfb.useWeight())
|
|
1273
|
+
props.weight = ppfb.weight();
|
|
1274
|
+
props.invisibleBoundary = (1 === ppfb.invisibleBoundary() ? true : undefined);
|
|
1275
|
+
props.snappable = (1 === ppfb.snappable() ? true : undefined);
|
|
1276
|
+
const symbolId = core_bentley_1.Id64.fromUint32Pair(ppfb.symbolId().low, ppfb.symbolId().high);
|
|
1277
|
+
props.symbolId = (core_bentley_1.Id64.isValid(symbolId) ? symbolId : undefined);
|
|
1278
|
+
const nDefLines = ppfb.defLineLength();
|
|
1279
|
+
if (0 !== nDefLines) {
|
|
1280
|
+
const defLines = [];
|
|
1281
|
+
for (let iLine = 0; iLine < nDefLines; ++iLine) {
|
|
1282
|
+
const defLine = ppfb.defLine(iLine);
|
|
1283
|
+
if (!defLine)
|
|
1284
|
+
continue;
|
|
1285
|
+
const line = {};
|
|
1286
|
+
const angle = defLine.angle();
|
|
1287
|
+
line.angle = (0 !== angle ? { radians: defLine.angle() } : undefined);
|
|
1288
|
+
const through = defLine.through();
|
|
1289
|
+
if (through) {
|
|
1290
|
+
const thr = core_geometry_1.Point2d.create(through.x(), through.y());
|
|
1291
|
+
if (!thr.isAlmostZero)
|
|
1292
|
+
line.through = thr;
|
|
1293
|
+
}
|
|
1294
|
+
const offset = defLine.offset();
|
|
1295
|
+
if (offset) {
|
|
1296
|
+
const off = core_geometry_1.Point2d.create(offset.x(), offset.y());
|
|
1297
|
+
if (!off.isAlmostZero)
|
|
1298
|
+
line.offset = off;
|
|
1299
|
+
}
|
|
1300
|
+
const dashArray = defLine.dashesArray();
|
|
1301
|
+
if (0 !== defLine.dashesLength() && null !== dashArray) {
|
|
1302
|
+
const dashes = [];
|
|
1303
|
+
for (const value of dashArray) {
|
|
1304
|
+
dashes.push(value);
|
|
1305
|
+
}
|
|
1306
|
+
line.dashes = dashes;
|
|
1307
|
+
}
|
|
1308
|
+
defLines.push(line);
|
|
1309
|
+
}
|
|
1310
|
+
props.defLines = defLines;
|
|
1311
|
+
}
|
|
1312
|
+
const pattern = AreaPattern_1.AreaPattern.Params.fromJSON(props);
|
|
1313
|
+
if (undefined !== localToWorld)
|
|
1314
|
+
pattern.applyTransform(localToWorld);
|
|
1315
|
+
if (undefined === geomParams.pattern || !pattern.equals(geomParams.pattern)) {
|
|
1316
|
+
geomParams.pattern = pattern;
|
|
1317
|
+
changed = true;
|
|
1318
|
+
}
|
|
1319
|
+
return changed;
|
|
1320
|
+
}
|
|
1321
|
+
case ElementGeometryOpcode.Material: {
|
|
1322
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1323
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.Material.getRootAsMaterial(buffer);
|
|
1324
|
+
if (ppfb.useMaterial()) {
|
|
1325
|
+
const matLong = ppfb.materialId();
|
|
1326
|
+
const materialId = core_bentley_1.Id64.fromUint32Pair(matLong.low, matLong.high);
|
|
1327
|
+
if (undefined === geomParams.materialId || materialId !== geomParams.materialId) {
|
|
1328
|
+
geomParams.materialId = materialId;
|
|
1329
|
+
changed = true;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
return changed;
|
|
1333
|
+
}
|
|
1334
|
+
default:
|
|
1335
|
+
return changed;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
ElementGeometry.updateGeometryParams = updateGeometryParams;
|
|
1339
|
+
/** Append entries to represent a [[GeometryParams]] */
|
|
1340
|
+
function appendGeometryParams(geomParams, entries, worldToLocal) {
|
|
1341
|
+
const fbbBas = new flatbuffers_1.flatbuffers.Builder();
|
|
1342
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.BasicSymbology;
|
|
1343
|
+
builder.startBasicSymbology(fbbBas);
|
|
1344
|
+
const subcatIdPair = core_bentley_1.Id64.getUint32Pair(geomParams.subCategoryId);
|
|
1345
|
+
builder.addSubCategoryId(fbbBas, flatbuffers_1.flatbuffers.Long.create(subcatIdPair.lower, subcatIdPair.upper));
|
|
1346
|
+
if (undefined !== geomParams.lineColor) {
|
|
1347
|
+
builder.addColor(fbbBas, geomParams.lineColor.tbgr);
|
|
1348
|
+
builder.addUseColor(fbbBas, 1);
|
|
1349
|
+
}
|
|
1350
|
+
if (undefined !== geomParams.weight) {
|
|
1351
|
+
builder.addWeight(fbbBas, geomParams.weight);
|
|
1352
|
+
builder.addUseWeight(fbbBas, 1);
|
|
1353
|
+
}
|
|
1354
|
+
if (undefined !== geomParams.styleInfo) {
|
|
1355
|
+
const styleIdPair = core_bentley_1.Id64.getUint32Pair(geomParams.styleInfo.styleId);
|
|
1356
|
+
builder.addLineStyleId(fbbBas, flatbuffers_1.flatbuffers.Long.create(styleIdPair.lower, styleIdPair.upper));
|
|
1357
|
+
builder.addUseStyle(fbbBas, 1);
|
|
1358
|
+
}
|
|
1359
|
+
if (undefined !== geomParams.elmTransparency && 0 !== geomParams.elmTransparency) {
|
|
1360
|
+
builder.addTransparency(fbbBas, geomParams.elmTransparency);
|
|
1361
|
+
}
|
|
1362
|
+
if (undefined !== geomParams.elmPriority && 0 !== geomParams.elmPriority) {
|
|
1363
|
+
builder.addDisplayPriority(fbbBas, geomParams.elmPriority);
|
|
1364
|
+
}
|
|
1365
|
+
if (undefined !== geomParams.geometryClass && GeometryParams_1.GeometryClass.Primary !== geomParams.geometryClass) {
|
|
1366
|
+
builder.addGeomClass(fbbBas, geomParams.geometryClass);
|
|
1367
|
+
}
|
|
1368
|
+
const mLoc = builder.endBasicSymbology(fbbBas);
|
|
1369
|
+
fbbBas.finish(mLoc);
|
|
1370
|
+
const data = fbbBas.asUint8Array();
|
|
1371
|
+
entries.push({ opcode: ElementGeometryOpcode.BasicSymbology, data });
|
|
1372
|
+
if (undefined !== geomParams.styleInfo && undefined !== geomParams.styleInfo.styleMod) {
|
|
1373
|
+
const fbbLS = new flatbuffers_1.flatbuffers.Builder();
|
|
1374
|
+
const builderLS = ElementGeometryFB_1.EGFBAccessors.LineStyleModifiers;
|
|
1375
|
+
builderLS.startLineStyleModifiers(fbbLS);
|
|
1376
|
+
let lsMods = geomParams.styleInfo.styleMod;
|
|
1377
|
+
if (undefined !== worldToLocal) {
|
|
1378
|
+
lsMods = new LineStyle_1.LineStyle.Modifier(lsMods);
|
|
1379
|
+
if (!lsMods.applyTransform(worldToLocal))
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
let modifiers = 0;
|
|
1383
|
+
if (undefined !== lsMods.scale) {
|
|
1384
|
+
builderLS.addScale(fbbLS, lsMods.scale);
|
|
1385
|
+
modifiers |= StyleMod.Scale;
|
|
1386
|
+
}
|
|
1387
|
+
if (undefined !== lsMods.dashScale) {
|
|
1388
|
+
builderLS.addDashScale(fbbLS, lsMods.dashScale);
|
|
1389
|
+
modifiers |= StyleMod.DashScale;
|
|
1390
|
+
}
|
|
1391
|
+
if (undefined !== lsMods.gapScale) {
|
|
1392
|
+
builderLS.addGapScale(fbbLS, lsMods.gapScale);
|
|
1393
|
+
modifiers |= StyleMod.GapScale;
|
|
1394
|
+
}
|
|
1395
|
+
if (undefined !== lsMods.startWidth) {
|
|
1396
|
+
builderLS.addStartWidth(fbbLS, lsMods.startWidth);
|
|
1397
|
+
modifiers |= StyleMod.StartWidth;
|
|
1398
|
+
}
|
|
1399
|
+
if (undefined !== lsMods.endWidth) {
|
|
1400
|
+
builderLS.addEndWidth(fbbLS, lsMods.endWidth);
|
|
1401
|
+
modifiers |= StyleMod.EndWidth;
|
|
1402
|
+
}
|
|
1403
|
+
if (undefined !== lsMods.distPhase) {
|
|
1404
|
+
builderLS.addDistPhase(fbbLS, lsMods.distPhase);
|
|
1405
|
+
modifiers |= StyleMod.DistPhase;
|
|
1406
|
+
}
|
|
1407
|
+
if (undefined !== lsMods.fractPhase) {
|
|
1408
|
+
builderLS.addFractPhase(fbbLS, lsMods.fractPhase);
|
|
1409
|
+
modifiers |= StyleMod.FractPhase;
|
|
1410
|
+
}
|
|
1411
|
+
if (lsMods.centerPhase) {
|
|
1412
|
+
modifiers |= StyleMod.CenterPhase;
|
|
1413
|
+
}
|
|
1414
|
+
if (undefined !== lsMods.segmentMode) {
|
|
1415
|
+
modifiers |= (lsMods.segmentMode ? StyleMod.SegMode : StyleMod.NoSegMode);
|
|
1416
|
+
}
|
|
1417
|
+
if (lsMods.physicalWidth) {
|
|
1418
|
+
modifiers |= StyleMod.PhysicalWidth;
|
|
1419
|
+
}
|
|
1420
|
+
if (undefined !== lsMods.normal) {
|
|
1421
|
+
const normalOffset = ElementGeometryFB_1.EGFBAccessors.DVec3d.createDVec3d(fbbLS, lsMods.normal.x, lsMods.normal.y, lsMods.normal.z);
|
|
1422
|
+
builderLS.addNormal(fbbLS, normalOffset);
|
|
1423
|
+
modifiers |= StyleMod.Normal;
|
|
1424
|
+
}
|
|
1425
|
+
if (undefined !== lsMods.rotation) {
|
|
1426
|
+
builderLS.addYaw(fbbLS, lsMods.rotation.yaw.degrees);
|
|
1427
|
+
builderLS.addPitch(fbbLS, lsMods.rotation.pitch.degrees);
|
|
1428
|
+
builderLS.addRoll(fbbLS, lsMods.rotation.roll.degrees);
|
|
1429
|
+
modifiers |= StyleMod.Rotation;
|
|
1430
|
+
}
|
|
1431
|
+
builderLS.addModifiers(fbbLS, modifiers);
|
|
1432
|
+
const mLocLS = builderLS.endLineStyleModifiers(fbbLS);
|
|
1433
|
+
fbbLS.finish(mLocLS);
|
|
1434
|
+
const dataLS = fbbLS.asUint8Array();
|
|
1435
|
+
if (0 !== modifiers)
|
|
1436
|
+
entries.push({ opcode: ElementGeometryOpcode.LineStyleModifiers, data: dataLS });
|
|
1437
|
+
}
|
|
1438
|
+
if (undefined !== geomParams.fillDisplay && GeometryParams_1.FillDisplay.Never !== geomParams.fillDisplay) {
|
|
1439
|
+
const fbbFill = new flatbuffers_1.flatbuffers.Builder();
|
|
1440
|
+
const builderFill = ElementGeometryFB_1.EGFBAccessors.AreaFill;
|
|
1441
|
+
let keyValuesOff;
|
|
1442
|
+
let keyColorsOff;
|
|
1443
|
+
let thematicOffset;
|
|
1444
|
+
if (undefined !== geomParams.gradient) {
|
|
1445
|
+
const keyColors = [];
|
|
1446
|
+
const keyValues = [];
|
|
1447
|
+
for (const key of geomParams.gradient.keys) {
|
|
1448
|
+
keyColors.push(key.color.tbgr);
|
|
1449
|
+
keyValues.push(key.value);
|
|
1450
|
+
}
|
|
1451
|
+
keyValuesOff = builderFill.createValuesVector(fbbFill, keyValues);
|
|
1452
|
+
keyColorsOff = builderFill.createColorsVector(fbbFill, keyColors);
|
|
1453
|
+
if (Gradient_1.Gradient.Mode.Thematic === geomParams.gradient.mode && undefined !== geomParams.gradient.thematicSettings) {
|
|
1454
|
+
const thematic = geomParams.gradient.thematicSettings;
|
|
1455
|
+
const builderThematic = ElementGeometryFB_1.EGFBAccessors.ThematicSettings;
|
|
1456
|
+
builderThematic.startThematicSettings(fbbFill);
|
|
1457
|
+
builderThematic.addMode(fbbFill, thematic.mode);
|
|
1458
|
+
builderThematic.addStepCount(fbbFill, thematic.stepCount);
|
|
1459
|
+
builderThematic.addMarginColor(fbbFill, thematic.marginColor.tbgr);
|
|
1460
|
+
builderThematic.addColorScheme(fbbFill, thematic.colorScheme);
|
|
1461
|
+
const rangeOffset = ElementGeometryFB_1.EGFBAccessors.DRange1d.createDRange1d(fbbFill, ThematicDisplay_1.ThematicGradientSettings.contentRange, ThematicDisplay_1.ThematicGradientSettings.contentMax);
|
|
1462
|
+
builderThematic.addRange(fbbFill, rangeOffset);
|
|
1463
|
+
thematicOffset = builderThematic.endThematicSettings(fbbFill);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
builderFill.startAreaFill(fbbFill);
|
|
1467
|
+
const toEGFBFillDisplay = (fill) => {
|
|
1468
|
+
switch (fill) {
|
|
1469
|
+
case GeometryParams_1.FillDisplay.ByView:
|
|
1470
|
+
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.ByView;
|
|
1471
|
+
case GeometryParams_1.FillDisplay.Always:
|
|
1472
|
+
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.Always;
|
|
1473
|
+
case GeometryParams_1.FillDisplay.Blanking:
|
|
1474
|
+
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.Blanking;
|
|
1475
|
+
default:
|
|
1476
|
+
return ElementGeometryFB_1.EGFBAccessors.FillDisplay.None;
|
|
1477
|
+
}
|
|
1478
|
+
};
|
|
1479
|
+
builderFill.addFill(fbbFill, toEGFBFillDisplay(geomParams.fillDisplay));
|
|
1480
|
+
if (undefined !== geomParams.fillTransparency)
|
|
1481
|
+
builderFill.addTransparency(fbbFill, geomParams.fillTransparency);
|
|
1482
|
+
if (undefined !== geomParams.gradient) {
|
|
1483
|
+
const toEGFBGradientMode = (mode) => {
|
|
1484
|
+
switch (mode) {
|
|
1485
|
+
case Gradient_1.Gradient.Mode.Linear:
|
|
1486
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Linear;
|
|
1487
|
+
case Gradient_1.Gradient.Mode.Curved:
|
|
1488
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Curved;
|
|
1489
|
+
case Gradient_1.Gradient.Mode.Cylindrical:
|
|
1490
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Cylindrical;
|
|
1491
|
+
case Gradient_1.Gradient.Mode.Spherical:
|
|
1492
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Spherical;
|
|
1493
|
+
case Gradient_1.Gradient.Mode.Hemispherical:
|
|
1494
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Hemispherical;
|
|
1495
|
+
case Gradient_1.Gradient.Mode.Thematic:
|
|
1496
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.Thematic;
|
|
1497
|
+
default:
|
|
1498
|
+
return ElementGeometryFB_1.EGFBAccessors.GradientMode.None;
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
builderFill.addMode(fbbFill, toEGFBGradientMode(geomParams.gradient.mode));
|
|
1502
|
+
builderFill.addFlags(fbbFill, geomParams.gradient.flags);
|
|
1503
|
+
builderFill.addShift(fbbFill, geomParams.gradient.shift);
|
|
1504
|
+
if (undefined !== geomParams.gradient.tint)
|
|
1505
|
+
builderFill.addTint(fbbFill, geomParams.gradient.tint);
|
|
1506
|
+
if (undefined !== geomParams.gradient.angle)
|
|
1507
|
+
builderFill.addAngle(fbbFill, geomParams.gradient.angle.radians);
|
|
1508
|
+
if (undefined !== keyValuesOff)
|
|
1509
|
+
builderFill.addValues(fbbFill, keyValuesOff);
|
|
1510
|
+
if (undefined !== keyColorsOff)
|
|
1511
|
+
builderFill.addColors(fbbFill, keyColorsOff);
|
|
1512
|
+
if (undefined !== thematicOffset)
|
|
1513
|
+
builderFill.addThematicSettings(fbbFill, thematicOffset);
|
|
1514
|
+
}
|
|
1515
|
+
else if (undefined !== geomParams.backgroundFill && GeometryParams_1.BackgroundFill.None !== geomParams.backgroundFill) {
|
|
1516
|
+
builderFill.addBackgroundFill(fbbFill, GeometryParams_1.BackgroundFill.Outline === geomParams.backgroundFill ? 2 : 1);
|
|
1517
|
+
}
|
|
1518
|
+
else if (undefined !== geomParams.fillColor) {
|
|
1519
|
+
builderFill.addColor(fbbFill, geomParams.fillColor.tbgr);
|
|
1520
|
+
builderFill.addUseColor(fbbFill, 1);
|
|
1521
|
+
}
|
|
1522
|
+
const mLocFill = builderFill.endAreaFill(fbbFill);
|
|
1523
|
+
fbbFill.finish(mLocFill);
|
|
1524
|
+
const dataFill = fbbFill.asUint8Array();
|
|
1525
|
+
entries.push({ opcode: ElementGeometryOpcode.Fill, data: dataFill });
|
|
1526
|
+
}
|
|
1527
|
+
if (undefined !== geomParams.pattern) {
|
|
1528
|
+
const fbbPat = new flatbuffers_1.flatbuffers.Builder();
|
|
1529
|
+
const builderPat = ElementGeometryFB_1.EGFBAccessors.AreaPattern;
|
|
1530
|
+
let pattern = geomParams.pattern;
|
|
1531
|
+
if (undefined !== worldToLocal) {
|
|
1532
|
+
pattern = pattern.clone();
|
|
1533
|
+
if (!pattern.applyTransform(worldToLocal))
|
|
1534
|
+
return false;
|
|
1535
|
+
}
|
|
1536
|
+
let defLineVecOffset;
|
|
1537
|
+
if (undefined !== pattern.defLines) {
|
|
1538
|
+
const defLines = pattern.defLines;
|
|
1539
|
+
const builderDefLines = ElementGeometryFB_1.EGFBAccessors.DwgHatchDefLine;
|
|
1540
|
+
const defLineOffsets = [];
|
|
1541
|
+
for (const line of defLines) {
|
|
1542
|
+
let dashOffset;
|
|
1543
|
+
if (undefined !== line.dashes)
|
|
1544
|
+
dashOffset = builderDefLines.createDashesVector(fbbPat, line.dashes);
|
|
1545
|
+
builderDefLines.startDwgHatchDefLine(fbbPat);
|
|
1546
|
+
if (undefined !== line.angle)
|
|
1547
|
+
builderDefLines.addAngle(fbbPat, line.angle.radians);
|
|
1548
|
+
// NOTE: Backend requires through and offset to be present...
|
|
1549
|
+
const throughOffset = ElementGeometryFB_1.EGFBAccessors.DPoint2d.createDPoint2d(fbbPat, undefined !== line.through ? line.through.x : 0, undefined !== line.through ? line.through.y : 0);
|
|
1550
|
+
builderDefLines.addThrough(fbbPat, throughOffset);
|
|
1551
|
+
const offsetOffset = ElementGeometryFB_1.EGFBAccessors.DPoint2d.createDPoint2d(fbbPat, undefined !== line.offset ? line.offset.x : 0, undefined !== line.offset ? line.offset.y : 0);
|
|
1552
|
+
builderDefLines.addOffset(fbbPat, offsetOffset);
|
|
1553
|
+
if (undefined !== dashOffset)
|
|
1554
|
+
builderDefLines.addDashes(fbbPat, dashOffset);
|
|
1555
|
+
defLineOffsets.push(builderDefLines.endDwgHatchDefLine(fbbPat));
|
|
1556
|
+
}
|
|
1557
|
+
if (0 !== defLineOffsets.length)
|
|
1558
|
+
defLineVecOffset = builderPat.createDefLineVector(fbbPat, defLineOffsets);
|
|
1559
|
+
}
|
|
1560
|
+
builderPat.startAreaPattern(fbbPat);
|
|
1561
|
+
if (undefined !== pattern.origin) {
|
|
1562
|
+
const originOffset = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbbPat, pattern.origin.x, pattern.origin.y, pattern.origin.z);
|
|
1563
|
+
builderPat.addOrigin(fbbPat, originOffset);
|
|
1564
|
+
}
|
|
1565
|
+
if (undefined !== pattern.rotation) {
|
|
1566
|
+
const matrix = pattern.rotation.toMatrix3d();
|
|
1567
|
+
const coffs = matrix.coffs;
|
|
1568
|
+
const rotationOffset = ElementGeometryFB_1.EGFBAccessors.RotMatrix.createRotMatrix(fbbPat, coffs[0], coffs[1], coffs[2], coffs[3], coffs[4], coffs[5], coffs[6], coffs[7], coffs[8]);
|
|
1569
|
+
builderPat.addRotation(fbbPat, rotationOffset);
|
|
1570
|
+
}
|
|
1571
|
+
if (undefined !== pattern.space1)
|
|
1572
|
+
builderPat.addSpace1(fbbPat, pattern.space1);
|
|
1573
|
+
if (undefined !== pattern.space2)
|
|
1574
|
+
builderPat.addSpace2(fbbPat, pattern.space2);
|
|
1575
|
+
if (undefined !== pattern.angle1)
|
|
1576
|
+
builderPat.addAngle1(fbbPat, pattern.angle1.radians);
|
|
1577
|
+
if (undefined !== pattern.angle2)
|
|
1578
|
+
builderPat.addAngle2(fbbPat, pattern.angle2.radians);
|
|
1579
|
+
if (undefined !== pattern.scale)
|
|
1580
|
+
builderPat.addScale(fbbPat, pattern.scale);
|
|
1581
|
+
if (undefined !== pattern.color) {
|
|
1582
|
+
builderPat.addColor(fbbPat, pattern.color.tbgr);
|
|
1583
|
+
builderPat.addUseColor(fbbPat, 1);
|
|
1584
|
+
}
|
|
1585
|
+
if (undefined !== pattern.weight) {
|
|
1586
|
+
builderPat.addWeight(fbbPat, pattern.weight);
|
|
1587
|
+
builderPat.addUseWeight(fbbPat, 1);
|
|
1588
|
+
}
|
|
1589
|
+
if (undefined !== pattern.invisibleBoundary && pattern.invisibleBoundary)
|
|
1590
|
+
builderPat.addInvisibleBoundary(fbbPat, 1);
|
|
1591
|
+
if (undefined !== pattern.snappable && pattern.snappable)
|
|
1592
|
+
builderPat.addSnappable(fbbPat, 1);
|
|
1593
|
+
if (undefined !== pattern.symbolId) {
|
|
1594
|
+
const symbolIdPair = core_bentley_1.Id64.getUint32Pair(pattern.symbolId);
|
|
1595
|
+
builderPat.addSymbolId(fbbPat, flatbuffers_1.flatbuffers.Long.create(symbolIdPair.lower, symbolIdPair.upper));
|
|
1596
|
+
}
|
|
1597
|
+
if (undefined !== defLineVecOffset)
|
|
1598
|
+
builderPat.addDefLine(fbbPat, defLineVecOffset);
|
|
1599
|
+
const mLocPat = builderPat.endAreaPattern(fbbPat);
|
|
1600
|
+
fbbPat.finish(mLocPat);
|
|
1601
|
+
const dataPat = fbbPat.asUint8Array();
|
|
1602
|
+
entries.push({ opcode: ElementGeometryOpcode.Pattern, data: dataPat });
|
|
1603
|
+
}
|
|
1604
|
+
if (undefined !== geomParams.materialId) {
|
|
1605
|
+
const fbbMat = new flatbuffers_1.flatbuffers.Builder();
|
|
1606
|
+
const builderMat = ElementGeometryFB_1.EGFBAccessors.Material;
|
|
1607
|
+
builderMat.startMaterial(fbbMat);
|
|
1608
|
+
const matIdPair = core_bentley_1.Id64.getUint32Pair(geomParams.materialId);
|
|
1609
|
+
builderMat.addMaterialId(fbbMat, flatbuffers_1.flatbuffers.Long.create(matIdPair.lower, matIdPair.upper));
|
|
1610
|
+
builderMat.addUseMaterial(fbbMat, 1);
|
|
1611
|
+
const mLocMat = builderMat.endMaterial(fbbMat);
|
|
1612
|
+
fbbMat.finish(mLocMat);
|
|
1613
|
+
const dataMat = fbbMat.asUint8Array();
|
|
1614
|
+
entries.push({ opcode: ElementGeometryOpcode.Material, data: dataMat });
|
|
1615
|
+
}
|
|
1616
|
+
return true;
|
|
1617
|
+
}
|
|
1618
|
+
ElementGeometry.appendGeometryParams = appendGeometryParams;
|
|
1619
|
+
/** Return entry as [[GeometryPart]] id and instance transform */
|
|
1620
|
+
function toGeometryPart(entry, partToElement) {
|
|
1621
|
+
if (ElementGeometryOpcode.PartReference !== entry.opcode)
|
|
1622
|
+
return undefined;
|
|
1623
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1624
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.GeometryPart.getRootAsGeometryPart(buffer);
|
|
1625
|
+
const partLong = ppfb.geomPartId();
|
|
1626
|
+
const partId = core_bentley_1.Id64.fromUint32Pair(partLong.low, partLong.high);
|
|
1627
|
+
if (undefined !== partToElement) {
|
|
1628
|
+
let origin;
|
|
1629
|
+
const originfb = ppfb.origin();
|
|
1630
|
+
if (null !== originfb)
|
|
1631
|
+
origin = core_geometry_1.Point3d.create(originfb.x(), originfb.y(), originfb.z());
|
|
1632
|
+
else
|
|
1633
|
+
origin = core_geometry_1.Point3d.createZero();
|
|
1634
|
+
const angles = core_geometry_1.YawPitchRollAngles.createDegrees(ppfb.yaw(), ppfb.pitch(), ppfb.roll());
|
|
1635
|
+
const matrix = angles.toMatrix3d();
|
|
1636
|
+
if (1.0 !== ppfb.scale())
|
|
1637
|
+
matrix.scaleColumnsInPlace(ppfb.scale(), ppfb.scale(), ppfb.scale());
|
|
1638
|
+
core_geometry_1.Transform.createOriginAndMatrix(origin, matrix, partToElement);
|
|
1639
|
+
}
|
|
1640
|
+
return partId;
|
|
1641
|
+
}
|
|
1642
|
+
ElementGeometry.toGeometryPart = toGeometryPart;
|
|
1643
|
+
/** Create entry from a [[GeometryPart]] id and instance transform */
|
|
1644
|
+
function fromGeometryPart(partId, partTransform, worldToLocal) {
|
|
1645
|
+
let partToElement = partTransform;
|
|
1646
|
+
if (undefined !== worldToLocal)
|
|
1647
|
+
partToElement = worldToLocal.multiplyTransformTransform(undefined !== partTransform ? partTransform : core_geometry_1.Transform.createIdentity());
|
|
1648
|
+
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
1649
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.GeometryPart;
|
|
1650
|
+
builder.startGeometryPart(fbb);
|
|
1651
|
+
const idPair = core_bentley_1.Id64.getUint32Pair(partId);
|
|
1652
|
+
builder.addGeomPartId(fbb, flatbuffers_1.flatbuffers.Long.create(idPair.lower, idPair.upper));
|
|
1653
|
+
if (undefined !== partToElement && !partToElement.isIdentity) {
|
|
1654
|
+
const originOffset = ElementGeometryFB_1.EGFBAccessors.DPoint3d.createDPoint3d(fbb, partToElement.origin.x, partToElement.origin.y, partToElement.origin.z);
|
|
1655
|
+
builder.addOrigin(fbb, originOffset);
|
|
1656
|
+
const angles = core_geometry_1.YawPitchRollAngles.createFromMatrix3d(partToElement.matrix);
|
|
1657
|
+
if (undefined !== angles) {
|
|
1658
|
+
builder.addYaw(fbb, angles.yaw.degrees);
|
|
1659
|
+
builder.addPitch(fbb, angles.pitch.degrees);
|
|
1660
|
+
builder.addRoll(fbb, angles.roll.degrees);
|
|
1661
|
+
}
|
|
1662
|
+
const result = partToElement.matrix.factorRigidWithSignedScale();
|
|
1663
|
+
if (undefined !== result && result.scale > 0.0)
|
|
1664
|
+
builder.addScale(fbb, result.scale);
|
|
1665
|
+
}
|
|
1666
|
+
const mLoc = builder.endGeometryPart(fbb);
|
|
1667
|
+
fbb.finish(mLoc);
|
|
1668
|
+
const data = fbb.asUint8Array();
|
|
1669
|
+
return { opcode: ElementGeometryOpcode.PartReference, data };
|
|
1670
|
+
}
|
|
1671
|
+
ElementGeometry.fromGeometryPart = fromGeometryPart;
|
|
1672
|
+
/** Return entry as a [[ElementAlignedBox3d]] representing the local range of a geometric entry */
|
|
1673
|
+
function toSubGraphicRange(entry) {
|
|
1674
|
+
if (ElementGeometryOpcode.SubGraphicRange !== entry.opcode)
|
|
1675
|
+
return undefined;
|
|
1676
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
1677
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.PointPrimitive.getRootAsPointPrimitive(buffer);
|
|
1678
|
+
if (2 !== ppfb.coordsLength())
|
|
1679
|
+
return undefined;
|
|
1680
|
+
const low = core_geometry_1.Point3d.create(ppfb.coords(0).x(), ppfb.coords(0).y(), ppfb.coords(0).z());
|
|
1681
|
+
const high = core_geometry_1.Point3d.create(ppfb.coords(1).x(), ppfb.coords(1).y(), ppfb.coords(1).z());
|
|
1682
|
+
return core_geometry_1.Range3d.create(low, high);
|
|
1683
|
+
}
|
|
1684
|
+
ElementGeometry.toSubGraphicRange = toSubGraphicRange;
|
|
1685
|
+
/** Create entry from a [[ElementAlignedBox3d]] to compute and store local ranges for subsequent geometric entries */
|
|
1686
|
+
function fromSubGraphicRange(bbox) {
|
|
1687
|
+
const fbb = new flatbuffers_1.flatbuffers.Builder();
|
|
1688
|
+
const builder = ElementGeometryFB_1.EGFBAccessors.PointPrimitive;
|
|
1689
|
+
builder.startCoordsVector(fbb, 2);
|
|
1690
|
+
fbb.addFloat64(bbox.high.z);
|
|
1691
|
+
fbb.addFloat64(bbox.high.y);
|
|
1692
|
+
fbb.addFloat64(bbox.high.x);
|
|
1693
|
+
fbb.addFloat64(bbox.low.z);
|
|
1694
|
+
fbb.addFloat64(bbox.low.y);
|
|
1695
|
+
fbb.addFloat64(bbox.low.x);
|
|
1696
|
+
const offset = fbb.endVector();
|
|
1697
|
+
builder.startPointPrimitive(fbb);
|
|
1698
|
+
builder.addCoords(fbb, offset);
|
|
1699
|
+
const mLoc = builder.endPointPrimitive(fbb);
|
|
1700
|
+
fbb.finish(mLoc);
|
|
1701
|
+
const data = fbb.asUint8Array();
|
|
1702
|
+
return { opcode: ElementGeometryOpcode.SubGraphicRange, data };
|
|
1703
|
+
}
|
|
1704
|
+
ElementGeometry.fromSubGraphicRange = fromSubGraphicRange;
|
|
1705
|
+
/** Create [[Transform]] from row-major storage 4x3 Float64Array */
|
|
1706
|
+
function toTransform(sourceToWorld) {
|
|
1707
|
+
if (12 !== sourceToWorld.length)
|
|
1708
|
+
return undefined;
|
|
1709
|
+
return core_geometry_1.Transform.createRowValues(sourceToWorld[0], sourceToWorld[1], sourceToWorld[2], sourceToWorld[3], sourceToWorld[4], sourceToWorld[5], sourceToWorld[6], sourceToWorld[7], sourceToWorld[8], sourceToWorld[9], sourceToWorld[10], sourceToWorld[11]);
|
|
1710
|
+
}
|
|
1711
|
+
ElementGeometry.toTransform = toTransform;
|
|
1712
|
+
/** Create [[ElementAlignedBox3d]] from lowX, lowY, lowZ, highX, highY, highZ Float64Array */
|
|
1713
|
+
function toElementAlignedBox3d(bbox) {
|
|
1714
|
+
if (6 !== bbox.length)
|
|
1715
|
+
return undefined;
|
|
1716
|
+
return core_geometry_1.Range3d.fromFloat64Array(bbox);
|
|
1717
|
+
}
|
|
1718
|
+
ElementGeometry.toElementAlignedBox3d = toElementAlignedBox3d;
|
|
1719
|
+
})(ElementGeometry = exports.ElementGeometry || (exports.ElementGeometry = {}));
|
|
1720
1720
|
//# sourceMappingURL=ElementGeometry.js.map
|