@itwin/core-common 3.1.0-dev.6 → 3.1.0

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 (98) hide show
  1. package/CHANGELOG.md +104 -17
  2. package/lib/cjs/CloudStorage.d.ts.map +1 -1
  3. package/lib/cjs/CloudStorage.js +14 -20
  4. package/lib/cjs/CloudStorage.js.map +1 -1
  5. package/lib/cjs/Fonts.d.ts +16 -5
  6. package/lib/cjs/Fonts.d.ts.map +1 -1
  7. package/lib/cjs/Fonts.js +6 -2
  8. package/lib/cjs/Fonts.js.map +1 -1
  9. package/lib/cjs/Gradient.d.ts.map +1 -1
  10. package/lib/cjs/Gradient.js +10 -18
  11. package/lib/cjs/Gradient.js.map +1 -1
  12. package/lib/cjs/MapImagerySettings.d.ts +2 -0
  13. package/lib/cjs/MapImagerySettings.d.ts.map +1 -1
  14. package/lib/cjs/MapImagerySettings.js.map +1 -1
  15. package/lib/cjs/MapLayerSettings.d.ts +120 -37
  16. package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
  17. package/lib/cjs/MapLayerSettings.js +156 -86
  18. package/lib/cjs/MapLayerSettings.js.map +1 -1
  19. package/lib/cjs/SpatialClassification.d.ts +5 -0
  20. package/lib/cjs/SpatialClassification.d.ts.map +1 -1
  21. package/lib/cjs/SpatialClassification.js +7 -0
  22. package/lib/cjs/SpatialClassification.js.map +1 -1
  23. package/lib/cjs/geometry/TextString.d.ts +5 -4
  24. package/lib/cjs/geometry/TextString.d.ts.map +1 -1
  25. package/lib/cjs/geometry/TextString.js.map +1 -1
  26. package/lib/cjs/ipc/IpcWebSocket.d.ts +0 -1
  27. package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
  28. package/lib/cjs/ipc/IpcWebSocket.js +4 -13
  29. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  30. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts +2 -1
  31. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  32. package/lib/cjs/ipc/IpcWebSocketTransport.js +24 -15
  33. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  34. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +1 -0
  35. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  36. package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -0
  37. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  38. package/lib/cjs/rpc/IModelTileRpcInterface.d.ts +4 -2
  39. package/lib/cjs/rpc/IModelTileRpcInterface.d.ts.map +1 -1
  40. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -2
  41. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  42. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  43. package/lib/cjs/rpc/core/RpcInvocation.js +1 -6
  44. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  45. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +1 -1
  46. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  47. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  48. package/lib/cjs/tile/IModelTileIO.js +2 -2
  49. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  50. package/lib/esm/CloudStorage.d.ts.map +1 -1
  51. package/lib/esm/CloudStorage.js +14 -20
  52. package/lib/esm/CloudStorage.js.map +1 -1
  53. package/lib/esm/Fonts.d.ts +16 -5
  54. package/lib/esm/Fonts.d.ts.map +1 -1
  55. package/lib/esm/Fonts.js +6 -2
  56. package/lib/esm/Fonts.js.map +1 -1
  57. package/lib/esm/Gradient.d.ts.map +1 -1
  58. package/lib/esm/Gradient.js +10 -18
  59. package/lib/esm/Gradient.js.map +1 -1
  60. package/lib/esm/MapImagerySettings.d.ts +2 -0
  61. package/lib/esm/MapImagerySettings.d.ts.map +1 -1
  62. package/lib/esm/MapImagerySettings.js.map +1 -1
  63. package/lib/esm/MapLayerSettings.d.ts +120 -37
  64. package/lib/esm/MapLayerSettings.d.ts.map +1 -1
  65. package/lib/esm/MapLayerSettings.js +152 -84
  66. package/lib/esm/MapLayerSettings.js.map +1 -1
  67. package/lib/esm/SpatialClassification.d.ts +5 -0
  68. package/lib/esm/SpatialClassification.d.ts.map +1 -1
  69. package/lib/esm/SpatialClassification.js +7 -0
  70. package/lib/esm/SpatialClassification.js.map +1 -1
  71. package/lib/esm/geometry/TextString.d.ts +5 -4
  72. package/lib/esm/geometry/TextString.d.ts.map +1 -1
  73. package/lib/esm/geometry/TextString.js.map +1 -1
  74. package/lib/esm/ipc/IpcWebSocket.d.ts +0 -1
  75. package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
  76. package/lib/esm/ipc/IpcWebSocket.js +4 -13
  77. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  78. package/lib/esm/ipc/IpcWebSocketTransport.d.ts +2 -1
  79. package/lib/esm/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  80. package/lib/esm/ipc/IpcWebSocketTransport.js +24 -15
  81. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  82. package/lib/esm/rpc/IModelReadRpcInterface.d.ts +1 -0
  83. package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  84. package/lib/esm/rpc/IModelReadRpcInterface.js +1 -0
  85. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  86. package/lib/esm/rpc/IModelTileRpcInterface.d.ts +4 -2
  87. package/lib/esm/rpc/IModelTileRpcInterface.d.ts.map +1 -1
  88. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -2
  89. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  90. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  91. package/lib/esm/rpc/core/RpcInvocation.js +1 -6
  92. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  93. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +1 -1
  94. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  95. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  96. package/lib/esm/tile/IModelTileIO.js +2 -2
  97. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  98. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,6 +1,93 @@
1
1
  # Change Log - @itwin/core-common
2
2
 
