@itwin/core-frontend 3.0.0-dev.133 → 3.0.0-dev.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/IModelApp.d.ts +4 -4
- package/lib/cjs/IModelApp.js +6 -6
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts +1 -1
- package/lib/cjs/IModelConnection.js +1 -1
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/IModeljs-css.js +1 -1
- package/lib/cjs/IModeljs-css.js.map +1 -1
- package/lib/cjs/LocalhostIpcApp.d.ts +2 -1
- package/lib/cjs/LocalhostIpcApp.d.ts.map +1 -1
- package/lib/cjs/LocalhostIpcApp.js +21 -7
- package/lib/cjs/LocalhostIpcApp.js.map +1 -1
- package/lib/cjs/SheetViewState.js +2 -0
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +1 -1
- package/lib/cjs/Viewport.js +1 -1
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +1 -1
- package/lib/cjs/core-frontend.js +1 -1
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.d.ts +3 -2
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js +3 -2
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts +5 -1
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.js +20 -5
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +26 -3
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +46 -7
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/render/RenderSystem.d.ts +0 -2
- package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
- package/lib/cjs/render/RenderSystem.js.map +1 -1
- package/lib/cjs/render/webgl/DrawCommand.d.ts.map +1 -1
- package/lib/cjs/render/webgl/DrawCommand.js +3 -1
- package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
- package/lib/cjs/render/webgl/Mesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Mesh.js +1 -2
- package/lib/cjs/render/webgl/Mesh.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +1 -0
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarTextureProjection.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PlanarTextureProjection.js +1 -0
- package/lib/cjs/render/webgl/PlanarTextureProjection.js.map +1 -1
- package/lib/cjs/render/webgl/SceneCompositor.js +1 -0
- package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.d.ts +8 -7
- package/lib/cjs/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.js +20 -18
- package/lib/cjs/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.d.ts.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js +1 -0
- package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +0 -3
- package/lib/cjs/render/webgl/System.d.ts.map +1 -1
- package/lib/cjs/render/webgl/System.js +0 -3
- package/lib/cjs/render/webgl/System.js.map +1 -1
- package/lib/cjs/render/webgl/Target.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Target.js +5 -0
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/render/webgl/Technique.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Technique.js +74 -29
- package/lib/cjs/render/webgl/Technique.js.map +1 -1
- package/lib/cjs/render/webgl/TechniqueFlags.d.ts +7 -1
- package/lib/cjs/render/webgl/TechniqueFlags.d.ts.map +1 -1
- package/lib/cjs/render/webgl/TechniqueFlags.js +10 -1
- package/lib/cjs/render/webgl/TechniqueFlags.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/AmbientOcclusion.js +1 -1
- package/lib/cjs/render/webgl/glsl/Blur.js +1 -1
- package/lib/cjs/render/webgl/glsl/ClearPickAndColor.js +2 -2
- package/lib/cjs/render/webgl/glsl/ClearTranslucent.js +2 -2
- package/lib/cjs/render/webgl/glsl/Combine3Textures.js +1 -1
- package/lib/cjs/render/webgl/glsl/CombineTextures.js +1 -1
- package/lib/cjs/render/webgl/glsl/Composite.js +1 -1
- package/lib/cjs/render/webgl/glsl/CopyColor.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyColor.js +17 -2
- package/lib/cjs/render/webgl/glsl/CopyColor.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyPickBuffers.js +2 -2
- package/lib/cjs/render/webgl/glsl/CopyStencil.js +6 -6
- package/lib/cjs/render/webgl/glsl/EVSMFromDepth.js +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +2 -2
- package/lib/cjs/render/webgl/glsl/Fragment.js +10 -10
- package/lib/cjs/render/webgl/glsl/LogarithmicDepthBuffer.js +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.js +3 -3
- package/lib/cjs/render/webgl/glsl/RealityMesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.js +5 -2
- package/lib/cjs/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/ScreenSpaceEffect.js +1 -1
- package/lib/cjs/render/webgl/glsl/SkyBox.js +1 -1
- package/lib/cjs/render/webgl/glsl/SkySphere.js +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.js +5 -2
- package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Translucency.js +2 -2
- package/lib/cjs/render/webgl/glsl/Wiremesh.d.ts +9 -0
- package/lib/cjs/render/webgl/glsl/Wiremesh.d.ts.map +1 -0
- package/lib/cjs/render/webgl/glsl/Wiremesh.js +40 -0
- package/lib/cjs/render/webgl/glsl/Wiremesh.js.map +1 -0
- package/lib/cjs/tile/B3dmReader.d.ts +1 -1
- package/lib/cjs/tile/B3dmReader.d.ts.map +1 -1
- package/lib/cjs/tile/B3dmReader.js +4 -4
- package/lib/cjs/tile/B3dmReader.js.map +1 -1
- package/lib/cjs/tile/ContextShareProvider.d.ts.map +1 -1
- package/lib/cjs/tile/ContextShareProvider.js +19 -0
- package/lib/cjs/tile/ContextShareProvider.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +3 -1
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +33 -1
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/I3dmReader.d.ts +1 -1
- package/lib/cjs/tile/I3dmReader.d.ts.map +1 -1
- package/lib/cjs/tile/I3dmReader.js +4 -4
- package/lib/cjs/tile/I3dmReader.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts +2 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +29 -10
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.d.ts +1 -0
- package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +3 -2
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +4 -4
- package/lib/esm/IModelApp.js +6 -6
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +1 -1
- package/lib/esm/IModelConnection.js +1 -1
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/IModeljs-css.js +1 -1
- package/lib/esm/IModeljs-css.js.map +1 -1
- package/lib/esm/LocalhostIpcApp.d.ts +2 -1
- package/lib/esm/LocalhostIpcApp.d.ts.map +1 -1
- package/lib/esm/LocalhostIpcApp.js +22 -8
- package/lib/esm/LocalhostIpcApp.js.map +1 -1
- package/lib/esm/SheetViewState.js +2 -0
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/Viewport.d.ts +1 -1
- package/lib/esm/Viewport.js +1 -1
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +1 -1
- package/lib/esm/core-frontend.js +1 -1
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.d.ts +3 -2
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js +3 -2
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
- package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts +5 -1
- package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/BasicUnitsProvider.js +18 -4
- package/lib/esm/quantity-formatting/BasicUnitsProvider.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +26 -3
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +45 -7
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/render/RenderSystem.d.ts +0 -2
- package/lib/esm/render/RenderSystem.d.ts.map +1 -1
- package/lib/esm/render/RenderSystem.js.map +1 -1
- package/lib/esm/render/webgl/DrawCommand.d.ts.map +1 -1
- package/lib/esm/render/webgl/DrawCommand.js +3 -1
- package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
- package/lib/esm/render/webgl/Mesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/Mesh.js +1 -2
- package/lib/esm/render/webgl/Mesh.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +1 -0
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/PlanarTextureProjection.d.ts.map +1 -1
- package/lib/esm/render/webgl/PlanarTextureProjection.js +1 -0
- package/lib/esm/render/webgl/PlanarTextureProjection.js.map +1 -1
- package/lib/esm/render/webgl/SceneCompositor.js +1 -0
- package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.d.ts +8 -7
- package/lib/esm/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.js +20 -18
- package/lib/esm/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.d.ts.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js +1 -0
- package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +0 -3
- package/lib/esm/render/webgl/System.d.ts.map +1 -1
- package/lib/esm/render/webgl/System.js +0 -3
- package/lib/esm/render/webgl/System.js.map +1 -1
- package/lib/esm/render/webgl/Target.d.ts.map +1 -1
- package/lib/esm/render/webgl/Target.js +5 -0
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/render/webgl/Technique.d.ts.map +1 -1
- package/lib/esm/render/webgl/Technique.js +74 -29
- package/lib/esm/render/webgl/Technique.js.map +1 -1
- package/lib/esm/render/webgl/TechniqueFlags.d.ts +7 -1
- package/lib/esm/render/webgl/TechniqueFlags.d.ts.map +1 -1
- package/lib/esm/render/webgl/TechniqueFlags.js +10 -1
- package/lib/esm/render/webgl/TechniqueFlags.js.map +1 -1
- package/lib/esm/render/webgl/glsl/AmbientOcclusion.js +1 -1
- package/lib/esm/render/webgl/glsl/Blur.js +1 -1
- package/lib/esm/render/webgl/glsl/ClearPickAndColor.js +2 -2
- package/lib/esm/render/webgl/glsl/ClearTranslucent.js +2 -2
- package/lib/esm/render/webgl/glsl/Combine3Textures.js +1 -1
- package/lib/esm/render/webgl/glsl/CombineTextures.js +1 -1
- package/lib/esm/render/webgl/glsl/Composite.js +1 -1
- package/lib/esm/render/webgl/glsl/CopyColor.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyColor.js +17 -2
- package/lib/esm/render/webgl/glsl/CopyColor.js.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyPickBuffers.js +2 -2
- package/lib/esm/render/webgl/glsl/CopyStencil.js +6 -6
- package/lib/esm/render/webgl/glsl/EVSMFromDepth.js +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js +2 -2
- package/lib/esm/render/webgl/glsl/Fragment.js +10 -10
- package/lib/esm/render/webgl/glsl/LogarithmicDepthBuffer.js +1 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.js +3 -3
- package/lib/esm/render/webgl/glsl/RealityMesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.js +5 -2
- package/lib/esm/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/glsl/ScreenSpaceEffect.js +1 -1
- package/lib/esm/render/webgl/glsl/SkyBox.js +1 -1
- package/lib/esm/render/webgl/glsl/SkySphere.js +1 -1
- package/lib/esm/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.js +5 -2
- package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Translucency.js +2 -2
- package/lib/esm/render/webgl/glsl/Wiremesh.d.ts +9 -0
- package/lib/esm/render/webgl/glsl/Wiremesh.d.ts.map +1 -0
- package/lib/esm/render/webgl/glsl/Wiremesh.js +36 -0
- package/lib/esm/render/webgl/glsl/Wiremesh.js.map +1 -0
- package/lib/esm/tile/B3dmReader.d.ts +1 -1
- package/lib/esm/tile/B3dmReader.d.ts.map +1 -1
- package/lib/esm/tile/B3dmReader.js +4 -4
- package/lib/esm/tile/B3dmReader.js.map +1 -1
- package/lib/esm/tile/ContextShareProvider.d.ts.map +1 -1
- package/lib/esm/tile/ContextShareProvider.js +19 -0
- package/lib/esm/tile/ContextShareProvider.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +3 -1
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +33 -1
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/I3dmReader.d.ts +1 -1
- package/lib/esm/tile/I3dmReader.d.ts.map +1 -1
- package/lib/esm/tile/I3dmReader.js +4 -4
- package/lib/esm/tile/I3dmReader.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts +2 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +30 -11
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.d.ts +1 -0
- package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +3 -2
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/package.json +22 -22
|
@@ -121,7 +121,7 @@ export * from "./RealityDataSource";
|
|
|
121
121
|
*/
|
|
122
122
|
/**
|
|
123
123
|
* @docs-group-description IModelApp
|
|
124
|
-
* Classes for configuring and administering an
|
|
124
|
+
* Classes for configuring and administering an iTwin.js application.
|
|
125
125
|
* See [the learning articles]($docs/learning/frontend/index.md).
|
|
126
126
|
*/
|
|
127
127
|
/**
|
package/lib/esm/core-frontend.js
CHANGED
|
@@ -125,7 +125,7 @@ export * from "./RealityDataSource";
|
|
|
125
125
|
*/
|
|
126
126
|
/**
|
|
127
127
|
* @docs-group-description IModelApp
|
|
128
|
-
* Classes for configuring and administering an
|
|
128
|
+
* Classes for configuring and administering an iTwin.js application.
|
|
129
129
|
* See [the learning articles]($docs/learning/frontend/index.md).
|
|
130
130
|
*/
|
|
131
131
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-frontend.js","sourceRoot":"","sources":["../../src/core-frontend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,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;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG","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\r\nexport * from \"./AccuDraw\";\r\nexport * from \"./AccuSnap\";\r\nexport * from \"./AuxCoordSys\";\r\nexport * from \"./BingLocation\";\r\nexport * from \"./BriefcaseConnection\";\r\nexport * from \"./BriefcaseTxns\";\r\nexport * from \"./CategorySelectorState\";\r\nexport * from \"./ChangeFlags\";\r\nexport * from \"./ContextRealityModelState\";\r\nexport * from \"./CoordSystem\";\r\nexport * from \"./DecorationsCache\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./DisplayStyleState\";\r\nexport * from \"./DrawingViewState\";\r\nexport * from \"./ElementLocateManager\";\r\nexport * from \"./EmphasizeElements\";\r\nexport * from \"./EntityState\";\r\nexport * from \"./EnvironmentDecorations\";\r\nexport * from \"./FeatureOverrideProvider\";\r\nexport * from \"./FlashSettings\";\r\nexport * from \"./FrontendLoggerCategory\";\r\nexport * from \"./FrontendHubAccess\";\r\nexport * from \"./Frustum2d\";\r\nexport * from \"./FrustumAnimator\";\r\nexport * from \"./FuzzySearch\";\r\nexport * from \"./GeoServices\";\r\nexport * from \"./GlobeAnimator\";\r\nexport * from \"./HitDetail\";\r\nexport * from \"./ImageUtil\";\r\nexport * from \"./IModelApp\";\r\nexport * from \"./IModelConnection\";\r\nexport * from \"./IModelRoutingContext\";\r\nexport * from \"./GraphicalEditingScope\";\r\nexport * from \"./IpcApp\";\r\nexport * from \"./LinePlaneIntersect\";\r\nexport * from \"./MarginPercent\";\r\nexport * from \"./Marker\";\r\nexport * from \"./ModelSelectorState\";\r\nexport * from \"./ModelState\";\r\nexport * from \"./NativeApp\";\r\nexport * from \"./NativeAppLogger\";\r\nexport * from \"./NoRenderApp\";\r\nexport * from \"./NotificationManager\";\r\nexport * from \"./PerModelCategoryVisibility\";\r\nexport * from \"./PlanarClipMaskState\";\r\nexport * from \"./quantity-formatting/QuantityFormatter\";\r\nexport * from \"./quantity-formatting/BaseUnitFormattingSettingsProvider\";\r\nexport * from \"./quantity-formatting/LocalUnitFormatProvider\";\r\nexport * from \"./RenderScheduleState\";\r\nexport * from \"./CheckpointConnection\";\r\nexport * from \"./SelectionSet\";\r\nexport * from \"./SheetViewState\";\r\nexport * from \"./SpatialViewState\";\r\nexport * from \"./Sprites\";\r\nexport * from \"./StandardView\";\r\nexport * from \"./SubCategoriesCache\";\r\nexport * from \"./TentativePoint\";\r\nexport * from \"./Tiles\";\r\nexport * from \"./TwoWayViewportSync\";\r\nexport * from \"./UserPreferences\";\r\nexport * from \"./ViewAnimation\";\r\nexport * from \"./ViewContext\";\r\nexport * from \"./ViewGlobalLocation\";\r\nexport * from \"./ViewingSpace\";\r\nexport * from \"./ViewManager\";\r\nexport * from \"./Viewport\";\r\nexport * from \"./ViewPose\";\r\nexport * from \"./ViewRect\";\r\nexport * from \"./ViewState\";\r\nexport * from \"./ViewStatus\";\r\nexport * from \"./properties/AngleDescription\";\r\nexport * from \"./properties/FormattedQuantityDescription\";\r\nexport * from \"./properties/LengthDescription\";\r\nexport * from \"./render/CanvasDecoration\";\r\nexport * from \"./render/Decorations\";\r\nexport * from \"./render/FeatureSymbology\";\r\nexport * from \"./render/FrameStats\";\r\nexport * from \"./render/GraphicBranch\";\r\nexport * from \"./render/GraphicBuilder\";\r\nexport * from \"./render/GraphicPrimitive\";\r\nexport * from \"./render/InstancedGraphicParams\";\r\nexport * from \"./render/MockRender\";\r\nexport * from \"./render/ParticleCollectionBuilder\";\r\nexport * from \"./render/Pixel\";\r\nexport * from \"./render/RenderClipVolume\";\r\nexport * from \"./render/RenderGraphic\";\r\nexport * from \"./render/RenderMemory\";\r\nexport * from \"./render/RenderPlan\";\r\nexport * from \"./render/RenderPlanarClassifier\";\r\nexport * from \"./render/RenderTarget\";\r\nexport * from \"./render/RenderSystem\";\r\nexport * from \"./render/RenderTexture\";\r\nexport * from \"./render/Scene\";\r\nexport * from \"./render/ScreenSpaceEffectBuilder\";\r\nexport * from \"./render/VisibleFeature\";\r\nexport * from \"./render/webgl/PerformanceMetrics\";\r\nexport * from \"./render/webgl/Target\";\r\nexport * from \"./render/webgl/IModelFrameLifecycle\";\r\nexport * from \"./tools/AccuDrawTool\";\r\nexport * from \"./tile/internal\";\r\nexport * from \"./tools/ClipViewTool\";\r\nexport * from \"./tools/EditManipulator\";\r\nexport * from \"./tools/ElementSetTool\";\r\nexport * from \"./tools/EventController\";\r\nexport * from \"./tools/IdleTool\";\r\nexport * from \"./tools/MeasureTool\";\r\nexport * from \"./tools/PrimitiveTool\";\r\nexport * from \"./tools/SelectTool\";\r\nexport * from \"./tools/Tool\";\r\nexport * from \"./tools/ToolSettings\";\r\nexport * from \"./tools/ToolAdmin\";\r\nexport * from \"./tools/ToolAssistance\";\r\nexport * from \"./tools/ViewTool\";\r\nexport * from \"./BackgroundMapGeometry\";\r\nexport * from \"./ViewCreator2d\";\r\nexport * from \"./ViewCreator3d\";\r\nexport * from \"./LocalhostIpcApp\";\r\nexport * from \"./RealityDataSource\";\r\n\r\n/** @docs-package-description\r\n * The core-frontend package always runs in a web browser. It contains classes for [querying iModels and showing views]($docs/learning/frontend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description IModelApp\r\n * Classes for configuring and administering an iModel.js application.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description IModelConnection\r\n * Classes for working with a connection to an [iModel briefcase]($docs/learning/IModels.md)\r\n */\r\n/**\r\n * @docs-group-description ElementState\r\n * Classes for working with the *state* of Elements in the frontend.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ModelState\r\n * Classes for working with the *state* of Models in the frontend.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Tools\r\n * Classes for [working with Tools]($docs/learning/frontend/Tools.md)\r\n */\r\n/**\r\n * @docs-group-description Measure\r\n * Classes for reporting point to point distances and mass properties of elements.\r\n */\r\n/**\r\n * @docs-group-description Views\r\n * Classes for [working with Views]($docs/learning/frontend/Views.md)\r\n */\r\n/**\r\n * @docs-group-description LocatingElements\r\n * Classes for locating and snapping to elements in views.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description AccuDraw\r\n * AccuDraw provides helpful assistance for creating and modifying elements in a view.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Notifications\r\n * Notifications provide feedback to the user of something of interest.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Extensions\r\n * Classes for creating and managing runtime [Extensions]($docs/learning/frontend/Extensions.md)\r\n */\r\n/**\r\n * @docs-group-description Properties\r\n * Classes for working with property records and descriptions.\r\n */\r\n/**\r\n * @docs-group-description Rendering\r\n * Classes for rendering the contents of views.\r\n */\r\n/**\r\n * @docs-group-description SelectionSet\r\n * Classes for working with the set of selected elements.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Native Applications\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package\r\n */\r\n/**\r\n * @docs-group-description QuantityFormatting\r\n * Classes for formatting and parsing quantity values.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * Classes representing graphics as [hierarchical 3d tiles](https://github.com/CesiumGS/3d-tiles).\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description UserPreferences\r\n * APIs for working with user preferences in an iModelApp.\r\n * See [the learning articles]($docs/learning/frontend/preferences.md).\r\n */\r\n"]}
|
|
1
|
+
{"version":3,"file":"core-frontend.js","sourceRoot":"","sources":["../../src/core-frontend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAA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AAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AAEH;;;;GAIG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG","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\r\nexport * from \"./AccuDraw\";\r\nexport * from \"./AccuSnap\";\r\nexport * from \"./AuxCoordSys\";\r\nexport * from \"./BingLocation\";\r\nexport * from \"./BriefcaseConnection\";\r\nexport * from \"./BriefcaseTxns\";\r\nexport * from \"./CategorySelectorState\";\r\nexport * from \"./ChangeFlags\";\r\nexport * from \"./ContextRealityModelState\";\r\nexport * from \"./CoordSystem\";\r\nexport * from \"./DecorationsCache\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./DisplayStyleState\";\r\nexport * from \"./DrawingViewState\";\r\nexport * from \"./ElementLocateManager\";\r\nexport * from \"./EmphasizeElements\";\r\nexport * from \"./EntityState\";\r\nexport * from \"./EnvironmentDecorations\";\r\nexport * from \"./FeatureOverrideProvider\";\r\nexport * from \"./FlashSettings\";\r\nexport * from \"./FrontendLoggerCategory\";\r\nexport * from \"./FrontendHubAccess\";\r\nexport * from \"./Frustum2d\";\r\nexport * from \"./FrustumAnimator\";\r\nexport * from \"./FuzzySearch\";\r\nexport * from \"./GeoServices\";\r\nexport * from \"./GlobeAnimator\";\r\nexport * from \"./HitDetail\";\r\nexport * from \"./ImageUtil\";\r\nexport * from \"./IModelApp\";\r\nexport * from \"./IModelConnection\";\r\nexport * from \"./IModelRoutingContext\";\r\nexport * from \"./GraphicalEditingScope\";\r\nexport * from \"./IpcApp\";\r\nexport * from \"./LinePlaneIntersect\";\r\nexport * from \"./MarginPercent\";\r\nexport * from \"./Marker\";\r\nexport * from \"./ModelSelectorState\";\r\nexport * from \"./ModelState\";\r\nexport * from \"./NativeApp\";\r\nexport * from \"./NativeAppLogger\";\r\nexport * from \"./NoRenderApp\";\r\nexport * from \"./NotificationManager\";\r\nexport * from \"./PerModelCategoryVisibility\";\r\nexport * from \"./PlanarClipMaskState\";\r\nexport * from \"./quantity-formatting/QuantityFormatter\";\r\nexport * from \"./quantity-formatting/BaseUnitFormattingSettingsProvider\";\r\nexport * from \"./quantity-formatting/LocalUnitFormatProvider\";\r\nexport * from \"./RenderScheduleState\";\r\nexport * from \"./CheckpointConnection\";\r\nexport * from \"./SelectionSet\";\r\nexport * from \"./SheetViewState\";\r\nexport * from \"./SpatialViewState\";\r\nexport * from \"./Sprites\";\r\nexport * from \"./StandardView\";\r\nexport * from \"./SubCategoriesCache\";\r\nexport * from \"./TentativePoint\";\r\nexport * from \"./Tiles\";\r\nexport * from \"./TwoWayViewportSync\";\r\nexport * from \"./UserPreferences\";\r\nexport * from \"./ViewAnimation\";\r\nexport * from \"./ViewContext\";\r\nexport * from \"./ViewGlobalLocation\";\r\nexport * from \"./ViewingSpace\";\r\nexport * from \"./ViewManager\";\r\nexport * from \"./Viewport\";\r\nexport * from \"./ViewPose\";\r\nexport * from \"./ViewRect\";\r\nexport * from \"./ViewState\";\r\nexport * from \"./ViewStatus\";\r\nexport * from \"./properties/AngleDescription\";\r\nexport * from \"./properties/FormattedQuantityDescription\";\r\nexport * from \"./properties/LengthDescription\";\r\nexport * from \"./render/CanvasDecoration\";\r\nexport * from \"./render/Decorations\";\r\nexport * from \"./render/FeatureSymbology\";\r\nexport * from \"./render/FrameStats\";\r\nexport * from \"./render/GraphicBranch\";\r\nexport * from \"./render/GraphicBuilder\";\r\nexport * from \"./render/GraphicPrimitive\";\r\nexport * from \"./render/InstancedGraphicParams\";\r\nexport * from \"./render/MockRender\";\r\nexport * from \"./render/ParticleCollectionBuilder\";\r\nexport * from \"./render/Pixel\";\r\nexport * from \"./render/RenderClipVolume\";\r\nexport * from \"./render/RenderGraphic\";\r\nexport * from \"./render/RenderMemory\";\r\nexport * from \"./render/RenderPlan\";\r\nexport * from \"./render/RenderPlanarClassifier\";\r\nexport * from \"./render/RenderTarget\";\r\nexport * from \"./render/RenderSystem\";\r\nexport * from \"./render/RenderTexture\";\r\nexport * from \"./render/Scene\";\r\nexport * from \"./render/ScreenSpaceEffectBuilder\";\r\nexport * from \"./render/VisibleFeature\";\r\nexport * from \"./render/webgl/PerformanceMetrics\";\r\nexport * from \"./render/webgl/Target\";\r\nexport * from \"./render/webgl/IModelFrameLifecycle\";\r\nexport * from \"./tools/AccuDrawTool\";\r\nexport * from \"./tile/internal\";\r\nexport * from \"./tools/ClipViewTool\";\r\nexport * from \"./tools/EditManipulator\";\r\nexport * from \"./tools/ElementSetTool\";\r\nexport * from \"./tools/EventController\";\r\nexport * from \"./tools/IdleTool\";\r\nexport * from \"./tools/MeasureTool\";\r\nexport * from \"./tools/PrimitiveTool\";\r\nexport * from \"./tools/SelectTool\";\r\nexport * from \"./tools/Tool\";\r\nexport * from \"./tools/ToolSettings\";\r\nexport * from \"./tools/ToolAdmin\";\r\nexport * from \"./tools/ToolAssistance\";\r\nexport * from \"./tools/ViewTool\";\r\nexport * from \"./BackgroundMapGeometry\";\r\nexport * from \"./ViewCreator2d\";\r\nexport * from \"./ViewCreator3d\";\r\nexport * from \"./LocalhostIpcApp\";\r\nexport * from \"./RealityDataSource\";\r\n\r\n/** @docs-package-description\r\n * The core-frontend package always runs in a web browser. It contains classes for [querying iModels and showing views]($docs/learning/frontend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description IModelApp\r\n * Classes for configuring and administering an iTwin.js application.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description IModelConnection\r\n * Classes for working with a connection to an [iModel briefcase]($docs/learning/IModels.md)\r\n */\r\n/**\r\n * @docs-group-description ElementState\r\n * Classes for working with the *state* of Elements in the frontend.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description ModelState\r\n * Classes for working with the *state* of Models in the frontend.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Tools\r\n * Classes for [working with Tools]($docs/learning/frontend/Tools.md)\r\n */\r\n/**\r\n * @docs-group-description Measure\r\n * Classes for reporting point to point distances and mass properties of elements.\r\n */\r\n/**\r\n * @docs-group-description Views\r\n * Classes for [working with Views]($docs/learning/frontend/Views.md)\r\n */\r\n/**\r\n * @docs-group-description LocatingElements\r\n * Classes for locating and snapping to elements in views.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description AccuDraw\r\n * AccuDraw provides helpful assistance for creating and modifying elements in a view.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Notifications\r\n * Notifications provide feedback to the user of something of interest.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Extensions\r\n * Classes for creating and managing runtime [Extensions]($docs/learning/frontend/Extensions.md)\r\n */\r\n/**\r\n * @docs-group-description Properties\r\n * Classes for working with property records and descriptions.\r\n */\r\n/**\r\n * @docs-group-description Rendering\r\n * Classes for rendering the contents of views.\r\n */\r\n/**\r\n * @docs-group-description SelectionSet\r\n * Classes for working with the set of selected elements.\r\n * See [the learning articles]($docs/learning/frontend/index.md).\r\n */\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Native Applications\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package\r\n */\r\n/**\r\n * @docs-group-description QuantityFormatting\r\n * Classes for formatting and parsing quantity values.\r\n */\r\n/**\r\n * @docs-group-description Tiles\r\n * Classes representing graphics as [hierarchical 3d tiles](https://github.com/CesiumGS/3d-tiles).\r\n */\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n/**\r\n * @docs-group-description UserPreferences\r\n * APIs for working with user preferences in an iModelApp.\r\n * See [the learning articles]($docs/learning/frontend/preferences.md).\r\n */\r\n"]}
|
|
@@ -7,8 +7,9 @@ import { FormattingUnitSystemChangedArgs, OverrideFormatEntry, QuantityFormatOve
|
|
|
7
7
|
/** This abstract class reacts to changes in the "active" iModel and updates the [[QuantityFormatter]] overrides and active
|
|
8
8
|
* presentation unit system based on stored preferences. In addition, monitors the [[QuantityFormatter]] for changes to format overrides and the active
|
|
9
9
|
* unit system and stores these changes. The "active" iModel is determined by listening to the `IModelApp.viewManager.onSelectedViewportChanged` event
|
|
10
|
-
*
|
|
11
|
-
* @beta
|
|
10
|
+
* and gets the iModel from the selected viewport.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
12
13
|
export declare abstract class BaseUnitFormattingSettingsProvider implements UnitFormattingSettingsProvider {
|
|
13
14
|
private _quantityFormatter;
|
|
14
15
|
private _maintainOverridesPerIModel?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseUnitFormattingSettingsProvider.d.ts","sourceRoot":"","sources":["../../../src/quantity-formatting/BaseUnitFormattingSettingsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EACL,+BAA+B,EAAE,mBAAmB,EAAE,kCAAkC,EAAE,iBAAiB,EAC3G,eAAe,EAAE,8BAA8B,EAChD,MAAM,qBAAqB,CAAC;AAE7B
|
|
1
|
+
{"version":3,"file":"BaseUnitFormattingSettingsProvider.d.ts","sourceRoot":"","sources":["../../../src/quantity-formatting/BaseUnitFormattingSettingsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EACL,+BAA+B,EAAE,mBAAmB,EAAE,kCAAkC,EAAE,iBAAiB,EAC3G,eAAe,EAAE,8BAA8B,EAChD,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,8BAAsB,kCAAmC,YAAW,8BAA8B;IASpF,OAAO,CAAC,kBAAkB;IAAqB,OAAO,CAAC,2BAA2B,CAAC;IAR/F,SAAS,CAAC,iBAAiB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAE1D;;;;;OAKG;gBACiB,kBAAkB,EAAE,iBAAiB,EAAU,2BAA2B,CAAC,qBAAS;IAQxG,IAAW,0BAA0B,IAAI,OAAO,CAE/C;IAEM,oBAAoB,2CAAgD,kCAAkC,mBAwB3G;IAEF,wCAAwC;IACjC,sBAAsB,eAAoB,+BAA+B,mBAE9E;IAEW,aAAa,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE,SAAS,CAAC,wCAAwC,2DAMhD;IAEF,OAAO,CAAC,gBAAgB,CAEtB;IAEF,OAAO,CAAC,qBAAqB,CAI3B;IAEF,OAAO,CAAC,iBAAiB,CAEvB;IAEF,SAAS,KAAK,gBAAgB,iCAE7B;IAED,iIAAiI;cACjH,+BAA+B;IA8B/C,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAEtG,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,GAAC,SAAS,CAAC;IAE3F,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAEnE,yFAAyF;IACzF,QAAQ,CAAE,kBAAkB,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAE/E,gFAAgF;IAChF,QAAQ,CAAE,kBAAkB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;CAC7E"}
|
|
@@ -10,8 +10,9 @@ import { IModelConnection } from "../IModelConnection";
|
|
|
10
10
|
/** This abstract class reacts to changes in the "active" iModel and updates the [[QuantityFormatter]] overrides and active
|
|
11
11
|
* presentation unit system based on stored preferences. In addition, monitors the [[QuantityFormatter]] for changes to format overrides and the active
|
|
12
12
|
* unit system and stores these changes. The "active" iModel is determined by listening to the `IModelApp.viewManager.onSelectedViewportChanged` event
|
|
13
|
-
*
|
|
14
|
-
* @beta
|
|
13
|
+
* and gets the iModel from the selected viewport.
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
15
16
|
export class BaseUnitFormattingSettingsProvider {
|
|
16
17
|
/**
|
|
17
18
|
* @param maintainOverridesPerIModel If maintainOverridesPerIModel is true the base class will set up listeners
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseUnitFormattingSettingsProvider.js","sourceRoot":"","sources":["../../../src/quantity-formatting/BaseUnitFormattingSettingsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD;;;;WAIW;AACX,MAAM,OAAgB,kCAAkC;IAEtD;;;;;OAKG;IACH,YAAoB,kBAAqC,EAAU,2BAAqC;QAApF,uBAAkB,GAAlB,kBAAkB,CAAmB;QAAU,gCAA2B,GAA3B,2BAA2B,CAAU;QAYjG,yBAAoB,GAAG,KAAK,EAAE,EAAC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAqC,EAAE,EAAE;YAC/G,IAAI,SAAS,KAAK,aAAa,EAAE;gBAC/B,yCAAyC;gBACzC,IAAI,SAAS,KAAK,UAAU,EAAE;oBAC5B,MAAM,IAAI,CAAC,MAAM,CAAE,OAAO,CAAC,CAAC;oBAC5B,OAAO;iBACR;qBAAK;oBACJ,0DAA0D;oBAC1D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAE,OAAO,CAAC,CAAC;oBACjD,IAAI,UAAU,EAAE;wBACd,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;wBAC9B,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;4BAClC,MAAM,IAAI,CAAC,KAAK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F,IAAI,eAAe,EAAE;gBACnB,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC;gBACpC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAE,OAAO,CAAC,CAAC;gBACpD,IAAI,aAAa,EAAE;oBACjB,mEAAmE;oBACnE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAE,CAAC,SAAS,EAAE,EAAE;wBAChD,MAAM,aAAa,GAAG,SAA0B,CAAC;wBACjD,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;wBAC3C,IAAI,KAAK,EAAE;4BACT,IAAI,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;gCAC1C,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAE,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;6BAC7D;iCAAM;gCACL,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;gCAC9C,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gCAC3B,mBAAmB,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;6BAChD;yBACF;oBACH,CAAC,CAAC,CAAC;iBACJ;aACF;SACF;QACD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CAgBF","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 QuantityFormatting\r\n */\r\n\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { SelectedViewportChangedArgs } from \"../ViewManager\";\r\nimport {\r\n FormattingUnitSystemChangedArgs, OverrideFormatEntry, QuantityFormatOverridesChangedArgs, QuantityFormatter,\r\n QuantityTypeKey, UnitFormattingSettingsProvider,\r\n} from \"./QuantityFormatter\";\r\n\r\n/** This abstract class reacts to changes in the \"active\" iModel and updates the [[QuantityFormatter]] overrides and active\r\n * presentation unit system based on stored preferences. In addition, monitors the [[QuantityFormatter]] for changes to format overrides and the active\r\n * unit system and stores these changes. The \"active\" iModel is determined by listening to the `IModelApp.viewManager.onSelectedViewportChanged` event\r\n * and gets the iModel from the selected viewport.\r\n * @beta */\r\nexport abstract class BaseUnitFormattingSettingsProvider implements UnitFormattingSettingsProvider {\r\n protected _imodelConnection: IModelConnection|undefined;\r\n /**\r\n * @param maintainOverridesPerIModel If maintainOverridesPerIModel is true the base class will set up listeners\r\n * to monitor \"active\" iModel changes so the overrides for the QuantityFormatter properly match the overrides set\r\n * up by the user. If false then the overrides are maintained only per user.\r\n * @beta\r\n */\r\n constructor(private _quantityFormatter: QuantityFormatter, private _maintainOverridesPerIModel?: boolean) {\r\n if (this._maintainOverridesPerIModel) {\r\n IModelApp.viewManager.onSelectedViewportChanged.addListener(this.handleViewportChanged);\r\n IModelConnection.onOpen.addListener(this.handleIModelOpen);\r\n IModelConnection.onClose.addListener(this.handleIModelClose);\r\n }\r\n }\r\n\r\n public get maintainOverridesPerIModel(): boolean {\r\n return !!this._maintainOverridesPerIModel;\r\n }\r\n\r\n public storeFormatOverrides = async ({typeKey, overrideEntry, unitSystem}: QuantityFormatOverridesChangedArgs) => {\r\n if (undefined === overrideEntry) {\r\n // remove all overrides for quantity type\r\n if (undefined === unitSystem) {\r\n await this.remove (typeKey);\r\n return;\r\n }else {\r\n // remove only system specific overrides for quantity type\r\n const storedJson = await this.retrieve (typeKey);\r\n if (storedJson) {\r\n delete storedJson[unitSystem];\r\n if (Object.keys(storedJson).length) {\r\n await this.store (typeKey, storedJson);\r\n } else {\r\n await this.remove (typeKey);\r\n }\r\n }\r\n }\r\n } else {\r\n // setting a new override or set of overrides\r\n const storedJson = await this.retrieve (typeKey);\r\n const updatedFormat = {...storedJson, ...overrideEntry};\r\n await this.store (typeKey, updatedFormat);\r\n }\r\n };\r\n\r\n /** save UnitSystem for active iModel */\r\n public storeUnitSystemSetting = async ({system}: FormattingUnitSystemChangedArgs) => {\r\n await this.storeUnitSystemKey(system);\r\n };\r\n\r\n public async loadOverrides(imodel?: IModelConnection): Promise<void> {\r\n await this.applyQuantityFormattingSettingsForIModel(imodel);\r\n }\r\n\r\n protected applyQuantityFormattingSettingsForIModel = async (imodel?: IModelConnection) => {\r\n if (this._maintainOverridesPerIModel)\r\n this._imodelConnection = imodel;\r\n const overrideFormatProps = await this.buildQuantityFormatOverridesMap();\r\n const unitSystemKey = await this.retrieveUnitSystem (this._quantityFormatter.activeUnitSystem);\r\n await this._quantityFormatter.reinitializeFormatAndParsingsMaps(overrideFormatProps, unitSystemKey, true, true);\r\n };\r\n\r\n private handleIModelOpen = async (imodel: IModelConnection) => {\r\n await this.applyQuantityFormattingSettingsForIModel (imodel);\r\n };\r\n\r\n private handleViewportChanged = async (args: SelectedViewportChangedArgs) => {\r\n if(args.current?.iModel && (args.current?.iModel?.iModelId !== this.imodelConnection?.iModelId)) {\r\n await this.applyQuantityFormattingSettingsForIModel (args.current?.iModel);\r\n }\r\n };\r\n\r\n private handleIModelClose = async () => {\r\n this._imodelConnection = undefined;\r\n };\r\n\r\n protected get imodelConnection() {\r\n return this._imodelConnection;\r\n }\r\n\r\n /** function to convert from serialized JSON format for Quantity Type overrides to build a map compatible with QuantityManager */\r\n protected async buildQuantityFormatOverridesMap() {\r\n const overrideFormatProps = new Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>();\r\n\r\n // use map and await all returned promises - overrides are stored by QuantityType\r\n for await (const quantityTypeKey of [...this._quantityFormatter.quantityTypesRegistry.keys()]) {\r\n const quantityTypeDef = this._quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDef) {\r\n const typeKey = quantityTypeDef.key;\r\n const overrideEntry = await this.retrieve (typeKey);\r\n if (overrideEntry) {\r\n // extract overrides and insert into appropriate override map entry\r\n Object.keys(overrideEntry).forEach ((systemKey) => {\r\n const unitSystemKey = systemKey as UnitSystemKey;\r\n const props = overrideEntry[unitSystemKey];\r\n if (props) {\r\n if (overrideFormatProps.has(unitSystemKey)) {\r\n overrideFormatProps.get(unitSystemKey)!.set(typeKey, props);\r\n } else {\r\n const newMap = new Map<string, FormatProps>();\r\n newMap.set(typeKey, props);\r\n overrideFormatProps.set(unitSystemKey, newMap);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n return overrideFormatProps;\r\n }\r\n\r\n /** Serializes JSON object containing format overrides for a specific quantity type. */\r\n abstract store(quantityTypeKey: QuantityTypeKey, overrideProps: OverrideFormatEntry): Promise<boolean>;\r\n\r\n /** Retrieves serialized JSON object containing format overrides for a specific quantity type. */\r\n abstract retrieve(quantityTypeKey: QuantityTypeKey): Promise<OverrideFormatEntry|undefined>;\r\n\r\n /** Removes the override formats for a specific quantity type. */\r\n abstract remove(quantityTypeKey: QuantityTypeKey): Promise<boolean>;\r\n\r\n /** Retrieves the active unit system typically based on the \"active\" iModelConnection. */\r\n abstract retrieveUnitSystem(defaultKey: UnitSystemKey): Promise<UnitSystemKey>;\r\n\r\n /** Store the active unit system typically for the \"active\" iModelConnection. */\r\n abstract storeUnitSystemKey(unitSystemKey: UnitSystemKey): Promise<boolean>;\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"BaseUnitFormattingSettingsProvider.js","sourceRoot":"","sources":["../../../src/quantity-formatting/BaseUnitFormattingSettingsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD;;;;;GAKG;AACH,MAAM,OAAgB,kCAAkC;IAGtD;;;;;OAKG;IACH,YAAoB,kBAAqC,EAAU,2BAAqC;QAApF,uBAAkB,GAAlB,kB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AC,CAAC;gCAC3B,mBAAmB,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;6BAChD;yBACF;oBACH,CAAC,CAAC,CAAC;iBACJ;aACF;SACF;QACD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CAgBF","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 QuantityFormatting\r\n */\r\n\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { SelectedViewportChangedArgs } from \"../ViewManager\";\r\nimport {\r\n FormattingUnitSystemChangedArgs, OverrideFormatEntry, QuantityFormatOverridesChangedArgs, QuantityFormatter,\r\n QuantityTypeKey, UnitFormattingSettingsProvider,\r\n} from \"./QuantityFormatter\";\r\n\r\n/** This abstract class reacts to changes in the \"active\" iModel and updates the [[QuantityFormatter]] overrides and active\r\n * presentation unit system based on stored preferences. In addition, monitors the [[QuantityFormatter]] for changes to format overrides and the active\r\n * unit system and stores these changes. The \"active\" iModel is determined by listening to the `IModelApp.viewManager.onSelectedViewportChanged` event\r\n * and gets the iModel from the selected viewport.\r\n * @beta\r\n */\r\nexport abstract class BaseUnitFormattingSettingsProvider implements UnitFormattingSettingsProvider {\r\n protected _imodelConnection: IModelConnection | undefined;\r\n\r\n /**\r\n * @param maintainOverridesPerIModel If maintainOverridesPerIModel is true the base class will set up listeners\r\n * to monitor \"active\" iModel changes so the overrides for the QuantityFormatter properly match the overrides set\r\n * up by the user. If false then the overrides are maintained only per user.\r\n * @beta\r\n */\r\n constructor(private _quantityFormatter: QuantityFormatter, private _maintainOverridesPerIModel?: boolean) {\r\n if (this._maintainOverridesPerIModel) {\r\n IModelApp.viewManager.onSelectedViewportChanged.addListener(this.handleViewportChanged);\r\n IModelConnection.onOpen.addListener(this.handleIModelOpen);\r\n IModelConnection.onClose.addListener(this.handleIModelClose);\r\n }\r\n }\r\n\r\n public get maintainOverridesPerIModel(): boolean {\r\n return !!this._maintainOverridesPerIModel;\r\n }\r\n\r\n public storeFormatOverrides = async ({typeKey, overrideEntry, unitSystem}: QuantityFormatOverridesChangedArgs) => {\r\n if (undefined === overrideEntry) {\r\n // remove all overrides for quantity type\r\n if (undefined === unitSystem) {\r\n await this.remove (typeKey);\r\n return;\r\n }else {\r\n // remove only system specific overrides for quantity type\r\n const storedJson = await this.retrieve (typeKey);\r\n if (storedJson) {\r\n delete storedJson[unitSystem];\r\n if (Object.keys(storedJson).length) {\r\n await this.store (typeKey, storedJson);\r\n } else {\r\n await this.remove (typeKey);\r\n }\r\n }\r\n }\r\n } else {\r\n // setting a new override or set of overrides\r\n const storedJson = await this.retrieve (typeKey);\r\n const updatedFormat = {...storedJson, ...overrideEntry};\r\n await this.store (typeKey, updatedFormat);\r\n }\r\n };\r\n\r\n /** save UnitSystem for active iModel */\r\n public storeUnitSystemSetting = async ({system}: FormattingUnitSystemChangedArgs) => {\r\n await this.storeUnitSystemKey(system);\r\n };\r\n\r\n public async loadOverrides(imodel?: IModelConnection): Promise<void> {\r\n await this.applyQuantityFormattingSettingsForIModel(imodel);\r\n }\r\n\r\n protected applyQuantityFormattingSettingsForIModel = async (imodel?: IModelConnection) => {\r\n if (this._maintainOverridesPerIModel)\r\n this._imodelConnection = imodel;\r\n const overrideFormatProps = await this.buildQuantityFormatOverridesMap();\r\n const unitSystemKey = await this.retrieveUnitSystem (this._quantityFormatter.activeUnitSystem);\r\n await this._quantityFormatter.reinitializeFormatAndParsingsMaps(overrideFormatProps, unitSystemKey, true, true);\r\n };\r\n\r\n private handleIModelOpen = async (imodel: IModelConnection) => {\r\n await this.applyQuantityFormattingSettingsForIModel (imodel);\r\n };\r\n\r\n private handleViewportChanged = async (args: SelectedViewportChangedArgs) => {\r\n if(args.current?.iModel && (args.current?.iModel?.iModelId !== this.imodelConnection?.iModelId)) {\r\n await this.applyQuantityFormattingSettingsForIModel (args.current?.iModel);\r\n }\r\n };\r\n\r\n private handleIModelClose = async () => {\r\n this._imodelConnection = undefined;\r\n };\r\n\r\n protected get imodelConnection() {\r\n return this._imodelConnection;\r\n }\r\n\r\n /** function to convert from serialized JSON format for Quantity Type overrides to build a map compatible with QuantityManager */\r\n protected async buildQuantityFormatOverridesMap() {\r\n const overrideFormatProps = new Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>();\r\n\r\n // use map and await all returned promises - overrides are stored by QuantityType\r\n for await (const quantityTypeKey of [...this._quantityFormatter.quantityTypesRegistry.keys()]) {\r\n const quantityTypeDef = this._quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDef) {\r\n const typeKey = quantityTypeDef.key;\r\n const overrideEntry = await this.retrieve (typeKey);\r\n if (overrideEntry) {\r\n // extract overrides and insert into appropriate override map entry\r\n Object.keys(overrideEntry).forEach ((systemKey) => {\r\n const unitSystemKey = systemKey as UnitSystemKey;\r\n const props = overrideEntry[unitSystemKey];\r\n if (props) {\r\n if (overrideFormatProps.has(unitSystemKey)) {\r\n overrideFormatProps.get(unitSystemKey)!.set(typeKey, props);\r\n } else {\r\n const newMap = new Map<string, FormatProps>();\r\n newMap.set(typeKey, props);\r\n overrideFormatProps.set(unitSystemKey, newMap);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n return overrideFormatProps;\r\n }\r\n\r\n /** Serializes JSON object containing format overrides for a specific quantity type. */\r\n abstract store(quantityTypeKey: QuantityTypeKey, overrideProps: OverrideFormatEntry): Promise<boolean>;\r\n\r\n /** Retrieves serialized JSON object containing format overrides for a specific quantity type. */\r\n abstract retrieve(quantityTypeKey: QuantityTypeKey): Promise<OverrideFormatEntry|undefined>;\r\n\r\n /** Removes the override formats for a specific quantity type. */\r\n abstract remove(quantityTypeKey: QuantityTypeKey): Promise<boolean>;\r\n\r\n /** Retrieves the active unit system typically based on the \"active\" iModelConnection. */\r\n abstract retrieveUnitSystem(defaultKey: UnitSystemKey): Promise<UnitSystemKey>;\r\n\r\n /** Store the active unit system typically for the \"active\" iModelConnection. */\r\n abstract storeUnitSystemKey(unitSystemKey: UnitSystemKey): Promise<boolean>;\r\n}\r\n\r\n"]}
|
|
@@ -26,9 +26,13 @@ interface UnitDefinition {
|
|
|
26
26
|
readonly name: string;
|
|
27
27
|
readonly phenomenon: string;
|
|
28
28
|
readonly displayLabel: string;
|
|
29
|
-
readonly altDisplayLabels
|
|
29
|
+
readonly altDisplayLabels?: string[];
|
|
30
30
|
readonly conversion: ConversionDef;
|
|
31
31
|
readonly system: string;
|
|
32
32
|
}
|
|
33
|
+
/** Function to generate default set of alternate unit labels
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function getDefaultAlternateUnitLabels(): Map<string, Set<string>> | undefined;
|
|
33
37
|
export {};
|
|
34
38
|
//# sourceMappingURL=BasicUnitsProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicUnitsProvider.d.ts","sourceRoot":"","sources":["../../../src/quantity-formatting/BasicUnitsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACe,cAAc,EAAE,SAAS,EAAE,aAAa,EAC7D,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"BasicUnitsProvider.d.ts","sourceRoot":"","sources":["../../../src/quantity-formatting/BasicUnitsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACe,cAAc,EAAE,SAAS,EAAE,aAAa,EAC7D,MAAM,sBAAsB,CAAC;AAK9B;;GAEG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IAEtD,uCAAuC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IA4BtG,sCAAsC;IACzB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAUvE,SAAS,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAStE,gDAAgD;IACnC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAQjE,mIAAmI;IACtH,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;CAiB5F;AAUD,+EAA+E;AAC/E,UAAU,aAAa;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAGD,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,6BAA6B,yCAU5C"}
|
|
@@ -22,12 +22,12 @@ export class BasicUnitsProvider {
|
|
|
22
22
|
if (unitSystemToFind && entry.system.toLowerCase() !== unitSystemToFind)
|
|
23
23
|
continue;
|
|
24
24
|
if (entry.displayLabel.toLowerCase() === labelToFind || entry.name.toLowerCase() === labelToFind) {
|
|
25
|
-
const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.
|
|
25
|
+
const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.system);
|
|
26
26
|
return unitProps;
|
|
27
27
|
}
|
|
28
28
|
if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {
|
|
29
29
|
if (entry.altDisplayLabels.findIndex((ref) => ref.toLowerCase() === labelToFind) !== -1) {
|
|
30
|
-
const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.
|
|
30
|
+
const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.system);
|
|
31
31
|
return unitProps;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@ export class BasicUnitsProvider {
|
|
|
40
40
|
for (const entry of UNIT_DATA) {
|
|
41
41
|
if (entry.phenomenon !== phenomenon)
|
|
42
42
|
continue;
|
|
43
|
-
units.push(new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.
|
|
43
|
+
units.push(new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.system));
|
|
44
44
|
}
|
|
45
45
|
return units;
|
|
46
46
|
}
|
|
@@ -55,7 +55,7 @@ export class BasicUnitsProvider {
|
|
|
55
55
|
async findUnitByName(unitName) {
|
|
56
56
|
const unitDataEntry = this.findUnitDefinition(unitName);
|
|
57
57
|
if (unitDataEntry) {
|
|
58
|
-
return new BasicUnit(unitDataEntry.name, unitDataEntry.displayLabel, unitDataEntry.phenomenon, unitDataEntry.
|
|
58
|
+
return new BasicUnit(unitDataEntry.name, unitDataEntry.displayLabel, unitDataEntry.phenomenon, unitDataEntry.system);
|
|
59
59
|
}
|
|
60
60
|
return new BadUnit();
|
|
61
61
|
}
|
|
@@ -84,6 +84,20 @@ class ConversionData {
|
|
|
84
84
|
this.offset = 0.0;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
/** Function to generate default set of alternate unit labels
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export function getDefaultAlternateUnitLabels() {
|
|
91
|
+
const altDisplayLabelsMap = new Map();
|
|
92
|
+
for (const entry of UNIT_DATA) {
|
|
93
|
+
if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {
|
|
94
|
+
altDisplayLabelsMap.set(entry.name, new Set(entry.altDisplayLabels));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (altDisplayLabelsMap.size)
|
|
98
|
+
return altDisplayLabelsMap;
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
87
101
|
// ========================================================================================================================================
|
|
88
102
|
// Minimum set of UNITs to be removed when official UnitsProvider is available
|
|
89
103
|
// ========================================================================================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicUnitsProvider.js","sourceRoot":"","sources":["../../../src/quantity-formatting/BasicUnitsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,OAAO,EAAE,SAAS,GACnB,MAAM,sBAAsB,CAAC;AAE9B,kCAAkC;AAElC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B,uCAAuC;IAChC,KAAK,CAAC,QAAQ,CAAC,SAAiB,EAAE,UAAmB,EAAE,UAAmB;QAC/E,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,CAAC,CAAA,SAAS,CAAC;QACzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,CAAC,CAAA,SAAS,CAAC;QAEzE,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;YAC7B,IAAI,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,gBAAgB;gBACnE,SAAS;YAEX,IAAI,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,gBAAgB;gBACrE,SAAS;YAEX,IAAI,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,WAAW,EAAE;gBAChG,MAAM,SAAS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AAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE;IACpM,EAAE,IAAI,EAAE,wBAAwB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE;IACnN,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE;IACpM,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE;CACrL,CAAC","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 QuantityFormatting\r\n */\r\n\r\nimport {\r\n BadUnit, BasicUnit, UnitConversion, UnitProps, UnitsProvider,\r\n} from \"@itwin/core-quantity\";\r\n\r\n// cSpell:ignore ussurvey USCUSTOM\r\n\r\n/** Units provider that provides a limited number of UnitDefinitions that are needed to support basic tools.\r\n * @internal\r\n */\r\nexport class BasicUnitsProvider implements UnitsProvider {\r\n /** Find a unit given the unitLabel. */\r\n public async findUnit(unitLabel: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n const labelToFind = unitLabel.toLowerCase();\r\n const unitFamilyToFind = phenomenon ? phenomenon.toLowerCase():undefined;\r\n const unitSystemToFind = unitSystem ? unitSystem.toLowerCase():undefined;\r\n\r\n for (const entry of UNIT_DATA) {\r\n if (phenomenon && entry.phenomenon.toLowerCase() !== unitFamilyToFind)\r\n continue;\r\n\r\n if (unitSystemToFind && entry.system.toLowerCase() !== unitSystemToFind)\r\n continue;\r\n\r\n if (entry.displayLabel.toLowerCase() === labelToFind || entry.name.toLowerCase() === labelToFind) {\r\n const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.altDisplayLabels, entry.system);\r\n return unitProps;\r\n }\r\n\r\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\r\n if (entry.altDisplayLabels.findIndex((ref) => ref.toLowerCase() === labelToFind) !== -1) {\r\n const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.altDisplayLabels, entry.system);\r\n return unitProps;\r\n }\r\n }\r\n }\r\n\r\n return new BadUnit();\r\n }\r\n\r\n /** find all units given phenomenon */\r\n public async getUnitsByFamily(phenomenon: string): Promise<UnitProps[]> {\r\n const units: UnitProps[] = [];\r\n for (const entry of UNIT_DATA) {\r\n if (entry.phenomenon !== phenomenon)\r\n continue;\r\n units.push(new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.altDisplayLabels, entry.system));\r\n }\r\n return units;\r\n }\r\n\r\n protected findUnitDefinition(name: string): UnitDefinition | undefined {\r\n for (const entry of UNIT_DATA) {\r\n if (entry.name === name)\r\n return entry;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Find a unit given the unit's unique name. */\r\n public async findUnitByName(unitName: string): Promise<UnitProps> {\r\n const unitDataEntry = this.findUnitDefinition(unitName);\r\n if (unitDataEntry) {\r\n return new BasicUnit(unitDataEntry.name, unitDataEntry.displayLabel, unitDataEntry.phenomenon, unitDataEntry.altDisplayLabels, unitDataEntry.system);\r\n }\r\n return new BadUnit();\r\n }\r\n\r\n /** Return the information needed to convert a value between two different units. The units should be from the same phenomenon. */\r\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversion> {\r\n const fromUnitData = this.findUnitDefinition(fromUnit.name);\r\n const toUnitData = this.findUnitDefinition(toUnit.name);\r\n\r\n if (fromUnitData && toUnitData) {\r\n const deltaOffset = toUnitData.conversion.offset - fromUnitData.conversion.offset;\r\n const deltaNumerator = toUnitData.conversion.numerator * fromUnitData.conversion.denominator;\r\n const deltaDenominator = toUnitData.conversion.denominator * fromUnitData.conversion.numerator;\r\n\r\n const conversion = new ConversionData();\r\n conversion.factor = deltaNumerator / deltaDenominator;\r\n conversion.offset = deltaOffset;\r\n return conversion;\r\n }\r\n\r\n return new ConversionData();\r\n }\r\n}\r\n\r\n/** Class that implements the minimum UnitConversion interface to provide information needed to convert unit values.\r\n * @alpha\r\n */\r\nclass ConversionData implements UnitConversion {\r\n public factor: number = 1.0;\r\n public offset: number = 0.0;\r\n}\r\n\r\n/** interface use to define unit conversions to a base used for a phenomenon */\r\ninterface ConversionDef {\r\n numerator: number;\r\n denominator: number;\r\n offset: number;\r\n}\r\n\r\n// Temporary interface use to define structure of the unit definitions in this example.\r\ninterface UnitDefinition {\r\n readonly name: string;\r\n readonly phenomenon: string;\r\n readonly displayLabel: string;\r\n readonly altDisplayLabels: string[];\r\n readonly conversion: ConversionDef;\r\n readonly system: string;\r\n}\r\n\r\n// ========================================================================================================================================\r\n// Minimum set of UNITs to be removed when official UnitsProvider is available\r\n// ========================================================================================================================================\r\n// cSpell:ignore MILLIINCH, MICROINCH, MILLIFOOT\r\n// Set of supported units - this information will come from Schema-based units once the EC package is ready to provide this information.\r\nconst UNIT_DATA: UnitDefinition[] = [\r\n // Angles ( base unit radian )\r\n { name: \"Units.RAD\", phenomenon: \"Units.ANGLE\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"rad\", altDisplayLabels: [\"radian\"] },\r\n // 1 rad = 180.0/PI °\r\n { name: \"Units.ARC_DEG\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 180.0, denominator: 3.1415926535897932384626433832795, offset: 0.0 }, displayLabel: \"°\", altDisplayLabels: [\"deg\", \"^\"] },\r\n { name: \"Units.ARC_MINUTE\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 10800.0, denominator: 3.14159265358979323846264338327950, offset: 0.0 }, displayLabel: \"'\", altDisplayLabels: [\"min\"] },\r\n { name: \"Units.ARC_SECOND\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 648000.0, denominator: 3.1415926535897932384626433832795, offset: 0.0 }, displayLabel: '\"', altDisplayLabels: [\"sec\"] },\r\n { name: \"Units.GRAD\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 200, denominator: 3.1415926535897932384626433832795, offset: 0.0 }, displayLabel: \"grad\", altDisplayLabels: [\"gd\"] },\r\n // Time ( base unit second )\r\n { name: \"Units.S\", phenomenon: \"Units.TIME\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"s\", altDisplayLabels: [\"sec\"] },\r\n { name: \"Units.MIN\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 60.0, offset: 0.0 }, displayLabel: \"min\", altDisplayLabels: [] },\r\n { name: \"Units.HR\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 3600.0, offset: 0.0 }, displayLabel: \"h\", altDisplayLabels: [\"hr\"] },\r\n { name: \"Units.DAY\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 86400.0, offset: 0.0 }, displayLabel: \"days\", altDisplayLabels: [\"day\"] },\r\n { name: \"Units.WEEK\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 604800.0, offset: 0.0 }, displayLabel: \"weeks\", altDisplayLabels: [\"week\"] },\r\n // 1 sec = 1/31536000.0 yr\r\n { name: \"Units.YR\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 31536000.0, offset: 0.0 }, displayLabel: \"years\", altDisplayLabels: [\"year\"] },\r\n // conversion => specified unit to base unit of m\r\n { name: \"Units.M\", phenomenon: \"Units.LENGTH\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"m\", altDisplayLabels: [\"meter\"] },\r\n { name: \"Units.MM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 1000.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"mm\", altDisplayLabels: [\"MM\"] },\r\n { name: \"Units.CM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 100.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"cm\", altDisplayLabels: [\"CM\"] },\r\n { name: \"Units.DM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 10.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"dm\", altDisplayLabels: [\"DM\"] },\r\n { name: \"Units.KM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 1.0, denominator: 1000.0, offset: 0.0 }, displayLabel: \"km\", altDisplayLabels: [\"KM\"] },\r\n { name: \"Units.UM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 1000000.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"µm\", altDisplayLabels: [] },\r\n { name: \"Units.MILLIINCH\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1000.0, denominator: 0.0254, offset: 0.0 }, displayLabel: \"mil\", altDisplayLabels: [] },\r\n { name: \"Units.MICROINCH\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1000000.0, denominator: 0.0254, offset: 0.0 }, displayLabel: \"µin\", altDisplayLabels: [] },\r\n { name: \"Units.MILLIFOOT\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1000.0, denominator: 0.3048, offset: 0.0 }, displayLabel: \"mft\", altDisplayLabels: [] },\r\n { name: \"Units.IN\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.0254, offset: 0.0 }, displayLabel: \"in\", altDisplayLabels: [\"IN\", \"\\\"\"] },\r\n { name: \"Units.FT\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.3048, offset: 0.0 }, displayLabel: \"ft\", altDisplayLabels: [\"F\", \"FT\", \"'\"] },\r\n { name: \"Units.CHAIN\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 66.0 * 0.3048, offset: 0.0 }, displayLabel: \"chain\", altDisplayLabels: [\"CHAIN\"] },\r\n { name: \"Units.YRD\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.9144, offset: 0.0 }, displayLabel: \"yd\", altDisplayLabels: [\"YRD\", \"yrd\"] },\r\n { name: \"Units.MILE\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 1609.344, offset: 0.0 }, displayLabel: \"mi\", altDisplayLabels: [\"mile\", \"Miles\", \"Mile\"] },\r\n { name: \"Units.US_SURVEY_FT\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 1200.0, offset: 0.0 }, displayLabel: \"ft (US Survey)\", altDisplayLabels: [\"ft\", \"SF\", \"USF\", \"ft (US Survey)\"] },\r\n { name: \"Units.US_SURVEY_YRD\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 3.0 * 1200.0, offset: 0.0 }, displayLabel: \"yrd (US Survey)\", altDisplayLabels: [\"USY\", \"yards (US Survey)\"] },\r\n { name: \"Units.US_SURVEY_IN\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 100.0, offset: 0.0 }, displayLabel: \"in (US Survey)\", altDisplayLabels: [\"USI\", \"inches (US Survey)\"] },\r\n { name: \"Units.US_SURVEY_MILE\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 5280.0 * 1200.0, offset: 0.0 }, displayLabel: \"mi (US Survey)\", altDisplayLabels: [\"miles (US Survey)\", \"mile (US Survey)\", \"USM\"] },\r\n { name: \"Units.US_SURVEY_CHAIN\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 1.0, denominator: 20.11684, offset: 0.0 }, displayLabel: \"chain (US Survey)\", altDisplayLabels: [\"chains (US Survey)\"] },\r\n // conversion => specified unit to base unit of m²\r\n { name: \"Units.SQ_FT\", phenomenon: \"Units.AREA\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: .09290304, offset: 0.0 }, displayLabel: \"ft²\", altDisplayLabels: [\"sf\"] },\r\n { name: \"Units.SQ_US_SURVEY_FT\", phenomenon: \"Units.AREA\", system: \"Units.USCUSTOM\", conversion: { numerator: 15499969.0, denominator: 1440000, offset: 0.0 }, displayLabel: \"ft² (US Survey)\", altDisplayLabels: [\"sussf\"] },\r\n { name: \"Units.SQ_M\", phenomenon: \"Units.AREA\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"m²\", altDisplayLabels: [\"sm\"] },\r\n // conversion => specified unit to base unit m³\r\n { name: \"Units.CUB_FT\", phenomenon: \"Units.VOLUME\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.028316847, offset: 0.0 }, displayLabel: \"ft³\", altDisplayLabels: [\"cf\"] },\r\n { name: \"Units.CUB_US_SURVEY_FT\", phenomenon: \"Units.VOLUME\", system: \"Units.USSURVEY\", conversion: { numerator: 1, denominator: 0.0283170164937591, offset: 0.0 }, displayLabel: \"ft³\", altDisplayLabels: [\"cf\"] },\r\n { name: \"Units.CUB_YRD\", phenomenon: \"Units.VOLUME\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.76455486, offset: 0.0 }, displayLabel: \"yd³\", altDisplayLabels: [\"cy\"] },\r\n { name: \"Units.CUB_M\", phenomenon: \"Units.VOLUME\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"m³\", altDisplayLabels: [\"cm\"] },\r\n];\r\n"]}
|
|
1
|
+
{"version":3,"file":"BasicUnitsProvider.js","sourceRoot":"","sources":["../../../src/quantity-formatting/BasicUnitsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,OAAO,EAAE,SAAS,GACnB,MAAM,sBAAsB,CAAC;AAG9B,kCAAkC;AAElC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAE7B,uCAAuC;IAChC,KAAK,CAAC,QAAQ,CAAC,SAAiB,EAAE,UAAmB,EAAE,UAAmB;QAC/E,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3E,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,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AAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE;IACpM,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE;CACrL,CAAC","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 QuantityFormatting\r\n */\r\n\r\nimport {\r\n BadUnit, BasicUnit, UnitConversion, UnitProps, UnitsProvider,\r\n} from \"@itwin/core-quantity\";\r\nimport { UnitNameKey } from \"./QuantityFormatter\";\r\n\r\n// cSpell:ignore ussurvey USCUSTOM\r\n\r\n/** Units provider that provides a limited number of UnitDefinitions that are needed to support basic tools.\r\n * @internal\r\n */\r\nexport class BasicUnitsProvider implements UnitsProvider {\r\n\r\n /** Find a unit given the unitLabel. */\r\n public async findUnit(unitLabel: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n const labelToFind = unitLabel.toLowerCase();\r\n const unitFamilyToFind = phenomenon ? phenomenon.toLowerCase() : undefined;\r\n const unitSystemToFind = unitSystem ? unitSystem.toLowerCase() : undefined;\r\n\r\n for (const entry of UNIT_DATA) {\r\n if (phenomenon && entry.phenomenon.toLowerCase() !== unitFamilyToFind)\r\n continue;\r\n\r\n if (unitSystemToFind && entry.system.toLowerCase() !== unitSystemToFind)\r\n continue;\r\n\r\n if (entry.displayLabel.toLowerCase() === labelToFind || entry.name.toLowerCase() === labelToFind) {\r\n const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.system);\r\n return unitProps;\r\n }\r\n\r\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\r\n if (entry.altDisplayLabels.findIndex((ref) => ref.toLowerCase() === labelToFind) !== -1) {\r\n const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.system);\r\n return unitProps;\r\n }\r\n }\r\n }\r\n\r\n return new BadUnit();\r\n }\r\n\r\n /** find all units given phenomenon */\r\n public async getUnitsByFamily(phenomenon: string): Promise<UnitProps[]> {\r\n const units: UnitProps[] = [];\r\n for (const entry of UNIT_DATA) {\r\n if (entry.phenomenon !== phenomenon)\r\n continue;\r\n units.push(new BasicUnit(entry.name, entry.displayLabel, entry.phenomenon, entry.system));\r\n }\r\n return units;\r\n }\r\n\r\n protected findUnitDefinition(name: string): UnitDefinition | undefined {\r\n for (const entry of UNIT_DATA) {\r\n if (entry.name === name)\r\n return entry;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Find a unit given the unit's unique name. */\r\n public async findUnitByName(unitName: string): Promise<UnitProps> {\r\n const unitDataEntry = this.findUnitDefinition(unitName);\r\n if (unitDataEntry) {\r\n return new BasicUnit(unitDataEntry.name, unitDataEntry.displayLabel, unitDataEntry.phenomenon, unitDataEntry.system);\r\n }\r\n return new BadUnit();\r\n }\r\n\r\n /** Return the information needed to convert a value between two different units. The units should be from the same phenomenon. */\r\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversion> {\r\n const fromUnitData = this.findUnitDefinition(fromUnit.name);\r\n const toUnitData = this.findUnitDefinition(toUnit.name);\r\n\r\n if (fromUnitData && toUnitData) {\r\n const deltaOffset = toUnitData.conversion.offset - fromUnitData.conversion.offset;\r\n const deltaNumerator = toUnitData.conversion.numerator * fromUnitData.conversion.denominator;\r\n const deltaDenominator = toUnitData.conversion.denominator * fromUnitData.conversion.numerator;\r\n\r\n const conversion = new ConversionData();\r\n conversion.factor = deltaNumerator / deltaDenominator;\r\n conversion.offset = deltaOffset;\r\n return conversion;\r\n }\r\n\r\n return new ConversionData();\r\n }\r\n}\r\n\r\n/** Class that implements the minimum UnitConversion interface to provide information needed to convert unit values.\r\n * @alpha\r\n */\r\nclass ConversionData implements UnitConversion {\r\n public factor: number = 1.0;\r\n public offset: number = 0.0;\r\n}\r\n\r\n/** interface use to define unit conversions to a base used for a phenomenon */\r\ninterface ConversionDef {\r\n numerator: number;\r\n denominator: number;\r\n offset: number;\r\n}\r\n\r\n// Temporary interface use to define structure of the unit definitions in this example.\r\ninterface UnitDefinition {\r\n readonly name: string;\r\n readonly phenomenon: string;\r\n readonly displayLabel: string;\r\n readonly altDisplayLabels?: string[];\r\n readonly conversion: ConversionDef;\r\n readonly system: string;\r\n}\r\n\r\n/** Function to generate default set of alternate unit labels\r\n * @internal\r\n */\r\nexport function getDefaultAlternateUnitLabels() {\r\n const altDisplayLabelsMap = new Map<UnitNameKey, Set<string>>();\r\n for (const entry of UNIT_DATA) {\r\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\r\n altDisplayLabelsMap.set(entry.name, new Set<string>(entry.altDisplayLabels));\r\n }\r\n }\r\n if (altDisplayLabelsMap.size)\r\n return altDisplayLabelsMap;\r\n return undefined;\r\n}\r\n\r\n// ========================================================================================================================================\r\n// Minimum set of UNITs to be removed when official UnitsProvider is available\r\n// ========================================================================================================================================\r\n// cSpell:ignore MILLIINCH, MICROINCH, MILLIFOOT\r\n// Set of supported units - this information will come from Schema-based units once the EC package is ready to provide this information.\r\nconst UNIT_DATA: UnitDefinition[] = [\r\n // Angles ( base unit radian )\r\n { name: \"Units.RAD\", phenomenon: \"Units.ANGLE\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"rad\", altDisplayLabels: [\"radian\"] },\r\n // 1 rad = 180.0/PI °\r\n { name: \"Units.ARC_DEG\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 180.0, denominator: 3.1415926535897932384626433832795, offset: 0.0 }, displayLabel: \"°\", altDisplayLabels: [\"deg\", \"^\"] },\r\n { name: \"Units.ARC_MINUTE\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 10800.0, denominator: 3.14159265358979323846264338327950, offset: 0.0 }, displayLabel: \"'\", altDisplayLabels: [\"min\"] },\r\n { name: \"Units.ARC_SECOND\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 648000.0, denominator: 3.1415926535897932384626433832795, offset: 0.0 }, displayLabel: '\"', altDisplayLabels: [\"sec\"] },\r\n { name: \"Units.GRAD\", phenomenon: \"Units.ANGLE\", system: \"Units.METRIC\", conversion: { numerator: 200, denominator: 3.1415926535897932384626433832795, offset: 0.0 }, displayLabel: \"grad\", altDisplayLabels: [\"gd\"] },\r\n // Time ( base unit second )\r\n { name: \"Units.S\", phenomenon: \"Units.TIME\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"s\", altDisplayLabels: [\"sec\"] },\r\n { name: \"Units.MIN\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 60.0, offset: 0.0 }, displayLabel: \"min\", altDisplayLabels: [] },\r\n { name: \"Units.HR\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 3600.0, offset: 0.0 }, displayLabel: \"h\", altDisplayLabels: [\"hr\"] },\r\n { name: \"Units.DAY\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 86400.0, offset: 0.0 }, displayLabel: \"days\", altDisplayLabels: [\"day\"] },\r\n { name: \"Units.WEEK\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 604800.0, offset: 0.0 }, displayLabel: \"weeks\", altDisplayLabels: [\"week\"] },\r\n // 1 sec = 1/31536000.0 yr\r\n { name: \"Units.YR\", phenomenon: \"Units.TIME\", system: \"Units.INTERNATIONAL\", conversion: { numerator: 1.0, denominator: 31536000.0, offset: 0.0 }, displayLabel: \"years\", altDisplayLabels: [\"year\"] },\r\n // conversion => specified unit to base unit of m\r\n { name: \"Units.M\", phenomenon: \"Units.LENGTH\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"m\", altDisplayLabels: [\"meter\"] },\r\n { name: \"Units.MM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 1000.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"mm\", altDisplayLabels: [\"MM\"] },\r\n { name: \"Units.CM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 100.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"cm\", altDisplayLabels: [\"CM\"] },\r\n { name: \"Units.DM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 10.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"dm\", altDisplayLabels: [\"DM\"] },\r\n { name: \"Units.KM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 1.0, denominator: 1000.0, offset: 0.0 }, displayLabel: \"km\", altDisplayLabels: [\"KM\"] },\r\n { name: \"Units.UM\", phenomenon: \"Units.LENGTH\", system: \"Units.METRIC\", conversion: { numerator: 1000000.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"µm\", altDisplayLabels: [] },\r\n { name: \"Units.MILLIINCH\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1000.0, denominator: 0.0254, offset: 0.0 }, displayLabel: \"mil\", altDisplayLabels: [] },\r\n { name: \"Units.MICROINCH\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1000000.0, denominator: 0.0254, offset: 0.0 }, displayLabel: \"µin\", altDisplayLabels: [] },\r\n { name: \"Units.MILLIFOOT\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1000.0, denominator: 0.3048, offset: 0.0 }, displayLabel: \"mft\", altDisplayLabels: [] },\r\n { name: \"Units.IN\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.0254, offset: 0.0 }, displayLabel: \"in\", altDisplayLabels: [\"IN\", \"\\\"\"] },\r\n { name: \"Units.FT\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.3048, offset: 0.0 }, displayLabel: \"ft\", altDisplayLabels: [\"F\", \"FT\", \"'\"] },\r\n { name: \"Units.CHAIN\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 66.0 * 0.3048, offset: 0.0 }, displayLabel: \"chain\", altDisplayLabels: [\"CHAIN\"] },\r\n { name: \"Units.YRD\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.9144, offset: 0.0 }, displayLabel: \"yd\", altDisplayLabels: [\"YRD\", \"yrd\"] },\r\n { name: \"Units.MILE\", phenomenon: \"Units.LENGTH\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 1609.344, offset: 0.0 }, displayLabel: \"mi\", altDisplayLabels: [\"mile\", \"Miles\", \"Mile\"] },\r\n { name: \"Units.US_SURVEY_FT\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 1200.0, offset: 0.0 }, displayLabel: \"ft (US Survey)\", altDisplayLabels: [\"ft\", \"SF\", \"USF\", \"ft (US Survey)\"] },\r\n { name: \"Units.US_SURVEY_YRD\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 3.0 * 1200.0, offset: 0.0 }, displayLabel: \"yrd (US Survey)\", altDisplayLabels: [\"USY\", \"yards (US Survey)\"] },\r\n { name: \"Units.US_SURVEY_IN\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 100.0, offset: 0.0 }, displayLabel: \"in (US Survey)\", altDisplayLabels: [\"USI\", \"inches (US Survey)\"] },\r\n { name: \"Units.US_SURVEY_MILE\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 3937.0, denominator: 5280.0 * 1200.0, offset: 0.0 }, displayLabel: \"mi (US Survey)\", altDisplayLabels: [\"miles (US Survey)\", \"mile (US Survey)\", \"USM\"] },\r\n { name: \"Units.US_SURVEY_CHAIN\", phenomenon: \"Units.LENGTH\", system: \"Units.USSURVEY\", conversion: { numerator: 1.0, denominator: 20.11684, offset: 0.0 }, displayLabel: \"chain (US Survey)\", altDisplayLabels: [\"chains (US Survey)\"] },\r\n // conversion => specified unit to base unit of m²\r\n { name: \"Units.SQ_FT\", phenomenon: \"Units.AREA\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: .09290304, offset: 0.0 }, displayLabel: \"ft²\", altDisplayLabels: [\"sf\"] },\r\n { name: \"Units.SQ_US_SURVEY_FT\", phenomenon: \"Units.AREA\", system: \"Units.USCUSTOM\", conversion: { numerator: 15499969.0, denominator: 1440000, offset: 0.0 }, displayLabel: \"ft² (US Survey)\", altDisplayLabels: [\"sussf\"] },\r\n { name: \"Units.SQ_M\", phenomenon: \"Units.AREA\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"m²\", altDisplayLabels: [\"sm\"] },\r\n // conversion => specified unit to base unit m³\r\n { name: \"Units.CUB_FT\", phenomenon: \"Units.VOLUME\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.028316847, offset: 0.0 }, displayLabel: \"ft³\", altDisplayLabels: [\"cf\"] },\r\n { name: \"Units.CUB_US_SURVEY_FT\", phenomenon: \"Units.VOLUME\", system: \"Units.USSURVEY\", conversion: { numerator: 1, denominator: 0.0283170164937591, offset: 0.0 }, displayLabel: \"ft³\", altDisplayLabels: [\"cf\"] },\r\n { name: \"Units.CUB_YRD\", phenomenon: \"Units.VOLUME\", system: \"Units.USCUSTOM\", conversion: { numerator: 1.0, denominator: 0.76455486, offset: 0.0 }, displayLabel: \"yd³\", altDisplayLabels: [\"cy\"] },\r\n { name: \"Units.CUB_M\", phenomenon: \"Units.VOLUME\", system: \"Units.SI\", conversion: { numerator: 1.0, denominator: 1.0, offset: 0.0 }, displayLabel: \"m³\", altDisplayLabels: [\"cm\"] },\r\n];\r\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module QuantityFormatting
|
|
3
3
|
*/
|
|
4
4
|
import { BeUiEvent } from "@itwin/core-bentley";
|
|
5
|
-
import { FormatProps, FormatterSpec, ParserSpec, QuantityParseResult, UnitConversion, UnitProps, UnitsProvider, UnitSystemKey } from "@itwin/core-quantity";
|
|
5
|
+
import { AlternateUnitLabelsProvider, FormatProps, FormatterSpec, ParserSpec, QuantityParseResult, UnitConversion, UnitProps, UnitsProvider, UnitSystemKey } from "@itwin/core-quantity";
|
|
6
6
|
import { IModelConnection } from "../IModelConnection";
|
|
7
7
|
/** Defines standard format types for tools that need to display measurements to user. Kept only to provide compatibility for existing API.
|
|
8
8
|
* @beta
|
|
@@ -26,6 +26,21 @@ export declare type QuantityTypeArg = QuantityType | string;
|
|
|
26
26
|
* @beta
|
|
27
27
|
*/
|
|
28
28
|
export declare type QuantityTypeKey = string;
|
|
29
|
+
/** String used to uniquely identify a UnitProp.
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export declare type UnitNameKey = string;
|
|
33
|
+
/**
|
|
34
|
+
* Class that contains alternate Unit Labels. These labels are used when parsing strings to quantities.
|
|
35
|
+
* One use case is to allow a "^", which is easily input, to be used to specify "°".
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare class AlternateUnitLabelsRegistry implements AlternateUnitLabelsProvider {
|
|
39
|
+
private _alternateLabelRegistry;
|
|
40
|
+
addAlternateLabels(key: UnitNameKey, ...labels: string[]): void;
|
|
41
|
+
constructor(defaultAlternates?: Map<UnitNameKey, Set<string>>);
|
|
42
|
+
getAlternateUnitLabels(unit: UnitProps): string[] | undefined;
|
|
43
|
+
}
|
|
29
44
|
/** Function to return a QuantityTypeKey given either a QuantityType or a string
|
|
30
45
|
* @beta
|
|
31
46
|
*/
|
|
@@ -99,7 +114,7 @@ export interface QuantityTypeDefinition {
|
|
|
99
114
|
/** Generate a [FormatterSpec]$(core-quantity) that will be called to format values.*/
|
|
100
115
|
generateFormatterSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider) => Promise<FormatterSpec>;
|
|
101
116
|
/** Generate a [ParserSpec]$(core-quantity) that will be called to parse a string into a quantity value.*/
|
|
102
|
-
generateParserSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider) => Promise<ParserSpec>;
|
|
117
|
+
generateParserSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider, alternateUnitLabelsProvider?: AlternateUnitLabelsProvider) => Promise<ParserSpec>;
|
|
103
118
|
}
|
|
104
119
|
/** CustomQuantityTypeDefinition interface is used to define a Custom quantity type that can be registered with the [[QuantityFormatter]].
|
|
105
120
|
* A custom quantity formatter must be able to generate a FormatterSpec and ParserSpec that will be called to format and parse values.
|
|
@@ -201,13 +216,14 @@ export interface UnitFormattingSettingsProvider {
|
|
|
201
216
|
*/
|
|
202
217
|
export declare class QuantityFormatter implements UnitsProvider {
|
|
203
218
|
private _unitsProvider;
|
|
219
|
+
private _alternateUnitLabelsRegistry;
|
|
204
220
|
protected _quantityTypeRegistry: Map<QuantityTypeKey, QuantityTypeDefinition>;
|
|
205
221
|
protected _activeUnitSystem: UnitSystemKey;
|
|
206
222
|
protected _activeFormatSpecsByType: Map<string, FormatterSpec>;
|
|
207
223
|
protected _activeParserSpecsByType: Map<string, ParserSpec>;
|
|
208
224
|
protected _overrideFormatPropsByUnitSystem: Map<UnitSystemKey, Map<string, FormatProps>>;
|
|
209
225
|
protected _unitFormattingSettingsProvider: UnitFormattingSettingsProvider | undefined;
|
|
210
|
-
/**
|
|
226
|
+
/** Set the settings provider and if not iModel specific initialize setting for user. */
|
|
211
227
|
setUnitFormattingSettingsProvider(provider: UnitFormattingSettingsProvider): Promise<void>;
|
|
212
228
|
/** Called after the active unit system is changed.
|
|
213
229
|
* The system will report the UnitSystemKey/name of the the system that was activated.
|
|
@@ -243,6 +259,13 @@ export declare class QuantityFormatter implements UnitsProvider {
|
|
|
243
259
|
*/
|
|
244
260
|
onInitialized(): Promise<void>;
|
|
245
261
|
get quantityTypesRegistry(): Map<string, QuantityTypeDefinition>;
|
|
262
|
+
get alternateUnitLabelsProvider(): AlternateUnitLabelsProvider;
|
|
263
|
+
/**
|
|
264
|
+
* Add one or more alternate labels for a unit - these labels are used during string parsing.
|
|
265
|
+
* @param key UnitNameKey which comes from `UnitProps.name`
|
|
266
|
+
* @param labels one or more unit labels
|
|
267
|
+
*/
|
|
268
|
+
addAlternateLabels(key: UnitNameKey, ...labels: string[]): void;
|
|
246
269
|
get unitsProvider(): UnitsProvider;
|
|
247
270
|
set unitsProvider(unitsProvider: UnitsProvider);
|
|
248
271
|
registerQuantityType(entry: CustomQuantityTypeDefinition, replace?: boolean): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantityFormatter.d.ts","sourceRoot":"","sources":["../../../src/quantity-formatting/QuantityFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"QuantityFormatter.d.ts","sourceRoot":"","sources":["../../../src/quantity-formatting/QuantityFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,q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AAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAgBjI;;;;OAIG;IACU,2BAA2B,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAOtH;;;;OAIG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,GAAG,SAAS,GAAG,MAAM;IAOvF;;;;OAIG;IACI,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,mBAAmB;IAMtG;OACG;IACI,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,aAAa;IAwBrF,iBAAiB,CAAC,IAAI,EAAE,eAAe,EAAE,yBAAyB,CAAC,EAAE,OAAO,GAAG,OAAO;IAiBtF,4BAA4B,CAAC,YAAY,EAAE,eAAe,EAAE,eAAe,CAAC,EAAE,aAAa,EAAE,eAAe,CAAC,EAAE,OAAO;IAQhH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAIzF,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAI1D,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAIpD,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;CAG5F"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { BeUiEvent } from "@itwin/core-bentley";
|
|
9
9
|
import { Format, FormatterSpec, ParseError, ParserSpec, } from "@itwin/core-quantity";
|
|
10
10
|
import { IModelApp } from "../IModelApp";
|
|
11
|
-
import { BasicUnitsProvider } from "./BasicUnitsProvider";
|
|
11
|
+
import { BasicUnitsProvider, getDefaultAlternateUnitLabels } from "./BasicUnitsProvider";
|
|
12
12
|
// cSpell:ignore FORMATPROPS FORMATKEY ussurvey uscustomary USCUSTOM
|
|
13
13
|
/** Defines standard format types for tools that need to display measurements to user. Kept only to provide compatibility for existing API.
|
|
14
14
|
* @beta
|
|
@@ -25,6 +25,29 @@ export var QuantityType;
|
|
|
25
25
|
QuantityType[QuantityType["LengthSurvey"] = 8] = "LengthSurvey";
|
|
26
26
|
QuantityType[QuantityType["LengthEngineering"] = 9] = "LengthEngineering";
|
|
27
27
|
})(QuantityType || (QuantityType = {}));
|
|
28
|
+
/**
|
|
29
|
+
* Class that contains alternate Unit Labels. These labels are used when parsing strings to quantities.
|
|
30
|
+
* One use case is to allow a "^", which is easily input, to be used to specify "°".
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export class AlternateUnitLabelsRegistry {
|
|
34
|
+
constructor(defaultAlternates) {
|
|
35
|
+
this._alternateLabelRegistry = new Map();
|
|
36
|
+
if (defaultAlternates) {
|
|
37
|
+
this._alternateLabelRegistry = defaultAlternates;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
addAlternateLabels(key, ...labels) {
|
|
41
|
+
[...labels].forEach((value) => { var _a; return (_a = this._alternateLabelRegistry.get(key)) === null || _a === void 0 ? void 0 : _a.add(value); });
|
|
42
|
+
}
|
|
43
|
+
getAlternateUnitLabels(unit) {
|
|
44
|
+
const key = unit.name;
|
|
45
|
+
const labels = this._alternateLabelRegistry.get(key);
|
|
46
|
+
if (labels)
|
|
47
|
+
return [...labels.values()];
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
28
51
|
/** Function to return a QuantityTypeKey given either a QuantityType or a string
|
|
29
52
|
* @beta
|
|
30
53
|
*/
|
|
@@ -69,16 +92,18 @@ class StandardQuantityTypeDefinition {
|
|
|
69
92
|
}
|
|
70
93
|
get key() { return this._key; }
|
|
71
94
|
get label() {
|
|
95
|
+
var _a;
|
|
72
96
|
if (!this._label) {
|
|
73
97
|
this._label = IModelApp.localization.getLocalizedString(this._labelKey);
|
|
74
98
|
}
|
|
75
|
-
return this._label;
|
|
99
|
+
return (_a = this._label) !== null && _a !== void 0 ? _a : "";
|
|
76
100
|
}
|
|
77
101
|
get description() {
|
|
102
|
+
var _a;
|
|
78
103
|
if (!this._description) {
|
|
79
104
|
this._description = IModelApp.localization.getLocalizedString(this._descriptionKey);
|
|
80
105
|
}
|
|
81
|
-
return this._description;
|
|
106
|
+
return (_a = this._description) !== null && _a !== void 0 ? _a : this.label;
|
|
82
107
|
}
|
|
83
108
|
getDefaultFormatPropsBySystem(requestedSystem) {
|
|
84
109
|
// Fallback same as Format "DefaultRealU" in Formats ecschema
|
|
@@ -104,9 +129,9 @@ class StandardQuantityTypeDefinition {
|
|
|
104
129
|
const format = await Format.createFromJSON(this.key, unitsProvider, formatProps);
|
|
105
130
|
return FormatterSpec.create(format.name, format, unitsProvider, this.persistenceUnit);
|
|
106
131
|
}
|
|
107
|
-
async generateParserSpec(formatProps, unitsProvider) {
|
|
132
|
+
async generateParserSpec(formatProps, unitsProvider, alternateUnitLabelsProvider) {
|
|
108
133
|
const format = await Format.createFromJSON(this.key, unitsProvider, formatProps);
|
|
109
|
-
return ParserSpec.create(format, unitsProvider, this.persistenceUnit);
|
|
134
|
+
return ParserSpec.create(format, unitsProvider, this.persistenceUnit, alternateUnitLabelsProvider);
|
|
110
135
|
}
|
|
111
136
|
}
|
|
112
137
|
/** Class that supports formatting quantity values into strings and parsing strings into quantity values. This class also maintains
|
|
@@ -128,6 +153,7 @@ export class QuantityFormatter {
|
|
|
128
153
|
*/
|
|
129
154
|
constructor(showMetricOrUnitSystem) {
|
|
130
155
|
this._unitsProvider = new BasicUnitsProvider();
|
|
156
|
+
this._alternateUnitLabelsRegistry = new AlternateUnitLabelsRegistry(getDefaultAlternateUnitLabels());
|
|
131
157
|
this._quantityTypeRegistry = new Map();
|
|
132
158
|
this._activeUnitSystem = "imperial";
|
|
133
159
|
this._activeFormatSpecsByType = new Map();
|
|
@@ -150,7 +176,7 @@ export class QuantityFormatter {
|
|
|
150
176
|
this._activeUnitSystem = showMetricOrUnitSystem;
|
|
151
177
|
}
|
|
152
178
|
}
|
|
153
|
-
/**
|
|
179
|
+
/** Set the settings provider and if not iModel specific initialize setting for user. */
|
|
154
180
|
async setUnitFormattingSettingsProvider(provider) {
|
|
155
181
|
this._unitFormattingSettingsProvider = provider;
|
|
156
182
|
if (!provider.maintainOverridesPerIModel)
|
|
@@ -224,7 +250,7 @@ export class QuantityFormatter {
|
|
|
224
250
|
}
|
|
225
251
|
async loadFormatAndParserSpec(quantityTypeDefinition, formatProps) {
|
|
226
252
|
const formatterSpec = await quantityTypeDefinition.generateFormatterSpec(formatProps, this.unitsProvider);
|
|
227
|
-
const parserSpec = await quantityTypeDefinition.generateParserSpec(formatProps, this.unitsProvider);
|
|
253
|
+
const parserSpec = await quantityTypeDefinition.generateParserSpec(formatProps, this.unitsProvider, this.alternateUnitLabelsProvider);
|
|
228
254
|
this._activeFormatSpecsByType.set(quantityTypeDefinition.key, formatterSpec);
|
|
229
255
|
this._activeParserSpecsByType.set(quantityTypeDefinition.key, parserSpec);
|
|
230
256
|
}
|
|
@@ -290,6 +316,18 @@ export class QuantityFormatter {
|
|
|
290
316
|
get quantityTypesRegistry() {
|
|
291
317
|
return this._quantityTypeRegistry;
|
|
292
318
|
}
|
|
319
|
+
get alternateUnitLabelsProvider() {
|
|
320
|
+
return this._alternateUnitLabelsRegistry;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Add one or more alternate labels for a unit - these labels are used during string parsing.
|
|
324
|
+
* @param key UnitNameKey which comes from `UnitProps.name`
|
|
325
|
+
* @param labels one or more unit labels
|
|
326
|
+
*/
|
|
327
|
+
addAlternateLabels(key, ...labels) {
|
|
328
|
+
this._alternateUnitLabelsRegistry.addAlternateLabels(key, ...labels);
|
|
329
|
+
this.onUnitsProviderChanged.emit();
|
|
330
|
+
}
|
|
293
331
|
get unitsProvider() {
|
|
294
332
|
return this._unitsProvider;
|
|
295
333
|
}
|