@itwin/core-common 5.0.0-dev.32 → 5.0.0-dev.34

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.
Files changed (193) hide show
  1. package/lib/cjs/AmbientOcclusion.js +9 -9
  2. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  3. package/lib/cjs/AnalysisStyle.js +1 -1
  4. package/lib/cjs/AnalysisStyle.js.map +1 -1
  5. package/lib/cjs/Atmosphere.js +19 -21
  6. package/lib/cjs/Atmosphere.js.map +1 -1
  7. package/lib/cjs/ClipStyle.js +5 -5
  8. package/lib/cjs/ClipStyle.js.map +1 -1
  9. package/lib/cjs/ColorDef.js +10 -10
  10. package/lib/cjs/ColorDef.js.map +1 -1
  11. package/lib/cjs/ContourDisplay.js +5 -5
  12. package/lib/cjs/ContourDisplay.js.map +1 -1
  13. package/lib/cjs/ECSqlReader.js +1 -1
  14. package/lib/cjs/ECSqlReader.js.map +1 -1
  15. package/lib/cjs/ElementProps.js +2 -2
  16. package/lib/cjs/ElementProps.js.map +1 -1
  17. package/lib/cjs/Environment.js +2 -2
  18. package/lib/cjs/Environment.js.map +1 -1
  19. package/lib/cjs/FeatureSymbology.js +3 -3
  20. package/lib/cjs/FeatureSymbology.js.map +1 -1
  21. package/lib/cjs/Gradient.js +9 -9
  22. package/lib/cjs/Gradient.js.map +1 -1
  23. package/lib/cjs/GroundPlane.js +2 -2
  24. package/lib/cjs/GroundPlane.js.map +1 -1
  25. package/lib/cjs/HiddenLine.js +4 -4
  26. package/lib/cjs/HiddenLine.js.map +1 -1
  27. package/lib/cjs/IModel.js +6 -6
  28. package/lib/cjs/IModel.js.map +1 -1
  29. package/lib/cjs/LightSettings.js +1 -1
  30. package/lib/cjs/LightSettings.js.map +1 -1
  31. package/lib/cjs/PlanarClipMask.js +2 -2
  32. package/lib/cjs/PlanarClipMask.js.map +1 -1
  33. package/lib/cjs/RealityModelDisplaySettings.js +4 -4
  34. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  35. package/lib/cjs/RenderMaterial.js +3 -3
  36. package/lib/cjs/RenderMaterial.js.map +1 -1
  37. package/lib/cjs/SkyBox.js +4 -4
  38. package/lib/cjs/SkyBox.js.map +1 -1
  39. package/lib/cjs/SolarShadows.js +1 -1
  40. package/lib/cjs/SolarShadows.js.map +1 -1
  41. package/lib/cjs/SubCategoryAppearance.js +1 -1
  42. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  43. package/lib/cjs/SubCategoryOverride.js +2 -2
  44. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  45. package/lib/cjs/TextureMapping.js +2 -2
  46. package/lib/cjs/TextureMapping.js.map +1 -1
  47. package/lib/cjs/ThematicDisplay.js +2 -2
  48. package/lib/cjs/ThematicDisplay.js.map +1 -1
  49. package/lib/cjs/ViewDetails.js +2 -2
  50. package/lib/cjs/ViewDetails.js.map +1 -1
  51. package/lib/cjs/ViewFlags.js +2 -2
  52. package/lib/cjs/ViewFlags.js.map +1 -1
  53. package/lib/cjs/WhiteOnWhiteReversalSettings.js +2 -2
  54. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  55. package/lib/cjs/annotation/TextStyle.js +19 -19
  56. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  57. package/lib/cjs/geometry/Cartographic.js +13 -13
  58. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  59. package/lib/cjs/ipc/IpcWebSocket.js +1 -1
  60. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  61. package/lib/cjs/ipc/IpcWebSocketTransport.js +1 -1
  62. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  63. package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
  64. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  65. package/lib/cjs/rpc/IModelReadRpcInterface.js +4 -4
  66. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  67. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
  68. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  69. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
  70. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  71. package/lib/cjs/rpc/core/RpcConfiguration.js +32 -34
  72. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  73. package/lib/cjs/rpc/core/RpcControl.js +8 -15
  74. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  75. package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
  76. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  77. package/lib/cjs/rpc/core/RpcOperation.js +2 -2
  78. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  79. package/lib/cjs/rpc/core/RpcProtocol.js +4 -4
  80. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  81. package/lib/cjs/rpc/core/RpcPush.js +5 -5
  82. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  83. package/lib/cjs/rpc/core/RpcRequest.js +5 -5
  84. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  85. package/lib/cjs/rpc/core/RpcRoutingToken.js +2 -2
  86. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  87. package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
  88. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  89. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +6 -6
  90. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  91. package/lib/cjs/rpc/web/RpcMultipart.js +12 -12
  92. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  93. package/lib/cjs/rpc/web/WebAppRpcRequest.js +17 -19
  94. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  95. package/lib/cjs/tile/IModelTileIO.js +1 -1
  96. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  97. package/lib/esm/AmbientOcclusion.js +9 -9
  98. package/lib/esm/AmbientOcclusion.js.map +1 -1
  99. package/lib/esm/AnalysisStyle.js +1 -1
  100. package/lib/esm/AnalysisStyle.js.map +1 -1
  101. package/lib/esm/Atmosphere.js +19 -21
  102. package/lib/esm/Atmosphere.js.map +1 -1
  103. package/lib/esm/ClipStyle.js +5 -5
  104. package/lib/esm/ClipStyle.js.map +1 -1
  105. package/lib/esm/ColorDef.js +10 -10
  106. package/lib/esm/ColorDef.js.map +1 -1
  107. package/lib/esm/ContourDisplay.js +5 -5
  108. package/lib/esm/ContourDisplay.js.map +1 -1
  109. package/lib/esm/ECSqlReader.js +1 -1
  110. package/lib/esm/ECSqlReader.js.map +1 -1
  111. package/lib/esm/ElementProps.js +2 -2
  112. package/lib/esm/ElementProps.js.map +1 -1
  113. package/lib/esm/Environment.js +2 -2
  114. package/lib/esm/Environment.js.map +1 -1
  115. package/lib/esm/FeatureSymbology.js +3 -3
  116. package/lib/esm/FeatureSymbology.js.map +1 -1
  117. package/lib/esm/Gradient.js +9 -9
  118. package/lib/esm/Gradient.js.map +1 -1
  119. package/lib/esm/GroundPlane.js +2 -2
  120. package/lib/esm/GroundPlane.js.map +1 -1
  121. package/lib/esm/HiddenLine.js +4 -4
  122. package/lib/esm/HiddenLine.js.map +1 -1
  123. package/lib/esm/IModel.js +6 -6
  124. package/lib/esm/IModel.js.map +1 -1
  125. package/lib/esm/LightSettings.js +1 -1
  126. package/lib/esm/LightSettings.js.map +1 -1
  127. package/lib/esm/PlanarClipMask.js +2 -2
  128. package/lib/esm/PlanarClipMask.js.map +1 -1
  129. package/lib/esm/RealityModelDisplaySettings.js +4 -4
  130. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  131. package/lib/esm/RenderMaterial.js +3 -3
  132. package/lib/esm/RenderMaterial.js.map +1 -1
  133. package/lib/esm/SkyBox.js +4 -4
  134. package/lib/esm/SkyBox.js.map +1 -1
  135. package/lib/esm/SolarShadows.js +1 -1
  136. package/lib/esm/SolarShadows.js.map +1 -1
  137. package/lib/esm/SubCategoryAppearance.js +1 -1
  138. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  139. package/lib/esm/SubCategoryOverride.js +2 -2
  140. package/lib/esm/SubCategoryOverride.js.map +1 -1
  141. package/lib/esm/TextureMapping.js +2 -2
  142. package/lib/esm/TextureMapping.js.map +1 -1
  143. package/lib/esm/ThematicDisplay.js +2 -2
  144. package/lib/esm/ThematicDisplay.js.map +1 -1
  145. package/lib/esm/ViewDetails.js +2 -2
  146. package/lib/esm/ViewDetails.js.map +1 -1
  147. package/lib/esm/ViewFlags.js +2 -2
  148. package/lib/esm/ViewFlags.js.map +1 -1
  149. package/lib/esm/WhiteOnWhiteReversalSettings.js +2 -2
  150. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  151. package/lib/esm/annotation/TextStyle.js +19 -19
  152. package/lib/esm/annotation/TextStyle.js.map +1 -1
  153. package/lib/esm/geometry/Cartographic.js +13 -13
  154. package/lib/esm/geometry/Cartographic.js.map +1 -1
  155. package/lib/esm/ipc/IpcWebSocket.js +1 -1
  156. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  157. package/lib/esm/ipc/IpcWebSocketTransport.js +1 -1
  158. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  159. package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
  160. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  161. package/lib/esm/rpc/IModelReadRpcInterface.js +4 -4
  162. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  163. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
  164. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  165. package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
  166. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  167. package/lib/esm/rpc/core/RpcConfiguration.js +32 -34
  168. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  169. package/lib/esm/rpc/core/RpcControl.js +8 -15
  170. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  171. package/lib/esm/rpc/core/RpcInvocation.js +3 -5
  172. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  173. package/lib/esm/rpc/core/RpcOperation.js +2 -2
  174. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  175. package/lib/esm/rpc/core/RpcProtocol.js +4 -4
  176. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  177. package/lib/esm/rpc/core/RpcPush.js +5 -5
  178. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  179. package/lib/esm/rpc/core/RpcRequest.js +5 -5
  180. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  181. package/lib/esm/rpc/core/RpcRoutingToken.js +2 -2
  182. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  183. package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
  184. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  185. package/lib/esm/rpc/web/BentleyCloudRpcManager.js +6 -6
  186. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  187. package/lib/esm/rpc/web/RpcMultipart.js +12 -12
  188. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  189. package/lib/esm/rpc/web/WebAppRpcRequest.js +17 -19
  190. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  191. package/lib/esm/tile/IModelTileIO.js +1 -1
  192. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  193. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"ColorDef.js","sourceRoot":"","sources":["../../src/ColorDef.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAA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M,CAAC;QAEhB,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,KAAK,CAAC,MAAM,EAAE,EAAE,4BAA4B;YAClE,OAAO,MAAM,CAAC;QAEhB,uEAAuE;QACvE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5F,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAe;QAC3B,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC;IACpC,CAAC;;AAED,iBAAiB;AACM,cAAK,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC/D,iBAAiB;AACM,cAAK,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC/D,eAAe;AACQ,YAAG,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC3D,iBAAiB;AACM,cAAK,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC/D,gBAAgB;AACO,aAAI,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Symbology\n */\n\nimport { Geometry } from \"@itwin/core-geometry\";\nimport { ColorByName } from \"./ColorByName\";\nimport { HSLColor } from \"./HSLColor\";\nimport { HSVColor, HSVConstants } from \"./HSVColor\";\n\n// cspell: ignore ttbbggrr bbggrr rrggbb aabbggrr abgr rrggbb hsla lerp torgb dhue dsaturation dvalue intpart fractpart cyanish\n\n// portions adapted from Three.js Copyright © 2010-2024 three.js authors\n\nconst scratchBytes = new Uint8Array(4);\nconst scratchUInt32 = new Uint32Array(scratchBytes.buffer);\n\n/** The JSON representation of a [[ColorDef]] - an unsigned 32-bit integer in 0xTTBBGGRR format.\n * @public\n * @extensions\n */\nexport type ColorDefProps = number;\n\n/** An immutable integer representation of a color.\n *\n * A color consists of 4 components: Red, Blue, Green, and Transparency. Each component is an 8-bit unsigned integer in the range [0..255]. A value of zero means that component contributes nothing\n * to the color: e.g., a color with Red=0 contains no shade of red, and a color with Transparency=0 is fully opaque. A value of 255 means that component contributes its maximum\n * value to the color: e.g., a color with Red=255 is as red as it is possible to be, and a color with Transparency=255 is fully transparent.\n *\n * Internally, these 4 components are combined into a single 32-bit unsigned integer as represented by [[ColorDefProps]]. This representation can result in some confusion regarding:\n * 1. The ordering of the individual components; and\n * 2. Whether to specify transparency or opacity (sometimes referred to as \"alpha\").\n *\n * ColorDef uses `0xTTBBGGRR` internally, which uses Transparency and puts Red in the low byte and Transparency in the high byte. It can be converted to `0xRRGGBB` format (blue in the low byte)\n * using [[getRgb]] and `0xAABBGGRRx format (red in the low byte, using opacity instead of transparency) using [[getAbgr]].\n *\n * A ColorDef can be created from a numeric [[ColorDefProps]], from a string in one of the common HTML formats (e.g., [[fromString]]), or by specifying values for the individual components\n * (e.g., [[from]]).\n *\n * ColorDef is **immutable**. To obtain a modified copy of a ColorDef, use methods like [[adjustedForContrast]], [[inverse]], or [[withTransparency]]. For example:\n * ```ts\n * const semiTransparentBlue = ColorDef.blue.withTransparency(100);\n * ```\n * @public\n * @extensions\n */\nexport class ColorDef {\n private readonly _tbgr: number;\n\n private constructor(tbgr: number) {\n scratchUInt32[0] = tbgr; // Force to be a 32-bit unsigned integer\n this._tbgr = scratchUInt32[0];\n }\n\n /**\n * Create a new ColorDef.\n * @param val value to use.\n * If a number, it is interpreted as a 0xTTBBGGRR (Red in the low byte, high byte is transparency 0==fully opaque) value.\n * If a string, it must be in one of the forms supported by [[fromString]] - any unrecognized string will produce [[black]].\n */\n public static create(val?: string | ColorDefProps) {\n return this.fromTbgr(this.computeTbgr(val));\n }\n\n /** Compute the 0xTTBBGGRR value corresponding to the specified representation of a color.\n * @see [[fromString]] for a description of valid string representations.\n */\n public static computeTbgr(val?: string | ColorDefProps): ColorDefProps {\n switch (typeof val) {\n case \"number\":\n return val;\n case \"string\":\n return this.computeTbgrFromString(val);\n default:\n return 0;\n }\n }\n\n /** Convert this ColorDef to a 32 bit number representing the 0xTTBBGGRR value */\n public toJSON(): ColorDefProps { return this._tbgr; }\n\n /** Create a new ColorDef from a json object. If the json object is a number, it is assumed to be a 0xTTBBGGRR value. */\n public static fromJSON(json?: ColorDefProps): ColorDef {\n return this.create(json);\n }\n\n /** Create a ColorDef from Red, Green, Blue, Transparency values. All inputs should be integers between 0-255. */\n public static from(red: number, green: number, blue: number, transparency?: number): ColorDef {\n return this.fromTbgr(this.computeTbgrFromComponents(red, green, blue, transparency));\n }\n\n /** Compute the 0xTTBBGGRR value corresponding to the specified Red, Green, Blue, Transparency components. All inputs should be integers between 0-255. */\n public static computeTbgrFromComponents(red: number, green: number, blue: number, transparency?: number): ColorDefProps {\n scratchBytes[0] = red;\n scratchBytes[1] = green;\n scratchBytes[2] = blue;\n scratchBytes[3] = transparency || 0;\n return scratchUInt32[0];\n }\n\n /** Create a ColorDef from its 0xTTBBGGRR representation. */\n public static fromTbgr(tbgr: ColorDefProps): ColorDef {\n switch (tbgr) {\n case ColorByName.black:\n return this.black;\n case ColorByName.white:\n return this.white;\n case ColorByName.red:\n return this.red;\n case ColorByName.green:\n return this.green;\n case ColorByName.blue:\n return this.blue;\n default:\n return new ColorDef(tbgr);\n }\n }\n\n /** Create a ColorDef from its 0xAABBGGRR representation. */\n public static fromAbgr(abgr: number): ColorDef {\n return this.fromTbgr(this.getAbgr(abgr));\n }\n\n /** Create a ColorDef from a string representation. The following representations are supported:\n * *\"rgb(255,0,0)\"*\n * *\"rgba(255,0,0,.2)\"*\n * *\"rgb(100%,0%,0%)\"*\n * *\"hsl(120,50%,50%)\"*\n * *\"#rrbbgg\"*\n * *\"blanchedAlmond\"* (see possible values from [[ColorByName]]). Case-insensitive.\n *\n * If `val` is not a valid color string, this function returns [[black]].\n * @see [[isValidColor]] to determine if `val` is a valid color string.\n */\n public static fromString(val: string): ColorDef {\n return this.fromTbgr(this.computeTbgrFromString(val));\n }\n\n /** Determine whether the input is a valid representation of a ColorDef.\n * @see [[fromString]] for the definition of a valid string representation.\n * @see [[ColorDefProps]] for the definition of a valid numeric representation.\n */\n public static isValidColor(val: string | number): boolean {\n if (typeof val === \"number\")\n return val >= 0 && val <= 0xffffffff && Math.floor(val) === val;\n\n return undefined !== this.tryComputeTbgrFromString(val);\n }\n\n /** Compute the 0xTTBBGGRR value corresponding to a string representation of a color.\n * If `val` is not a valid color string, this function returns 0 (black).\n * @see [[fromString]] for the definition of a valid color string.\n * @see [[tryComputeTbgrFromString]] to determine if `val` is a valid color string.\n */\n public static computeTbgrFromString(val: string): ColorDefProps {\n return this.tryComputeTbgrFromString(val) ?? 0;\n }\n\n /** Try to compute the 0xTTBBGGRR value corresponding to a string representation of a ColorDef.\n * @returns the corresponding numeric representation, or `undefined` if the input does not represent a color.\n * @see [[fromString]] for the definition of a valid color string.\n */\n public static tryComputeTbgrFromString(val: string): ColorDefProps | undefined {\n if (typeof val !== \"string\")\n return undefined;\n\n val = val.toLowerCase();\n let m = /^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec(val);\n if (m) { // rgb / hsl\n let color;\n const name = m[1];\n const components = m[2];\n\n const hasPercent = (str: string) => str[str.length - 1] === \"%\";\n const floatOrPercent = (str: string) => {\n const v = parseFloat(str);\n return 255 * Geometry.clamp(hasPercent(str) ? v / 100 : v, 0, 1);\n };\n const intOrPercent = (str: string) => {\n const v = hasPercent(str) ? (parseFloat(str) / 100) * 255 : parseInt(str, 10);\n return Geometry.clamp(v, 0, 255);\n };\n\n switch (name) {\n case \"rgb\":\n case \"rgba\":\n color = /^(\\d+%*)\\s*[, ]\\s*(\\d+%*)\\s*[, ]\\s*(\\d+%*)\\s*([,\\/]\\s*([0-9]*\\.?[0-9]+%*)\\s*)?$/.exec(components);\n if (color) { // rgb(255,0,0) rgba(255,0,0,0.5)\n return this.computeTbgrFromComponents(\n intOrPercent(color[1]),\n intOrPercent(color[2]),\n intOrPercent(color[3]),\n typeof color[5] === \"string\" ? 255 - floatOrPercent(color[5]) : 0);\n }\n\n break;\n case \"hsl\":\n case \"hsla\":\n color = /^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(components);\n if (color) { // hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n const h = parseFloat(color[1]) / 360;\n const s = parseInt(color[2], 10) / 100;\n const l = parseInt(color[3], 10) / 100;\n const t = typeof color[5] === \"string\" ? 255 - floatOrPercent(color[5]) : 0;\n return this.computeTbgrFromHSL(h, s, l, t);\n }\n\n break;\n }\n } else if (m = /^\\#([a-f0-9]+)$/.exec(val)) { // hex color\n const hex = m[1];\n const size = hex.length;\n\n if (size === 3) { // #ff0\n return this.computeTbgrFromComponents(\n parseInt(hex.charAt(0) + hex.charAt(0), 16),\n parseInt(hex.charAt(1) + hex.charAt(1), 16),\n parseInt(hex.charAt(2) + hex.charAt(2), 16), 0);\n }\n if (size === 6) { // #ff0000\n return this.computeTbgrFromComponents(\n parseInt(hex.charAt(0) + hex.charAt(1), 16),\n parseInt(hex.charAt(2) + hex.charAt(3), 16),\n parseInt(hex.charAt(4) + hex.charAt(5), 16), 0);\n }\n }\n\n if (val && val.length > 0) { // ColorRgb value\n for (const [key, value] of Object.entries(ColorByName))\n if (key.toLowerCase() === val)\n return value;\n }\n\n return undefined;\n }\n\n /** Get the red, green, blue, and transparency values from this ColorDef. Values will be integers between 0-255. */\n public get colors(): { r: number, g: number, b: number, t: number } {\n return ColorDef.getColors(this._tbgr);\n }\n\n /** Get the r,g,b,t values encoded in an 0xTTBBGGRR value. Values will be integers between 0-255. */\n public static getColors(tbgr: ColorDefProps) {\n scratchUInt32[0] = tbgr;\n return {\n b: scratchBytes[2],\n g: scratchBytes[1],\n r: scratchBytes[0],\n t: scratchBytes[3],\n };\n }\n\n /** The color value of this ColorDef as an integer in the form 0xTTBBGGRR (red in the low byte) */\n public get tbgr(): ColorDefProps { return this._tbgr; }\n\n /** Get the value of the color as a number in 0xAABBGGRR format (i.e. red is in low byte). Transparency (0==fully opaque) converted to alpha (0==fully transparent). */\n public getAbgr(): number {\n return ColorDef.getAbgr(this._tbgr);\n }\n\n /** Get the value of a 0xTTBBGGRR color as a number in 0xAABBGGRR format (i.e. red is in low byte). Transparency (0==fully opaque) converted to alpha (0==fully transparent). */\n public static getAbgr(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n scratchBytes[3] = 255 - scratchBytes[3];\n return scratchUInt32[0];\n }\n\n /** Get the RGB value of the color as a number in 0xRRGGBB format (i.e blue is in the low byte). Transparency is ignored. Value will be from 0 to 2^24 */\n public getRgb(): number {\n return ColorDef.getRgb(this._tbgr);\n }\n\n /** Get the RGB value of the 0xTTBBGGRR color as a number in 0xRRGGBB format (i.e blue is in the low byte). Transparency is ignored. Value will be from 0 to 2^24 */\n public static getRgb(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n return (scratchBytes[0] << 16) + (scratchBytes[1] << 8) + scratchBytes[2];\n }\n\n /** Return a copy of this ColorDef with the specified alpha component.\n * @param alpha the new alpha value as an integer between 0-255.\n * @returns A ColorDef with equivalent red, green, and blue components to this one but with the specified alpha.\n */\n public withAlpha(alpha: number): ColorDef {\n const tbgr = ColorDef.withAlpha(this._tbgr, alpha);\n return tbgr === this._tbgr ? this : ColorDef.fromTbgr(tbgr);\n }\n\n /** Return a color equivalent to the specified 0xTTBBGGRR but with modified alpha component.\n * @param alpha the new alpha value as an integer between 0-255.\n * @returns The 0xTTBBGGRR value equivalent to `tbgr` but with the specified alpha.\n */\n public static withAlpha(tbgr: ColorDefProps, alpha: number): number {\n scratchUInt32[0] = tbgr;\n scratchBytes[3] = 255 - (alpha | 0);\n return scratchUInt32[0];\n }\n\n /** Get the alpha value for this ColorDef. Will be between 0-255 */\n public getAlpha(): number {\n return ColorDef.getAlpha(this._tbgr);\n }\n\n /** Extract the alpha value from a 0xTTBBGGRR color. */\n public static getAlpha(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n return 255 - scratchBytes[3];\n }\n\n /** True if this ColorDef is fully opaque. */\n public get isOpaque(): boolean {\n return ColorDef.isOpaque(this._tbgr);\n }\n\n /** True if the specified 0xTTBBGGRR color is fully opaque. */\n public static isOpaque(tbgr: ColorDefProps): boolean {\n return 255 === this.getAlpha(tbgr);\n }\n\n /** Get the transparency value for this ColorDef (inverse of alpha). Will be between 0-255. */\n public getTransparency(): number {\n return ColorDef.getTransparency(this._tbgr);\n }\n\n /** Extract the transparency component from a 0xTTBBGGRR color as an integer between 0-255.. */\n public static getTransparency(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n return scratchBytes[3];\n }\n\n /** Create a copy of this ColorDef with the specified transparency.\n * @param transparency the new transparency value. Must be between 0-255, where 0 means 'fully opaque' and 255 means 'fully transparent'.\n * @returns a new ColorDef with the same color as this one and the specified transparency.\n */\n public withTransparency(transparency: number): ColorDef {\n const tbgr = ColorDef.withTransparency(this._tbgr, transparency);\n return tbgr === this._tbgr ? this : ColorDef.fromTbgr(tbgr);\n }\n\n /** Compute the 0xTTBBGGRR value of the specified color and transparency.\n * @param transparency the new transparency as an integer between 0-255.\n * @returns The 0xTTBBGGRR value equivalent to `tbgr` but with the specified transparency.\n */\n public static withTransparency(tbgr: ColorDefProps, transparency: number): ColorDefProps {\n return this.withAlpha(tbgr, 255 - transparency);\n }\n\n /** The \"known name\" for this ColorDef. Will be undefined if color value is not in [[ColorByName]] list */\n public get name(): string | undefined {\n return ColorDef.getName(this.tbgr);\n }\n\n /** Obtain the name of the color in the [[ColorByName]] list associated with the specified 0xTTBBGGRR value, or undefined if no such named color exists.\n * @note A handful of colors (like \"aqua\" and \"cyan\") have identical tbgr values; in such cases the first match will be returned.\n */\n public static getName(tbgr: ColorDefProps): string | undefined {\n for (const [key, value] of Object.entries(ColorByName))\n if (value === tbgr)\n return key;\n\n return undefined;\n }\n\n /** Convert this ColorDef to a string in the form \"#rrggbb\" where values are hex digits of the respective colors */\n public toHexString(): string {\n return ColorDef.toHexString(this.tbgr);\n }\n\n /** Convert the 0xTTBBGGRR value to a string in the form \"#rrggbb\". */\n public static toHexString(tbgr: ColorDefProps): string {\n return `#${(`000000${this.getRgb(tbgr).toString(16)}`).slice(-6)}`;\n }\n\n private static getColorsString(tbgr: ColorDefProps) {\n const c = this.getColors(tbgr);\n return `${c.r},${c.g},${c.b}`;\n }\n\n /** Convert this ColorDef to a string in the form \"rgb(r,g,b)\" where values are decimal digits of the respective colors. */\n public toRgbString(): string {\n return ColorDef.toRgbString(this.tbgr);\n }\n\n /** Convert the 0xTTBBGGRR color to a string in the form \"rgb(r,g,b)\" where each component is specified in decimal. */\n public static toRgbString(tbgr: ColorDefProps): string {\n return `rgb(${this.getColorsString(tbgr)})`;\n }\n\n /** Convert this ColorDef to a string in the form \"rgba(r,g,b,a)\" where color values are decimal digits and a is a fraction */\n public toRgbaString(): string {\n return ColorDef.toRgbaString(this.tbgr);\n }\n\n /** Convert the 0xTTBBGGRR color to a string of the form \"rgba(r,g,b,a)\" where the color components are specified in decimal and the alpha component is a fraction. */\n public static toRgbaString(tbgr: ColorDefProps): string {\n return `rgba(${this.getColorsString(tbgr)},${this.getAlpha(tbgr) / 255.})`;\n }\n\n /** Create a ColorDef that is the linear interpolation of this ColorDef and another ColorDef, using a weighting factor.\n * @param color2 The other color\n * @param weight The weighting factor for color2. 0.0 = this color, 1.0 = color2.\n * @param result Optional ColorDef to hold result. If undefined, a new ColorDef is created.\n */\n public lerp(color2: ColorDef, weight: number): ColorDef {\n return ColorDef.fromTbgr(ColorDef.lerp(this.tbgr, color2.tbgr, weight));\n }\n\n /** Interpolate between two 0xTTBBGGRR colors using a weighting factor.\n * @param tbgr1 The first color\n * @param tbgr2 The other color\n * @param weight The weighting factor in [0..1]. A value of 0.0 selects `tbgr1`; 1.0 selects `tbgr2`; 0.5 mixes them evenly; etc.\n * @returns The linear interpolation between `tbgr1` and `tbgr2` using the specified weight.\n */\n public static lerp(tbgr1: ColorDefProps, tbgr2: ColorDefProps, weight: number): ColorDefProps {\n const c = this.getColors(tbgr1);\n const color = this.getColors(tbgr2);\n c.r += (color.r - c.r) * weight;\n c.g += (color.g - c.g) * weight;\n c.b += (color.b - c.b) * weight;\n return this.computeTbgrFromComponents(c.r, c.g, c.b, c.t);\n }\n\n /** Create a new ColorDef that is the inverse (all colors set to 255 - this) of this color. Ignores transparency - result has 0 transparency. */\n public inverse(): ColorDef {\n return ColorDef.fromTbgr(ColorDef.inverse(this.tbgr));\n }\n\n /** Return a 0xTTBBGGRR color whose color components are the inverse of the input color. The result has 0 transparency. */\n public static inverse(tbgr: ColorDefProps): ColorDefProps {\n const colors = this.getColors(tbgr);\n return this.computeTbgrFromComponents(255 - colors.r, 255 - colors.g, 255 - colors.b);\n }\n\n /** Create a ColorDef from hue, saturation, lightness values */\n public static fromHSL(h: number, s: number, l: number, transparency = 0): ColorDef {\n return this.fromTbgr(this.computeTbgrFromHSL(h, s, l, transparency));\n }\n\n /** Compute the 0xTTBBGGRR color corresponding to the specified hue, saturation, lightness values. */\n public static computeTbgrFromHSL(h: number, s: number, l: number, transparency = 0): ColorDefProps {\n const torgb = (p1: number, q1: number, t: number) => {\n if (t < 0)\n t += 1;\n if (t > 1)\n t -= 1;\n\n if (t < 1 / 6)\n return p1 + (q1 - p1) * 6 * t;\n if (t < 1 / 2)\n return q1;\n if (t < 2 / 3)\n return p1 + (q1 - p1) * 6 * (2 / 3 - t);\n\n return p1;\n };\n\n const hue2rgb = (p1: number, q1: number, t: number) => Math.round(torgb(p1, q1, t) * 255);\n const modulo = (n: number, m: number) => ((n % m) + m) % m;\n\n // h,s,l ranges are in 0.0 - 1.0\n h = modulo(h, 1);\n s = Geometry.clamp(s, 0, 1);\n l = Geometry.clamp(l, 0, 1);\n\n if (s === 0) {\n l *= 255;\n return this.computeTbgrFromComponents(l, l, l, transparency);\n }\n\n const p = l <= 0.5 ? l * (1 + s) : l + s - (l * s);\n const q = (2 * l) - p;\n return this.computeTbgrFromComponents(\n hue2rgb(q, p, h + 1 / 3),\n hue2rgb(q, p, h),\n hue2rgb(q, p, h - 1 / 3),\n transparency);\n }\n\n /** Create an [[HSLColor]] from this ColorDef */\n public toHSL(): HSLColor {\n // h,s,l ranges are in 0.0 - 1.0\n const col = this.colors;\n col.r /= 255;\n col.g /= 255;\n col.b /= 255;\n const max = Math.max(col.r, col.g, col.b);\n const min = Math.min(col.r, col.g, col.b);\n\n let hue = 0;\n let saturation;\n const lightness = (min + max) / 2.0;\n\n if (min === max) {\n saturation = 0;\n } else {\n const delta = max - min;\n saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);\n switch (max) {\n case col.r:\n hue = (col.g - col.b) / delta + (col.g < col.b ? 6 : 0);\n break;\n case col.g:\n hue = (col.b - col.r) / delta + 2;\n break;\n case col.b:\n hue = (col.r - col.g) / delta + 4;\n break;\n }\n\n hue /= 6;\n }\n\n return new HSLColor(hue, saturation, lightness);\n }\n\n /** Create an [[HSVColor]] from this ColorDef */\n public toHSV(): HSVColor {\n const { r, g, b } = this.colors;\n let min = (r < g) ? r : g;\n if (b < min)\n min = b;\n\n let max = (r > g) ? r : g;\n if (b > max)\n max = b;\n\n /* amount of \"blackness\" present */\n const v = Math.floor((max / 255.0 * 100) + 0.5);\n const deltaRgb = max - min;\n const s = (max !== 0.0) ? Math.floor((deltaRgb / max * 100) + 0.5) : 0;\n let h = 0;\n\n if (s) {\n const redDistance = (max - r) / deltaRgb;\n const greenDistance = (max - g) / deltaRgb;\n const blueDistance = (max - b) / deltaRgb;\n\n let intermediateHue: number;\n if (r === max) /* color between yellow & magenta */\n intermediateHue = blueDistance - greenDistance;\n else if (g === max) /* color between cyan & yellow */\n intermediateHue = 2.0 + redDistance - blueDistance;\n else /* color between magenta & cyan */\n intermediateHue = 4.0 + greenDistance - redDistance;\n\n /* intermediate hue is [0..6] */\n intermediateHue *= 60;\n\n if (intermediateHue < 0.0)\n intermediateHue += 360;\n\n h = Math.floor(intermediateHue + 0.5);\n\n if (h >= 360)\n h = 0;\n } else {\n h = 0;\n }\n\n return new HSVColor(h, s, v);\n }\n\n /** Create a ColorDef from an HSVColor */\n public static fromHSV(hsv: HSVColor, transparency = 0): ColorDef {\n // Check for simple case first.\n if ((!hsv.s) || (hsv.h === -1)) {\n // hue must be undefined, have no color only white\n const white = 0xff & Math.floor(((255.0 * hsv.v) / 100.0) + 0.5 + 3.0e-14);\n return ColorDef.from(white, white, white, 0);\n }\n\n let dhue = hsv.h, dsaturation = hsv.s, dvalue = hsv.v;\n if (dhue === 360)\n dhue = 0.0;\n\n dhue /= 60; // hue is now [0..6]\n const hueIntpart = Math.floor(dhue); // convert double -> int\n const hueFractpart = dhue - hueIntpart;\n dvalue /= 100;\n dsaturation /= 100;\n\n const p = 0xff & Math.floor((dvalue * (1.0 - dsaturation) * 255.0) + 0.5);\n const q = 0xff & Math.floor((dvalue * (1.0 - (dsaturation * hueFractpart)) * 255.0) + 0.5);\n const t = 0xff & Math.floor((dvalue * (1.0 - (dsaturation * (1.0 - hueFractpart))) * 255.0) + 0.5);\n const v = 0xff & Math.floor(dvalue * 255 + 0.5);\n\n let r = 0, b = 0, g = 0;\n switch (hueIntpart) {\n case 0: r = v; g = t; b = p; break; // reddish\n case 1: r = q, g = v; b = p; break; // yellowish\n case 2: r = p, g = v; b = t; break; // greenish\n case 3: r = p, g = q; b = v; break; // cyanish\n case 4: r = t, g = p; b = v; break; // bluish\n case 5: r = v, g = p; b = q; break; // magenta-ish\n }\n\n return ColorDef.from(r, g, b, transparency);\n }\n\n private visibilityCheck(other: ColorDef): number {\n const fg = this.colors;\n const bg = other.colors;\n // Compute luminosity\n const red = Math.abs(fg.r - bg.r);\n const green = Math.abs(fg.g - bg.g);\n const blue = Math.abs(fg.b - bg.b);\n return (0.30 * red) + (0.59 * green) + (0.11 * blue);\n }\n\n /**\n * Create a new ColorDef that is adjusted from this ColorDef for maximum contrast against another color. The color will either be lighter\n * or darker, depending on which has more visibility against the other color.\n * @param other the color to contrast with\n * @param alpha optional alpha value for the adjusted color. If not supplied alpha from this color is used.\n */\n public adjustedForContrast(other: ColorDef, alpha?: number): ColorDef {\n const visibility = this.visibilityCheck(other);\n if (HSVConstants.VISIBILITY_GOAL <= visibility) {\n return undefined !== alpha ? this.withAlpha(alpha) : this;\n }\n\n const adjPercent = Math.floor(((HSVConstants.VISIBILITY_GOAL - visibility) / 255.0) * 100.0);\n let darkerHSV = this.toHSV();\n let brightHSV = darkerHSV.clone();\n\n darkerHSV = darkerHSV.adjusted(true, adjPercent);\n brightHSV = brightHSV.adjusted(false, adjPercent);\n\n if (undefined === alpha)\n alpha = this.getAlpha();\n\n const darker = ColorDef.fromHSV(darkerHSV).withAlpha(alpha);\n const bright = ColorDef.fromHSV(brightHSV).withAlpha(alpha);\n\n if (bright.getRgb() === other.getRgb()) // Couldn't adjust brighter...\n return darker;\n\n if (darker.getRgb() === other.getRgb()) // Couldn't adjust darker...\n return bright;\n\n // NOTE: Best choice is the one most visible against the other color...\n return (bright.visibilityCheck(other) >= darker.visibilityCheck(other)) ? bright : darker;\n }\n\n /** True if the value of this ColorDef is the same as another ColorDef. */\n public equals(other: ColorDef): boolean {\n return this._tbgr === other._tbgr;\n }\n\n /** pure black */\n public static readonly black = new ColorDef(ColorByName.black);\n /** pure white */\n public static readonly white = new ColorDef(ColorByName.white);\n /** pure red */\n public static readonly red = new ColorDef(ColorByName.red);\n /** pure green */\n public static readonly green = new ColorDef(ColorByName.green);\n /** pure blue */\n public static readonly blue = new ColorDef(ColorByName.blue);\n}\n"]}