3
- This log was last generated on Wed, 12 Jan 2022 14:52:38 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 29 Mar 2022 20:53:47 GMT and should not be manually modified.
4
+
5
+ ## 3.1.0
6
+ Tue, 29 Mar 2022 20:53:47 GMT
7
+
8
+ ### Updates
9
+
10
+ - Add support for map layers using model geometry.
11
+ - Deprecate IModelReadRpcInterface.getViewThumbnail
12
+ - Deprecate RenderMaterial.Params in favor of CreateRenderMaterialArgs (core-frontend).
13
+ - Remove IModelDb.elementGeometryUpdate.
14
+ - ElementGeometryBuilderParams
15
+ - Web IPC fix (when reloading frontend).
16
+
17
+ ## 3.0.3
18
+ Fri, 25 Mar 2022 15:10:02 GMT
19
+
20
+ _Version update only_
21
+
22
+ ## 3.0.2
23
+ Thu, 10 Mar 2022 21:18:13 GMT
24
+
25
+ _Version update only_
26
+
27
+ ## 3.0.1
28
+ Thu, 24 Feb 2022 15:26:55 GMT
29
+
30
+ ### Updates
31
+
32
+ - Migrated from deprecated MapBox api.
33
+
34
+ ## 3.0.0
35
+ Mon, 24 Jan 2022 14:00:52 GMT
36
+
37
+ ### Updates
38
+
39
+ - Add support for producing larger tiles.
40
+ - The Cartographic creation API now takes an interface as an argument with named properties. This will avoid callers mixing up the order of longitude, latitude, and height.
41
+ - improve concurrent query changes
42
+ - Upgrade target to ES2019 and deliver both a CommonJs and ESModule version of package
43
+ - Added additional documentation for ecefLocation iniModel
44
+ - Add support for indexed edges in tile graphics.
45
+ - Added non-existent property to EntityProps to make the compiler discriminate between EntityProps and Entity.
46
+ - Add compare method to ThematicGradientSettings. Fix Gradient.Symb.compareSymb method to also compare thematicSettings.
47
+ - Clean up SkyBox and GroundPlane APIs.
48
+ - improve getMetaData() and provide extended error codes
49
+ - Added support to LightSettings for Fresnel effect.
50
+ - Add new GeoServices class and first method to interpret WKT or complete GCS JSON."
51
+ - GeoCoordStatus documentation added
52
+ - getAccessToken always returns a token
53
+ - Fix frustum translate method.
54
+ - Make ViewFlags immutable. Simplify ViewFlagOverrides.
55
+ - Added LOCAL_ELLIPSOID vertical datum identifier.
56
+ - Added ability to convert iModel coordinates to or from any Geographic CRS
57
+ - rename contextId -> iTwinId
58
+ - MapLayerSettings.fromJSON, BaseLayerSettings.fromJSON and MapSubLayerSettings.fromJSON no longer return undefined.
59
+ - Fix problem with RealityDataSourceKey string convertion
60
+ - Promote RealityDataSource and RealityDataSourceKey API to beta and update documentation
61
+ - Removed internal tag from EGFBAccessors
62
+ - Moved RealityDataAccessProps from core-frontend to core-common
63
+ - FeatureOverrides now merge by default in case of conflicts.
64
+ - rename to @itwin/core-common
65
+ - Fix an import which would cause consumers of core-common to fail during build
66
+ - move js-base64 from devDeps to deps
67
+ - Improve conformance with the glTF 2.0 spec when reading glb chunks.
68
+ - remove ClientRequestContext and its subclasses
69
+ - Added AuthorizationClient
70
+ - Add support for inverting planar clip mask (inside vs outside)
71
+ - Remove deprecated APIs for 3.0.
72
+ - Generalize the way to attach a reality data by adding a RealityDataSourceKey to ContextRealityModelProps
73
+ - Enhance RealityDataSource class
74
+ - Replace usage of I18N with generic Localization interface.
75
+ - GeometryContainmentRequestProps.clip and SnapRequestProps.viewFlags use stricter type than `any`.
76
+ - removed deprecated apis
77
+ - Move map imagery provider from BackgroundMapSettings to MapImagerySettings.backgroundBase.
78
+ - remove IModelWriteRpcInterface
79
+ - Rename AnalysisStyleScalar to AnalysisStyleThematic
80
+ - Rename AnalysisStyleScalar to AnalysisStyleThematic.
81
+ - remove ClientRequestContext.current
82
+ - rework locks
83
+ - Fix for IModel._ecefTrans not being updated when setting IModel._ecefLocation.
84
+ - Deprecate RenderTexture.Params
85
+ - Renamed an iModel's parent container to iTwin
86
+ - Support Open City Planner (OCP) that stores orbit point clouds (OPC) in their own azure environment.
87
+ - FeatureAppearance transparency override by default ignores render mode and transparency view flag.
88
+ - Adding WebEditServer (test scenarios only for now)
89
+ - Concurrency fix within web IPC transport system.
90
+ - Add ViewFlags.wiremesh to control wiremesh display.
4
91
 
5
92
  ## 2.19.28
6
93
  Wed, 12 Jan 2022 14:52:38 GMT
@@ -193,8 +280,8 @@ Fri, 09 Jul 2021 18:11:24 GMT
193
280
 
194
281
  ### Updates
195
282
 
196
- - Accomodated the inability to reverse Changesets when creating change summaries.
197
- - Use ecef location calculated for projected models.
283
+ - Accomodated the inability to reverse Changesets when creating change summaries.
284
+ - Use ecef location calculated for projected models.
198
285
  - Clean up and promote AnalysisStyle APIs.
199
286
  - Added support for section clip to ElementGraphicsRequestProps.
200
287
  - Add internal API for reconstructing TileOptions from tree and content Ids.
@@ -460,7 +547,7 @@ Thu, 28 Jan 2021 13:39:27 GMT
460
547
  ### Updates
461
548
 
462
549
  - Fix brep DataProps to/from flatbuffer to account for base64 string header.
463
- - Element geometry creation by brep operations.
550
+ - Element geometry creation by brep operations.
464
551
  - add EditCommand
465
552
  - Improve ElementGeometry documentation.
466
553
  - Remove assertion in supplyPathForOperation when defaulting changeSetId.
@@ -616,8 +703,8 @@ Fri, 02 Oct 2020 18:03:32 GMT
616
703
 
617
704
  - Add documentation for ContextRealityModelProps.
618
705
  - Fix calculation of cartographic range.
619
- - Fixes to front end methods to pull, merge and push.
620
- - Fixed desktop authorization after recent changes.
706
+ - Fixes to front end methods to pull, merge and push.
707
+ - Fixed desktop authorization after recent changes.
621
708
  - Update Tile version due to changes to indexes for tesselated polylines
