@itwin/core-frontend 5.12.0-dev.13 → 5.12.0-dev.15
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/AccuDraw.d.ts.map +1 -1
- package/lib/cjs/AccuDraw.js +7 -2
- package/lib/cjs/AccuDraw.js.map +1 -1
- package/lib/cjs/AuxCoordSys.d.ts +11 -4
- package/lib/cjs/AuxCoordSys.d.ts.map +1 -1
- package/lib/cjs/AuxCoordSys.js +12 -6
- package/lib/cjs/AuxCoordSys.js.map +1 -1
- package/lib/cjs/EntityState.js +1 -1
- package/lib/cjs/EntityState.js.map +1 -1
- package/lib/cjs/IpcApp.d.ts +37 -0
- package/lib/cjs/IpcApp.d.ts.map +1 -1
- package/lib/cjs/IpcApp.js +56 -26
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.d.ts +20 -3
- package/lib/cjs/tools/AccuDrawTool.d.ts.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.js +108 -58
- package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
- package/lib/esm/AccuDraw.d.ts.map +1 -1
- package/lib/esm/AccuDraw.js +8 -3
- package/lib/esm/AccuDraw.js.map +1 -1
- package/lib/esm/AuxCoordSys.d.ts +11 -4
- package/lib/esm/AuxCoordSys.d.ts.map +1 -1
- package/lib/esm/AuxCoordSys.js +13 -7
- package/lib/esm/AuxCoordSys.js.map +1 -1
- package/lib/esm/EntityState.js +1 -1
- package/lib/esm/EntityState.js.map +1 -1
- package/lib/esm/IpcApp.d.ts +37 -0
- package/lib/esm/IpcApp.d.ts.map +1 -1
- package/lib/esm/IpcApp.js +56 -27
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/tile/TileRequestChannel.js.map +1 -1
- package/lib/esm/tools/AccuDrawTool.d.ts +20 -3
- package/lib/esm/tools/AccuDrawTool.d.ts.map +1 -1
- package/lib/esm/tools/AccuDrawTool.js +109 -59
- package/lib/esm/tools/AccuDrawTool.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +23 -23
package/lib/cjs/AuxCoordSys.d.ts
CHANGED
|
@@ -40,11 +40,18 @@ export declare abstract class AuxCoordSystemState extends ElementState implement
|
|
|
40
40
|
description?: string;
|
|
41
41
|
static fromProps(props: AuxCoordSystemProps, iModel: IModelConnection): AuxCoordSystemState;
|
|
42
42
|
/** Create a new AuxCoordSystemState.
|
|
43
|
-
* @param
|
|
44
|
-
* @param iModel the iModel for which the ACS applies
|
|
45
|
-
* @note
|
|
43
|
+
* @param _acsName unused, this method creates an empty code as it lacks sufficient information to do otherwise.
|
|
44
|
+
* @param iModel the iModel for which the ACS applies
|
|
45
|
+
* @note Inserting a new named ACS element requires creating a CodeProps for the type of view and the view's definition model.
|
|
46
|
+
* This method doesn't have the information to do this so it creates an empty code.
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const codeSpecName = vp.view.isSpatialView() ? BisCodeSpec.auxCoordSystemSpatial : (vp.view.is3d() ? BisCodeSpec.auxCoordSystem3d : BisCodeSpec.auxCoordSystem2d);
|
|
50
|
+
* const codeSpec = await vp.iModel.codeSpecs.getByName(codeSpecName);
|
|
51
|
+
* const code = new Code({ spec: codeSpec.id, scope: vp.view.model, value: acsName });
|
|
52
|
+
* ```
|
|
46
53
|
*/
|
|
47
|
-
static createNew(
|
|
54
|
+
static createNew(_acsName: string, iModel: IModelConnection): AuxCoordSystemState;
|
|
48
55
|
constructor(props: AuxCoordSystemProps, iModel: IModelConnection);
|
|
49
56
|
toJSON(): AuxCoordSystemProps;
|
|
50
57
|
isValidForView(view: ViewState): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuxCoordSys.d.ts","sourceRoot":"","sources":["../../src/AuxCoordSys.ts"],"names":[],"mappings":"A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AAC,QAAQ,CAAW;gBAExB,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,gBAAgB;IAUlD,MAAM,IAAI,qBAAqB;IASxC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IACpC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IACpC,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI;CAO5C;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,qBAAqB;IACnE,WAA2B,SAAS,WAAsC;CAC3E"}
|
package/lib/cjs/AuxCoordSys.js
CHANGED
|
@@ -55,13 +55,19 @@ class AuxCoordSystemState extends EntityState_1.ElementState {
|
|
|
55
55
|
return new AuxCoordSystemSpatialState(props, iModel);
|
|
56
56
|
}
|
|
57
57
|
/** Create a new AuxCoordSystemState.
|
|
58
|
-
* @param
|
|
59
|
-
* @param iModel the iModel for which the ACS applies
|
|
60
|
-
* @note
|
|
58
|
+
* @param _acsName unused, this method creates an empty code as it lacks sufficient information to do otherwise.
|
|
59
|
+
* @param iModel the iModel for which the ACS applies
|
|
60
|
+
* @note Inserting a new named ACS element requires creating a CodeProps for the type of view and the view's definition model.
|
|
61
|
+
* This method doesn't have the information to do this so it creates an empty code.
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const codeSpecName = vp.view.isSpatialView() ? BisCodeSpec.auxCoordSystemSpatial : (vp.view.is3d() ? BisCodeSpec.auxCoordSystem3d : BisCodeSpec.auxCoordSystem2d);
|
|
65
|
+
* const codeSpec = await vp.iModel.codeSpecs.getByName(codeSpecName);
|
|
66
|
+
* const code = new Code({ spec: codeSpec.id, scope: vp.view.model, value: acsName });
|
|
67
|
+
* ```
|
|
61
68
|
*/
|
|
62
|
-
static createNew(
|
|
63
|
-
|
|
64
|
-
return new AuxCoordSystemSpatialState({ model: core_common_1.IModel.dictionaryId, code: myCode, classFullName: this.classFullName }, iModel);
|
|
69
|
+
static createNew(_acsName, iModel) {
|
|
70
|
+
return new AuxCoordSystemSpatialState({ model: core_common_1.IModel.dictionaryId, code: core_common_1.Code.createEmpty(), classFullName: this.classFullName }, iModel);
|
|
65
71
|
}
|
|
66
72
|
constructor(props, iModel) {
|
|
67
73
|
super(props, iModel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuxCoordSys.js","sourceRoot":"","sources":["../../src/AuxCoordSys.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgD;AAChD,wDAAoJ;AACpJ,oDAE4B;AAC5B,+CAA6C;AAI7C,+CAA4C;AAG5C,6DAA0D;AAE1D;;;GAGG;AACH,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,qCAAQ,CAAA;IACR,mDAAe,CAAA;IACf,mDAAe,CAAA;IACf,+CAAa,CAAA;AACf,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAED;;;GAGG;AACH,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,yDAAQ,CAAA;IACR,6DAAiB,CAAA;IACjB,yEAAuB,CAAA;IACvB,6DAAiB,CAAA;IACjB,yEAAuB,CAAA;IACvB,kEAAmB,CAAA;AACrB,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;AAgBD;;;GAGG;AACH,MAAsB,mBAAoB,SAAQ,0BAAY;IACrD,MAAM,KAAc,SAAS,KAAK,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAC5D,IAAI,CAAS;IACb,WAAW,CAAU;IAErB,MAAM,CAAC,SAAS,CAAC,KAA0B,EAAE,MAAwB;QAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC3B,OAAO,IAAI,qBAAqB,CAAC,KAAK,EAAE,MAAM,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AC,CAAC,CAAC;IACxF,SAAS,CAAC,GAAmB,IAAU,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClE,WAAW,CAAC,MAAiB,IAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAChF,WAAW,CAAC,OAAiB;QAClC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,kCAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;CACF;AArCD,sDAqCC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,qBAAqB;IAC5D,MAAM,KAAc,SAAS,KAAK,OAAO,uBAAuB,CAAC,CAAC,CAAC;CAC3E;AAFD,gEAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { JsonUtils } from \"@itwin/core-bentley\";\nimport { Angle, AngleSweep, Arc3d, Matrix3d, Point2d, Point3d, Transform, Vector3d, XAndY, XYAndZ, YawPitchRollAngles } from \"@itwin/core-geometry\";\nimport {\n AuxCoordSystem2dProps, AuxCoordSystem3dProps, AuxCoordSystemProps, BisCodeSpec, Code, ColorDef, IModel, LinePixels, Npc,\n} from \"@itwin/core-common\";\nimport { ElementState } from \"./EntityState\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\nimport { DecorateContext } from \"./ViewContext\";\nimport { CoordSystem } from \"./CoordSystem\";\nimport { Viewport } from \"./Viewport\";\nimport { ViewState } from \"./ViewState\";\nimport { GraphicType } from \"./common/render/GraphicType\";\n\n/**\n * @public\n * @extensions\n */\nexport enum ACSType {\n None = 0,\n Rectangular = 1,\n Cylindrical = 2,\n Spherical = 3,\n}\n\n/**\n * @public\n * @extensions\n */\nexport enum ACSDisplayOptions {\n None = 0, // used for testing individual bits.\n Active = (1 << 0),\n Deemphasized = (1 << 1),\n Hilite = (1 << 2),\n CheckVisible = (1 << 3),\n Dynamics = (1 << 4),\n}\n\nconst enum ACSDisplaySizes { // eslint-disable-line no-restricted-syntax\n TriadSizeInches = 0.6,\n ArrowBaseStart = 0.3,\n ArrowBaseWidth = 0.2,\n ArrowTipEnd = 1.25,\n ArrowTipStart = 0.85,\n ArrowTipFlange = 0.75,\n ArrowTipWidth = 0.4,\n ZAxisLength = 0.65,\n LabelStart = 0.4, // eslint-disable-line @typescript-eslint/no-duplicate-enum-values\n LabelEnd = 0.8,\n LabelWidth = 0.15,\n}\n\n/** The state of an AuxCoordSystem element in the frontend\n * @public\n * @extensions\n */\nexport abstract class AuxCoordSystemState extends ElementState implements AuxCoordSystemProps {\n public static override get className() { return \"AuxCoordSystem\"; }\n public type: number;\n public description?: string;\n\n public static fromProps(props: AuxCoordSystemProps, iModel: IModelConnection): AuxCoordSystemState {\n const name = props.classFullName.toLowerCase();\n if (name.endsWith(\"system2d\"))\n return new AuxCoordSystem2dState(props, iModel);\n\n if (name.endsWith(\"system3d\"))\n return new AuxCoordSystem3dState(props, iModel);\n\n return new AuxCoordSystemSpatialState(props, iModel);\n }\n\n /** Create a new AuxCoordSystemState.\n * @param acsName the name for the new AuxCoordSystem\n * @param iModel the iModel for which the ACS applies.\n * @note call this method with the appropriate subclass (e.g. AuxCoordSystemSpatialState, AuxCoordSystem2dState, etc), not on AuxCoordSystemState directly\n */\n public static createNew(acsName: string, iModel: IModelConnection): AuxCoordSystemState {\n const myCode = new Code({ spec: BisCodeSpec.auxCoordSystemSpatial, scope: IModel.dictionaryId.toString(), value: acsName });\n return new AuxCoordSystemSpatialState({ model: IModel.dictionaryId, code: myCode, classFullName: this.classFullName }, iModel);\n }\n\n public constructor(props: AuxCoordSystemProps, iModel: IModelConnection) {\n super(props, iModel);\n this.type = JsonUtils.asInt(props.type, ACSType.None);\n this.description = props.description;\n }\n public override toJSON(): AuxCoordSystemProps {\n const val = super.toJSON() as AuxCoordSystemProps;\n val.type = this.type;\n val.description = this.description;\n return val;\n }\n\n public isValidForView(view: ViewState): boolean {\n if (view.isSpatialView())\n return this instanceof AuxCoordSystemSpatialState;\n return (view.is3d() === this.is3d);\n }\n\n public abstract getOrigin(result?: Point3d): Point3d;\n public abstract setOrigin(val: XYAndZ | XAndY): void;\n /** get a *copy of* the rotation matrix for this ACS. */\n public abstract getRotation(result?: Matrix3d): Matrix3d;\n public abstract setRotation(val: Matrix3d): void;\n public get is3d(): boolean { return this instanceof AuxCoordSystem3dState; }\n\n public drawGrid(context: DecorateContext): void {\n // Called for active ACS when grid orientation is GridOrientationType::ACS.\n const view = context.viewport.view;\n const fixedRepsAuto = Point2d.create(); // limit grid to project extents\n context.drawStandardGrid(this.getOrigin(), this.getRotation(), view.getGridSpacing(), view.getGridsPerRef(), false, fixedRepsAuto);\n }\n\n /** Returns the value, clamped to the supplied range. */\n private static limitRange(min: number, max: number, val: number): number { return Math.max(min, Math.min(max, val)); }\n\n /**\n * Given an origin point, returns whether the point falls within the view or not. If adjustOrigin is set to true, a point outside\n * the view will be modified to fall within the appropriate range.\n */\n public static isOriginInView(drawOrigin: Point3d, viewport: Viewport, adjustOrigin: boolean): boolean {\n const testPtView = viewport.worldToView(drawOrigin);\n const frustum = viewport.getFrustum(CoordSystem.View);\n const screenRange = Point3d.create();\n screenRange.x = frustum.points[Npc._000].distance(frustum.points[Npc._100]);\n screenRange.y = frustum.points[Npc._000].distance(frustum.points[Npc._010]);\n screenRange.z = frustum.points[Npc._000].distance(frustum.points[Npc._001]);\n\n // Check if current acs origin is outside view...\n const inView = (!((testPtView.x < 0 || testPtView.x > screenRange.x) || (testPtView.y < 0 || testPtView.y > screenRange.y)));\n\n if (!adjustOrigin)\n return inView;\n\n if (!inView) {\n const offset = viewport.pixelsFromInches(ACSDisplaySizes.TriadSizeInches);\n testPtView.x = AuxCoordSystemState.limitRange(offset, screenRange.x - offset, testPtView.x);\n testPtView.y = AuxCoordSystemState.limitRange(offset, screenRange.y - offset, testPtView.y);\n }\n\n // Limit point to NPC box to prevent triad from being clipped from display...\n const originPtNpc = viewport.viewToNpc(testPtView);\n originPtNpc.x = AuxCoordSystemState.limitRange(0, 1, originPtNpc.x);\n originPtNpc.y = AuxCoordSystemState.limitRange(0, 1, originPtNpc.y);\n originPtNpc.z = AuxCoordSystemState.limitRange(0, 1, originPtNpc.z);\n viewport.npcToView(originPtNpc, testPtView);\n viewport.viewToWorld(testPtView, drawOrigin);\n\n return inView;\n }\n\n private getAdjustedColor(inColor: ColorDef, isFill: boolean, viewport: Viewport, options: ACSDisplayOptions): ColorDef {\n let color;\n if ((options & ACSDisplayOptions.Hilite) !== ACSDisplayOptions.None) {\n color = viewport.hilite.color;\n } else if ((options & ACSDisplayOptions.Active) !== ACSDisplayOptions.None) {\n color = inColor.equals(ColorDef.white) ? viewport.getContrastToBackgroundColor() : inColor;\n } else {\n color = ColorDef.from(150, 150, 150, 0);\n }\n\n color = color.adjustedForContrast(viewport.view.backgroundColor);\n\n if (isFill)\n color = color.withTransparency((options & (ACSDisplayOptions.Deemphasized | ACSDisplayOptions.Dynamics)) !== ACSDisplayOptions.None ? 225 : 200);\n else\n color = color.withTransparency((options & ACSDisplayOptions.Deemphasized) !== ACSDisplayOptions.None ? 150 : 75);\n\n return color;\n }\n\n private addAxisLabel(builder: GraphicBuilder, axis: number, options: ACSDisplayOptions, vp: Viewport) {\n const color = ColorDef.white;\n const lineColor = this.getAdjustedColor(color, false, vp, options);\n builder.setSymbology(lineColor, lineColor, 2);\n\n const linePts1: Point3d[] = [];\n if (0 === axis) {\n linePts1[0] = Point3d.create(ACSDisplaySizes.LabelStart, -ACSDisplaySizes.LabelWidth);\n linePts1[1] = Point3d.create(ACSDisplaySizes.LabelEnd, ACSDisplaySizes.LabelWidth);\n } else {\n linePts1[0] = Point3d.create(0.0, ACSDisplaySizes.LabelStart);\n linePts1[1] = Point3d.create(0.0, (ACSDisplaySizes.LabelStart + ACSDisplaySizes.LabelEnd) * 0.5);\n }\n builder.addLineString(linePts1);\n\n const linePts2: Point3d[] = []; // NOTE: Don't use same point array, addPointString/addLineString don't deep copy...\n if (0 === axis) {\n linePts2[0] = Point3d.create(ACSDisplaySizes.LabelStart, ACSDisplaySizes.LabelWidth);\n linePts2[1] = Point3d.create(ACSDisplaySizes.LabelEnd, -ACSDisplaySizes.LabelWidth);\n } else {\n linePts2[0] = Point3d.create(ACSDisplaySizes.LabelWidth, ACSDisplaySizes.LabelEnd);\n linePts2[1] = Point3d.create(0.0, (ACSDisplaySizes.LabelStart + ACSDisplaySizes.LabelEnd) * 0.5);\n linePts2[2] = Point3d.create(-ACSDisplaySizes.LabelWidth, ACSDisplaySizes.LabelEnd);\n }\n builder.addLineString(linePts2);\n }\n\n private addAxis(builder: GraphicBuilder, axis: number, options: ACSDisplayOptions, vp: Viewport) {\n const color = (0 === axis ? ColorDef.red : (1 === axis ? ColorDef.green : ColorDef.blue));\n const lineColor = this.getAdjustedColor(color, false, vp, options);\n const fillColor = this.getAdjustedColor(color, true, vp, options);\n\n if (axis === 2) {\n builder.setSymbology(lineColor, lineColor, 6);\n builder.addPointString([Point3d.create(0.0, 0.0, ACSDisplaySizes.ZAxisLength)]); // NOTE: ACS origin point will be drawn separately as a pickable world decoration...\n\n const linePts2: Point3d[] = [Point3d.create(), Point3d.create()]; // NOTE: Don't use same point array, addPointString/addLineString don't deep copy...\n linePts2[1].z = ACSDisplaySizes.ZAxisLength;\n builder.setSymbology(lineColor, lineColor, 1, (options & ACSDisplayOptions.Dynamics) === ACSDisplayOptions.None ? LinePixels.Solid : LinePixels.Code2);\n builder.addLineString(linePts2);\n\n const scale = ACSDisplaySizes.ArrowTipWidth / 2;\n const center = Point3d.create();\n const viewRMatrix = vp.rotation;\n\n const xVec = viewRMatrix.getRow(0);\n const yVec = viewRMatrix.getRow(1);\n\n builder.placement.matrix.multiplyTransposeVectorInPlace(xVec);\n builder.placement.matrix.multiplyTransposeVectorInPlace(yVec);\n\n xVec.normalize(xVec);\n yVec.normalize(yVec);\n\n const ellipse = Arc3d.createScaledXYColumns(center, Matrix3d.createColumns(xVec, yVec, Vector3d.create()), scale, scale, AngleSweep.createStartEnd(Angle.createRadians(0), Angle.createRadians(Math.PI * 2)));\n builder.addArc(ellipse, false, false);\n\n builder.setBlankingFill(fillColor);\n builder.addArc(ellipse, true, true);\n return;\n }\n\n const shapePts: Point3d[] = [];\n shapePts[0] = Point3d.create(ACSDisplaySizes.ArrowTipEnd, 0.0);\n shapePts[1] = Point3d.create(ACSDisplaySizes.ArrowTipFlange, ACSDisplaySizes.ArrowTipWidth);\n shapePts[2] = Point3d.create(ACSDisplaySizes.ArrowTipStart, ACSDisplaySizes.ArrowBaseWidth);\n shapePts[3] = Point3d.create(ACSDisplaySizes.ArrowBaseStart, ACSDisplaySizes.ArrowBaseWidth);\n shapePts[4] = Point3d.create(ACSDisplaySizes.ArrowBaseStart, -ACSDisplaySizes.ArrowBaseWidth);\n shapePts[5] = Point3d.create(ACSDisplaySizes.ArrowTipStart, -ACSDisplaySizes.ArrowBaseWidth);\n shapePts[6] = Point3d.create(ACSDisplaySizes.ArrowTipFlange, -ACSDisplaySizes.ArrowTipWidth);\n shapePts[7] = shapePts[0].clone();\n if (1 === axis)\n shapePts.forEach((tmpPt) => tmpPt.set(tmpPt.y, tmpPt.x));\n\n builder.setSymbology(lineColor, lineColor, 1, (options & ACSDisplayOptions.Dynamics) === ACSDisplayOptions.None ? LinePixels.Solid : LinePixels.Code2);\n builder.addLineString(shapePts);\n\n this.addAxisLabel(builder, axis, options, vp);\n\n builder.setBlankingFill(fillColor);\n builder.addShape(shapePts);\n }\n\n /** Returns a GraphicBuilder for this AuxCoordSystemState. */\n private createGraphicBuilder(context: DecorateContext, options: ACSDisplayOptions): GraphicBuilder {\n const checkOutOfView = (options & ACSDisplayOptions.CheckVisible) !== ACSDisplayOptions.None;\n const drawOrigin = this.getOrigin();\n\n if (checkOutOfView && !AuxCoordSystemState.isOriginInView(drawOrigin, context.viewport, true))\n options = options | ACSDisplayOptions.Deemphasized;\n\n let pixelSize = context.viewport.pixelsFromInches(ACSDisplaySizes.TriadSizeInches);\n\n if ((options & ACSDisplayOptions.Deemphasized) !== ACSDisplayOptions.None)\n pixelSize *= 0.8;\n else if ((options & ACSDisplayOptions.Active) !== ACSDisplayOptions.None)\n pixelSize *= 0.9;\n\n const exaggerate = context.viewport.view.getAspectRatioSkew();\n const scale = context.getPixelSizeAtPoint(drawOrigin) * pixelSize;\n const rMatrix = this.getRotation();\n\n rMatrix.transposeInPlace();\n rMatrix.scaleColumns(scale, scale / exaggerate, scale, rMatrix);\n const transform = Transform.createRefs(drawOrigin, rMatrix);\n\n const builder = context.createGraphicBuilder(GraphicType.WorldOverlay, transform);\n const vp = context.viewport;\n this.addAxis(builder, 0, options, vp);\n this.addAxis(builder, 1, options, vp);\n this.addAxis(builder, 2, options, vp);\n return builder;\n }\n\n public display(context: DecorateContext, options: ACSDisplayOptions) {\n const builder = this.createGraphicBuilder(context, options);\n if (undefined !== builder)\n context.addDecorationFromBuilder(builder);\n }\n}\n\n/** The state of an AuxCoordSystem2d element in the frontend\n * @public\n * @extensions\n */\nexport class AuxCoordSystem2dState extends AuxCoordSystemState implements AuxCoordSystem2dProps {\n public static override get className() { return \"AuxCoordSystem2d\"; }\n public readonly origin: Point2d;\n public angle: number; // in degrees\n private readonly _rMatrix: Matrix3d;\n\n constructor(props: AuxCoordSystem2dProps, iModel: IModelConnection) {\n super(props, iModel);\n this.origin = Point2d.fromJSON(props.origin);\n this.angle = JsonUtils.asDouble(props.angle);\n this._rMatrix = Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(this.angle)) ?? Matrix3d.createIdentity();\n }\n\n public override toJSON(): AuxCoordSystem2dProps {\n const val = super.toJSON() as AuxCoordSystem2dProps;\n val.origin = this.origin;\n val.angle = this.angle;\n return val;\n }\n\n public getOrigin(result?: Point3d): Point3d { return Point3d.createFrom(this.origin, result); }\n public setOrigin(val: XYAndZ | XAndY): void { this.origin.setFrom(val); }\n public getRotation(result?: Matrix3d): Matrix3d { return this._rMatrix.clone(result); }\n public setRotation(val: Matrix3d): void {\n this._rMatrix.setFrom(val);\n const angle = YawPitchRollAngles.createFromMatrix3d(val);\n this.angle = (undefined !== angle ? angle.yaw.degrees : 0.0);\n }\n}\n\n/** The state of an AuxCoordSystem3d element in the frontend\n * @public\n * @extensions\n */\nexport class AuxCoordSystem3dState extends AuxCoordSystemState implements AuxCoordSystem3dProps {\n public static override get className() { return \"AuxCoordSystem3d\"; }\n public readonly origin: Point3d;\n public yaw: number; // in degrees\n public pitch: number; // in degrees\n public roll: number; // in degrees\n private readonly _rMatrix: Matrix3d;\n\n constructor(props: AuxCoordSystem3dProps, iModel: IModelConnection) {\n super(props, iModel);\n this.origin = Point3d.fromJSON(props.origin);\n this.yaw = JsonUtils.asDouble(props.yaw);\n this.pitch = JsonUtils.asDouble(props.pitch);\n this.roll = JsonUtils.asDouble(props.roll);\n const angles = new YawPitchRollAngles(Angle.createDegrees(this.yaw), Angle.createDegrees(this.pitch), Angle.createDegrees(this.roll));\n this._rMatrix = angles.toMatrix3d();\n }\n\n public override toJSON(): AuxCoordSystem3dProps {\n const val = super.toJSON() as AuxCoordSystem3dProps;\n val.origin = this.origin;\n val.yaw = this.yaw;\n val.pitch = this.pitch;\n val.roll = this.roll;\n return val;\n }\n\n public getOrigin(result?: Point3d): Point3d { return Point3d.createFrom(this.origin, result); }\n public setOrigin(val: XYAndZ | XAndY): void { this.origin.setFrom(val); }\n public getRotation(result?: Matrix3d): Matrix3d { return this._rMatrix.clone(result); }\n public setRotation(rMatrix: Matrix3d): void {\n this._rMatrix.setFrom(rMatrix);\n const angles = YawPitchRollAngles.createFromMatrix3d(rMatrix);\n this.yaw = (undefined !== angles ? angles.yaw.degrees : 0.0);\n this.pitch = (undefined !== angles ? angles.pitch.degrees : 0.0);\n this.roll = (undefined !== angles ? angles.roll.degrees : 0.0);\n }\n}\n\n/** The state of an AuxCoordSystemSpatial element in the frontend\n * @public\n * @extensions\n */\nexport class AuxCoordSystemSpatialState extends AuxCoordSystem3dState {\n public static override get className() { return \"AuxCoordSystemSpatial\"; }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AuxCoordSys.js","sourceRoot":"","sources":["../../src/AuxCoordSys.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgD;AAChD,wDAAoJ;AACpJ,oDAE4B;AAC5B,+CAA6C;AAI7C,+CAA4C;AAG5C,6DAA0D;AAE1D;;;GAGG;AACH,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,qCAAQ,CAAA;IACR,mDAAe,CAAA;IACf,mDAAe,CAAA;IACf,+CAAa,CAAA;AACf,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAED;;;GAGG;AACH,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,yDAAQ,CAAA;IACR,6DAAiB,CAAA;IACjB,yEAAuB,CAAA;IACvB,6DAAiB,CAAA;IACjB,yEAAuB,CAAA;IACvB,kEAAmB,CAAA;AACrB,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB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AK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,SAAS,CAAC,MAAgB,IAAa,OAAO,uBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACxF,SAAS,CAAC,GAAmB,IAAU,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClE,WAAW,CAAC,MAAiB,IAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAChF,WAAW,CAAC,OAAiB;QAClC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,kCAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;CACF;AArCD,sDAqCC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,qBAAqB;IAC5D,MAAM,KAAc,SAAS,KAAK,OAAO,uBAAuB,CAAC,CAAC,CAAC;CAC3E;AAFD,gEAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { JsonUtils } from \"@itwin/core-bentley\";\nimport { Angle, AngleSweep, Arc3d, Matrix3d, Point2d, Point3d, Transform, Vector3d, XAndY, XYAndZ, YawPitchRollAngles } from \"@itwin/core-geometry\";\nimport {\n AuxCoordSystem2dProps, AuxCoordSystem3dProps, AuxCoordSystemProps, Code, ColorDef, IModel, LinePixels, Npc,\n} from \"@itwin/core-common\";\nimport { ElementState } from \"./EntityState\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\nimport { DecorateContext } from \"./ViewContext\";\nimport { CoordSystem } from \"./CoordSystem\";\nimport { Viewport } from \"./Viewport\";\nimport { ViewState } from \"./ViewState\";\nimport { GraphicType } from \"./common/render/GraphicType\";\n\n/**\n * @public\n * @extensions\n */\nexport enum ACSType {\n None = 0,\n Rectangular = 1,\n Cylindrical = 2,\n Spherical = 3,\n}\n\n/**\n * @public\n * @extensions\n */\nexport enum ACSDisplayOptions {\n None = 0, // used for testing individual bits.\n Active = (1 << 0),\n Deemphasized = (1 << 1),\n Hilite = (1 << 2),\n CheckVisible = (1 << 3),\n Dynamics = (1 << 4),\n}\n\nconst enum ACSDisplaySizes { // eslint-disable-line no-restricted-syntax\n TriadSizeInches = 0.6,\n ArrowBaseStart = 0.3,\n ArrowBaseWidth = 0.2,\n ArrowTipEnd = 1.25,\n ArrowTipStart = 0.85,\n ArrowTipFlange = 0.75,\n ArrowTipWidth = 0.4,\n ZAxisLength = 0.65,\n LabelStart = 0.4, // eslint-disable-line @typescript-eslint/no-duplicate-enum-values\n LabelEnd = 0.8,\n LabelWidth = 0.15,\n}\n\n/** The state of an AuxCoordSystem element in the frontend\n * @public\n * @extensions\n */\nexport abstract class AuxCoordSystemState extends ElementState implements AuxCoordSystemProps {\n public static override get className() { return \"AuxCoordSystem\"; }\n public type: number;\n public description?: string;\n\n public static fromProps(props: AuxCoordSystemProps, iModel: IModelConnection): AuxCoordSystemState {\n const name = props.classFullName.toLowerCase();\n if (name.endsWith(\"system2d\"))\n return new AuxCoordSystem2dState(props, iModel);\n\n if (name.endsWith(\"system3d\"))\n return new AuxCoordSystem3dState(props, iModel);\n\n return new AuxCoordSystemSpatialState(props, iModel);\n }\n\n /** Create a new AuxCoordSystemState.\n * @param _acsName unused, this method creates an empty code as it lacks sufficient information to do otherwise.\n * @param iModel the iModel for which the ACS applies\n * @note Inserting a new named ACS element requires creating a CodeProps for the type of view and the view's definition model.\n * This method doesn't have the information to do this so it creates an empty code.\n * @example\n * ```typescript\n * const codeSpecName = vp.view.isSpatialView() ? BisCodeSpec.auxCoordSystemSpatial : (vp.view.is3d() ? BisCodeSpec.auxCoordSystem3d : BisCodeSpec.auxCoordSystem2d);\n * const codeSpec = await vp.iModel.codeSpecs.getByName(codeSpecName);\n * const code = new Code({ spec: codeSpec.id, scope: vp.view.model, value: acsName });\n * ```\n */\n public static createNew(_acsName: string, iModel: IModelConnection): AuxCoordSystemState {\n return new AuxCoordSystemSpatialState({ model: IModel.dictionaryId, code: Code.createEmpty(), classFullName: this.classFullName }, iModel);\n }\n\n public constructor(props: AuxCoordSystemProps, iModel: IModelConnection) {\n super(props, iModel);\n this.type = JsonUtils.asInt(props.type, ACSType.None);\n this.description = props.description;\n }\n public override toJSON(): AuxCoordSystemProps {\n const val = super.toJSON() as AuxCoordSystemProps;\n val.type = this.type;\n val.description = this.description;\n return val;\n }\n\n public isValidForView(view: ViewState): boolean {\n if (view.isSpatialView())\n return this instanceof AuxCoordSystemSpatialState;\n return (view.is3d() === this.is3d);\n }\n\n public abstract getOrigin(result?: Point3d): Point3d;\n public abstract setOrigin(val: XYAndZ | XAndY): void;\n /** get a *copy of* the rotation matrix for this ACS. */\n public abstract getRotation(result?: Matrix3d): Matrix3d;\n public abstract setRotation(val: Matrix3d): void;\n public get is3d(): boolean { return this instanceof AuxCoordSystem3dState; }\n\n public drawGrid(context: DecorateContext): void {\n // Called for active ACS when grid orientation is GridOrientationType::ACS.\n const view = context.viewport.view;\n const fixedRepsAuto = Point2d.create(); // limit grid to project extents\n context.drawStandardGrid(this.getOrigin(), this.getRotation(), view.getGridSpacing(), view.getGridsPerRef(), false, fixedRepsAuto);\n }\n\n /** Returns the value, clamped to the supplied range. */\n private static limitRange(min: number, max: number, val: number): number { return Math.max(min, Math.min(max, val)); }\n\n /**\n * Given an origin point, returns whether the point falls within the view or not. If adjustOrigin is set to true, a point outside\n * the view will be modified to fall within the appropriate range.\n */\n public static isOriginInView(drawOrigin: Point3d, viewport: Viewport, adjustOrigin: boolean): boolean {\n const testPtView = viewport.worldToView(drawOrigin);\n const frustum = viewport.getFrustum(CoordSystem.View);\n const screenRange = Point3d.create();\n screenRange.x = frustum.points[Npc._000].distance(frustum.points[Npc._100]);\n screenRange.y = frustum.points[Npc._000].distance(frustum.points[Npc._010]);\n screenRange.z = frustum.points[Npc._000].distance(frustum.points[Npc._001]);\n\n // Check if current acs origin is outside view...\n const inView = (!((testPtView.x < 0 || testPtView.x > screenRange.x) || (testPtView.y < 0 || testPtView.y > screenRange.y)));\n\n if (!adjustOrigin)\n return inView;\n\n if (!inView) {\n const offset = viewport.pixelsFromInches(ACSDisplaySizes.TriadSizeInches);\n testPtView.x = AuxCoordSystemState.limitRange(offset, screenRange.x - offset, testPtView.x);\n testPtView.y = AuxCoordSystemState.limitRange(offset, screenRange.y - offset, testPtView.y);\n }\n\n // Limit point to NPC box to prevent triad from being clipped from display...\n const originPtNpc = viewport.viewToNpc(testPtView);\n originPtNpc.x = AuxCoordSystemState.limitRange(0, 1, originPtNpc.x);\n originPtNpc.y = AuxCoordSystemState.limitRange(0, 1, originPtNpc.y);\n originPtNpc.z = AuxCoordSystemState.limitRange(0, 1, originPtNpc.z);\n viewport.npcToView(originPtNpc, testPtView);\n viewport.viewToWorld(testPtView, drawOrigin);\n\n return inView;\n }\n\n private getAdjustedColor(inColor: ColorDef, isFill: boolean, viewport: Viewport, options: ACSDisplayOptions): ColorDef {\n let color;\n if ((options & ACSDisplayOptions.Hilite) !== ACSDisplayOptions.None) {\n color = viewport.hilite.color;\n } else if ((options & ACSDisplayOptions.Active) !== ACSDisplayOptions.None) {\n color = inColor.equals(ColorDef.white) ? viewport.getContrastToBackgroundColor() : inColor;\n } else {\n color = ColorDef.from(150, 150, 150, 0);\n }\n\n color = color.adjustedForContrast(viewport.view.backgroundColor);\n\n if (isFill)\n color = color.withTransparency((options & (ACSDisplayOptions.Deemphasized | ACSDisplayOptions.Dynamics)) !== ACSDisplayOptions.None ? 225 : 200);\n else\n color = color.withTransparency((options & ACSDisplayOptions.Deemphasized) !== ACSDisplayOptions.None ? 150 : 75);\n\n return color;\n }\n\n private addAxisLabel(builder: GraphicBuilder, axis: number, options: ACSDisplayOptions, vp: Viewport) {\n const color = ColorDef.white;\n const lineColor = this.getAdjustedColor(color, false, vp, options);\n builder.setSymbology(lineColor, lineColor, 2);\n\n const linePts1: Point3d[] = [];\n if (0 === axis) {\n linePts1[0] = Point3d.create(ACSDisplaySizes.LabelStart, -ACSDisplaySizes.LabelWidth);\n linePts1[1] = Point3d.create(ACSDisplaySizes.LabelEnd, ACSDisplaySizes.LabelWidth);\n } else {\n linePts1[0] = Point3d.create(0.0, ACSDisplaySizes.LabelStart);\n linePts1[1] = Point3d.create(0.0, (ACSDisplaySizes.LabelStart + ACSDisplaySizes.LabelEnd) * 0.5);\n }\n builder.addLineString(linePts1);\n\n const linePts2: Point3d[] = []; // NOTE: Don't use same point array, addPointString/addLineString don't deep copy...\n if (0 === axis) {\n linePts2[0] = Point3d.create(ACSDisplaySizes.LabelStart, ACSDisplaySizes.LabelWidth);\n linePts2[1] = Point3d.create(ACSDisplaySizes.LabelEnd, -ACSDisplaySizes.LabelWidth);\n } else {\n linePts2[0] = Point3d.create(ACSDisplaySizes.LabelWidth, ACSDisplaySizes.LabelEnd);\n linePts2[1] = Point3d.create(0.0, (ACSDisplaySizes.LabelStart + ACSDisplaySizes.LabelEnd) * 0.5);\n linePts2[2] = Point3d.create(-ACSDisplaySizes.LabelWidth, ACSDisplaySizes.LabelEnd);\n }\n builder.addLineString(linePts2);\n }\n\n private addAxis(builder: GraphicBuilder, axis: number, options: ACSDisplayOptions, vp: Viewport) {\n const color = (0 === axis ? ColorDef.red : (1 === axis ? ColorDef.green : ColorDef.blue));\n const lineColor = this.getAdjustedColor(color, false, vp, options);\n const fillColor = this.getAdjustedColor(color, true, vp, options);\n\n if (axis === 2) {\n builder.setSymbology(lineColor, lineColor, 6);\n builder.addPointString([Point3d.create(0.0, 0.0, ACSDisplaySizes.ZAxisLength)]); // NOTE: ACS origin point will be drawn separately as a pickable world decoration...\n\n const linePts2: Point3d[] = [Point3d.create(), Point3d.create()]; // NOTE: Don't use same point array, addPointString/addLineString don't deep copy...\n linePts2[1].z = ACSDisplaySizes.ZAxisLength;\n builder.setSymbology(lineColor, lineColor, 1, (options & ACSDisplayOptions.Dynamics) === ACSDisplayOptions.None ? LinePixels.Solid : LinePixels.Code2);\n builder.addLineString(linePts2);\n\n const scale = ACSDisplaySizes.ArrowTipWidth / 2;\n const center = Point3d.create();\n const viewRMatrix = vp.rotation;\n\n const xVec = viewRMatrix.getRow(0);\n const yVec = viewRMatrix.getRow(1);\n\n builder.placement.matrix.multiplyTransposeVectorInPlace(xVec);\n builder.placement.matrix.multiplyTransposeVectorInPlace(yVec);\n\n xVec.normalize(xVec);\n yVec.normalize(yVec);\n\n const ellipse = Arc3d.createScaledXYColumns(center, Matrix3d.createColumns(xVec, yVec, Vector3d.create()), scale, scale, AngleSweep.createStartEnd(Angle.createRadians(0), Angle.createRadians(Math.PI * 2)));\n builder.addArc(ellipse, false, false);\n\n builder.setBlankingFill(fillColor);\n builder.addArc(ellipse, true, true);\n return;\n }\n\n const shapePts: Point3d[] = [];\n shapePts[0] = Point3d.create(ACSDisplaySizes.ArrowTipEnd, 0.0);\n shapePts[1] = Point3d.create(ACSDisplaySizes.ArrowTipFlange, ACSDisplaySizes.ArrowTipWidth);\n shapePts[2] = Point3d.create(ACSDisplaySizes.ArrowTipStart, ACSDisplaySizes.ArrowBaseWidth);\n shapePts[3] = Point3d.create(ACSDisplaySizes.ArrowBaseStart, ACSDisplaySizes.ArrowBaseWidth);\n shapePts[4] = Point3d.create(ACSDisplaySizes.ArrowBaseStart, -ACSDisplaySizes.ArrowBaseWidth);\n shapePts[5] = Point3d.create(ACSDisplaySizes.ArrowTipStart, -ACSDisplaySizes.ArrowBaseWidth);\n shapePts[6] = Point3d.create(ACSDisplaySizes.ArrowTipFlange, -ACSDisplaySizes.ArrowTipWidth);\n shapePts[7] = shapePts[0].clone();\n if (1 === axis)\n shapePts.forEach((tmpPt) => tmpPt.set(tmpPt.y, tmpPt.x));\n\n builder.setSymbology(lineColor, lineColor, 1, (options & ACSDisplayOptions.Dynamics) === ACSDisplayOptions.None ? LinePixels.Solid : LinePixels.Code2);\n builder.addLineString(shapePts);\n\n this.addAxisLabel(builder, axis, options, vp);\n\n builder.setBlankingFill(fillColor);\n builder.addShape(shapePts);\n }\n\n /** Returns a GraphicBuilder for this AuxCoordSystemState. */\n private createGraphicBuilder(context: DecorateContext, options: ACSDisplayOptions): GraphicBuilder {\n const checkOutOfView = (options & ACSDisplayOptions.CheckVisible) !== ACSDisplayOptions.None;\n const drawOrigin = this.getOrigin();\n\n if (checkOutOfView && !AuxCoordSystemState.isOriginInView(drawOrigin, context.viewport, true))\n options = options | ACSDisplayOptions.Deemphasized;\n\n let pixelSize = context.viewport.pixelsFromInches(ACSDisplaySizes.TriadSizeInches);\n\n if ((options & ACSDisplayOptions.Deemphasized) !== ACSDisplayOptions.None)\n pixelSize *= 0.8;\n else if ((options & ACSDisplayOptions.Active) !== ACSDisplayOptions.None)\n pixelSize *= 0.9;\n\n const exaggerate = context.viewport.view.getAspectRatioSkew();\n const scale = context.getPixelSizeAtPoint(drawOrigin) * pixelSize;\n const rMatrix = this.getRotation();\n\n rMatrix.transposeInPlace();\n rMatrix.scaleColumns(scale, scale / exaggerate, scale, rMatrix);\n const transform = Transform.createRefs(drawOrigin, rMatrix);\n\n const builder = context.createGraphicBuilder(GraphicType.WorldOverlay, transform);\n const vp = context.viewport;\n this.addAxis(builder, 0, options, vp);\n this.addAxis(builder, 1, options, vp);\n this.addAxis(builder, 2, options, vp);\n return builder;\n }\n\n public display(context: DecorateContext, options: ACSDisplayOptions) {\n const builder = this.createGraphicBuilder(context, options);\n if (undefined !== builder)\n context.addDecorationFromBuilder(builder);\n }\n}\n\n/** The state of an AuxCoordSystem2d element in the frontend\n * @public\n * @extensions\n */\nexport class AuxCoordSystem2dState extends AuxCoordSystemState implements AuxCoordSystem2dProps {\n public static override get className() { return \"AuxCoordSystem2d\"; }\n public readonly origin: Point2d;\n public angle: number; // in degrees\n private readonly _rMatrix: Matrix3d;\n\n constructor(props: AuxCoordSystem2dProps, iModel: IModelConnection) {\n super(props, iModel);\n this.origin = Point2d.fromJSON(props.origin);\n this.angle = JsonUtils.asDouble(props.angle);\n this._rMatrix = Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(this.angle)) ?? Matrix3d.createIdentity();\n }\n\n public override toJSON(): AuxCoordSystem2dProps {\n const val = super.toJSON() as AuxCoordSystem2dProps;\n val.origin = this.origin;\n val.angle = this.angle;\n return val;\n }\n\n public getOrigin(result?: Point3d): Point3d { return Point3d.createFrom(this.origin, result); }\n public setOrigin(val: XYAndZ | XAndY): void { this.origin.setFrom(val); }\n public getRotation(result?: Matrix3d): Matrix3d { return this._rMatrix.clone(result); }\n public setRotation(val: Matrix3d): void {\n this._rMatrix.setFrom(val);\n const angle = YawPitchRollAngles.createFromMatrix3d(val);\n this.angle = (undefined !== angle ? angle.yaw.degrees : 0.0);\n }\n}\n\n/** The state of an AuxCoordSystem3d element in the frontend\n * @public\n * @extensions\n */\nexport class AuxCoordSystem3dState extends AuxCoordSystemState implements AuxCoordSystem3dProps {\n public static override get className() { return \"AuxCoordSystem3d\"; }\n public readonly origin: Point3d;\n public yaw: number; // in degrees\n public pitch: number; // in degrees\n public roll: number; // in degrees\n private readonly _rMatrix: Matrix3d;\n\n constructor(props: AuxCoordSystem3dProps, iModel: IModelConnection) {\n super(props, iModel);\n this.origin = Point3d.fromJSON(props.origin);\n this.yaw = JsonUtils.asDouble(props.yaw);\n this.pitch = JsonUtils.asDouble(props.pitch);\n this.roll = JsonUtils.asDouble(props.roll);\n const angles = new YawPitchRollAngles(Angle.createDegrees(this.yaw), Angle.createDegrees(this.pitch), Angle.createDegrees(this.roll));\n this._rMatrix = angles.toMatrix3d();\n }\n\n public override toJSON(): AuxCoordSystem3dProps {\n const val = super.toJSON() as AuxCoordSystem3dProps;\n val.origin = this.origin;\n val.yaw = this.yaw;\n val.pitch = this.pitch;\n val.roll = this.roll;\n return val;\n }\n\n public getOrigin(result?: Point3d): Point3d { return Point3d.createFrom(this.origin, result); }\n public setOrigin(val: XYAndZ | XAndY): void { this.origin.setFrom(val); }\n public getRotation(result?: Matrix3d): Matrix3d { return this._rMatrix.clone(result); }\n public setRotation(rMatrix: Matrix3d): void {\n this._rMatrix.setFrom(rMatrix);\n const angles = YawPitchRollAngles.createFromMatrix3d(rMatrix);\n this.yaw = (undefined !== angles ? angles.yaw.degrees : 0.0);\n this.pitch = (undefined !== angles ? angles.pitch.degrees : 0.0);\n this.roll = (undefined !== angles ? angles.roll.degrees : 0.0);\n }\n}\n\n/** The state of an AuxCoordSystemSpatial element in the frontend\n * @public\n * @extensions\n */\nexport class AuxCoordSystemSpatialState extends AuxCoordSystem3dState {\n public static override get className() { return \"AuxCoordSystemSpatial\"; }\n}\n"]}
|
package/lib/cjs/EntityState.js
CHANGED
|
@@ -97,7 +97,7 @@ class ElementState extends EntityState {
|
|
|
97
97
|
toJSON() {
|
|
98
98
|
const val = super.toJSON();
|
|
99
99
|
if (core_bentley_1.Id64.isValid(this.code.spec))
|
|
100
|
-
val.code = this.code;
|
|
100
|
+
val.code = this.code.toJSON(); // Ensure _value with get accessor is serialized...
|
|
101
101
|
val.model = this.model;
|
|
102
102
|
val.parent = this.parent;
|
|
103
103
|
val.federationGuid = this.federationGuid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityState.js","sourceRoot":"","sources":["../../src/EntityState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmE;AACnE,oDAAqF;AAGrF;;;GAGG;AACH,MAAa,WAAW;IACtB;;OAEG;IACI,MAAM,KAAK,UAAU,KAAK,OAAO,SAAS,CAAC,CAAC,CAAC;IAEpD,IAAY,KAAK,KAAyB,OAAO,IAAI,CAAC,WAAiC,CAAC,CAAC,CAAC;IAE1F;;;;OAIG;IACI,MAAM,KAAK,SAAS,KAAK,OAAO,QAAQ,CAAC,CAAC,CAAC;IAElD,4DAA4D;IAC5D,IAAW,SAAS,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAE/D,kGAAkG;IAClF,EAAE,CAAa;IAC/B,mDAAmD;IACnC,MAAM,CAAmB;IACzC,sDAAsD;IACtC,aAAa,CAAS;IACtC,sHAAsH;IACtG,cAAc,CAAyB;IAEvD;;;;OAIG;IACH,YAAY,KAAkB,EAAE,MAAwB,EAAE,MAAoB;QAC5E,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QAC1F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,mBAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAA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AAS;YAC/B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACrC,CAAC;IAED;;OAEG;IACa,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAkB,CAAC;QAC3C,IAAI,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9B,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,mDAAmD;QAEpF,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/B,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAvCD,oCAuCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementState\n */\n\nimport { GuidString, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, ElementProps, EntityProps, RelatedElement } from \"@itwin/core-common\";\nimport { IModelConnection } from \"./IModelConnection\";\n\n/** The \"state\" of an Entity as represented in a web browser. Every subclass of EntityState handles one BIS class.\n * @public\n * @extensions\n */\nexport class EntityState implements EntityProps {\n /** The name of the BIS schema for this class.\n * @note Subclasses from other than the BisCore domain must override the static member \"schemaName\" with their schema name.\n */\n public static get schemaName() { return \"BisCore\"; }\n\n private get _ctor(): typeof EntityState { return this.constructor as typeof EntityState; }\n\n /** The name of the BIS class associated with this class.\n * @note Every subclass of EntityState **MUST** override this method to identify its BIS class.\n * Failure to do so will ordinarily result in an error when the class is registered, since there may only\n * be one JavaScript class for a given BIS class (usually the errant class will collide with its superclass.)\n */\n public static get className() { return \"Entity\"; }\n\n /** The name of the BIS class associated with this class. */\n public get className(): string { return this._ctor.className; }\n\n /** The Id of this Entity. May be invalid if the Entity has not yet been saved in the database. */\n public readonly id: Id64String;\n /** The iModel from which this Entity was loaded */\n public readonly iModel: IModelConnection;\n /** The full class name in the form \"schema:class\". */\n public readonly classFullName: string;\n /** Optional [json properties]($docs/bis/guide/fundamentals/element-fundamentals.md#jsonproperties) of this Entity. */\n public readonly jsonProperties: { [key: string]: any };\n\n /** Constructor for EntityState\n * @param props the properties of the Entity for this EntityState\n * @param iModel the iModel from which this EntityState is to be constructed\n * @param _state source EntityState for clone\n */\n constructor(props: EntityProps, iModel: IModelConnection, _state?: EntityState) {\n this.classFullName = props.classFullName ? props.classFullName : this._ctor.classFullName;\n this.iModel = iModel;\n this.id = Id64.fromJSON(props.id);\n this.jsonProperties = props.jsonProperties ? JSON.parse(JSON.stringify(props.jsonProperties)) : {}; // make sure we have our own copy\n }\n\n /** @internal */\n public toJSON(): EntityProps {\n const val: any = {};\n val.classFullName = this.classFullName;\n if (Id64.isValid(this.id))\n val.id = this.id;\n if (this.jsonProperties && Object.keys(this.jsonProperties).length > 0)\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n /** Return true if this EntityState is equal to another one. */\n public equals(other: this): boolean { return JSON.stringify(this.toJSON()) === JSON.stringify(other.toJSON()); }\n\n /** Make an independent copy of this EntityState */\n public clone(iModel?: IModelConnection): this { return new this._ctor(this.toJSON(), iModel ? iModel : this.iModel, this) as this; }\n\n /** Get full BIS class name of this Entity in the form \"SchemaName:ClassName\". */\n public static get classFullName(): string { return `${this.schemaName}:${this.className}`; }\n}\n\n/** The \"state\" of an Element as represented in a web browser.\n * @public\n * @extensions\n */\nexport class ElementState extends EntityState implements ElementProps {\n public static override get className() { return \"Element\"; }\n\n /** The ModelId of the [Model]($docs/bis/guide/fundamentals/model-fundamentals.md) containing this element */\n public readonly model: Id64String;\n /** The [Code]($docs/bis/guide/fundamentals/codes.md) for this element */\n public readonly code: Code;\n /** The parent Element of this, or undefined if no parent. */\n public readonly parent?: RelatedElement;\n /** A [FederationGuid]($docs/bis/guide/fundamentals/element-fundamentals.md#federationguid) assigned to this element by some other federated database */\n public readonly federationGuid?: GuidString;\n /** A [user-assigned label]($docs/bis/guide/fundamentals/element-fundamentals.md#userlabel) for this element. */\n public readonly userLabel?: string;\n\n constructor(props: ElementProps, iModel: IModelConnection) {\n super(props, iModel);\n this.code = Code.fromJSON(props.code);\n this.model = RelatedElement.idFromJson(props.model);\n this.parent = RelatedElement.fromJSON(props.parent);\n if (undefined !== props.federationGuid)\n this.federationGuid = props.federationGuid;\n if (undefined !== props.userLabel)\n this.userLabel = props.userLabel;\n }\n\n /** Obtain this element's JSON representation. Subclasses of ElementState typically override this method with a more\n * specific return type.\n */\n public override toJSON(): ElementProps {\n const val = super.toJSON() as ElementProps;\n if (Id64.isValid(this.code.spec))\n val.code = this.code.toJSON(); // Ensure _value with get accessor is serialized...\n\n val.model = this.model;\n val.parent = this.parent;\n val.federationGuid = this.federationGuid;\n val.userLabel = this.userLabel;\n return val;\n }\n}\n"]}
|
package/lib/cjs/IpcApp.d.ts
CHANGED
|
@@ -57,6 +57,18 @@ export declare class IpcApp {
|
|
|
57
57
|
* primitive types and `ArrayBuffers` are allowed.
|
|
58
58
|
*/
|
|
59
59
|
static send(channel: string, ...data: any[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Establish a handler for an Ipc channel to receive [[IpcHost.invoke]] calls
|
|
62
|
+
* @param channel The name of the channel for this handler.
|
|
63
|
+
* @param handler A function that supplies the implementation for `channel`
|
|
64
|
+
* @returns A function to call to remove the handler.
|
|
65
|
+
* @note If `handler` throws, or its returned Promise rejects, the thrown value is serialized (see
|
|
66
|
+
* [[serializeIpcError]]) and sent as the response instead of being rethrown here. Without this, the
|
|
67
|
+
* corresponding [[IpcHost.invoke]] call on the backend would never receive a reply and would hang (leaking
|
|
68
|
+
* its listener and `_pendingInvokes` entry) until [[IpcHost.shutdown]] is called.
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction;
|
|
60
72
|
/**
|
|
61
73
|
* Call a method on the backend through an Ipc channel.
|
|
62
74
|
* @param channelName the channel registered by the backend handler.
|
|
@@ -114,4 +126,29 @@ export declare abstract class NotificationHandler {
|
|
|
114
126
|
*/
|
|
115
127
|
static register(): RemoveFunction;
|
|
116
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Base class for all implementations of an Ipc interface.
|
|
131
|
+
*
|
|
132
|
+
* Create a subclass to implement your Ipc interface. Your class should be declared like this:
|
|
133
|
+
* ```ts
|
|
134
|
+
* class MyHandler extends IpcHandler implements MyInterface
|
|
135
|
+
* ```
|
|
136
|
+
* to ensure all methods and signatures are correct.
|
|
137
|
+
*
|
|
138
|
+
* Then, call `MyClass.register` at startup to connect your class to your channel.
|
|
139
|
+
* @beta
|
|
140
|
+
*/
|
|
141
|
+
export declare abstract class IpcHandler {
|
|
142
|
+
abstract get channelName(): string;
|
|
143
|
+
/**
|
|
144
|
+
* Register this class as the handler for methods on its channel. This static method creates a new instance
|
|
145
|
+
* that becomes the handler and is `this` when its methods are called.
|
|
146
|
+
* @returns A function that can be called to remove the handler.
|
|
147
|
+
* @note Call this only once per channel. Each call registers an *additional* handler rather than
|
|
148
|
+
* replacing a previous one, so registering the same channel more than once causes every registered
|
|
149
|
+
* handler to run and reply to an invocation. To replace a handler, first call the [[RemoveFunction]]
|
|
150
|
+
* returned by the previous `register`.
|
|
151
|
+
*/
|
|
152
|
+
static register(): RemoveFunction;
|
|
153
|
+
}
|
|
117
154
|
//# sourceMappingURL=IpcApp.d.ts.map
|
package/lib/cjs/IpcApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcApp.d.ts","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO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,eAAe,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAM5G;;OAEG;WACiB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAIzG;;OAEG;WACW,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;IAI7F;;;OAGG;WACW,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC;IAIrG,+EAA+E;IAC/E,OAAc,cAAc,oCAAkE;IAE9F;qFACiF;WAC7D,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,aAAa;IAMxE,gBAAgB;WACI,QAAQ;CAK7B;AAED;;;;;;;;;;;;;GAaG;AACH,8BAAsB,mBAAmB;IACvC,wFAAwF;IACxF,aAAoB,WAAW,IAAI,MAAM,CAAC;IAEnC,YAAY,IAAI,cAAc;IAUrC;;;;;OAKG;WACW,QAAQ,IAAI,cAAc;CAGzC;AAQD;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU;IAE9B,aAAoB,WAAW,IAAI,MAAM,CAAC;IAE1C;;;;;;;;OAQG;WACW,QAAQ,IAAI,cAAc;CAIzC"}
|
package/lib/cjs/IpcApp.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module NativeApp
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.NotificationHandler = exports.IpcApp = void 0;
|
|
10
|
+
exports.IpcHandler = exports.NotificationHandler = exports.IpcApp = void 0;
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
12
|
const core_common_1 = require("@itwin/core-common");
|
|
13
13
|
const Symbols_1 = require("./common/internal/Symbols");
|
|
@@ -65,6 +65,29 @@ class IpcApp {
|
|
|
65
65
|
static send(channel, ...data) {
|
|
66
66
|
return this.ipc.send((0, core_common_1.iTwinChannel)(channel), ...data);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Establish a handler for an Ipc channel to receive [[IpcHost.invoke]] calls
|
|
70
|
+
* @param channel The name of the channel for this handler.
|
|
71
|
+
* @param handler A function that supplies the implementation for `channel`
|
|
72
|
+
* @returns A function to call to remove the handler.
|
|
73
|
+
* @note If `handler` throws, or its returned Promise rejects, the thrown value is serialized (see
|
|
74
|
+
* [[serializeIpcError]]) and sent as the response instead of being rethrown here. Without this, the
|
|
75
|
+
* corresponding [[IpcHost.invoke]] call on the backend would never receive a reply and would hang (leaking
|
|
76
|
+
* its listener and `_pendingInvokes` entry) until [[IpcHost.shutdown]] is called.
|
|
77
|
+
* @beta
|
|
78
|
+
*/
|
|
79
|
+
static handle(channel, handler) {
|
|
80
|
+
const listener = async (_evt, responseChannel, ...args) => {
|
|
81
|
+
try {
|
|
82
|
+
const response = await handler(...args);
|
|
83
|
+
this.ipc.send(responseChannel, response);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
this.ipc.send(responseChannel, (0, core_common_1.serializeIpcError)(err, true));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return this.addListener(channel, listener);
|
|
90
|
+
}
|
|
68
91
|
/**
|
|
69
92
|
* Call a method on the backend through an Ipc channel.
|
|
70
93
|
* @param channelName the channel registered by the backend handler.
|
|
@@ -76,21 +99,8 @@ class IpcApp {
|
|
|
76
99
|
*/
|
|
77
100
|
static async [Symbols_1._callIpcChannel](channelName, methodName, ...args) {
|
|
78
101
|
const retVal = (await this.invoke(channelName, methodName, ...args));
|
|
79
|
-
if
|
|
80
|
-
|
|
81
|
-
// backend threw an exception, rethrow one on frontend
|
|
82
|
-
const err = retVal.error;
|
|
83
|
-
if (!core_bentley_1.JsonUtils.isObject(err)) {
|
|
84
|
-
// Exception wasn't an object?
|
|
85
|
-
throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error
|
|
86
|
-
}
|
|
87
|
-
// Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.
|
|
88
|
-
if (!core_bentley_1.BentleyError.isError(err))
|
|
89
|
-
throw Object.assign(new Error(typeof err.message === "string" ? err.message : "unknown error"), err);
|
|
90
|
-
const trimErr = { ...err };
|
|
91
|
-
delete trimErr.iTwinErrorId; // these are methods on BackendError and will cause Object.assign to fail.
|
|
92
|
-
delete trimErr.loggingMetadata;
|
|
93
|
-
throw Object.assign(new core_common_1.BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);
|
|
102
|
+
// for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.
|
|
103
|
+
return (0, core_common_1.unwrapIpcInvokeReturn)(retVal, core_common_1.BackendError);
|
|
94
104
|
}
|
|
95
105
|
/** @internal
|
|
96
106
|
* @deprecated in 4.8 - might be removed in next major version. Use [[makeIpcProxy]] for a type-safe interface.
|
|
@@ -102,22 +112,14 @@ class IpcApp {
|
|
|
102
112
|
* @param channelName the channel registered by the backend handler.
|
|
103
113
|
*/
|
|
104
114
|
static makeIpcProxy(channelName) {
|
|
105
|
-
return
|
|
106
|
-
get(_target, methodName) {
|
|
107
|
-
return async (...args) => IpcApp[Symbols_1._callIpcChannel](channelName, methodName, ...args);
|
|
108
|
-
},
|
|
109
|
-
});
|
|
115
|
+
return (0, core_common_1.createIpcProxy)(async (methodName, ...args) => IpcApp[Symbols_1._callIpcChannel](channelName, methodName, ...args));
|
|
110
116
|
}
|
|
111
117
|
/** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a "methodName" argument followed by optional arguments
|
|
112
118
|
* @param channelName the channel registered by the backend handler.
|
|
113
119
|
* @param functionName the function to call on the handler.
|
|
114
120
|
*/
|
|
115
121
|
static makeIpcFunctionProxy(channelName, functionName) {
|
|
116
|
-
return
|
|
117
|
-
get(_target, methodName) {
|
|
118
|
-
return async (...args) => IpcApp[Symbols_1._callIpcChannel](channelName, functionName, methodName, ...args);
|
|
119
|
-
},
|
|
120
|
-
});
|
|
122
|
+
return (0, core_common_1.createIpcProxy)(async (methodName, ...args) => IpcApp[Symbols_1._callIpcChannel](channelName, functionName, methodName, ...args));
|
|
121
123
|
}
|
|
122
124
|
/** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */
|
|
123
125
|
static appFunctionIpc = IpcApp.makeIpcProxy(core_common_1.ipcAppChannels.functions);
|
|
@@ -175,4 +177,32 @@ class IpcAppNotifyHandler extends NotificationHandler {
|
|
|
175
177
|
get channelName() { return core_common_1.ipcAppChannels.appNotify; }
|
|
176
178
|
notifyApp() { }
|
|
177
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Base class for all implementations of an Ipc interface.
|
|
182
|
+
*
|
|
183
|
+
* Create a subclass to implement your Ipc interface. Your class should be declared like this:
|
|
184
|
+
* ```ts
|
|
185
|
+
* class MyHandler extends IpcHandler implements MyInterface
|
|
186
|
+
* ```
|
|
187
|
+
* to ensure all methods and signatures are correct.
|
|
188
|
+
*
|
|
189
|
+
* Then, call `MyClass.register` at startup to connect your class to your channel.
|
|
190
|
+
* @beta
|
|
191
|
+
*/
|
|
192
|
+
class IpcHandler {
|
|
193
|
+
/**
|
|
194
|
+
* Register this class as the handler for methods on its channel. This static method creates a new instance
|
|
195
|
+
* that becomes the handler and is `this` when its methods are called.
|
|
196
|
+
* @returns A function that can be called to remove the handler.
|
|
197
|
+
* @note Call this only once per channel. Each call registers an *additional* handler rather than
|
|
198
|
+
* replacing a previous one, so registering the same channel more than once causes every registered
|
|
199
|
+
* handler to run and reply to an invocation. To replace a handler, first call the [[RemoveFunction]]
|
|
200
|
+
* returned by the previous `register`.
|
|
201
|
+
*/
|
|
202
|
+
static register() {
|
|
203
|
+
const impl = new this(); // create an instance of subclass. "as any" is necessary because base class is abstract
|
|
204
|
+
return IpcApp.handle(impl.channelName, (0, core_common_1.createIpcDispatcher)(impl, impl.channelName, true));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.IpcHandler = IpcHandler;
|
|
178
208
|
//# sourceMappingURL=IpcApp.js.map
|
package/lib/cjs/IpcApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6G;AAC7G,oDAG4B;AAC5B,uDAA4D;AAC5D,2CAA0D;AAU1D;;;GAGG;AACH,MAAa,MAAM;IACT,MAAM,CAAC,IAAI,CAAgC;IAC3C,MAAM,CAAC,gBAAgB,CAA6B;IAC5D,qEAAqE;IAE7D,MAAM,KAAK,GAAG,KAAwB,OAAO,IAAA,4BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhF,iIAAiI;IAC1H,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE;;;;;;;OAOG;IACI,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,OAAoB;QAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAC,OAAe,EAAE,QAAqB;QACjE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,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AAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BentleyError, expectDefined, IModelStatus, JsonUtils, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n private static _removeAppNotify: RemoveFunction | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return expectDefined(this._ipc); }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (retVal.error === undefined)\n return retVal.result; // method was successful\n\n // backend threw an exception, rethrow one on frontend\n const err = retVal.error;\n if (!JsonUtils.isObject(err)) {\n // Exception wasn't an object?\n throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n if (!BentleyError.isError(err))\n throw Object.assign(new Error(typeof err.message === \"string\" ? err.message : \"unknown error\"), err);\n\n const trimErr = { ...err } as any;\n delete trimErr.iTwinErrorId // these are methods on BackendError and will cause Object.assign to fail.\n delete trimErr.loggingMetadata;\n throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);\n }\n\n /** @internal\n * @deprecated in 4.8 - might be removed in next major version. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n this._removeAppNotify = IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoF;AACpF,oDAG4B;AAC5B,uDAA4D;AAC5D,2CAA0D;AAU1D;;;GAGG;AACH,MAAa,MAAM;IACT,MAAM,CAAC,IAAI,CAAgC;IAC3C,MAAM,CAAC,gBAAgB,CAA6B;IAC5D,qEAAqE;IAE7D,MAAM,KAAK,GAAG,KAAwB,OAAO,IAAA,4BAA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C,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAvBD,kDAuBC;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,4BAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,MAAsB,UAAU;IAI9B;;;;;;;;OAQG;IACI,MAAM,CAAC,QAAQ;QACpB,MAAM,IAAI,GAAG,IAAK,IAAY,EAAgB,CAAC,CAAC,uFAAuF;QACvI,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,IAAA,iCAAmB,EAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF;AAjBD,gCAiBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { expectDefined, IModelStatus, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, createIpcDispatcher, createIpcProxy, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction, serializeIpcError, unwrapIpcInvokeReturn,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n private static _removeAppNotify: RemoveFunction | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return expectDefined(this._ipc); }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[IpcHost.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @returns A function to call to remove the handler.\n * @note If `handler` throws, or its returned Promise rejects, the thrown value is serialized (see\n * [[serializeIpcError]]) and sent as the response instead of being rethrown here. Without this, the\n * corresponding [[IpcHost.invoke]] call on the backend would never receive a reply and would hang (leaking\n * its listener and `_pendingInvokes` entry) until [[IpcHost.shutdown]] is called.\n * @beta\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n const listener = async (_evt: Event, responseChannel: string, ...args: any[]) => {\n try {\n const response = await handler(...args);\n this.ipc.send(responseChannel, response);\n } catch (err) {\n this.ipc.send(responseChannel, serializeIpcError(err, true));\n }\n };\n\n return this.addListener(channel, listener);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n // for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n return unwrapIpcInvokeReturn(retVal, BackendError);\n }\n\n /** @internal\n * @deprecated in 4.8 - might be removed in next major version. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return createIpcProxy<K>(async (methodName: string, ...args: any[]) => IpcApp[_callIpcChannel](channelName, methodName, ...args));\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return createIpcProxy<K>(async (methodName: string, ...args: any[]) => IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args));\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n this._removeAppNotify = IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @beta\n */\nexport abstract class IpcHandler {\n /* All subclasses must implement this method to specify their channel name. */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note Call this only once per channel. Each call registers an *additional* handler rather than\n * replacing a previous one, so registering the same channel more than once causes every registered\n * handler to run and reply to an invocation. To replace a handler, first call the [[RemoveFunction]]\n * returned by the previous `register`.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n return IpcApp.handle(impl.channelName, createIpcDispatcher(impl, impl.channelName, true));\n }\n}\n"]}
|