1
+ {"version":3,"file":"ColorDef.js","source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,CAAC;QAC5D,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE5D,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,KAAK,CAAC,MAAM,EAAE,EAAE,8BAA8B;YACpE,OAAO,MAAM,CAAC;QAEhB,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,KAAK,CAAC,MAAM,EAAE,EAAE,4BAA4B;YAClE,OAAO,MAAM,CAAC;QAEhB,uEAAuE;QACvE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5F,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAe;QAC3B,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC;IACpC,CAAC;IAED,iBAAiB;aACM,UAAK,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/D,iBAAiB;aACM,UAAK,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/D,eAAe;aACQ,QAAG,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC3D,iBAAiB;aACM,UAAK,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/D,gBAAgB;aACO,SAAI,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Symbology\n */\n\nimport { Geometry } from \"@itwin/core-geometry\";\nimport { ColorByName } from \"./ColorByName\";\nimport { HSLColor } from \"./HSLColor\";\nimport { HSVColor, HSVConstants } from \"./HSVColor\";\n\n// cspell: ignore ttbbggrr bbggrr rrggbb aabbggrr abgr rrggbb hsla lerp torgb dhue dsaturation dvalue intpart fractpart cyanish\n\n// portions adapted from Three.js Copyright © 2010-2024 three.js authors\n\nconst scratchBytes = new Uint8Array(4);\nconst scratchUInt32 = new Uint32Array(scratchBytes.buffer);\n\n/** The JSON representation of a [[ColorDef]] - an unsigned 32-bit integer in 0xTTBBGGRR format.\n * @public\n * @extensions\n */\nexport type ColorDefProps = number;\n\n/** An immutable integer representation of a color.\n *\n * A color consists of 4 components: Red, Blue, Green, and Transparency. Each component is an 8-bit unsigned integer in the range [0..255]. A value of zero means that component contributes nothing\n * to the color: e.g., a color with Red=0 contains no shade of red, and a color with Transparency=0 is fully opaque. A value of 255 means that component contributes its maximum\n * value to the color: e.g., a color with Red=255 is as red as it is possible to be, and a color with Transparency=255 is fully transparent.\n *\n * Internally, these 4 components are combined into a single 32-bit unsigned integer as represented by [[ColorDefProps]]. This representation can result in some confusion regarding:\n * 1. The ordering of the individual components; and\n * 2. Whether to specify transparency or opacity (sometimes referred to as \"alpha\").\n *\n * ColorDef uses `0xTTBBGGRR` internally, which uses Transparency and puts Red in the low byte and Transparency in the high byte. It can be converted to `0xRRGGBB` format (blue in the low byte)\n * using [[getRgb]] and `0xAABBGGRRx format (red in the low byte, using opacity instead of transparency) using [[getAbgr]].\n *\n * A ColorDef can be created from a numeric [[ColorDefProps]], from a string in one of the common HTML formats (e.g., [[fromString]]), or by specifying values for the individual components\n * (e.g., [[from]]).\n *\n * ColorDef is **immutable**. To obtain a modified copy of a ColorDef, use methods like [[adjustedForContrast]], [[inverse]], or [[withTransparency]]. For example:\n * ```ts\n * const semiTransparentBlue = ColorDef.blue.withTransparency(100);\n * ```\n * @public\n * @extensions\n */\nexport class ColorDef {\n private readonly _tbgr: number;\n\n private constructor(tbgr: number) {\n scratchUInt32[0] = tbgr; // Force to be a 32-bit unsigned integer\n this._tbgr = scratchUInt32[0];\n }\n\n /**\n * Create a new ColorDef.\n * @param val value to use.\n * If a number, it is interpreted as a 0xTTBBGGRR (Red in the low byte, high byte is transparency 0==fully opaque) value.\n * If a string, it must be in one of the forms supported by [[fromString]] - any unrecognized string will produce [[black]].\n */\n public static create(val?: string | ColorDefProps) {\n return this.fromTbgr(this.computeTbgr(val));\n }\n\n /** Compute the 0xTTBBGGRR value corresponding to the specified representation of a color.\n * @see [[fromString]] for a description of valid string representations.\n */\n public static computeTbgr(val?: string | ColorDefProps): ColorDefProps {\n switch (typeof val) {\n case \"number\":\n return val;\n case \"string\":\n return this.computeTbgrFromString(val);\n default:\n return 0;\n }\n }\n\n /** Convert this ColorDef to a 32 bit number representing the 0xTTBBGGRR value */\n public toJSON(): ColorDefProps { return this._tbgr; }\n\n /** Create a new ColorDef from a json object. If the json object is a number, it is assumed to be a 0xTTBBGGRR value. */\n public static fromJSON(json?: ColorDefProps): ColorDef {\n return this.create(json);\n }\n\n /** Create a ColorDef from Red, Green, Blue, Transparency values. All inputs should be integers between 0-255. */\n public static from(red: number, green: number, blue: number, transparency?: number): ColorDef {\n return this.fromTbgr(this.computeTbgrFromComponents(red, green, blue, transparency));\n }\n\n /** Compute the 0xTTBBGGRR value corresponding to the specified Red, Green, Blue, Transparency components. All inputs should be integers between 0-255. */\n public static computeTbgrFromComponents(red: number, green: number, blue: number, transparency?: number): ColorDefProps {\n scratchBytes[0] = red;\n scratchBytes[1] = green;\n scratchBytes[2] = blue;\n scratchBytes[3] = transparency || 0;\n return scratchUInt32[0];\n }\n\n /** Create a ColorDef from its 0xTTBBGGRR representation. */\n public static fromTbgr(tbgr: ColorDefProps): ColorDef {\n switch (tbgr) {\n case ColorByName.black:\n return this.black;\n case ColorByName.white:\n return this.white;\n case ColorByName.red:\n return this.red;\n case ColorByName.green:\n return this.green;\n case ColorByName.blue:\n return this.blue;\n default:\n return new ColorDef(tbgr);\n }\n }\n\n /** Create a ColorDef from its 0xAABBGGRR representation. */\n public static fromAbgr(abgr: number): ColorDef {\n return this.fromTbgr(this.getAbgr(abgr));\n }\n\n /** Create a ColorDef from a string representation. The following representations are supported:\n * *\"rgb(255,0,0)\"*\n * *\"rgba(255,0,0,.2)\"*\n * *\"rgb(100%,0%,0%)\"*\n * *\"hsl(120,50%,50%)\"*\n * *\"#rrbbgg\"*\n * *\"blanchedAlmond\"* (see possible values from [[ColorByName]]). Case-insensitive.\n *\n * If `val` is not a valid color string, this function returns [[black]].\n * @see [[isValidColor]] to determine if `val` is a valid color string.\n */\n public static fromString(val: string): ColorDef {\n return this.fromTbgr(this.computeTbgrFromString(val));\n }\n\n /** Determine whether the input is a valid representation of a ColorDef.\n * @see [[fromString]] for the definition of a valid string representation.\n * @see [[ColorDefProps]] for the definition of a valid numeric representation.\n */\n public static isValidColor(val: string | number): boolean {\n if (typeof val === \"number\")\n return val >= 0 && val <= 0xffffffff && Math.floor(val) === val;\n\n return undefined !== this.tryComputeTbgrFromString(val);\n }\n\n /** Compute the 0xTTBBGGRR value corresponding to a string representation of a color.\n * If `val` is not a valid color string, this function returns 0 (black).\n * @see [[fromString]] for the definition of a valid color string.\n * @see [[tryComputeTbgrFromString]] to determine if `val` is a valid color string.\n */\n public static computeTbgrFromString(val: string): ColorDefProps {\n return this.tryComputeTbgrFromString(val) ?? 0;\n }\n\n /** Try to compute the 0xTTBBGGRR value corresponding to a string representation of a ColorDef.\n * @returns the corresponding numeric representation, or `undefined` if the input does not represent a color.\n * @see [[fromString]] for the definition of a valid color string.\n */\n public static tryComputeTbgrFromString(val: string): ColorDefProps | undefined {\n if (typeof val !== \"string\")\n return undefined;\n\n val = val.toLowerCase();\n let m = /^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec(val);\n if (m) { // rgb / hsl\n let color;\n const name = m[1];\n const components = m[2];\n\n const hasPercent = (str: string) => str[str.length - 1] === \"%\";\n const floatOrPercent = (str: string) => {\n const v = parseFloat(str);\n return 255 * Geometry.clamp(hasPercent(str) ? v / 100 : v, 0, 1);\n };\n const intOrPercent = (str: string) => {\n const v = hasPercent(str) ? (parseFloat(str) / 100) * 255 : parseInt(str, 10);\n return Geometry.clamp(v, 0, 255);\n };\n\n switch (name) {\n case \"rgb\":\n case \"rgba\":\n color = /^(\\d+%*)\\s*[, ]\\s*(\\d+%*)\\s*[, ]\\s*(\\d+%*)\\s*([,\\/]\\s*([0-9]*\\.?[0-9]+%*)\\s*)?$/.exec(components);\n if (color) { // rgb(255,0,0) rgba(255,0,0,0.5)\n return this.computeTbgrFromComponents(\n intOrPercent(color[1]),\n intOrPercent(color[2]),\n intOrPercent(color[3]),\n typeof color[5] === \"string\" ? 255 - floatOrPercent(color[5]) : 0);\n }\n\n break;\n case \"hsl\":\n case \"hsla\":\n color = /^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(components);\n if (color) { // hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n const h = parseFloat(color[1]) / 360;\n const s = parseInt(color[2], 10) / 100;\n const l = parseInt(color[3], 10) / 100;\n const t = typeof color[5] === \"string\" ? 255 - floatOrPercent(color[5]) : 0;\n return this.computeTbgrFromHSL(h, s, l, t);\n }\n\n break;\n }\n } else if (m = /^\\#([a-f0-9]+)$/.exec(val)) { // hex color\n const hex = m[1];\n const size = hex.length;\n\n if (size === 3) { // #ff0\n return this.computeTbgrFromComponents(\n parseInt(hex.charAt(0) + hex.charAt(0), 16),\n parseInt(hex.charAt(1) + hex.charAt(1), 16),\n parseInt(hex.charAt(2) + hex.charAt(2), 16), 0);\n }\n if (size === 6) { // #ff0000\n return this.computeTbgrFromComponents(\n parseInt(hex.charAt(0) + hex.charAt(1), 16),\n parseInt(hex.charAt(2) + hex.charAt(3), 16),\n parseInt(hex.charAt(4) + hex.charAt(5), 16), 0);\n }\n }\n\n if (val && val.length > 0) { // ColorRgb value\n for (const [key, value] of Object.entries(ColorByName))\n if (key.toLowerCase() === val)\n return value;\n }\n\n return undefined;\n }\n\n /** Get the red, green, blue, and transparency values from this ColorDef. Values will be integers between 0-255. */\n public get colors(): { r: number, g: number, b: number, t: number } {\n return ColorDef.getColors(this._tbgr);\n }\n\n /** Get the r,g,b,t values encoded in an 0xTTBBGGRR value. Values will be integers between 0-255. */\n public static getColors(tbgr: ColorDefProps) {\n scratchUInt32[0] = tbgr;\n return {\n b: scratchBytes[2],\n g: scratchBytes[1],\n r: scratchBytes[0],\n t: scratchBytes[3],\n };\n }\n\n /** The color value of this ColorDef as an integer in the form 0xTTBBGGRR (red in the low byte) */\n public get tbgr(): ColorDefProps { return this._tbgr; }\n\n /** Get the value of the color as a number in 0xAABBGGRR format (i.e. red is in low byte). Transparency (0==fully opaque) converted to alpha (0==fully transparent). */\n public getAbgr(): number {\n return ColorDef.getAbgr(this._tbgr);\n }\n\n /** Get the value of a 0xTTBBGGRR color as a number in 0xAABBGGRR format (i.e. red is in low byte). Transparency (0==fully opaque) converted to alpha (0==fully transparent). */\n public static getAbgr(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n scratchBytes[3] = 255 - scratchBytes[3];\n return scratchUInt32[0];\n }\n\n /** Get the RGB value of the color as a number in 0xRRGGBB format (i.e blue is in the low byte). Transparency is ignored. Value will be from 0 to 2^24 */\n public getRgb(): number {\n return ColorDef.getRgb(this._tbgr);\n }\n\n /** Get the RGB value of the 0xTTBBGGRR color as a number in 0xRRGGBB format (i.e blue is in the low byte). Transparency is ignored. Value will be from 0 to 2^24 */\n public static getRgb(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n return (scratchBytes[0] << 16) + (scratchBytes[1] << 8) + scratchBytes[2];\n }\n\n /** Return a copy of this ColorDef with the specified alpha component.\n * @param alpha the new alpha value as an integer between 0-255.\n * @returns A ColorDef with equivalent red, green, and blue components to this one but with the specified alpha.\n */\n public withAlpha(alpha: number): ColorDef {\n const tbgr = ColorDef.withAlpha(this._tbgr, alpha);\n return tbgr === this._tbgr ? this : ColorDef.fromTbgr(tbgr);\n }\n\n /** Return a color equivalent to the specified 0xTTBBGGRR but with modified alpha component.\n * @param alpha the new alpha value as an integer between 0-255.\n * @returns The 0xTTBBGGRR value equivalent to `tbgr` but with the specified alpha.\n */\n public static withAlpha(tbgr: ColorDefProps, alpha: number): number {\n scratchUInt32[0] = tbgr;\n scratchBytes[3] = 255 - (alpha | 0);\n return scratchUInt32[0];\n }\n\n /** Get the alpha value for this ColorDef. Will be between 0-255 */\n public getAlpha(): number {\n return ColorDef.getAlpha(this._tbgr);\n }\n\n /** Extract the alpha value from a 0xTTBBGGRR color. */\n public static getAlpha(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n return 255 - scratchBytes[3];\n }\n\n /** True if this ColorDef is fully opaque. */\n public get isOpaque(): boolean {\n return ColorDef.isOpaque(this._tbgr);\n }\n\n /** True if the specified 0xTTBBGGRR color is fully opaque. */\n public static isOpaque(tbgr: ColorDefProps): boolean {\n return 255 === this.getAlpha(tbgr);\n }\n\n /** Get the transparency value for this ColorDef (inverse of alpha). Will be between 0-255. */\n public getTransparency(): number {\n return ColorDef.getTransparency(this._tbgr);\n }\n\n /** Extract the transparency component from a 0xTTBBGGRR color as an integer between 0-255.. */\n public static getTransparency(tbgr: ColorDefProps): number {\n scratchUInt32[0] = tbgr;\n return scratchBytes[3];\n }\n\n /** Create a copy of this ColorDef with the specified transparency.\n * @param transparency the new transparency value. Must be between 0-255, where 0 means 'fully opaque' and 255 means 'fully transparent'.\n * @returns a new ColorDef with the same color as this one and the specified transparency.\n */\n public withTransparency(transparency: number): ColorDef {\n const tbgr = ColorDef.withTransparency(this._tbgr, transparency);\n return tbgr === this._tbgr ? this : ColorDef.fromTbgr(tbgr);\n }\n\n /** Compute the 0xTTBBGGRR value of the specified color and transparency.\n * @param transparency the new transparency as an integer between 0-255.\n * @returns The 0xTTBBGGRR value equivalent to `tbgr` but with the specified transparency.\n */\n public static withTransparency(tbgr: ColorDefProps, transparency: number): ColorDefProps {\n return this.withAlpha(tbgr, 255 - transparency);\n }\n\n /** The \"known name\" for this ColorDef. Will be undefined if color value is not in [[ColorByName]] list */\n public get name(): string | undefined {\n return ColorDef.getName(this.tbgr);\n }\n\n /** Obtain the name of the color in the [[ColorByName]] list associated with the specified 0xTTBBGGRR value, or undefined if no such named color exists.\n * @note A handful of colors (like \"aqua\" and \"cyan\") have identical tbgr values; in such cases the first match will be returned.\n */\n public static getName(tbgr: ColorDefProps): string | undefined {\n for (const [key, value] of Object.entries(ColorByName))\n if (value === tbgr)\n return key;\n\n return undefined;\n }\n\n /** Convert this ColorDef to a string in the form \"#rrggbb\" where values are hex digits of the respective colors */\n public toHexString(): string {\n return ColorDef.toHexString(this.tbgr);\n }\n\n /** Convert the 0xTTBBGGRR value to a string in the form \"#rrggbb\". */\n public static toHexString(tbgr: ColorDefProps): string {\n return `#${(`000000${this.getRgb(tbgr).toString(16)}`).slice(-6)}`;\n }\n\n private static getColorsString(tbgr: ColorDefProps) {\n const c = this.getColors(tbgr);\n return `${c.r},${c.g},${c.b}`;\n }\n\n /** Convert this ColorDef to a string in the form \"rgb(r,g,b)\" where values are decimal digits of the respective colors. */\n public toRgbString(): string {\n return ColorDef.toRgbString(this.tbgr);\n }\n\n /** Convert the 0xTTBBGGRR color to a string in the form \"rgb(r,g,b)\" where each component is specified in decimal. */\n public static toRgbString(tbgr: ColorDefProps): string {\n return `rgb(${this.getColorsString(tbgr)})`;\n }\n\n /** Convert this ColorDef to a string in the form \"rgba(r,g,b,a)\" where color values are decimal digits and a is a fraction */\n public toRgbaString(): string {\n return ColorDef.toRgbaString(this.tbgr);\n }\n\n /** Convert the 0xTTBBGGRR color to a string of the form \"rgba(r,g,b,a)\" where the color components are specified in decimal and the alpha component is a fraction. */\n public static toRgbaString(tbgr: ColorDefProps): string {\n return `rgba(${this.getColorsString(tbgr)},${this.getAlpha(tbgr) / 255.})`;\n }\n\n /** Create a ColorDef that is the linear interpolation of this ColorDef and another ColorDef, using a weighting factor.\n * @param color2 The other color\n * @param weight The weighting factor for color2. 0.0 = this color, 1.0 = color2.\n * @param result Optional ColorDef to hold result. If undefined, a new ColorDef is created.\n */\n public lerp(color2: ColorDef, weight: number): ColorDef {\n return ColorDef.fromTbgr(ColorDef.lerp(this.tbgr, color2.tbgr, weight));\n }\n\n /** Interpolate between two 0xTTBBGGRR colors using a weighting factor.\n * @param tbgr1 The first color\n * @param tbgr2 The other color\n * @param weight The weighting factor in [0..1]. A value of 0.0 selects `tbgr1`; 1.0 selects `tbgr2`; 0.5 mixes them evenly; etc.\n * @returns The linear interpolation between `tbgr1` and `tbgr2` using the specified weight.\n */\n public static lerp(tbgr1: ColorDefProps, tbgr2: ColorDefProps, weight: number): ColorDefProps {\n const c = this.getColors(tbgr1);\n const color = this.getColors(tbgr2);\n c.r += (color.r - c.r) * weight;\n c.g += (color.g - c.g) * weight;\n c.b += (color.b - c.b) * weight;\n return this.computeTbgrFromComponents(c.r, c.g, c.b, c.t);\n }\n\n /** Create a new ColorDef that is the inverse (all colors set to 255 - this) of this color. Ignores transparency - result has 0 transparency. */\n public inverse(): ColorDef {\n return ColorDef.fromTbgr(ColorDef.inverse(this.tbgr));\n }\n\n /** Return a 0xTTBBGGRR color whose color components are the inverse of the input color. The result has 0 transparency. */\n public static inverse(tbgr: ColorDefProps): ColorDefProps {\n const colors = this.getColors(tbgr);\n return this.computeTbgrFromComponents(255 - colors.r, 255 - colors.g, 255 - colors.b);\n }\n\n /** Create a ColorDef from hue, saturation, lightness values */\n public static fromHSL(h: number, s: number, l: number, transparency = 0): ColorDef {\n return this.fromTbgr(this.computeTbgrFromHSL(h, s, l, transparency));\n }\n\n /** Compute the 0xTTBBGGRR color corresponding to the specified hue, saturation, lightness values. */\n public static computeTbgrFromHSL(h: number, s: number, l: number, transparency = 0): ColorDefProps {\n const torgb = (p1: number, q1: number, t: number) => {\n if (t < 0)\n t += 1;\n if (t > 1)\n t -= 1;\n\n if (t < 1 / 6)\n return p1 + (q1 - p1) * 6 * t;\n if (t < 1 / 2)\n return q1;\n if (t < 2 / 3)\n return p1 + (q1 - p1) * 6 * (2 / 3 - t);\n\n return p1;\n };\n\n const hue2rgb = (p1: number, q1: number, t: number) => Math.round(torgb(p1, q1, t) * 255);\n const modulo = (n: number, m: number) => ((n % m) + m) % m;\n\n // h,s,l ranges are in 0.0 - 1.0\n h = modulo(h, 1);\n s = Geometry.clamp(s, 0, 1);\n l = Geometry.clamp(l, 0, 1);\n\n if (s === 0) {\n l *= 255;\n return this.computeTbgrFromComponents(l, l, l, transparency);\n }\n\n const p = l <= 0.5 ? l * (1 + s) : l + s - (l * s);\n const q = (2 * l) - p;\n return this.computeTbgrFromComponents(\n hue2rgb(q, p, h + 1 / 3),\n hue2rgb(q, p, h),\n hue2rgb(q, p, h - 1 / 3),\n transparency);\n }\n\n /** Create an [[HSLColor]] from this ColorDef */\n public toHSL(): HSLColor {\n // h,s,l ranges are in 0.0 - 1.0\n const col = this.colors;\n col.r /= 255;\n col.g /= 255;\n col.b /= 255;\n const max = Math.max(col.r, col.g, col.b);\n const min = Math.min(col.r, col.g, col.b);\n\n let hue = 0;\n let saturation;\n const lightness = (min + max) / 2.0;\n\n if (min === max) {\n saturation = 0;\n } else {\n const delta = max - min;\n saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);\n switch (max) {\n case col.r:\n hue = (col.g - col.b) / delta + (col.g < col.b ? 6 : 0);\n break;\n case col.g:\n hue = (col.b - col.r) / delta + 2;\n break;\n case col.b:\n hue = (col.r - col.g) / delta + 4;\n break;\n }\n\n hue /= 6;\n }\n\n return new HSLColor(hue, saturation, lightness);\n }\n\n /** Create an [[HSVColor]] from this ColorDef */\n public toHSV(): HSVColor {\n const { r, g, b } = this.colors;\n let min = (r < g) ? r : g;\n if (b < min)\n min = b;\n\n let max = (r > g) ? r : g;\n if (b > max)\n max = b;\n\n /* amount of \"blackness\" present */\n const v = Math.floor((max / 255.0 * 100) + 0.5);\n const deltaRgb = max - min;\n const s = (max !== 0.0) ? Math.floor((deltaRgb / max * 100) + 0.5) : 0;\n let h = 0;\n\n if (s) {\n const redDistance = (max - r) / deltaRgb;\n const greenDistance = (max - g) / deltaRgb;\n const blueDistance = (max - b) / deltaRgb;\n\n let intermediateHue: number;\n if (r === max) /* color between yellow & magenta */\n intermediateHue = blueDistance - greenDistance;\n else if (g === max) /* color between cyan & yellow */\n intermediateHue = 2.0 + redDistance - blueDistance;\n else /* color between magenta & cyan */\n intermediateHue = 4.0 + greenDistance - redDistance;\n\n /* intermediate hue is [0..6] */\n intermediateHue *= 60;\n\n if (intermediateHue < 0.0)\n intermediateHue += 360;\n\n h = Math.floor(intermediateHue + 0.5);\n\n if (h >= 360)\n h = 0;\n } else {\n h = 0;\n }\n\n return new HSVColor(h, s, v);\n }\n\n /** Create a ColorDef from an HSVColor */\n public static fromHSV(hsv: HSVColor, transparency = 0): ColorDef {\n // Check for simple case first.\n if ((!hsv.s) || (hsv.h === -1)) {\n // hue must be undefined, have no color only white\n const white = 0xff & Math.floor(((255.0 * hsv.v) / 100.0) + 0.5 + 3.0e-14);\n return ColorDef.from(white, white, white, 0);\n }\n\n let dhue = hsv.h, dsaturation = hsv.s, dvalue = hsv.v;\n if (dhue === 360)\n dhue = 0.0;\n\n dhue /= 60; // hue is now [0..6]\n const hueIntpart = Math.floor(dhue); // convert double -> int\n const hueFractpart = dhue - hueIntpart;\n dvalue /= 100;\n dsaturation /= 100;\n\n const p = 0xff & Math.floor((dvalue * (1.0 - dsaturation) * 255.0) + 0.5);\n const q = 0xff & Math.floor((dvalue * (1.0 - (dsaturation * hueFractpart)) * 255.0) + 0.5);\n const t = 0xff & Math.floor((dvalue * (1.0 - (dsaturation * (1.0 - hueFractpart))) * 255.0) + 0.5);\n const v = 0xff & Math.floor(dvalue * 255 + 0.5);\n\n let r = 0, b = 0, g = 0;\n switch (hueIntpart) {\n case 0: r = v; g = t; b = p; break; // reddish\n case 1: r = q, g = v; b = p; break; // yellowish\n case 2: r = p, g = v; b = t; break; // greenish\n case 3: r = p, g = q; b = v; break; // cyanish\n case 4: r = t, g = p; b = v; break; // bluish\n case 5: r = v, g = p; b = q; break; // magenta-ish\n }\n\n return ColorDef.from(r, g, b, transparency);\n }\n\n private visibilityCheck(other: ColorDef): number {\n const fg = this.colors;\n const bg = other.colors;\n // Compute luminosity\n const red = Math.abs(fg.r - bg.r);\n const green = Math.abs(fg.g - bg.g);\n const blue = Math.abs(fg.b - bg.b);\n return (0.30 * red) + (0.59 * green) + (0.11 * blue);\n }\n\n /**\n * Create a new ColorDef that is adjusted from this ColorDef for maximum contrast against another color. The color will either be lighter\n * or darker, depending on which has more visibility against the other color.\n * @param other the color to contrast with\n * @param alpha optional alpha value for the adjusted color. If not supplied alpha from this color is used.\n */\n public adjustedForContrast(other: ColorDef, alpha?: number): ColorDef {\n const visibility = this.visibilityCheck(other);\n if (HSVConstants.VISIBILITY_GOAL <= visibility) {\n return undefined !== alpha ? this.withAlpha(alpha) : this;\n }\n\n const adjPercent = Math.floor(((HSVConstants.VISIBILITY_GOAL - visibility) / 255.0) * 100.0);\n let darkerHSV = this.toHSV();\n let brightHSV = darkerHSV.clone();\n\n darkerHSV = darkerHSV.adjusted(true, adjPercent);\n brightHSV = brightHSV.adjusted(false, adjPercent);\n\n if (undefined === alpha)\n alpha = this.getAlpha();\n\n const darker = ColorDef.fromHSV(darkerHSV).withAlpha(alpha);\n const bright = ColorDef.fromHSV(brightHSV).withAlpha(alpha);\n\n if (bright.getRgb() === other.getRgb()) // Couldn't adjust brighter...\n return darker;\n\n if (darker.getRgb() === other.getRgb()) // Couldn't adjust darker...\n return bright;\n\n // NOTE: Best choice is the one most visible against the other color...\n return (bright.visibilityCheck(other) >= darker.visibilityCheck(other)) ? bright : darker;\n }\n\n /** True if the value of this ColorDef is the same as another ColorDef. */\n public equals(other: ColorDef): boolean {\n return this._tbgr === other._tbgr;\n }\n\n /** pure black */\n public static readonly black = new ColorDef(ColorByName.black);\n /** pure white */\n public static readonly white = new ColorDef(ColorByName.white);\n /** pure red */\n public static readonly red = new ColorDef(ColorByName.red);\n /** pure green */\n public static readonly green = new ColorDef(ColorByName.green);\n /** pure blue */\n public static readonly blue = new ColorDef(ColorByName.blue);\n}\n"]}
@@ -85,6 +85,7 @@ export class ContourStyle {
85
85
  * @public
86
86
  */
87
87
  export class Contour {
88
+ static { this.defaults = new Contour({}); }
88
89
  equals(other) {
89
90
  if (!this.majorStyle.equals(other.majorStyle) || !this.minorStyle.equals(other.minorStyle) || this.minorInterval !== other.minorInterval || this.majorIntervalCount !== other.majorIntervalCount || this.showGeometry !== other.showGeometry) {
90
91
  return false;
@@ -148,7 +149,6 @@ export class Contour {
148
149
  return Contour.create({ ...this, ...changedProps });
149
150
  }
150
151
  }
151
- Contour.defaults = new Contour({});
152
152
  /** Defines a group of objects to which to apply [[Contour]] lines in a particular style.
153
153
  * The [[ContourDisplay]] settings can contain multiple groups.
154
154
  * Each group is described by a set of [SubCategory]($backend)'s; all geometry belonging to any of those subcategories belongs to the group.
@@ -229,6 +229,10 @@ export class ContourGroup {
229
229
  * @public
230
230
  */
231
231
  export class ContourDisplay {
232
+ /** The maximum number of contour groups that the system will allow. Any contour groups added to the [[groups]] array beyond this number will be ignored
233
+ * for display purposes.
234
+ */
235
+ static { this.maxContourGroups = 5; }
232
236
  /** Returns true if `this` and `other` are logically equivalent, having the same groups and styling. */
233
237
  equals(other) {
234
238
  if (this.displayContours !== other.displayContours)
@@ -286,8 +290,4 @@ export class ContourDisplay {
286
290
  return ContourDisplay.create({ ...this, ...changedProps });
287
291
  }
288
292
  }
289
- /** The maximum number of contour groups that the system will allow. Any contour groups added to the [[groups]] array beyond this number will be ignored
290
- * for display purposes.
291
- */
292
- ContourDisplay.maxContourGroups = 5;
293
293
  //# sourceMappingURL=ContourDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContourDisplay.js","sourceRoot":"","sources":["../../src/ContourDisplay.ts"],"names":[],"mappings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AAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wHAAwH;IACjH,MAAM,CAAC,MAAM,CAAC,KAAyC;QAC5D,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,EAAE,CAAC;IACxD,CAAC;IAED,yFAAyF;IAClF,mBAAmB,CAAC,eAAwB;QACjD,OAAO,eAAe,KAAK,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAC/G,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAgD;QAC3D,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,OAAO,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;IAC7D,CAAC;;AAvED;;GAEG;AACoB,+BAAgB,GAAG,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Symbology\n */\n\nimport { compareBooleans, compareNumbers, CompressedId64Set, NonFunctionPropertiesOf, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { LinePixels } from \"./LinePixels\";\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\n\n/** JSON representation of a [[ContourStyle]].\n * @public\n */\nexport interface ContourStyleProps {\n /** See [[ContourStyle.color]]. */\n color?: RgbColorProps;\n /** See [[ContourStyle.pixelWidth]]. */\n pixelWidth?: number;\n /** See [[ContourStyle.pattern]]. */\n pattern?: LinePixels;\n}\n\n/** A type containing all of the properties of [[ContourStyle]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[ContourStyle.create]] and [[ContourStyle.clone]].\n * @public\n */\nexport type ContourStyleProperties = NonFunctionPropertiesOf<ContourStyle>;\n\n/** The style settings used by either a minor or major contour.\n * @see [[Contour.majorStyle]]\n * @see [[Contour.minorStyle]]\n * @public\n */\nexport class ContourStyle {\n /** The color in which to draw the contour lines. Default: black. */\n public readonly color: RgbColor;\n /** The width in screen pixels of the contour lines.\n * Useful values range between 1 and 8.5, in increments of 0.5. Other values will be rounded to meet these criteria.\n * Default: 1.0.\n */\n public readonly pixelWidth: number;\n /** The pattern for a major or minor contour line. Defaults to [[LinePixels.Solid]]. */\n public readonly pattern: LinePixels;\n\n /** Returns true if `this` and `other` are logically equivalent. */\n public equals(other: ContourStyle): boolean {\n if (!this.color.equals(other.color) || this.pixelWidth !== other.pixelWidth || this.pattern !== other.pattern) {\n return false;\n }\n return true;\n }\n\n /** Performs ordered comparison of two contour styles.\n * @param lhs First contour style to compare\n * @param rhs Second contour style to compare\n * @returns 0 if lhs is equivalent to rhs, a negative number if lhs compares less than rhs, or a positive number if lhs compares greater than rhs.\n * @public\n */\n public static compare(lhs: ContourStyle, rhs: ContourStyle): number {\n let diff = 0;\n if ((diff = lhs.color.compareTo(rhs.color)) !== 0)\n return diff;\n if ((diff = compareNumbers(lhs.pixelWidth, rhs.pixelWidth)) !== 0)\n return diff;\n if ((diff = compareNumbers(lhs.pattern, rhs.pattern)) !== 0)\n return diff;\n\n return diff;\n }\n\n private constructor(props?: Partial<ContourStyleProperties>) {\n this.color = props?.color ?? RgbColor.fromJSON({r: 0, g: 0, b: 0});\n this.pixelWidth = props?.pixelWidth ?? 1;\n this.pattern = props?.pattern ?? LinePixels.Solid;\n }\n\n public static fromJSON(props?: ContourStyleProps) {\n if (!props)\n return new ContourStyle();\n\n return new this({\n color: props?.color ? RgbColor.fromJSON(props.color) : undefined,\n pixelWidth: props?.pixelWidth,\n pattern: props?.pattern,\n });\n }\n\n public toJSON(): ContourStyleProps {\n const props: ContourStyleProps = {};\n\n if (!this.color.equals(RgbColor.fromJSON({r: 0, g: 0, b: 0})))\n props.color = this.color.toJSON();\n\n if (1 !== this.pixelWidth)\n props.pixelWidth = this.pixelWidth;\n\n if (0 !== this.pattern)\n props.pattern = this.pattern;\n\n return props;\n }\n\n /** Create a new ContourStyle. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourStyleProperties>): ContourStyle {\n return props ? new this(props) : new ContourStyle();\n }\n\n /** Create a copy of this ContourStyle, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourStyleProperties>): ContourStyle {\n if (!changedProps)\n return this;\n\n return ContourStyle.create({ ...this, ...changedProps });\n }\n}\n\n/** JSON representation of a [[Contour]].\n * @public\n */\nexport interface ContourProps {\n /** See [[Contour.majorStyle]]. */\n majorStyle?: ContourStyleProps;\n /** See [[Contour.minor]]. */\n minorStyle?: ContourStyleProps;\n /** See [[Contour.minorInterval]]. */\n minorInterval?: number;\n /** See [[Contour.majorIntervalCount]]. */\n majorIntervalCount?: number;\n /** See [[Contour.showGeometry]] */\n showGeometry?: boolean;\n}\n\n/** A type containing all of the properties of [[Contour]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[Contour.create]] and [[Contour.clone]].\n * @public\n */\nexport type ContourProperties = NonFunctionPropertiesOf<Contour>;\n\n/** Describes how to generate and style contour lines for geometry within a single [[ContourGroup]].\n * Contours provide a way to visualize elevation within a 3d scene by drawing lines at fixed intervals along the z-axis.\n * There are actually 2 kinds of contour lines: major and minor. Each kind can be styled independently.\n * A contour line is generated every [[minorInterval]] meters. Every `nth` line will be a *major* contour, where `n` = [[majorIntervalCount]]; the intervening lines will\n * all be *minor* contours.\n * For example, with a [[majorIntervalCount]] of `1`, every contour will be major; of `2`, every other contour will be major; and of `3`, there will be two minor contours in between\n * each major contour.\n *\n * @public\n */\nexport class Contour {\n /** Settings that describe how a major contour is styled. Defaults to an instantation of [[ContourStyle]] using `pixelWidth` of 2 and default values for the other properties. */\n public readonly majorStyle: ContourStyle;\n /** Settings that describe how a minor contour is styled. Defaults to an instantation of [[ContourStyle]] using default values for the properties. */\n public readonly minorStyle: ContourStyle;\n /** The interval for the minor contour occurrence in meters; these can be specified as fractional. Defaults to 1. If a value <= 0 is specified, this will be treated as 1 meter. */\n public readonly minorInterval: number;\n /** The count of minor contour intervals that define a major interval (integer > 0). A value of 1 means no minor contours will be shown, only major contours. Defaults to 5. If a value < 1 is specified, this will be treated as 1. If a non-integer value is specified, it will be treated as if it were rounded to the nearest integer. */\n public readonly majorIntervalCount: number;\n /** If true, show underlying geometry along with the associated contours. If false, only show the contours, not the underlying geometry. Defaults to true. */\n public readonly showGeometry: boolean;\n\n public static readonly defaults = new Contour({});\n\n public equals(other: Contour): boolean {\n if (!this.majorStyle.equals(other.majorStyle) || !this.minorStyle.equals(other.minorStyle) || this.minorInterval !== other.minorInterval || this.majorIntervalCount !== other.majorIntervalCount || this.showGeometry !== other.showGeometry) {\n return false;\n }\n return true;\n }\n\n /** Performs ordered comparison of two contours.\n * @param lhs First contour to compare\n * @param rhs Second contour to compare\n * @returns 0 if lhs is equivalent to rhs, a negative number if lhs compares less than rhs, or a positive number if lhs compares greater than rhs.\n */\n public static compare(lhs: Contour, rhs: Contour): number {\n return ContourStyle.compare(lhs.majorStyle, rhs.majorStyle)\n || ContourStyle.compare(lhs.minorStyle, rhs.minorStyle)\n || compareNumbers(lhs.minorInterval, rhs.minorInterval)\n || compareNumbers(lhs.majorIntervalCount, rhs.majorIntervalCount)\n || compareBooleans(lhs.showGeometry, rhs.showGeometry);\n }\n\n private constructor(props?: Partial<ContourProperties>) {\n this.majorStyle = props?.majorStyle ?? ContourStyle.fromJSON({ pixelWidth: 2 });\n this.minorStyle = props?.minorStyle ?? ContourStyle.fromJSON();\n this.minorInterval = props?.minorInterval ?? 1;\n this.majorIntervalCount = props?.majorIntervalCount ?? 5;\n this.showGeometry = props?.showGeometry ?? true;\n }\n\n public static fromJSON(props?: ContourProps) {\n if (!props)\n return new Contour();\n\n return new this({\n majorStyle: props?.majorStyle ? ContourStyle.fromJSON(props.majorStyle) : undefined,\n minorStyle: props?.minorStyle ? ContourStyle.fromJSON(props.minorStyle) : undefined,\n minorInterval: props?.minorInterval,\n majorIntervalCount: props?.majorIntervalCount,\n showGeometry: props?.showGeometry,\n });\n }\n\n public toJSON(): ContourProps {\n const props: ContourProps = {};\n\n if (!this.majorStyle.equals(ContourStyle.fromJSON({ pixelWidth: 2 })))\n props.majorStyle = this.majorStyle.toJSON();\n\n if (!this.minorStyle.equals(ContourStyle.fromJSON()))\n props.minorStyle = this.minorStyle.toJSON();\n\n if (1 !== this.minorInterval)\n props.minorInterval = this.minorInterval;\n\n if (5 !== this.majorIntervalCount)\n props.majorIntervalCount = this.majorIntervalCount;\n\n if (true !== this.showGeometry)\n props.showGeometry = this.showGeometry;\n\n return props;\n }\n\n /** Create a new Contour. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourProperties>): Contour {\n return props ? new this(props) : new Contour();\n }\n\n /** Create a copy of this Contour, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourProperties>): Contour {\n if (!changedProps)\n return this;\n\n return Contour.create({ ...this, ...changedProps });\n }\n}\n\n/** JSON representation of a [[ContourGroup]].\n * @public\n */\nexport interface ContourGroupProps {\n /** See [[ContourGroup.contourDef]]. */\n contourDef?: ContourProps;\n /** See [[ContourGroup.subCategories]]. */\n subCategories?: CompressedId64Set;\n /** See [[ContourGroup.name]]. */\n name?: string;\n}\n\n/** A type containing all of the properties of [[ContourGroup]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[ContourGroup.create]] and [[ContourGroup.clone]].\n * @public\n */\nexport type ContourGroupProperties = NonFunctionPropertiesOf<ContourGroup>;\n\n/** Defines a group of objects to which to apply [[Contour]] lines in a particular style.\n * The [[ContourDisplay]] settings can contain multiple groups.\n * Each group is described by a set of [SubCategory]($backend)'s; all geometry belonging to any of those subcategories belongs to the group.\n * An empty set of subcategories indicates that this is a default group, implicitly containing all subcategories that are not explicitly included in another group.\n * Each group has an optional, non-user-facing name that applications can use to assign semantics to particular groups.\n * @public\n */\nexport class ContourGroup {\n private _subCategories: CompressedId64Set;\n\n /** Describes the appearance of all of the contours applied to geometry belonging to this group. */\n public readonly contourDef: Contour;\n /** An optional, non-user-facing name that applications can use to assign semantics to particular groups.\n * Default: an empty string.\n */\n public readonly name: string;\n\n /** The set of subcategories belonging to this group, or an empty set if this is a default group. If more than one empty set exists in the [[ContourDisplay]] object's `groups` array, the last entry in that array is used for rendering the default styling.\n * @see [[isDefaultGroup]] to test if this is a default group.\n */\n public get subCategories(): OrderedId64Iterable {\n return CompressedId64Set.iterable(this._subCategories);\n }\n\n /** Returns true if [[subCategories]] is an empty set, indicating that any subcategory not included in any other [[ContourGroup]] is implicitly\n * included in this group.\n */\n public get isDefaultGroup(): boolean {\n return OrderedId64Iterable.isEmptySet(this._subCategories);\n }\n\n /** Returns true if `this` and `other` contain the exact same set of subcategories. */\n public subCategoriesEqual(other: ContourGroup): boolean {\n return this._subCategories === other._subCategories;\n }\n\n /** Returns true if `this` and `other` are logically equivalent, having the same styling, name, and set of subcategories. */\n public equals(other: ContourGroup | undefined): boolean {\n if (this === undefined && other === undefined)\n return true;\n if (this === undefined || other === undefined)\n return false;\n if (!this.contourDef.equals(other.contourDef))\n return false;\n if (this._subCategories !== other._subCategories)\n return false;\n if (this.name !== other.name)\n return false;\n return true;\n }\n\n private constructor(props?: Partial<ContourGroupProperties>) {\n this.contourDef = props?.contourDef ?? Contour.fromJSON();\n this._subCategories = props?.subCategories ? CompressedId64Set.sortAndCompress(props.subCategories) : \"\";\n this.name = props?.name ?? \"\";\n }\n\n public static fromJSON(props?: ContourGroupProps) {\n if (!props)\n return new ContourGroup();\n\n return new this({\n contourDef: props?.contourDef ? Contour.fromJSON(props.contourDef) : undefined,\n name: props?.name,\n subCategories: props?.subCategories ? CompressedId64Set.iterable(props.subCategories) : undefined,\n });\n }\n\n public toJSON(): ContourGroupProps {\n const props: ContourGroupProps = {};\n\n if (!this.contourDef.equals(Contour.defaults))\n props.contourDef = this.contourDef.toJSON();\n\n if (this.name)\n props.name = this.name;\n\n props.subCategories = this._subCategories;\n return props;\n }\n\n /** Create a new ContourGroup. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourGroupProperties>): ContourGroup {\n return props ? new this(props) : new ContourGroup();\n }\n\n /** Create a copy of this ContourGroup, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourGroupProperties>): ContourGroup {\n if (!changedProps)\n return this;\n\n return ContourGroup.create({ ...this, ...changedProps });\n }\n}\n\n/** JSON representation of [[ContourDisplay]] settings.\n * @public\n */\nexport interface ContourDisplayProps {\n /** See [[ContourDisplay.groups]]. */\n groups?: ContourGroupProps[];\n /** See [[ContourDisplay.displayContours]]. */\n displayContours?: boolean;\n}\n\n/** A type containing all of the properties of [[ContourDisplay]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[ContourDisplay.create]] and [[ContourDisplay.clone]].\n * @public\n */\nexport type ContourDisplayProperties = NonFunctionPropertiesOf<ContourDisplay>;\n\n/** Settings that specify how to apply [contour lines]($docs/learning/display/ContourDisplay.md) to groups of geometry\n * within a 3d scene.\n * @see [[DisplayStyle3dSettings.contours]] to associate contour settings with a display style.\n * @public\n */\nexport class ContourDisplay {\n /** A list of the groups, each describing their own specific contour display settings. Defaults to an empty array.\n * @note The display system supports no more than [[ContourDisplay.maxContourGroups]]. Entries in this array exceeding that maximum will\n * have no effect on the display of contour lines.\n */\n public readonly groups: ContourGroup[];\n /** Whether to display the contour lines described by these settings. Default: false.\n * @see [[withDisplayContours]] to change this flag.\n */\n public readonly displayContours: boolean;\n /** The maximum number of contour groups that the system will allow. Any contour groups added to the [[groups]] array beyond this number will be ignored\n * for display purposes.\n */\n public static readonly maxContourGroups = 5;\n\n /** Returns true if `this` and `other` are logically equivalent, having the same groups and styling. */\n public equals(other: ContourDisplay): boolean {\n if (this.displayContours !== other.displayContours)\n return false;\n if (this.groups.length !== other.groups.length)\n return false;\n for (let index = 0, len = this.groups.length; index < len && index < ContourDisplay.maxContourGroups; ++index) {\n const match = this.groups[index].equals(other.groups[index]);\n if (!match)\n return false;\n }\n return true;\n }\n\n private constructor(props?: Partial<ContourDisplayProperties>) {\n this.displayContours = props?.displayContours ?? false;\n this.groups = props?.groups ?? [];\n }\n\n public static fromJSON(props?: ContourDisplayProps) {\n if (!props)\n return new ContourDisplay();\n\n const groups: ContourGroup[] = [];\n if (undefined !== props && undefined !== props.groups) {\n for (let n = 0; n < props.groups.length; n++) {\n groups[n] = ContourGroup.fromJSON(props.groups[n]);\n }\n }\n\n return new this({\n displayContours: props?.displayContours,\n groups: props.groups ? groups : undefined,\n });\n }\n\n public toJSON(): ContourDisplayProps {\n const props: ContourDisplayProps = {};\n\n props.groups = [];\n for (let n = 0; n < this.groups.length; n++) {\n props.groups[n] = this.groups[n].toJSON();\n }\n\n props.displayContours = this.displayContours;\n return props;\n }\n\n /** Create a new ContourDisplay. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourDisplayProperties>): ContourDisplay {\n return props ? new this(props) : new ContourDisplay();\n }\n\n /** Create a copy of these settings, changing the `displayContours` flag as specified. */\n public withDisplayContours(displayContours: boolean): ContourDisplay {\n return displayContours === this.displayContours ? this : ContourDisplay.create({ ...this, displayContours });\n }\n\n /** Create a copy of this ContourDisplay, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourDisplayProperties>): ContourDisplay {\n if (!changedProps)\n return this;\n\n return ContourDisplay.create({ ...this, ...changed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C,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5C,CAAC;QAED,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wHAAwH;IACjH,MAAM,CAAC,MAAM,CAAC,KAAyC;QAC5D,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,EAAE,CAAC;IACxD,CAAC;IAED,yFAAyF;IAClF,mBAAmB,CAAC,eAAwB;QACjD,OAAO,eAAe,KAAK,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAC/G,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAgD;QAC3D,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,OAAO,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;IAC7D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Symbology\n */\n\nimport { compareBooleans, compareNumbers, CompressedId64Set, NonFunctionPropertiesOf, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { LinePixels } from \"./LinePixels\";\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\n\n/** JSON representation of a [[ContourStyle]].\n * @public\n */\nexport interface ContourStyleProps {\n /** See [[ContourStyle.color]]. */\n color?: RgbColorProps;\n /** See [[ContourStyle.pixelWidth]]. */\n pixelWidth?: number;\n /** See [[ContourStyle.pattern]]. */\n pattern?: LinePixels;\n}\n\n/** A type containing all of the properties of [[ContourStyle]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[ContourStyle.create]] and [[ContourStyle.clone]].\n * @public\n */\nexport type ContourStyleProperties = NonFunctionPropertiesOf<ContourStyle>;\n\n/** The style settings used by either a minor or major contour.\n * @see [[Contour.majorStyle]]\n * @see [[Contour.minorStyle]]\n * @public\n */\nexport class ContourStyle {\n /** The color in which to draw the contour lines. Default: black. */\n public readonly color: RgbColor;\n /** The width in screen pixels of the contour lines.\n * Useful values range between 1 and 8.5, in increments of 0.5. Other values will be rounded to meet these criteria.\n * Default: 1.0.\n */\n public readonly pixelWidth: number;\n /** The pattern for a major or minor contour line. Defaults to [[LinePixels.Solid]]. */\n public readonly pattern: LinePixels;\n\n /** Returns true if `this` and `other` are logically equivalent. */\n public equals(other: ContourStyle): boolean {\n if (!this.color.equals(other.color) || this.pixelWidth !== other.pixelWidth || this.pattern !== other.pattern) {\n return false;\n }\n return true;\n }\n\n /** Performs ordered comparison of two contour styles.\n * @param lhs First contour style to compare\n * @param rhs Second contour style to compare\n * @returns 0 if lhs is equivalent to rhs, a negative number if lhs compares less than rhs, or a positive number if lhs compares greater than rhs.\n * @public\n */\n public static compare(lhs: ContourStyle, rhs: ContourStyle): number {\n let diff = 0;\n if ((diff = lhs.color.compareTo(rhs.color)) !== 0)\n return diff;\n if ((diff = compareNumbers(lhs.pixelWidth, rhs.pixelWidth)) !== 0)\n return diff;\n if ((diff = compareNumbers(lhs.pattern, rhs.pattern)) !== 0)\n return diff;\n\n return diff;\n }\n\n private constructor(props?: Partial<ContourStyleProperties>) {\n this.color = props?.color ?? RgbColor.fromJSON({r: 0, g: 0, b: 0});\n this.pixelWidth = props?.pixelWidth ?? 1;\n this.pattern = props?.pattern ?? LinePixels.Solid;\n }\n\n public static fromJSON(props?: ContourStyleProps) {\n if (!props)\n return new ContourStyle();\n\n return new this({\n color: props?.color ? RgbColor.fromJSON(props.color) : undefined,\n pixelWidth: props?.pixelWidth,\n pattern: props?.pattern,\n });\n }\n\n public toJSON(): ContourStyleProps {\n const props: ContourStyleProps = {};\n\n if (!this.color.equals(RgbColor.fromJSON({r: 0, g: 0, b: 0})))\n props.color = this.color.toJSON();\n\n if (1 !== this.pixelWidth)\n props.pixelWidth = this.pixelWidth;\n\n if (0 !== this.pattern)\n props.pattern = this.pattern;\n\n return props;\n }\n\n /** Create a new ContourStyle. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourStyleProperties>): ContourStyle {\n return props ? new this(props) : new ContourStyle();\n }\n\n /** Create a copy of this ContourStyle, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourStyleProperties>): ContourStyle {\n if (!changedProps)\n return this;\n\n return ContourStyle.create({ ...this, ...changedProps });\n }\n}\n\n/** JSON representation of a [[Contour]].\n * @public\n */\nexport interface ContourProps {\n /** See [[Contour.majorStyle]]. */\n majorStyle?: ContourStyleProps;\n /** See [[Contour.minor]]. */\n minorStyle?: ContourStyleProps;\n /** See [[Contour.minorInterval]]. */\n minorInterval?: number;\n /** See [[Contour.majorIntervalCount]]. */\n majorIntervalCount?: number;\n /** See [[Contour.showGeometry]] */\n showGeometry?: boolean;\n}\n\n/** A type containing all of the properties of [[Contour]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[Contour.create]] and [[Contour.clone]].\n * @public\n */\nexport type ContourProperties = NonFunctionPropertiesOf<Contour>;\n\n/** Describes how to generate and style contour lines for geometry within a single [[ContourGroup]].\n * Contours provide a way to visualize elevation within a 3d scene by drawing lines at fixed intervals along the z-axis.\n * There are actually 2 kinds of contour lines: major and minor. Each kind can be styled independently.\n * A contour line is generated every [[minorInterval]] meters. Every `nth` line will be a *major* contour, where `n` = [[majorIntervalCount]]; the intervening lines will\n * all be *minor* contours.\n * For example, with a [[majorIntervalCount]] of `1`, every contour will be major; of `2`, every other contour will be major; and of `3`, there will be two minor contours in between\n * each major contour.\n *\n * @public\n */\nexport class Contour {\n /** Settings that describe how a major contour is styled. Defaults to an instantation of [[ContourStyle]] using `pixelWidth` of 2 and default values for the other properties. */\n public readonly majorStyle: ContourStyle;\n /** Settings that describe how a minor contour is styled. Defaults to an instantation of [[ContourStyle]] using default values for the properties. */\n public readonly minorStyle: ContourStyle;\n /** The interval for the minor contour occurrence in meters; these can be specified as fractional. Defaults to 1. If a value <= 0 is specified, this will be treated as 1 meter. */\n public readonly minorInterval: number;\n /** The count of minor contour intervals that define a major interval (integer > 0). A value of 1 means no minor contours will be shown, only major contours. Defaults to 5. If a value < 1 is specified, this will be treated as 1. If a non-integer value is specified, it will be treated as if it were rounded to the nearest integer. */\n public readonly majorIntervalCount: number;\n /** If true, show underlying geometry along with the associated contours. If false, only show the contours, not the underlying geometry. Defaults to true. */\n public readonly showGeometry: boolean;\n\n public static readonly defaults = new Contour({});\n\n public equals(other: Contour): boolean {\n if (!this.majorStyle.equals(other.majorStyle) || !this.minorStyle.equals(other.minorStyle) || this.minorInterval !== other.minorInterval || this.majorIntervalCount !== other.majorIntervalCount || this.showGeometry !== other.showGeometry) {\n return false;\n }\n return true;\n }\n\n /** Performs ordered comparison of two contours.\n * @param lhs First contour to compare\n * @param rhs Second contour to compare\n * @returns 0 if lhs is equivalent to rhs, a negative number if lhs compares less than rhs, or a positive number if lhs compares greater than rhs.\n */\n public static compare(lhs: Contour, rhs: Contour): number {\n return ContourStyle.compare(lhs.majorStyle, rhs.majorStyle)\n || ContourStyle.compare(lhs.minorStyle, rhs.minorStyle)\n || compareNumbers(lhs.minorInterval, rhs.minorInterval)\n || compareNumbers(lhs.majorIntervalCount, rhs.majorIntervalCount)\n || compareBooleans(lhs.showGeometry, rhs.showGeometry);\n }\n\n private constructor(props?: Partial<ContourProperties>) {\n this.majorStyle = props?.majorStyle ?? ContourStyle.fromJSON({ pixelWidth: 2 });\n this.minorStyle = props?.minorStyle ?? ContourStyle.fromJSON();\n this.minorInterval = props?.minorInterval ?? 1;\n this.majorIntervalCount = props?.majorIntervalCount ?? 5;\n this.showGeometry = props?.showGeometry ?? true;\n }\n\n public static fromJSON(props?: ContourProps) {\n if (!props)\n return new Contour();\n\n return new this({\n majorStyle: props?.majorStyle ? ContourStyle.fromJSON(props.majorStyle) : undefined,\n minorStyle: props?.minorStyle ? ContourStyle.fromJSON(props.minorStyle) : undefined,\n minorInterval: props?.minorInterval,\n majorIntervalCount: props?.majorIntervalCount,\n showGeometry: props?.showGeometry,\n });\n }\n\n public toJSON(): ContourProps {\n const props: ContourProps = {};\n\n if (!this.majorStyle.equals(ContourStyle.fromJSON({ pixelWidth: 2 })))\n props.majorStyle = this.majorStyle.toJSON();\n\n if (!this.minorStyle.equals(ContourStyle.fromJSON()))\n props.minorStyle = this.minorStyle.toJSON();\n\n if (1 !== this.minorInterval)\n props.minorInterval = this.minorInterval;\n\n if (5 !== this.majorIntervalCount)\n props.majorIntervalCount = this.majorIntervalCount;\n\n if (true !== this.showGeometry)\n props.showGeometry = this.showGeometry;\n\n return props;\n }\n\n /** Create a new Contour. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourProperties>): Contour {\n return props ? new this(props) : new Contour();\n }\n\n /** Create a copy of this Contour, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourProperties>): Contour {\n if (!changedProps)\n return this;\n\n return Contour.create({ ...this, ...changedProps });\n }\n}\n\n/** JSON representation of a [[ContourGroup]].\n * @public\n */\nexport interface ContourGroupProps {\n /** See [[ContourGroup.contourDef]]. */\n contourDef?: ContourProps;\n /** See [[ContourGroup.subCategories]]. */\n subCategories?: CompressedId64Set;\n /** See [[ContourGroup.name]]. */\n name?: string;\n}\n\n/** A type containing all of the properties of [[ContourGroup]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[ContourGroup.create]] and [[ContourGroup.clone]].\n * @public\n */\nexport type ContourGroupProperties = NonFunctionPropertiesOf<ContourGroup>;\n\n/** Defines a group of objects to which to apply [[Contour]] lines in a particular style.\n * The [[ContourDisplay]] settings can contain multiple groups.\n * Each group is described by a set of [SubCategory]($backend)'s; all geometry belonging to any of those subcategories belongs to the group.\n * An empty set of subcategories indicates that this is a default group, implicitly containing all subcategories that are not explicitly included in another group.\n * Each group has an optional, non-user-facing name that applications can use to assign semantics to particular groups.\n * @public\n */\nexport class ContourGroup {\n private _subCategories: CompressedId64Set;\n\n /** Describes the appearance of all of the contours applied to geometry belonging to this group. */\n public readonly contourDef: Contour;\n /** An optional, non-user-facing name that applications can use to assign semantics to particular groups.\n * Default: an empty string.\n */\n public readonly name: string;\n\n /** The set of subcategories belonging to this group, or an empty set if this is a default group. If more than one empty set exists in the [[ContourDisplay]] object's `groups` array, the last entry in that array is used for rendering the default styling.\n * @see [[isDefaultGroup]] to test if this is a default group.\n */\n public get subCategories(): OrderedId64Iterable {\n return CompressedId64Set.iterable(this._subCategories);\n }\n\n /** Returns true if [[subCategories]] is an empty set, indicating that any subcategory not included in any other [[ContourGroup]] is implicitly\n * included in this group.\n */\n public get isDefaultGroup(): boolean {\n return OrderedId64Iterable.isEmptySet(this._subCategories);\n }\n\n /** Returns true if `this` and `other` contain the exact same set of subcategories. */\n public subCategoriesEqual(other: ContourGroup): boolean {\n return this._subCategories === other._subCategories;\n }\n\n /** Returns true if `this` and `other` are logically equivalent, having the same styling, name, and set of subcategories. */\n public equals(other: ContourGroup | undefined): boolean {\n if (this === undefined && other === undefined)\n return true;\n if (this === undefined || other === undefined)\n return false;\n if (!this.contourDef.equals(other.contourDef))\n return false;\n if (this._subCategories !== other._subCategories)\n return false;\n if (this.name !== other.name)\n return false;\n return true;\n }\n\n private constructor(props?: Partial<ContourGroupProperties>) {\n this.contourDef = props?.contourDef ?? Contour.fromJSON();\n this._subCategories = props?.subCategories ? CompressedId64Set.sortAndCompress(props.subCategories) : \"\";\n this.name = props?.name ?? \"\";\n }\n\n public static fromJSON(props?: ContourGroupProps) {\n if (!props)\n return new ContourGroup();\n\n return new this({\n contourDef: props?.contourDef ? Contour.fromJSON(props.contourDef) : undefined,\n name: props?.name,\n subCategories: props?.subCategories ? CompressedId64Set.iterable(props.subCategories) : undefined,\n });\n }\n\n public toJSON(): ContourGroupProps {\n const props: ContourGroupProps = {};\n\n if (!this.contourDef.equals(Contour.defaults))\n props.contourDef = this.contourDef.toJSON();\n\n if (this.name)\n props.name = this.name;\n\n props.subCategories = this._subCategories;\n return props;\n }\n\n /** Create a new ContourGroup. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourGroupProperties>): ContourGroup {\n return props ? new this(props) : new ContourGroup();\n }\n\n /** Create a copy of this ContourGroup, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourGroupProperties>): ContourGroup {\n if (!changedProps)\n return this;\n\n return ContourGroup.create({ ...this, ...changedProps });\n }\n}\n\n/** JSON representation of [[ContourDisplay]] settings.\n * @public\n */\nexport interface ContourDisplayProps {\n /** See [[ContourDisplay.groups]]. */\n groups?: ContourGroupProps[];\n /** See [[ContourDisplay.displayContours]]. */\n displayContours?: boolean;\n}\n\n/** A type containing all of the properties of [[ContourDisplay]] with none of the methods and with the `readonly` modifiers removed.\n * Used by [[ContourDisplay.create]] and [[ContourDisplay.clone]].\n * @public\n */\nexport type ContourDisplayProperties = NonFunctionPropertiesOf<ContourDisplay>;\n\n/** Settings that specify how to apply [contour lines]($docs/learning/display/ContourDisplay.md) to groups of geometry\n * within a 3d scene.\n * @see [[DisplayStyle3dSettings.contours]] to associate contour settings with a display style.\n * @public\n */\nexport class ContourDisplay {\n /** A list of the groups, each describing their own specific contour display settings. Defaults to an empty array.\n * @note The display system supports no more than [[ContourDisplay.maxContourGroups]]. Entries in this array exceeding that maximum will\n * have no effect on the display of contour lines.\n */\n public readonly groups: ContourGroup[];\n /** Whether to display the contour lines described by these settings. Default: false.\n * @see [[withDisplayContours]] to change this flag.\n */\n public readonly displayContours: boolean;\n /** The maximum number of contour groups that the system will allow. Any contour groups added to the [[groups]] array beyond this number will be ignored\n * for display purposes.\n */\n public static readonly maxContourGroups = 5;\n\n /** Returns true if `this` and `other` are logically equivalent, having the same groups and styling. */\n public equals(other: ContourDisplay): boolean {\n if (this.displayContours !== other.displayContours)\n return false;\n if (this.groups.length !== other.groups.length)\n return false;\n for (let index = 0, len = this.groups.length; index < len && index < ContourDisplay.maxContourGroups; ++index) {\n const match = this.groups[index].equals(other.groups[index]);\n if (!match)\n return false;\n }\n return true;\n }\n\n private constructor(props?: Partial<ContourDisplayProperties>) {\n this.displayContours = props?.displayContours ?? false;\n this.groups = props?.groups ?? [];\n }\n\n public static fromJSON(props?: ContourDisplayProps) {\n if (!props)\n return new ContourDisplay();\n\n const groups: ContourGroup[] = [];\n if (undefined !== props && undefined !== props.groups) {\n for (let n = 0; n < props.groups.length; n++) {\n groups[n] = ContourGroup.fromJSON(props.groups[n]);\n }\n }\n\n return new this({\n displayContours: props?.displayContours,\n groups: props.groups ? groups : undefined,\n });\n }\n\n public toJSON(): ContourDisplayProps {\n const props: ContourDisplayProps = {};\n\n props.groups = [];\n for (let n = 0; n < this.groups.length; n++) {\n props.groups[n] = this.groups[n].toJSON();\n }\n\n props.displayContours = this.displayContours;\n return props;\n }\n\n /** Create a new ContourDisplay. Any properties not specified by `props` will be initialized to their default values. */\n public static create(props?: Partial<ContourDisplayProperties>): ContourDisplay {\n return props ? new this(props) : new ContourDisplay();\n }\n\n /** Create a copy of these settings, changing the `displayContours` flag as specified. */\n public withDisplayContours(displayContours: boolean): ContourDisplay {\n return displayContours === this.displayContours ? this : ContourDisplay.create({ ...this, displayContours });\n }\n\n /** Create a copy of this ContourDisplay, identical except for any properties specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps?: Partial<ContourDisplayProperties>): ContourDisplay {\n if (!changedProps)\n return this;\n\n return ContourDisplay.create({ ...this, ...changedProps });\n }\n}\n"]}
@@ -74,6 +74,7 @@ export class PropertyMetaDataMap {
74
74
  * @public
75
75
  */
76
76
  export class ECSqlReader {
77
+ static { this._maxRetryCount = 10; }
77
78
  /**
78
79
  * @internal
79
80
  */
@@ -402,5 +403,4 @@ export class ECSqlReader {
402
403
  }
403
404
  }
404
405
  }
405
- ECSqlReader._maxRetryCount = 10;
406
406
  //# sourceMappingURL=ECSqlReader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlReader.js","sourceRoot":"","sources":["../../src/ECSqlReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,YAAY,EAAsD,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAgB,mBAAmB,EACzI,cAAc,GACtC,MAAM,mBAAmB,CAAC;AAE3B,cAAc;AACd,MAAM,OAAO,mBAAmB;IAK9B,YAAmC,UAAmC;QAAnC,eAAU,GAAV,UAAU,CAAyB;QAJ9D,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACxC,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACxC,cAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QAG5C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACvC,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAG,uDAAuD;YACjJ,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC;YACzF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C;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI;QACf,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAC1C,IAAI,IAAI,CAAC,YAAY,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC;YACvC,EAAE,IAAI,CAAC,YAAY,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;YACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,OAAO,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI;QACf,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACtB,OAAO;gBACL,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC;QACJ,CAAC;IACH,CAAC;;AAtVuB,0BAAc,GAAG,EAAE,AAAL,CAAM","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport { Base64EncodedString } from \"./Base64EncodedString\";\nimport {\n DbQueryError, DbQueryRequest, DbQueryResponse, DbRequestExecutor, DbRequestKind, DbResponseStatus, DbValueFormat, QueryBinder, QueryOptions, QueryOptionsBuilder,\n QueryPropertyMetaData, QueryRowFormat,\n} from \"./ConcurrentQuery\";\n\n/** @public */\nexport class PropertyMetaDataMap implements Iterable<QueryPropertyMetaData> {\n private _byPropName = new Map<string, number>();\n private _byJsonName = new Map<string, number>();\n private _byNoCase = new Map<string, number>();\n\n public constructor(public readonly properties: QueryPropertyMetaData[]) {\n for (const property of this.properties) {\n property.extendType = property.extendedType !== undefined ? property.extendedType : \"\"; // eslint-disable-line @typescript-eslint/no-deprecated\n property.extendedType = property.extendedType === \"\" ? undefined : property.extendedType;\n this._byPropName.set(property.name, property.index);\n this._byJsonName.set(property.jsonName, property.index);\n this._byNoCase.set(property.name.toLowerCase(), property.index);\n this._byNoCase.set(property.jsonName.toLowerCase(), property.index);\n }\n }\n\n public get length(): number {\n return this.properties.length;\n }\n\n public [Symbol.iterator](): Iterator<QueryPropertyMetaData, any, undefined> {\n return this.properties[Symbol.iterator]();\n }\n\n public findByName(name: string): QueryPropertyMetaData | undefined {\n const index = this._byPropName.get(name);\n if (typeof index === \"number\") {\n return this.properties[index];\n }\n return undefined;\n }\n\n public findByJsonName(name: string): QueryPropertyMetaData | undefined {\n const index = this._byJsonName.get(name);\n if (typeof index === \"number\") {\n return this.properties[index];\n }\n return undefined;\n }\n\n public findByNoCase(name: string): QueryPropertyMetaData | undefined {\n const index = this._byNoCase.get(name.toLowerCase());\n if (typeof index === \"number\") {\n return this.properties[index];\n }\n return undefined;\n }\n}\n\n/**\n * The format for rows returned by [[ECSqlReader]].\n * @public\n */\nexport type QueryValueType = any;\n\n/**\n * Methods and ways of accessing values from rows returned by [[ECSqlReader]].\n * @public\n */\nexport interface QueryRowProxy {\n /**\n * Get the current row as a JavaScript `object`.\n *\n * @returns The current row as a JavaScript `object`.\n */\n toRow(): any;\n\n /**\n * Get all remaining rows from the query result.\n * If called on the current row ([[ECSqlReader.current]]), only that row is returned.\n *\n * @returns All remaining rows from the query result.\n */\n toArray(): QueryValueType[];\n\n /**\n * Get the metadata for each column in the query result.\n *\n * @returns The metadata for each column in the query result.\n */\n getMetaData(): QueryPropertyMetaData[];\n\n /**\n * Access a property using its name.\n *\n * @returns The value from the row whose key (ECSQL column name) is `propertyName`.\n *\n * @example\n * The following lines will all return the same result:\n * ```ts\n * reader.current.ECInstanceId;\n * reader.current.ecinstanceid;\n * reader.current.[\"ECInstanceId\"];\n * ```\n */\n [propertyName: string]: QueryValueType;\n\n /**\n * Access a property using its index.\n * The index is relative to the order of the columns returned by the query that produced the row.\n *\n * @returns The value from the column at `propertyIndex`.\n *\n * @example reader.current[0]\n */\n [propertyIndex: number]: QueryValueType;\n}\n\n/**\n * Performance-related statistics for [[ECSqlReader]].\n * @public\n */\nexport interface QueryStats {\n /** Time spent running the query; not including time spent queued. Time is in microseconds */\n backendCpuTime: number;\n /** Total time it took the backend to run the query. Time is in milliseconds. */\n backendTotalTime: number;\n /** Estimated memory used for the query. */\n backendMemUsed: number;\n /** Total number of rows returned by the backend. */\n backendRowsReturned: number;\n /** The total round trip time from the client's perspective. Time is in milliseconds. */\n totalTime: number;\n /** The number of retries attempted to execute the query. */\n retryCount: number;\n}\n\n/**\n * Execute ECSQL statements and read the results.\n *\n * The query results are returned one row at a time. The format of the row is dictated by the\n * [[QueryOptions.rowFormat]] specified in the `options` parameter of the constructed ECSqlReader object. Defaults to\n * [[QueryRowFormat.UseECSqlPropertyIndexes]] when no `rowFormat` is defined.\n *\n * There are three primary ways to interact with and read the results:\n * - Stream them using ECSqlReader as an asynchronous iterator.\n * - Iterator over them manually using [[ECSqlReader.step]].\n * - Capture all of the results at once in an array using [[QueryRowProxy.toArray]].\n *\n * @see\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [ECSQL Row Formats]($docs/learning/ECSQLRowFormat) for more details on how rows are formatted.\n * - [ECSQL Code Examples]($docs/learning/ECSQLCodeExamples#iterating-over-query-results) for examples of each\n * of the above ways of interacting with ECSqlReader.\n *\n * @note When iterating over the results, the current row will be a [[QueryRowProxy]] object. To get the row as a basic\n * JavaScript object, call [[QueryRowProxy.toRow]] on it.\n * @public\n */\nexport class ECSqlReader implements AsyncIterableIterator<QueryRowProxy> {\n private static readonly _maxRetryCount = 10;\n\n private _localRows: any[] = [];\n private _localOffset: number = 0;\n private _globalOffset: number = -1;\n private _globalCount: number = -1;\n private _done: boolean = false;\n private _globalDone: boolean = false;\n private _props = new PropertyMetaDataMap([]);\n private _param = new QueryBinder().serialize();\n private _lockArgs: boolean = false;\n private _stats = { backendCpuTime: 0, backendTotalTime: 0, backendMemUsed: 0, backendRowsReturned: 0, totalTime: 0, retryCount: 0 };\n private _options: QueryOptions = new QueryOptionsBuilder().getOptions();\n\n private _rowProxy = new Proxy<ECSqlReader>(this, {\n get: (target: ECSqlReader, key: string | symbol) => {\n if (typeof key === \"string\") {\n const idx = Number.parseInt(key, 10);\n if (!Number.isNaN(idx)) {\n return target.getRowInternal()[idx];\n }\n const prop = target._props.findByNoCase(key);\n if (prop) {\n return target.getRowInternal()[prop.index];\n }\n if (key === \"getMetaData\") {\n return () => target._props.properties;\n }\n if (key === \"toRow\") {\n return () => target.formatCurrentRow(true);\n }\n if (key === \"toArray\") {\n return () => this.getRowInternal();\n }\n }\n return undefined;\n },\n has: (target: ECSqlReader, p: string | symbol) => {\n return !target._props.findByNoCase(p as string);\n },\n ownKeys: (target: ECSqlReader) => {\n const keys = [];\n for (const prop of target._props) {\n keys.push(prop.name);\n }\n return keys;\n },\n });\n\n /**\n * @internal\n */\n public constructor(private _executor: DbRequestExecutor<DbQueryRequest, DbQueryResponse>, public readonly query: string, param?: QueryBinder, options?: QueryOptions) {\n if (query.trim().length === 0) {\n throw new Error(\"expecting non-empty ecsql statement\");\n }\n if (param) {\n this._param = param.serialize();\n }\n this.reset(options);\n }\n\n private static replaceBase64WithUint8Array(row: any) {\n for (const key of Object.keys(row)) {\n const val = row[key];\n if (typeof val === \"string\") {\n if (Base64EncodedString.hasPrefix(val)) {\n row[key] = Base64EncodedString.toUint8Array(val);\n }\n } else if (typeof val === \"object\" && val !== null) {\n this.replaceBase64WithUint8Array(val);\n }\n }\n }\n\n public setParams(param: QueryBinder) {\n if (this._lockArgs) {\n throw new Error(\"call resetBindings() before setting or changing parameters\");\n }\n this._param = param.serialize();\n }\n\n public reset(options?: QueryOptions) {\n if (options) {\n this._options = options;\n }\n this._props = new PropertyMetaDataMap([]);\n this._localRows = [];\n this._globalDone = false;\n this._globalOffset = 0;\n this._globalCount = -1;\n if (typeof this._options.rowFormat === \"undefined\")\n this._options.rowFormat = QueryRowFormat.UseECSqlPropertyIndexes;\n if (this._options.limit) {\n if (typeof this._options.limit.offset === \"number\" && this._options.limit.offset > 0)\n this._globalOffset = this._options.limit.offset;\n if (typeof this._options.limit.count === \"number\" && this._options.limit.count > 0)\n this._globalCount = this._options.limit.count;\n }\n this._done = false;\n }\n\n /**\n * Get the current row from the query result. The current row is the one most recently stepped-to\n * (by step() or during iteration).\n *\n * Each value from the row can be accessed by index or by name.\n *\n * The format of the row is dictated by the [[QueryOptions.rowFormat]] specified in the `options` parameter of the\n * constructed ECSqlReader object.\n *\n * @see\n * - [[QueryRowFormat]]\n * - [ECSQL Row Formats]($docs/learning/ECSQLRowFormat)\n *\n * @note The current row is be a [[QueryRowProxy]] object. To get the row as a basic JavaScript object, call\n * [[QueryRowProxy.toRow]] on it.\n *\n * @example\n * ```ts\n * const reader = iModel.createQueryReader(\"SELECT ECInstanceId FROM bis.Element\");\n * while (await reader.step()) {\n * // Both lines below print the same value\n * console.log(reader.current[0]);\n * console.log(reader.current.ecinstanceid);\n * }\n * ```\n *\n * @return The current row as a [[QueryRowProxy]].\n */\n public get current(): QueryRowProxy {\n return this._rowProxy as any;\n }\n\n /**\n * Clear all bindings.\n */\n public resetBindings() {\n this._param = new QueryBinder().serialize();\n this._lockArgs = false;\n }\n\n /**\n * Returns if there are more rows available.\n *\n * @returns `true` if all rows have been stepped through already.<br/>\n * `false` if there are any yet unaccessed rows.\n */\n public get done(): boolean {\n return this._done;\n }\n\n /**\n * @internal\n */\n public getRowInternal(): any[] {\n if (this._localRows.length <= this._localOffset)\n throw new Error(\"no current row\");\n return this._localRows[this._localOffset] as any[];\n }\n\n /**\n * Get performance-related statistics for the current query.\n */\n public get stats(): QueryStats {\n return this._stats;\n }\n\n /**\n *\n */\n private async readRows(): Promise<any[]> {\n if (this._globalDone) {\n return [];\n }\n this._lockArgs = true;\n this._globalOffset += this._localRows.length;\n this._globalCount -= this._localRows.length;\n if (this._globalCount === 0) {\n return [];\n }\n const valueFormat = this._options.rowFormat === QueryRowFormat.UseJsPropertyNames ? DbValueFormat.JsNames : DbValueFormat.ECSqlNames;\n const request: DbQueryRequest = {\n ... this._options,\n kind: DbRequestKind.ECSql,\n valueFormat,\n query: this.query,\n args: this._param,\n };\n request.includeMetaData = this._props.length > 0 ? false : true;\n request.limit = { offset: this._globalOffset, count: this._globalCount < 1 ? -1 : this._globalCount };\n const resp = await this.runWithRetry(request);\n this._globalDone = resp.status === DbResponseStatus.Done;\n if (this._props.length === 0 && resp.meta.length > 0) {\n this._props = new PropertyMetaDataMap(resp.meta);\n }\n for (const row of resp.data) {\n ECSqlReader.replaceBase64WithUint8Array(row);\n }\n return resp.data;\n }\n\n /**\n * @internal\n */\n protected async runWithRetry(request: DbQueryRequest) {\n const needRetry = (rs: DbQueryResponse) => (rs.status === DbResponseStatus.Partial || rs.status === DbResponseStatus.QueueFull || rs.status === DbResponseStatus.Timeout) && (rs.data === undefined || rs.data.length === 0);\n const updateStats = (rs: DbQueryResponse) => {\n this._stats.backendCpuTime += rs.stats.cpuTime;\n this._stats.backendTotalTime += rs.stats.totalTime;\n this._stats.backendMemUsed += rs.stats.memUsed;\n this._stats.backendRowsReturned += (rs.data === undefined) ? 0 : rs.data.length;\n };\n const execQuery = async (req: DbQueryRequest) => {\n const startTime = Date.now();\n const rs = await this._executor.execute(req);\n this.stats.totalTime += (Date.now() - startTime);\n return rs;\n };\n let retry = ECSqlReader._maxRetryCount;\n let resp = await execQuery(request);\n DbQueryError.throwIfError(resp, request);\n while (--retry > 0 && needRetry(resp)) {\n resp = await execQuery(request);\n this._stats.retryCount += 1;\n if (needRetry(resp)) {\n updateStats(resp);\n }\n }\n if (retry === 0 && needRetry(resp)) {\n throw new Error(\"query too long to execute or server is too busy\");\n }\n updateStats(resp);\n return resp;\n }\n\n /**\n * @internal\n */\n public formatCurrentRow(onlyReturnObject: boolean = false): any[] | object {\n if (!onlyReturnObject && this._options.rowFormat === QueryRowFormat.UseECSqlPropertyIndexes) {\n return this.getRowInternal();\n }\n const formattedRow = {};\n for (const prop of this._props) {\n const propName = this._options.rowFormat === QueryRowFormat.UseJsPropertyNames ? prop.jsonName : prop.name;\n const val = this.getRowInternal()[prop.index];\n if (typeof val !== \"undefined\" && val !== null) {\n Object.defineProperty(formattedRow, propName, {\n value: val,\n enumerable: true,\n });\n }\n }\n return formattedRow;\n }\n\n /**\n * Get the metadata for each column in the query result.\n *\n * @returns An array of [[QueryPropertyMetaData]].\n */\n public async getMetaData(): Promise<QueryPropertyMetaData[]> {\n if (this._props.length === 0) {\n await this.fetchRows();\n }\n return this._props.properties;\n }\n\n /**\n *\n */\n private async fetchRows() {\n this._localOffset = -1;\n this._localRows = await this.readRows();\n if (this._localRows.length === 0) {\n this._done = true;\n }\n }\n\n /**\n * Step to the next row of the query result.\n *\n * @returns `true` if a row can be read from `current`.<br/>\n * `false` if there are no more rows; i.e., all rows have been stepped through already.\n */\n public async step(): Promise<boolean> {\n if (this._done) {\n return false;\n }\n const cachedRows = this._localRows.length;\n if (this._localOffset < cachedRows - 1) {\n ++this._localOffset;\n } else {\n await this.fetchRows();\n this._localOffset = 0;\n return !this._done;\n }\n return true;\n }\n\n /**\n * Get all remaining rows from the query result.\n *\n * @returns An array of all remaining rows from the query result.\n */\n public async toArray(): Promise<any[]> {\n const rows = [];\n while (await this.step()) {\n rows.push(this.formatCurrentRow());\n }\n return rows;\n }\n\n /**\n * Accessor for using ECSqlReader as an asynchronous iterator.\n *\n * @returns An asynchronous iterator over the rows returned by the executed ECSQL query.\n */\n public [Symbol.asyncIterator](): AsyncIterableIterator<QueryRowProxy> {\n return this;\n }\n\n /**\n * Calls step when called as an iterator.\n *\n * Returns the row alongside a `done` boolean to indicate if there are any more rows for an iterator to step to.\n *\n * @returns An object with the keys: `value` which contains the row and `done` which contains a boolean.\n */\n public async next(): Promise<IteratorResult<QueryRowProxy, any>> {\n if (await this.step()) {\n return {\n done: false,\n value: this.current,\n };\n } else {\n return {\n done: true,\n value: this.current,\n };\n }\n }\n}\n\n"]}
1
+ {"version":3,"file":"ECSqlReader.js","sourceRoot":"","sources":["../../src/ECSqlReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,YAAY,EAAsD,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAgB,mBAAmB,EACzI,cAAc,GACtC,MAAM,mBAAmB,CAAC;AAE3B,cAAc;AACd,MAAM,OAAO,mBAAmB;IAK9B,YAAmC,UAAmC;QAAnC,eAAU,GAAV,UAAU,CAAyB;QAJ9D,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACxC,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACxC,cAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QAG5C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACvC,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAA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BACV,KAAK,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC;QACJ,CAAC;IACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport { Base64EncodedString } from \"./Base64EncodedString\";\nimport {\n DbQueryError, DbQueryRequest, DbQueryResponse, DbRequestExecutor, DbRequestKind, DbResponseStatus, DbValueFormat, QueryBinder, QueryOptions, QueryOptionsBuilder,\n QueryPropertyMetaData, QueryRowFormat,\n} from \"./ConcurrentQuery\";\n\n/** @public */\nexport class PropertyMetaDataMap implements Iterable<QueryPropertyMetaData> {\n private _byPropName = new Map<string, number>();\n private _byJsonName = new Map<string, number>();\n private _byNoCase = new Map<string, number>();\n\n public constructor(public readonly properties: QueryPropertyMetaData[]) {\n for (const property of this.properties) {\n property.extendType = property.extendedType !== undefined ? property.extendedType : \"\"; // eslint-disable-line @typescript-eslint/no-deprecated\n property.extendedType = property.extendedType === \"\" ? undefined : property.extendedType;\n this._byPropName.set(property.name, property.index);\n this._byJsonName.set(property.jsonName, property.index);\n this._byNoCase.set(property.name.toLowerCase(), property.index);\n this._byNoCase.set(property.jsonName.toLowerCase(), property.index);\n }\n }\n\n public get length(): number {\n return this.properties.length;\n }\n\n public [Symbol.iterator](): Iterator<QueryPropertyMetaData, any, undefined> {\n return this.properties[Symbol.iterator]();\n }\n\n public findByName(name: string): QueryPropertyMetaData | undefined {\n const index = this._byPropName.get(name);\n if (typeof index === \"number\") {\n return this.properties[index];\n }\n return undefined;\n }\n\n public findByJsonName(name: string): QueryPropertyMetaData | undefined {\n const index = this._byJsonName.get(name);\n if (typeof index === \"number\") {\n return this.properties[index];\n }\n return undefined;\n }\n\n public findByNoCase(name: string): QueryPropertyMetaData | undefined {\n const index = this._byNoCase.get(name.toLowerCase());\n if (typeof index === \"number\") {\n return this.properties[index];\n }\n return undefined;\n }\n}\n\n/**\n * The format for rows returned by [[ECSqlReader]].\n * @public\n */\nexport type QueryValueType = any;\n\n/**\n * Methods and ways of accessing values from rows returned by [[ECSqlReader]].\n * @public\n */\nexport interface QueryRowProxy {\n /**\n * Get the current row as a JavaScript `object`.\n *\n * @returns The current row as a JavaScript `object`.\n */\n toRow(): any;\n\n /**\n * Get all remaining rows from the query result.\n * If called on the current row ([[ECSqlReader.current]]), only that row is returned.\n *\n * @returns All remaining rows from the query result.\n */\n toArray(): QueryValueType[];\n\n /**\n * Get the metadata for each column in the query result.\n *\n * @returns The metadata for each column in the query result.\n */\n getMetaData(): QueryPropertyMetaData[];\n\n /**\n * Access a property using its name.\n *\n * @returns The value from the row whose key (ECSQL column name) is `propertyName`.\n *\n * @example\n * The following lines will all return the same result:\n * ```ts\n * reader.current.ECInstanceId;\n * reader.current.ecinstanceid;\n * reader.current.[\"ECInstanceId\"];\n * ```\n */\n [propertyName: string]: QueryValueType;\n\n /**\n * Access a property using its index.\n * The index is relative to the order of the columns returned by the query that produced the row.\n *\n * @returns The value from the column at `propertyIndex`.\n *\n * @example reader.current[0]\n */\n [propertyIndex: number]: QueryValueType;\n}\n\n/**\n * Performance-related statistics for [[ECSqlReader]].\n * @public\n */\nexport interface QueryStats {\n /** Time spent running the query; not including time spent queued. Time is in microseconds */\n backendCpuTime: number;\n /** Total time it took the backend to run the query. Time is in milliseconds. */\n backendTotalTime: number;\n /** Estimated memory used for the query. */\n backendMemUsed: number;\n /** Total number of rows returned by the backend. */\n backendRowsReturned: number;\n /** The total round trip time from the client's perspective. Time is in milliseconds. */\n totalTime: number;\n /** The number of retries attempted to execute the query. */\n retryCount: number;\n}\n\n/**\n * Execute ECSQL statements and read the results.\n *\n * The query results are returned one row at a time. The format of the row is dictated by the\n * [[QueryOptions.rowFormat]] specified in the `options` parameter of the constructed ECSqlReader object. Defaults to\n * [[QueryRowFormat.UseECSqlPropertyIndexes]] when no `rowFormat` is defined.\n *\n * There are three primary ways to interact with and read the results:\n * - Stream them using ECSqlReader as an asynchronous iterator.\n * - Iterator over them manually using [[ECSqlReader.step]].\n * - Capture all of the results at once in an array using [[QueryRowProxy.toArray]].\n *\n * @see\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [ECSQL Row Formats]($docs/learning/ECSQLRowFormat) for more details on how rows are formatted.\n * - [ECSQL Code Examples]($docs/learning/ECSQLCodeExamples#iterating-over-query-results) for examples of each\n * of the above ways of interacting with ECSqlReader.\n *\n * @note When iterating over the results, the current row will be a [[QueryRowProxy]] object. To get the row as a basic\n * JavaScript object, call [[QueryRowProxy.toRow]] on it.\n * @public\n */\nexport class ECSqlReader implements AsyncIterableIterator<QueryRowProxy> {\n private static readonly _maxRetryCount = 10;\n\n private _localRows: any[] = [];\n private _localOffset: number = 0;\n private _globalOffset: number = -1;\n private _globalCount: number = -1;\n private _done: boolean = false;\n private _globalDone: boolean = false;\n private _props = new PropertyMetaDataMap([]);\n private _param = new QueryBinder().serialize();\n private _lockArgs: boolean = false;\n private _stats = { backendCpuTime: 0, backendTotalTime: 0, backendMemUsed: 0, backendRowsReturned: 0, totalTime: 0, retryCount: 0 };\n private _options: QueryOptions = new QueryOptionsBuilder().getOptions();\n\n private _rowProxy = new Proxy<ECSqlReader>(this, {\n get: (target: ECSqlReader, key: string | symbol) => {\n if (typeof key === \"string\") {\n const idx = Number.parseInt(key, 10);\n if (!Number.isNaN(idx)) {\n return target.getRowInternal()[idx];\n }\n const prop = target._props.findByNoCase(key);\n if (prop) {\n return target.getRowInternal()[prop.index];\n }\n if (key === \"getMetaData\") {\n return () => target._props.properties;\n }\n if (key === \"toRow\") {\n return () => target.formatCurrentRow(true);\n }\n if (key === \"toArray\") {\n return () => this.getRowInternal();\n }\n }\n return undefined;\n },\n has: (target: ECSqlReader, p: string | symbol) => {\n return !target._props.findByNoCase(p as string);\n },\n ownKeys: (target: ECSqlReader) => {\n const keys = [];\n for (const prop of target._props) {\n keys.push(prop.name);\n }\n return keys;\n },\n });\n\n /**\n * @internal\n */\n public constructor(private _executor: DbRequestExecutor<DbQueryRequest, DbQueryResponse>, public readonly query: string, param?: QueryBinder, options?: QueryOptions) {\n if (query.trim().length === 0) {\n throw new Error(\"expecting non-empty ecsql statement\");\n }\n if (param) {\n this._param = param.serialize();\n }\n this.reset(options);\n }\n\n private static replaceBase64WithUint8Array(row: any) {\n for (const key of Object.keys(row)) {\n const val = row[key];\n if (typeof val === \"string\") {\n if (Base64EncodedString.hasPrefix(val)) {\n row[key] = Base64EncodedString.toUint8Array(val);\n }\n } else if (typeof val === \"object\" && val !== null) {\n this.replaceBase64WithUint8Array(val);\n }\n }\n }\n\n public setParams(param: QueryBinder) {\n if (this._lockArgs) {\n throw new Error(\"call resetBindings() before setting or changing parameters\");\n }\n this._param = param.serialize();\n }\n\n public reset(options?: QueryOptions) {\n if (options) {\n this._options = options;\n }\n this._props = new PropertyMetaDataMap([]);\n this._localRows = [];\n this._globalDone = false;\n this._globalOffset = 0;\n this._globalCount = -1;\n if (typeof this._options.rowFormat === \"undefined\")\n this._options.rowFormat = QueryRowFormat.UseECSqlPropertyIndexes;\n if (this._options.limit) {\n if (typeof this._options.limit.offset === \"number\" && this._options.limit.offset > 0)\n this._globalOffset = this._options.limit.offset;\n if (typeof this._options.limit.count === \"number\" && this._options.limit.count > 0)\n this._globalCount = this._options.limit.count;\n }\n this._done = false;\n }\n\n /**\n * Get the current row from the query result. The current row is the one most recently stepped-to\n * (by step() or during iteration).\n *\n * Each value from the row can be accessed by index or by name.\n *\n * The format of the row is dictated by the [[QueryOptions.rowFormat]] specified in the `options` parameter of the\n * constructed ECSqlReader object.\n *\n * @see\n * - [[QueryRowFormat]]\n * - [ECSQL Row Formats]($docs/learning/ECSQLRowFormat)\n *\n * @note The current row is be a [[QueryRowProxy]] object. To get the row as a basic JavaScript object, call\n * [[QueryRowProxy.toRow]] on it.\n *\n * @example\n * ```ts\n * const reader = iModel.createQueryReader(\"SELECT ECInstanceId FROM bis.Element\");\n * while (await reader.step()) {\n * // Both lines below print the same value\n * console.log(reader.current[0]);\n * console.log(reader.current.ecinstanceid);\n * }\n * ```\n *\n * @return The current row as a [[QueryRowProxy]].\n */\n public get current(): QueryRowProxy {\n return this._rowProxy as any;\n }\n\n /**\n * Clear all bindings.\n */\n public resetBindings() {\n this._param = new QueryBinder().serialize();\n this._lockArgs = false;\n }\n\n /**\n * Returns if there are more rows available.\n *\n * @returns `true` if all rows have been stepped through already.<br/>\n * `false` if there are any yet unaccessed rows.\n */\n public get done(): boolean {\n return this._done;\n }\n\n /**\n * @internal\n */\n public getRowInternal(): any[] {\n if (this._localRows.length <= this._localOffset)\n throw new Error(\"no current row\");\n return this._localRows[this._localOffset] as any[];\n }\n\n /**\n * Get performance-related statistics for the current query.\n */\n public get stats(): QueryStats {\n return this._stats;\n }\n\n /**\n *\n */\n private async readRows(): Promise<any[]> {\n if (this._globalDone) {\n return [];\n }\n this._lockArgs = true;\n this._globalOffset += this._localRows.length;\n this._globalCount -= this._localRows.length;\n if (this._globalCount === 0) {\n return [];\n }\n const valueFormat = this._options.rowFormat === QueryRowFormat.UseJsPropertyNames ? DbValueFormat.JsNames : DbValueFormat.ECSqlNames;\n const request: DbQueryRequest = {\n ... this._options,\n kind: DbRequestKind.ECSql,\n valueFormat,\n query: this.query,\n args: this._param,\n };\n request.includeMetaData = this._props.length > 0 ? false : true;\n request.limit = { offset: this._globalOffset, count: this._globalCount < 1 ? -1 : this._globalCount };\n const resp = await this.runWithRetry(request);\n this._globalDone = resp.status === DbResponseStatus.Done;\n if (this._props.length === 0 && resp.meta.length > 0) {\n this._props = new PropertyMetaDataMap(resp.meta);\n }\n for (const row of resp.data) {\n ECSqlReader.replaceBase64WithUint8Array(row);\n }\n return resp.data;\n }\n\n /**\n * @internal\n */\n protected async runWithRetry(request: DbQueryRequest) {\n const needRetry = (rs: DbQueryResponse) => (rs.status === DbResponseStatus.Partial || rs.status === DbResponseStatus.QueueFull || rs.status === DbResponseStatus.Timeout) && (rs.data === undefined || rs.data.length === 0);\n const updateStats = (rs: DbQueryResponse) => {\n this._stats.backendCpuTime += rs.stats.cpuTime;\n this._stats.backendTotalTime += rs.stats.totalTime;\n this._stats.backendMemUsed += rs.stats.memUsed;\n this._stats.backendRowsReturned += (rs.data === undefined) ? 0 : rs.data.length;\n };\n const execQuery = async (req: DbQueryRequest) => {\n const startTime = Date.now();\n const rs = await this._executor.execute(req);\n this.stats.totalTime += (Date.now() - startTime);\n return rs;\n };\n let retry = ECSqlReader._maxRetryCount;\n let resp = await execQuery(request);\n DbQueryError.throwIfError(resp, request);\n while (--retry > 0 && needRetry(resp)) {\n resp = await execQuery(request);\n this._stats.retryCount += 1;\n if (needRetry(resp)) {\n updateStats(resp);\n }\n }\n if (retry === 0 && needRetry(resp)) {\n throw new Error(\"query too long to execute or server is too busy\");\n }\n updateStats(resp);\n return resp;\n }\n\n /**\n * @internal\n */\n public formatCurrentRow(onlyReturnObject: boolean = false): any[] | object {\n if (!onlyReturnObject && this._options.rowFormat === QueryRowFormat.UseECSqlPropertyIndexes) {\n return this.getRowInternal();\n }\n const formattedRow = {};\n for (const prop of this._props) {\n const propName = this._options.rowFormat === QueryRowFormat.UseJsPropertyNames ? prop.jsonName : prop.name;\n const val = this.getRowInternal()[prop.index];\n if (typeof val !== \"undefined\" && val !== null) {\n Object.defineProperty(formattedRow, propName, {\n value: val,\n enumerable: true,\n });\n }\n }\n return formattedRow;\n }\n\n /**\n * Get the metadata for each column in the query result.\n *\n * @returns An array of [[QueryPropertyMetaData]].\n */\n public async getMetaData(): Promise<QueryPropertyMetaData[]> {\n if (this._props.length === 0) {\n await this.fetchRows();\n }\n return this._props.properties;\n }\n\n /**\n *\n */\n private async fetchRows() {\n this._localOffset = -1;\n this._localRows = await this.readRows();\n if (this._localRows.length === 0) {\n this._done = true;\n }\n }\n\n /**\n * Step to the next row of the query result.\n *\n * @returns `true` if a row can be read from `current`.<br/>\n * `false` if there are no more rows; i.e., all rows have been stepped through already.\n */\n public async step(): Promise<boolean> {\n if (this._done) {\n return false;\n }\n const cachedRows = this._localRows.length;\n if (this._localOffset < cachedRows - 1) {\n ++this._localOffset;\n } else {\n await this.fetchRows();\n this._localOffset = 0;\n return !this._done;\n }\n return true;\n }\n\n /**\n * Get all remaining rows from the query result.\n *\n * @returns An array of all remaining rows from the query result.\n */\n public async toArray(): Promise<any[]> {\n const rows = [];\n while (await this.step()) {\n rows.push(this.formatCurrentRow());\n }\n return rows;\n }\n\n /**\n * Accessor for using ECSqlReader as an asynchronous iterator.\n *\n * @returns An asynchronous iterator over the rows returned by the executed ECSQL query.\n */\n public [Symbol.asyncIterator](): AsyncIterableIterator<QueryRowProxy> {\n return this;\n }\n\n /**\n * Calls step when called as an iterator.\n *\n * Returns the row alongside a `done` boolean to indicate if there are any more rows for an iterator to step to.\n *\n * @returns An object with the keys: `value` which contains the row and `done` which contains a boolean.\n */\n public async next(): Promise<IteratorResult<QueryRowProxy, any>> {\n if (await this.step()) {\n return {\n done: false,\n value: this.current,\n };\n } else {\n return {\n done: true,\n value: this.current,\n };\n }\n }\n}\n\n"]}
@@ -18,6 +18,8 @@ export class RelatedElement {
18
18
  static fromJSON(json) {
19
19
  return json ? new RelatedElement(json) : undefined;
20
20
  }
21
+ /** Used to *null out* an existing navigation relationship. */
22
+ static { this.none = new RelatedElement({ id: Id64.invalid }); }
21
23
  /** Accept the value of a navigation property that might be in the shortened format of just an id or might be in the full RelatedElement format. */
22
24
  static idFromJson(json) {
23
25
  if ((typeof json === "object") && ("id" in json)) {
@@ -35,8 +37,6 @@ export class RelatedElement {
35
37
  };
36
38
  }
37
39
  }
38
- /** Used to *null out* an existing navigation relationship. */
39
- RelatedElement.none = new RelatedElement({ id: Id64.invalid });
40
40
  /** A [RelatedElement]($common) relationship that describes the [TypeDefinitionElement]($backend) of an element.
41
41
  * @public
42
42
  */