622
709
  - On iOS download in background
623
710
  - Introduce NoContentError (transmitted via 204)
@@ -749,7 +836,7 @@ Fri, 10 Jul 2020 17:23:14 GMT
749
836
  - Add ability to create selective overrides from display style settings, and apply the overrides to another settings.
750
837
  - Fix orientation of Ecef.createFromCartographicOrigin
751
838
  - Add non-locatable flag to TerrainSettings.
752
- - Setup BriefcaseDb.open() to allow profile and domain schema validation and upgrades.
839
+ - Setup BriefcaseDb.open() to allow profile and domain schema validation and upgrades.
753
840
  - Support for multiple RPC interface clients and attaching interfaces after startup.
754
841
  - Add function to convert solar angles to solar direction.
755
842
  - enforce max texture size for stepped gradients.
@@ -783,7 +870,7 @@ Thu, 28 May 2020 22:48:59 GMT
783
870
  ### Updates
784
871
 
785
872
  - Improved log message written on rpc error
786
- - Change default origin mode for terrain to Geodetic.
873
+ - Change default origin mode for terrain to Geodetic.
787
874
  - Fix transforms for creating and querying part instance geometry in world coordinate.
788
875
  - channel rules
789
876
  - Optimize thematic sensor display by culling sensors based on a distanceCutoff property on ThematicDisplaySensorSettings.
@@ -798,7 +885,7 @@ Wed, 06 May 2020 13:17:49 GMT
798
885
  - Show min/max window error for mouse wheel zoom.
799
886
  - Make animation state of a display style persistent.
800
887
  - Send a default pending message since Azure strips content-type header if no data is present
801
- - Monitor progress of downloading briefcases, ability to cancel download of briefcases.
888
+ - Monitor progress of downloading briefcases, ability to cancel download of briefcases.
802
889
  - Added to DisplayStyle3dSettings: MonochromeMode, LightSettings.
803
890
  - Simplify GeometryStreamIteratorEntry (breaking API change).
804
891
  - constructor of ColorDef wasn't setting transparency properly for rgba() strings
@@ -821,11 +908,11 @@ Wed, 06 May 2020 13:17:49 GMT
821
908
  - Added file size.
822
909
  - Supply RPC routing props for SnapshotIModelRpcInterface open methods"
823
910
  - MobileRpcConfiguration throws exception
824
- - Added NativeApp.deleteBriefcase, avoided authorization exceptions when offline.
825
- - Refactored NativeApp API and RPC interfaces. This continues to be WIP.
826
- - Added DownloadBriefcaseOptions and OpenBriefcaseOptions as parameters to the download/open calls for a briefcase.
911
+ - Added NativeApp.deleteBriefcase, avoided authorization exceptions when offline.
912
+ - Refactored NativeApp API and RPC interfaces. This continues to be WIP.
913
+ - Added DownloadBriefcaseOptions and OpenBriefcaseOptions as parameters to the download/open calls for a briefcase.
827
914
  - Added new interface for native app
828
- - VSTS#217447, 162382: Cleanups to implementation of downloading/opening/discovering briefcases in native applications (WIP).
915
+ - VSTS#217447, 162382: Cleanups to implementation of downloading/opening/discovering briefcases in native applications (WIP).
829
916
  - Handle null JSON in ViewDetails.
830
917
  - Renamed OIDC constructs for consistency; Removed SAML support.
831
918
  - OrbitGT point cloud interface.
@@ -875,7 +962,7 @@ Wed, 12 Feb 2020 17:45:50 GMT
875
962
  - iModel write API development
876
963
  - Fix issue with constructing the tile cache URL() on Safari.
877
964
  - Prevent reuse of cached tiles after project extents change.
878
- - VSTS#256133: Fixed issue with reopening connections if the backend crashes. Fixes to integration tests.
965
+ - VSTS#256133: Fixed issue with reopening connections if the backend crashes. Fixes to integration tests.
879
966
  - Define ViewDetails for manipulating optional detail settings of ViewDefinition and ViewState.
880
967
  - Add support for plan projection models with 3d display priority.
881
968
  - Add settings to control display of plan projection models.
@@ -1037,7 +1124,7 @@ Mon, 13 May 2019 15:52:05 GMT
1037
1124
 
1038
1125
  ### Updates
1039
1126
 
1040
- - Support spatial classification of context reality models.
1127
+ - Support spatial classification of context reality models.
1041
1128
  - Added OpenAPIInfo to the barrel file
1042
1129
  - Adds parameter for api-extractor to validate missing release tags
1043
1130
  - Adds ignoreMissingTags flag
@@ -1050,14 +1137,14 @@ Mon, 13 May 2019 15:52:05 GMT
1050
1137
  - LoggerCategory -> CommonLoggerCategory
1051
1138
  - Fix default line pattern for hidden edges.
1052
1139
  - Introduce LoggerCategory enum to advertise logger categories used by this package.
1053
- - Logging fixes.
1140
+ - Logging fixes.
1054
1141
  - Put sourcemap in npm package.
1055
1142
  - Add SVG to ImageSourceFormat
1056
1143
  - Add imodeljs-markup
1057
1144
  - New tile cache naming scheme.
1058
1145
  - queryPage use memoization/pending pattern
1059
1146
  - Remove StandaloneIModelRpcInterface
1060
- - Setup a generic context for tracking client requests, and made various related enhancements to logging, usage tracking and authorization.
1147
+ - Setup a generic context for tracking client requests, and made various related enhancements to logging, usage tracking and authorization.
1061
1148
  - Prefer the IModelToken values in the url (if different from values in JSON body -- should never happen except in a malicious request).
1062
1149
  - Exports interface MarshalingBinaryMarker to prevent errors in api-extractor V7
1063
1150
  - Add SnapshotIModelRpcInterface
@@ -1 +1 @@
1
- {"version":3,"file":"CloudStorage.d.ts","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,YAAY;AACZ,oBAAY,oBAAoB;IAC9B,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,OAAO,IAAA;CACR;AAED,YAAY;AACZ,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,YAAY;AACZ,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,+BAA+B,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,YAAY;AACZ,yBAAiB,wBAAwB,CAAC;IACxC,SAAgB,KAAK,IAAI,wBAAwB,CAOhD;CACF;AAED,YAAY;AACZ,8BAAsB,iBAAiB,CAAC,UAAU,EAAE,YAAY;IAC9D,OAAO,CAAC,WAAW,CAAwC;IAEpD,QAAQ,EAAE,oBAAoB,CAAgC;aACrD,iBAAiB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM;aACzC,gBAAgB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM;IACxD,SAAS,CAAC,gBAAgB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM;IACl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E,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,YAAY;AACZ,yBAAiB,wBAAwB,CAAC;IACxC,SAAgB,KAAK,IAAI,wBAAwB,CAOhD;CACF;AAED,YAAY;AACZ,8BAAsB,iBAAiB,CAAC,UAAU,EAAE,YAAY;IAC9D,OAAO,CAAC,WAAW,CAAwC;IAEpD,QAAQ,EAAE,oBAAoB,CAAgC;aACrD,iBAAiB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM;aACzC,gBAAgB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM;IACxD,SAAS,CAAC,gBAAgB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM;IAClD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,+BAA+B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IACrI,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAC7F,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS;;IAMrF,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;cAkBxD,eAAe,CAAC,SAAS,EAAE,wBAAwB,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAgBvG,OAAO,CAAC,yBAAyB,CAA6D;cAE9E,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAmChF"}
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.CloudStorageCache = exports.CloudStorageContainerUrl = exports.CloudStorageProvider = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
11
12
  /** @beta */
12
13
  var CloudStorageProvider;
13
14
  (function (CloudStorageProvider) {
@@ -40,27 +41,20 @@ class CloudStorageCache {
40
41
  formContainerKey(id) { return this.formContainerName(id); }
41
42
  supplyUrlBase(_container, _id) { return undefined; }
42
43
  async retrieve(id) {
43
- return new Promise(async (resolve) => {
44
- try {
45
- const container = await this.getContainer(id);
46
- if (!container.url) {
47
- resolve(undefined);
48
- return;
49
- }
50
- const response = await this.requestResource(container, id);
51
- if (response.ok) {
52
- const content = await this.instantiateResource(response);
53
- resolve(content);
54
- }
55
- else {
56
- resolve(undefined);
57
- }
44
+ try {
45
+ const container = await this.getContainer(id);
46
+ if (!container.url)
47
+ return undefined;
48
+ const response = await this.requestResource(container, id);
49
+ if (response.ok) {
50
+ const content = await this.instantiateResource(response);
51
+ return content;
58
52
  }
59
- catch (_err) {
60
- // todo: log this?
61
- resolve(undefined);
62
- }
63
- });
53
+ }
54
+ catch (err) {
55
+ core_bentley_1.UnexpectedErrors.handle(err);
56
+ }
57
+ return undefined;
64
58
  }
65
59
  async requestResource(container, id) {
66
60
  const base = this.supplyUrlBase(container, id);
@@ -1 +1 @@
1
- {"version":3,"file":"CloudStorage.js","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,YAAY;AACZ,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,iEAAK,CAAA;IACL,mEAAM,CAAA;IACN,uEAAQ,CAAA;IACR,uEAAQ,CAAA;IACR,qEAAO,CAAA;AACT,CAAC,EANW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAM/B;AAoBD,YAAY;AACZ,IAAiB,wBAAwB,CASxC;AATD,WAAiB,wBAAwB;IACvC,SAAgB,KAAK;QACnB,OAAO;YACL,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,EAAE;SACR,CAAC;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AAI,CAAC,SAAS,EAAE;YACd,IAAI,OAAO,GAAG,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACtD,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC9C,IAAI;wBACF,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;wBAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBACrC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,OAAO,CAAC,SAAS,CAAC,CAAC;qBACpB;oBAAC,OAAO,GAAG,EAAE;wBACZ,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aAClD;YAED,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA3FD,8CA2FC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\n/** @beta */\r\nexport enum CloudStorageProvider {\r\n Azure,\r\n Amazon,\r\n AliCloud,\r\n External,\r\n Unknown,\r\n}\r\n\r\n/** @beta */\r\nexport interface CloudStorageContainerDescriptor {\r\n provider?: CloudStorageProvider;\r\n name: string;\r\n resource?: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface CloudStorageContainerUrl {\r\n descriptor: CloudStorageContainerDescriptor;\r\n valid: number;\r\n expires: number;\r\n url: string;\r\n method?: string;\r\n headers?: Record<string, string>;\r\n bound?: boolean;\r\n}\r\n\r\n/** @beta */\r\nexport namespace CloudStorageContainerUrl {\r\n export function empty(): CloudStorageContainerUrl {\r\n return {\r\n descriptor: { name: \"\" },\r\n valid: 0,\r\n expires: 0,\r\n url: \"\",\r\n };\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport abstract class CloudStorageCache<TContentId, TContentType> {\r\n private _containers: Map<string, CloudStorageContainerUrl>;\r\n\r\n public provider: CloudStorageProvider = CloudStorageProvider.Unknown;\r\n public abstract formContainerName(id: TContentId): string;\r\n public abstract formResourceName(id: TContentId): string;\r\n protected formContainerKey(id: TContentId): string { return this.formContainerName(id); }\r\n protected abstract obtainContainerUrl(id: TContentId, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl>;\r\n protected abstract instantiateResource(response: Response): Promise<TContentType | undefined>;\r\n protected supplyUrlBase(_container: CloudStorageContainerUrl, _id: TContentId): string | undefined { return undefined; }\r\n\r\n public constructor() {\r\n this._containers = new Map();\r\n }\r\n\r\n public async retrieve(id: TContentId): Promise<TContentType | undefined> {\r\n return new Promise(async (resolve) => {\r\n try {\r\n const container = await this.getContainer(id);\r\n if (!container.url) {\r\n resolve(undefined);\r\n return;\r\n }\r\n\r\n const response = await this.requestResource(container, id);\r\n if (response.ok) {\r\n const content = await this.instantiateResource(response);\r\n resolve(content);\r\n } else {\r\n resolve(undefined);\r\n }\r\n } catch (_err) {\r\n // todo: log this?\r\n resolve(undefined);\r\n }\r\n });\r\n }\r\n\r\n protected async requestResource(container: CloudStorageContainerUrl, id: TContentId): Promise<Response> {\r\n const base = this.supplyUrlBase(container, id);\r\n const url = (undefined === base || \"\" === base) ? new URL(container.url) : new URL(container.url, base);\r\n\r\n if (!container.bound) {\r\n url.pathname += `/${this.formResourceName(id)}`;\r\n }\r\n\r\n const init: RequestInit = {\r\n headers: container.headers,\r\n method: \"GET\",\r\n };\r\n\r\n return fetch(url.toString(), init);\r\n }\r\n\r\n private _pendingContainerRequests: Map<string, Promise<CloudStorageContainerUrl>> = new Map();\r\n\r\n protected async getContainer(id: TContentId): Promise<CloudStorageContainerUrl> {\r\n const now = new Date().getTime();\r\n const name = this.formContainerName(id);\r\n const resource = this.formResourceName(id);\r\n const key = this.formContainerKey(id);\r\n\r\n let container = this._containers.get(key);\r\n if (container && container.url && (container.valid > now || container.expires < now)) {\r\n container = undefined;\r\n this._containers.delete(key);\r\n }\r\n\r\n if (!container) {\r\n let request = this._pendingContainerRequests.get(key);\r\n if (!request) {\r\n request = new Promise(async (resolve, reject) => {\r\n try {\r\n container = await this.obtainContainerUrl(id, { name, resource });\r\n this._containers.set(key, container);\r\n this._pendingContainerRequests.delete(key);\r\n resolve(container);\r\n } catch (err) {\r\n this._pendingContainerRequests.delete(key);\r\n reject(err);\r\n }\r\n });\r\n\r\n this._pendingContainerRequests.set(key, request);\r\n }\r\n\r\n return request;\r\n }\r\n\r\n return container;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CloudStorage.js","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuD;AAEvD,YAAY;AACZ,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,iEAAK,CAAA;IACL,mEAAM,CAAA;IACN,uEAAQ,CAAA;IACR,uEAAQ,CAAA;IACR,qEAAO,CAAA;AACT,CAAC,EANW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAM/B;AAoBD,YAAY;AACZ,IAAiB,wBAAwB,CASxC;AATD,WAAiB,wBAAwB;IACvC,SAAgB,KAAK;QACnB,OAAO;YACL,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,EAAE;SACR,CAAC;IAC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AC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC9C,IAAI;wBACF,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;wBAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBACrC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,OAAO,CAAC,SAAS,CAAC,CAAC;qBACpB;oBAAC,OAAO,GAAG,EAAE;wBACZ,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aAClD;YAED,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAtFD,8CAsFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\nimport { UnexpectedErrors } from \"@itwin/core-bentley\";\r\n\r\n/** @beta */\r\nexport enum CloudStorageProvider {\r\n Azure,\r\n Amazon,\r\n AliCloud,\r\n External,\r\n Unknown,\r\n}\r\n\r\n/** @beta */\r\nexport interface CloudStorageContainerDescriptor {\r\n provider?: CloudStorageProvider;\r\n name: string;\r\n resource?: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface CloudStorageContainerUrl {\r\n descriptor: CloudStorageContainerDescriptor;\r\n valid: number;\r\n expires: number;\r\n url: string;\r\n method?: string;\r\n headers?: Record<string, string>;\r\n bound?: boolean;\r\n}\r\n\r\n/** @beta */\r\nexport namespace CloudStorageContainerUrl {\r\n export function empty(): CloudStorageContainerUrl {\r\n return {\r\n descriptor: { name: \"\" },\r\n valid: 0,\r\n expires: 0,\r\n url: \"\",\r\n };\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport abstract class CloudStorageCache<TContentId, TContentType> {\r\n private _containers: Map<string, CloudStorageContainerUrl>;\r\n\r\n public provider: CloudStorageProvider = CloudStorageProvider.Unknown;\r\n public abstract formContainerName(id: TContentId): string;\r\n public abstract formResourceName(id: TContentId): string;\r\n protected formContainerKey(id: TContentId): string { return this.formContainerName(id); }\r\n protected abstract obtainContainerUrl(id: TContentId, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl>;\r\n protected abstract instantiateResource(response: Response): Promise<TContentType | undefined>;\r\n protected supplyUrlBase(_container: CloudStorageContainerUrl, _id: TContentId): string | undefined { return undefined; }\r\n\r\n public constructor() {\r\n this._containers = new Map();\r\n }\r\n\r\n public async retrieve(id: TContentId): Promise<TContentType | undefined> {\r\n try {\r\n const container = await this.getContainer(id);\r\n if (!container.url)\r\n return undefined;\r\n\r\n const response = await this.requestResource(container, id);\r\n if (response.ok) {\r\n const content = await this.instantiateResource(response);\r\n return content;\r\n }\r\n } catch (err) {\r\n UnexpectedErrors.handle(err);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n protected async requestResource(container: CloudStorageContainerUrl, id: TContentId): Promise<Response> {\r\n const base = this.supplyUrlBase(container, id);\r\n const url = (undefined === base || \"\" === base) ? new URL(container.url) : new URL(container.url, base);\r\n\r\n if (!container.bound) {\r\n url.pathname += `/${this.formResourceName(id)}`;\r\n }\r\n\r\n const init: RequestInit = {\r\n headers: container.headers,\r\n method: \"GET\",\r\n };\r\n\r\n return fetch(url.toString(), init);\r\n }\r\n\r\n private _pendingContainerRequests: Map<string, Promise<CloudStorageContainerUrl>> = new Map();\r\n\r\n protected async getContainer(id: TContentId): Promise<CloudStorageContainerUrl> {\r\n const now = new Date().getTime();\r\n const name = this.formContainerName(id);\r\n const resource = this.formResourceName(id);\r\n const key = this.formContainerKey(id);\r\n\r\n let container = this._containers.get(key);\r\n if (container && container.url && (container.valid > now || container.expires < now)) {\r\n container = undefined;\r\n this._containers.delete(key);\r\n }\r\n\r\n if (!container) {\r\n let request = this._pendingContainerRequests.get(key);\r\n if (!request) {\r\n request = new Promise(async (resolve, reject) => {\r\n try {\r\n container = await this.obtainContainerUrl(id, { name, resource });\r\n this._containers.set(key, container);\r\n this._pendingContainerRequests.delete(key);\r\n resolve(container);\r\n } catch (err) {\r\n this._pendingContainerRequests.delete(key);\r\n reject(err);\r\n }\r\n });\r\n\r\n this._pendingContainerRequests.set(key, request);\r\n }\r\n\r\n return request;\r\n }\r\n\r\n return container;\r\n }\r\n}\r\n"]}
@@ -9,12 +9,19 @@ export declare enum FontType {
9
9
  Rsc = 2,
10
10
  Shx = 3
11
11
  }
12
- /** The properties of a Font. This includes a iModel local id, the font type, and the font name.
12
+ /** An iModel-local identifier for a font.
13
+ * @public
14
+ */
15
+ export declare type FontId = number;
16
+ /** The properties of a Font.
13
17
  * @public
14
18
  */
15
19
  export interface FontProps {
16
- id: number;
20
+ /** the Id, within an iModel, of this font. */
21
+ id: FontId;
22
+ /** The type of font */
17
23
  type: FontType;
24
+ /** The name of the font. */
18
25
  name: string;
19
26
  }
20
27
  /** The properties of a FontMap
@@ -23,8 +30,12 @@ export interface FontProps {
23
30
  export interface FontMapProps {
24
31
  fonts: FontProps[];
25
32
  }
26
- /** A FontMap holds the table of known fonts available in an iModel.
27
- * A font is referenced by an "id" that is local to the iModel. This table maps those local ids to a FontProps.
33
+ /**
34
+ * A FontMap holds the set of font names available in an iModel.
35
+ * Within the GeometryStream of an Element, a specific font is referenced by its FontId that is local to the iModel.
36
+ * This class maps FontIds to FontProps.
37
+ * @note The font map is generally established when the iModel is first created to specify the set of fonts available
38
+ * for editors. Adding new entries requires that the schema lock be held.
28
39
  * @public
29
40
  */
30
41
  export declare class FontMap {
@@ -33,6 +44,6 @@ export declare class FontMap {
33
44
  addFonts(fonts: FontProps[]): void;
34
45
  toJSON(): FontMapProps;
35
46
  /** look up a font by name or number and return its FontProps */
36
- getFont(arg: string | number): FontProps | undefined;
47
+ getFont(arg: string | FontId): FontProps | undefined;
37
48
  }
38
49
  //# sourceMappingURL=Fonts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Fonts.d.ts","sourceRoot":"","sources":["../../src/Fonts.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,oBAAY,QAAQ;IAAG,QAAQ,IAAI;IAAE,GAAG,IAAI;IAAE,GAAG,IAAI;CAAE;AAEvD;;GAEG;AACH,MAAM,WAAW,SAAS;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAEvE;;GAEG;AACH,MAAM,WAAW,YAAY;IAAG,KAAK,EAAE,SAAS,EAAE,CAAA;CAAE;AAEpD;;;GAGG;AACH,qBAAa,OAAO;IAClB,SAAgB,KAAK,yBAAgC;gBACzC,KAAK,CAAC,EAAE,YAAY;IAIzB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE;IAG3B,MAAM,IAAI,YAAY;IAK7B,gEAAgE;IACzD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS;CAM5D"}
1
+ {"version":3,"file":"Fonts.d.ts","sourceRoot":"","sources":["../../src/Fonts.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,oBAAY,QAAQ;IAAG,QAAQ,IAAI;IAAE,GAAG,IAAI;IAAE,GAAG,IAAI;CAAE;AAEvD;;GAEG;AACH,oBAAY,MAAM,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,uBAAuB;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAAG,KAAK,EAAE,SAAS,EAAE,CAAA;CAAE;AAEpD;;;;;;;GAOG;AACH,qBAAa,OAAO;IAClB,SAAgB,KAAK,yBAAgC;gBACzC,KAAK,CAAC,EAAE,YAAY;IAIzB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE;IAG3B,MAAM,IAAI,YAAY;IAK7B,gEAAgE;IACzD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS;CAM5D"}
package/lib/cjs/Fonts.js CHANGED
@@ -17,8 +17,12 @@ var FontType;
17
17
  FontType[FontType["Rsc"] = 2] = "Rsc";
18
18
  FontType[FontType["Shx"] = 3] = "Shx";
19
19
  })(FontType = exports.FontType || (exports.FontType = {}));
20
- /** A FontMap holds the table of known fonts available in an iModel.
21
- * A font is referenced by an "id" that is local to the iModel. This table maps those local ids to a FontProps.
20
+ /**
21
+ * A FontMap holds the set of font names available in an iModel.
22
+ * Within the GeometryStream of an Element, a specific font is referenced by its FontId that is local to the iModel.
23
+ * This class maps FontIds to FontProps.
24
+ * @note The font map is generally established when the iModel is first created to specify the set of fonts available
25
+ * for editors. Adding new entries requires that the schema lock be held.
22
26
  * @public
23
27
  */
24
28
  class FontMap {
@@ -1 +1 @@
1
- {"version":3,"file":"Fonts.js","sourceRoot":"","sources":["../../src/Fonts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,QAA2C;AAAvD,WAAY,QAAQ;IAAG,+CAAY,CAAA;IAAE,qCAAO,CAAA;IAAE,qCAAO,CAAA;AAAC,CAAC,EAA3C,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAAmC;AAYvD;;;GAGG;AACH,MAAa,OAAO;IAElB,YAAY,KAAoB;QADhB,UAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;QAEnD,IAAI,SAAS,KAAK,KAAK;YACrB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACM,QAAQ,CAAC,KAAkB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IACM,MAAM;QACX,MAAM,KAAK,GAAgB,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/C,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IACD,gEAAgE;IACzD,OAAO,CAAC,GAAoB;QACjC,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACpC,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG;gBAAE,OAAO,IAAI,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArBD,0BAqBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Symbology\r\n */\r\n\r\n/** The type of a font.\r\n * @public\r\n */\r\nexport enum FontType { TrueType = 1, Rsc = 2, Shx = 3 }\r\n\r\n/** The properties of a Font. This includes a iModel local id, the font type, and the font name.\r\n * @public\r\n */\r\nexport interface FontProps { id: number, type: FontType, name: string }\r\n\r\n/** The properties of a FontMap\r\n * @public\r\n */\r\nexport interface FontMapProps { fonts: FontProps[] }\r\n\r\n/** A FontMap holds the table of known fonts available in an iModel.\r\n * A font is referenced by an \"id\" that is local to the iModel. This table maps those local ids to a FontProps.\r\n * @public\r\n */\r\nexport class FontMap {\r\n public readonly fonts = new Map<number, FontProps>();\r\n constructor(props?: FontMapProps) {\r\n if (undefined !== props)\r\n this.addFonts(props.fonts);\r\n }\r\n public addFonts(fonts: FontProps[]) {\r\n fonts.forEach((font) => this.fonts.set(font.id, font));\r\n }\r\n public toJSON(): FontMapProps {\r\n const fonts: FontProps[] = [];\r\n this.fonts.forEach((font) => fonts.push(font));\r\n return { fonts };\r\n }\r\n /** look up a font by name or number and return its FontProps */\r\n public getFont(arg: string | number): FontProps | undefined {\r\n if (typeof arg === \"number\") return this.fonts.get(arg);\r\n for (const font of this.fonts.values())\r\n if (font.name === arg) return font;\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Fonts.js","sourceRoot":"","sources":["../../src/Fonts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,QAA2C;AAAvD,WAAY,QAAQ;IAAG,+CAAY,CAAA;IAAE,qCAAO,CAAA;IAAE,qCAAO,CAAA;AAAC,CAAC,EAA3C,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAAmC;AAwBvD;;;;;;;GAOG;AACH,MAAa,OAAO;IAElB,YAAY,KAAoB;QADhB,UAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;QAEnD,IAAI,SAAS,KAAK,KAAK;YACrB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACM,QAAQ,CAAC,KAAkB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IACM,MAAM;QACX,MAAM,KAAK,GAAgB,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/C,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IACD,gEAAgE;IACzD,OAAO,CAAC,GAAoB;QACjC,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACpC,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG;gBAAE,OAAO,IAAI,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArBD,0BAqBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Symbology\r\n */\r\n\r\n/** The type of a font.\r\n * @public\r\n */\r\nexport enum FontType { TrueType = 1, Rsc = 2, Shx = 3 }\r\n\r\n/** An iModel-local identifier for a font.\r\n * @public\r\n */\r\nexport type FontId = number;\r\n\r\n/** The properties of a Font.\r\n * @public\r\n */\r\nexport interface FontProps {\r\n /** the Id, within an iModel, of this font. */\r\n id: FontId;\r\n /** The type of font */\r\n type: FontType;\r\n /** The name of the font. */\r\n name: string;\r\n}\r\n\r\n/** The properties of a FontMap\r\n * @public\r\n */\r\nexport interface FontMapProps { fonts: FontProps[] }\r\n\r\n/**\r\n * A FontMap holds the set of font names available in an iModel.\r\n * Within the GeometryStream of an Element, a specific font is referenced by its FontId that is local to the iModel.\r\n * This class maps FontIds to FontProps.\r\n * @note The font map is generally established when the iModel is first created to specify the set of fonts available\r\n * for editors. Adding new entries requires that the schema lock be held.\r\n * @public\r\n */\r\nexport class FontMap {\r\n public readonly fonts = new Map<FontId, FontProps>();\r\n constructor(props?: FontMapProps) {\r\n if (undefined !== props)\r\n this.addFonts(props.fonts);\r\n }\r\n public addFonts(fonts: FontProps[]) {\r\n fonts.forEach((font) => this.fonts.set(font.id, font));\r\n }\r\n public toJSON(): FontMapProps {\r\n const fonts: FontProps[] = [];\r\n this.fonts.forEach((font) => fonts.push(font));\r\n return { fonts };\r\n }\r\n /** look up a font by name or number and return its FontProps */\r\n public getFont(arg: string | FontId): FontProps | undefined {\r\n if (typeof arg === \"number\") return this.fonts.get(arg);\r\n for (const font of this.fonts.values())\r\n if (font.name === arg) return font;\r\n return undefined;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Gradient.d.ts","sourceRoot":"","sources":["../../src/Gradient.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAC;AACzD,OAAO,EAAqD,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAE/I;;;;GAIG;AACH,yBAAiB,QAAQ,CAAC;IACxB,4CAA4C;IAC5C,KAAY,KAAK;QACf,gBAAgB;QAChB,IAAI,IAAI;QACR,8CAA8C;QAC9C,MAAM,IAAI;QACV,2EAA2E;QAC3E,OAAO,IAAI;KACZ;IAED,+FAA+F;IAC/F,KAAY,IAAI;QACd,IAAI,IAAI;QACR,MAAM,IAAI;QACV,MAAM,IAAI;QACV,WAAW,IAAI;QACf,SAAS,IAAI;QACb,aAAa,IAAI;QACjB,4DAA4D;QAC5D,QAAQ,IAAI;KACb;IAED,mDAAmD;IACnD,UAAiB,aAAa;QAC5B,iEAAiE;QACjE,KAAK,EAAE,MAAM,CAAC;Q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AI,IAAI;QAIpB,2EAA2E;QACpE,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;QAInC;;;;WAIG;eACW,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,GAAG,MAAM;QAsDzE;;WAEG;QACI,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM;QAInC;;;WAGG;QACH,OAAO,CAAC,WAAW;QAInB,6FAA6F;QACtF,QAAQ,CAAC,KAAK,EAAE,MAAM;QAqC7B,IAAW,eAAe,IAAI,OAAO,CAOpC;QAED,kEAAkE;QAClE,IAAW,UAAU,IAAI,OAAO,CAA+C;QAE/E;;;;WAIG;QACI,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW;QAsDrE,kEAAkE;QAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW;KA2J5D;CACF"}
@@ -244,12 +244,10 @@ var Gradient;
244
244
  }
245
245
  const stepCount = Math.min(settings.stepCount, maxDimension);
246
246
  const dimension = (ThematicDisplay_1.ThematicGradientMode.Smooth === settings.mode) ? maxDimension : stepCount;
247
- const hasAlpha = this.hasTranslucency;
248
- const image = new Uint8Array(1 * dimension * (hasAlpha ? 4 : 3));
247
+ const image = new Uint8Array(1 * dimension * 4);
249
248
  let currentIdx = image.length - 1;
250
249
  function addColor(color) {
251
- if (hasAlpha)
252
- image[currentIdx--] = color.getAlpha();
250
+ image[currentIdx--] = color.getAlpha();
253
251
  image[currentIdx--] = color.colors.b;
254
252
  image[currentIdx--] = color.colors.g;
255
253
  image[currentIdx--] = color.colors.r;
@@ -281,7 +279,7 @@ var Gradient;
281
279
  }
282
280
  }
283
281
  (0, core_bentley_1.assert)(-1 === currentIdx);
284
- const imageBuffer = Image_1.ImageBuffer.create(image, hasAlpha ? Image_1.ImageBufferFormat.Rgba : Image_1.ImageBufferFormat.Rgb, 1);
282
+ const imageBuffer = Image_1.ImageBuffer.create(image, Image_1.ImageBufferFormat.Rgba, 1);
285
283
  (0, core_bentley_1.assert)(undefined !== imageBuffer);
286
284
  return imageBuffer;
287
285
  }
@@ -292,11 +290,10 @@ var Gradient;
292
290
  // NB: The height used to be hardcoded to 8192 here. Now we will let the render system decide.
293
291
  width = 1; // Force width to 1 for thematic gradients.
294
292
  }
295
- const hasAlpha = this.hasTranslucency;
296
293
  const thisAngle = (this.angle === undefined) ? 0 : this.angle.radians;
297
294
  const cosA = Math.cos(thisAngle);
298
295
  const sinA = Math.sin(thisAngle);
299
- const image = new Uint8Array(width * height * (hasAlpha ? 4 : 3));
296
+ const image = new Uint8Array(width * height * 4);
300
297
  let currentIdx = image.length - 1;
301
298
  const shift = Math.min(1.0, Math.abs(this.shift));
302
299
  switch (this.mode) {
@@ -335,8 +332,7 @@ var Gradient;
335
332
  f = Math.sin(Math.PI / 2 * (1.0 - d / dMin));
336
333
  }
337
334
  const color = this.mapColor(f);
338
- if (hasAlpha)
339
- image[currentIdx--] = color.getAlpha();
335
+ image[currentIdx--] = color.getAlpha();
340
336
  image[currentIdx--] = color.colors.b;
341
337
  image[currentIdx--] = color.colors.g;
342
338
  image[currentIdx--] = color.colors.r;
@@ -355,8 +351,7 @@ var Gradient;
355
351
  const yr = y * cosA - x * sinA;
356
352
  const f = Math.sin(Math.PI / 2 * (1 - Math.sqrt(xr * xr + yr * yr)));
357
353
  const color = this.mapColor(f);
358
- if (hasAlpha)
359
- image[currentIdx--] = color.getAlpha();
354
+ image[currentIdx--] = color.getAlpha();
360
355
  image[currentIdx--] = color.colors.b;
361
356
  image[currentIdx--] = color.colors.g;
362
357
  image[currentIdx--] = color.colors.r;
@@ -374,8 +369,7 @@ var Gradient;
374
369
  const x = xs + i / width - 0.5;
375
370
  const f = Math.sin(Math.PI / 2 * (1.0 - Math.sqrt(x * x + y * y) / r));
376
371
  const color = this.mapColor(f);
377
- if (hasAlpha)
378
- image[currentIdx--] = color.getAlpha();
372
+ image[currentIdx--] = color.getAlpha();
379
373
  image[currentIdx--] = color.colors.b;
380
374
  image[currentIdx--] = color.colors.g;
381
375
  image[currentIdx--] = color.colors.r;
@@ -392,8 +386,7 @@ var Gradient;
392
386
  const x = i / width - xs;
393
387
  const f = Math.sin(Math.PI / 2 * (1.0 - Math.sqrt(x * x + y * y)));
394
388
  const color = this.mapColor(f);
395
- if (hasAlpha)
396
- image[currentIdx--] = color.getAlpha();
389
+ image[currentIdx--] = color.getAlpha();
397
390
  image[currentIdx--] = color.colors.b;
398
391
  image[currentIdx--] = color.colors.g;
399
392
  image[currentIdx--] = color.colors.r;
@@ -430,8 +423,7 @@ var Gradient;
430
423
  }
431
424
  }
432
425
  for (let i = 0; i < width; i++) {
433
- if (hasAlpha)
434
- image[currentIdx--] = color.getAlpha();
426
+ image[currentIdx--] = color.getAlpha();
435
427
  image[currentIdx--] = color.colors.b;
436
428
  image[currentIdx--] = color.colors.g;
437
429
  image[currentIdx--] = color.colors.r;
@@ -440,7 +432,7 @@ var Gradient;
440
432
  }
441
433
  }
442
434
  (0, core_bentley_1.assert)(-1 === currentIdx);
443
- const imageBuffer = Image_1.ImageBuffer.create(image, hasAlpha ? Image_1.ImageBufferFormat.Rgba : Image_1.ImageBufferFormat.Rgb, width);
435
+ const imageBuffer = Image_1.ImageBuffer.create(image, Image_1.ImageBufferFormat.Rgba, width);
444
436
  (0, core_bentley_1.assert)(undefined !== imageBuffer);
445
437
  return imageBuffer;
446
438
  }