@itwin/core-frontend 4.10.0-dev.26 → 4.10.0-dev.28
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/DrawingViewState.d.ts +7 -2
- package/lib/cjs/DrawingViewState.d.ts.map +1 -1
- package/lib/cjs/DrawingViewState.js +18 -6
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/HitDetail.d.ts +6 -7
- package/lib/cjs/HitDetail.d.ts.map +1 -1
- package/lib/cjs/HitDetail.js +1 -2
- package/lib/cjs/HitDetail.js.map +1 -1
- package/lib/cjs/ViewState.d.ts +6 -2
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +3 -1
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/ViewingSpace.d.ts.map +1 -1
- package/lib/cjs/ViewingSpace.js +3 -0
- package/lib/cjs/ViewingSpace.js.map +1 -1
- package/lib/cjs/render/GraphicBranch.d.ts +1 -1
- package/lib/cjs/render/GraphicBranch.js.map +1 -1
- package/lib/cjs/render/Pixel.d.ts +3 -1
- package/lib/cjs/render/Pixel.d.ts.map +1 -1
- package/lib/cjs/render/Pixel.js.map +1 -1
- package/lib/esm/DrawingViewState.d.ts +7 -2
- package/lib/esm/DrawingViewState.d.ts.map +1 -1
- package/lib/esm/DrawingViewState.js +18 -6
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/HitDetail.d.ts +6 -7
- package/lib/esm/HitDetail.d.ts.map +1 -1
- package/lib/esm/HitDetail.js +1 -2
- package/lib/esm/HitDetail.js.map +1 -1
- package/lib/esm/ViewState.d.ts +6 -2
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +3 -1
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/ViewingSpace.d.ts.map +1 -1
- package/lib/esm/ViewingSpace.js +3 -0
- package/lib/esm/ViewingSpace.js.map +1 -1
- package/lib/esm/render/GraphicBranch.d.ts +1 -1
- package/lib/esm/render/GraphicBranch.js.map +1 -1
- package/lib/esm/render/Pixel.d.ts +3 -1
- package/lib/esm/render/Pixel.d.ts.map +1 -1
- package/lib/esm/render/Pixel.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 +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewingSpace.d.ts","sourceRoot":"","sources":["../../src/ViewingSpace.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACsC,KAAK,EAAE,QAAQ,EAAgC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAW,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EACxK,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAwC,MAAM,oBAAoB,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiB;IAE9C,gBAAgB;IACT,aAAa,SAAO;IAC3B;;OAEG;IACH,OAAc,iBAAiB,SAAU;IACzC;;OAEG;IACH,OAAc,cAAc,SAAU;IACtC,wCAAwC;IACxC,SAAgB,UAAU,UAAiB;IAC3C,uCAAuC;IACvC,SAAgB,SAAS,WAAkB;IAC3C,+CAA+C;IAC/C,SAAgB,oBAAoB,UAAiB;IACrD,8CAA8C;IAC9C,SAAgB,mBAAmB,WAAkB;IACrD,mDAAmD;IACnD,SAAgB,QAAQ,WAAkB;IAC1C,+DAA+D;IAC/D,SAAgB,cAAc,QAA0B;IACx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AAkB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAExE;;;;OAIG;IACI,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IACrD;;;;OAIG;IACI,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IACrD;;;;OAIG;IACI,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IACzD;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IAC3D;;;;OAIG;IACI,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IACzD;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IAE5D;;;;;;;;;;;OAWG;IACI,UAAU,CAAC,GAAG,GAAE,WAA+B,EAAE,WAAW,GAAE,OAAc,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IAkC5G,gBAAgB;IACT,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO;IAM5C,gBAAgB;IACT,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO;CAYjF"}
|
package/lib/cjs/ViewingSpace.js
CHANGED
|
@@ -246,6 +246,9 @@ class ViewingSpace {
|
|
|
246
246
|
zMax = Math.max(zMax, 1.0); // make sure we have at least +-1m. Data may be purely planar
|
|
247
247
|
delta.z = 2.0 * zMax;
|
|
248
248
|
origin.z = -zMax;
|
|
249
|
+
const ds = this.view.displayStyle;
|
|
250
|
+
if (ds.getIsBackgroundMapVisible() && undefined !== ds.getBackgroundMapGeometry())
|
|
251
|
+
this.adjustZPlanes(origin, delta); // make sure view volume includes background map
|
|
249
252
|
}
|
|
250
253
|
else {
|
|
251
254
|
if (view.isCameraOn)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewingSpace.js","sourceRoot":"","sources":["../../src/ViewingSpace.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAE8B;AAC9B,oDAAqG;AACrG,2EAAwE;AACxE,+CAA4C;AAE5C,gDAA6C;AAE7C,2CAAwC;AACxC,mEAAgF;AAEhF;;;;;GAKG;AACH,MAAa,YAAY;IAmCvB,sCAAsC;IACtC,IAAW,IAAI,KAAgB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,IAAW,IAAI,CAAC,IAAe,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAKvD,6DAA6D;IAC7D,IAAY,SAAS;QACnB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,WAAW,CAAC,IAAS,EAAE,EAAQ;QAC5C,IAAI,EAAE,GAAG,IAAI,CAAC;QACd,IAAI,EAAE,EAAE,CAAC;YACP,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACjB,EAAE,GAAG,EAAE,CAAC;QACV,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,gBAAgB;IACT,iBAAiB,CAAC,IAAS,EAAE,EAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1H,gBAAgB;IACT,mBAAmB,CAAC,IAAS,EAAE,EAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,8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C,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAClG,MAAM,OAAO,GAAG,IAAI,uBAAO,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,gBAAgB;IACT,iBAAiB,CAAC,gBAAqC,EAAE,MAAgB;QAC9E,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,yBAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAE7D,IAAI,gBAAgB,IAAI,gBAAgB,YAAY,yBAAS,EAAE,CAAC;YAC9D,OAAO,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;YACpE,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAClD,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC1C,OAAO,eAAe,CAAC;QACzB,CAAC;IACH,CAAC;;AA3eH,oCA4eC;AAteC;;GAEG;AACW,8BAAiB,GAAG,MAAM,AAAT,CAAU;AACzC;;GAEG;AACW,2BAAc,GAAG,MAAM,AAAT,CAAU;AAoGvB,sBAAS,GAAG,CAAC,AAAJ,CAAK,CAAC,qEAAqE","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 Views\r\n */\r\n\r\nimport {\r\n AxisOrder, ClipPlaneContainment, Constant, Map4d, Matrix3d, Plane3dByOriginAndUnitNormal, Point3d, Point4d, Range1d, Range2d, Range3d, Transform, Vector3d, XYAndZ, XYZ,\r\n} from \"@itwin/core-geometry\";\r\nimport { AxisAlignedBox3d, Frustum, GridOrientationType, Npc, NpcCorners } from \"@itwin/core-common\";\r\nimport { ApproximateTerrainHeights } from \"./ApproximateTerrainHeights\";\r\nimport { CoordSystem } from \"./CoordSystem\";\r\nimport { Viewport } from \"./Viewport\";\r\nimport { ViewRect } from \"./common/ViewRect\";\r\nimport { ViewState } from \"./ViewState\";\r\nimport { Frustum2d } from \"./Frustum2d\";\r\nimport { getFrustumPlaneIntersectionDepthRange } from \"./BackgroundMapGeometry\";\r\n\r\n/** Describes a [[Viewport]]'s viewing volume, plus its size on the screen. A new\r\n * instance of ViewingSpace is created every time the Viewport's frustum changes.\r\n * @see [[Viewport.viewingSpace]].\r\n * @public\r\n * @extensions\r\n */\r\nexport class ViewingSpace {\r\n private readonly _viewRange = new ViewRect(); // scratch variable\r\n private readonly _viewCorners = new Range3d(); // scratch variable\r\n\r\n /** @internal */\r\n public frustFraction = 1.0;\r\n /** Maximum ratio of frontplane to backplane distance for 24 bit non-logarithmic zbuffer\r\n * @internal\r\n */\r\n public static nearScaleNonLog24 = 0.0003;\r\n /** Maximum fraction of frontplane to backplane distance for 24 bit logarithmic zbuffer\r\n * @internal\r\n */\r\n public static nearScaleLog24 = 1.0E-8;\r\n /** View origin, potentially expanded */\r\n public readonly viewOrigin = new Point3d();\r\n /** View delta, potentially expanded */\r\n public readonly viewDelta = new Vector3d();\r\n /** View origin (from ViewState, unexpanded) */\r\n public readonly viewOriginUnexpanded = new Point3d();\r\n /** View delta (from ViewState, unexpanded) */\r\n public readonly viewDeltaUnexpanded = new Vector3d();\r\n /** View rotation matrix (copied from ViewState) */\r\n public readonly rotation = new Matrix3d();\r\n /** Provides conversions between world and view coordinates. */\r\n public readonly worldToViewMap = Map4d.createIdentity();\r\n /** Providers conversions between world and Npc (non-dimensional perspective) coordinates. */\r\n public readonly worldToNpcMap = Map4d.createIdentity();\r\n /** @internal */\r\n public readonly zClipAdjusted: boolean = false; // were the view z clip planes adjusted due to front/back clipping off?\r\n /** Eye point - undefined if not a perspective projection. */\r\n public readonly eyePoint: Point3d | undefined;\r\n\r\n private _view: ViewState;\r\n\r\n /** The ViewState for this Viewport */\r\n public get view(): ViewState { return this._view; }\r\n public set view(view: ViewState) { this._view = view; }\r\n\r\n private readonly _clientWidth: number;\r\n private readonly _clientHeight: number;\r\n\r\n /** Get the rectangle of this Viewport in ViewCoordinates. */\r\n private get _viewRect(): ViewRect {\r\n this._viewRange.init(0, 0, this._clientWidth, this._clientHeight);\r\n return this._viewRange;\r\n }\r\n\r\n private static _copyOutput(from: XYZ, to?: XYZ) {\r\n let pt = from;\r\n if (to) {\r\n to.setFrom(from);\r\n pt = to;\r\n }\r\n\r\n return pt;\r\n }\r\n\r\n /** @internal */\r\n public toViewOrientation(from: XYZ, to?: XYZ) { this.rotation.multiplyVectorInPlace(ViewingSpace._copyOutput(from, to)); }\r\n /** @internal */\r\n public fromViewOrientation(from: XYZ, to?: XYZ) { this.rotation.multiplyTransposeVectorInPlace(ViewingSpace._copyOutput(from, to)); }\r\n\r\n /** Ensure the rotation matrix for this view is aligns the root z with the view out (i.e. a \"2d view\"). */\r\n private alignWithRootZ() {\r\n const zUp = Vector3d.unitZ();\r\n if (zUp.isAlmostEqual(this.rotation.rowZ()))\r\n return;\r\n const r = this.rotation.transpose();\r\n r.setColumn(2, zUp);\r\n Matrix3d.createRigidFromMatrix3d(r, AxisOrder.ZXY, r);\r\n r.transpose(this.rotation);\r\n this.view.setRotation(this.rotation); // Don't let viewState and viewport rotation be different.\r\n }\r\n\r\n private validateCamera() {\r\n const view = this.view;\r\n if (!view.is3d())\r\n return;\r\n\r\n const camera = view.camera;\r\n camera.validateLens();\r\n if (camera.isFocusValid)\r\n return;\r\n\r\n const vDelta = view.getExtents();\r\n const maxDelta = vDelta.x > vDelta.y ? vDelta.x : vDelta.y;\r\n let focusDistance = maxDelta / (2.0 * Math.tan(camera.getLensAngle().radians / 2.0));\r\n\r\n if (focusDistance < vDelta.z / 2.0)\r\n focusDistance = vDelta.z / 2.0;\r\n\r\n const eyePoint = new Point3d(vDelta.x / 2.0, vDelta.y / 2.0, (vDelta.z / 2.0) + focusDistance);\r\n\r\n this.fromViewOrientation(eyePoint);\r\n eyePoint.plus(view.getOrigin(), eyePoint);\r\n camera.setEyePoint(eyePoint);\r\n camera.setFocusDistance(focusDistance);\r\n }\r\n\r\n /** @internal */\r\n public getTerrainHeightRange(): Range1d | undefined {\r\n const frustum = this.getFrustum();\r\n const cartoRange = Range2d.createNull();\r\n for (let i = 0; i < 8; i++) {\r\n const corner = frustum.getCorner(i);\r\n const carto = this.view.iModel.spatialToCartographicFromEcef(corner);\r\n cartoRange.extendXY(carto.longitude, carto.latitude);\r\n }\r\n\r\n return ApproximateTerrainHeights.instance.getMinimumMaximumHeights(cartoRange);\r\n }\r\n\r\n private static _minDepth = 1; // Allowing very small depth will cause frustum calculations to fail.\r\n\r\n /** Compute the bounding box of this viewing space in [[CoordSystem.World]] coordinates, including the extents of any [[TiledGraphicsProvider]]s registered with the [[Viewport]]. */\r\n public readonly getViewedExtents: () => AxisAlignedBox3d;\r\n\r\n /** Adjust the front and back planes to encompass the entire viewed volume */\r\n private adjustZPlanes(origin: Point3d, delta: Vector3d): void {\r\n const view = this.view;\r\n if (!view.is3d()) // only necessary for 3d views\r\n return;\r\n\r\n delta.z = Math.max(delta.z, ViewingSpace._minDepth);\r\n\r\n const extents = this.getViewedExtents();\r\n const frustum = new Frustum();\r\n const worldToNpc = this.view.computeWorldToNpc(this.rotation, this.viewOrigin, this.viewDelta, false).map as Map4d;\r\n\r\n if (worldToNpc === undefined)\r\n return;\r\n\r\n worldToNpc.transform1.multiplyPoint3dArrayQuietNormalize(frustum.points);\r\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\r\n const viewedExtentCorners = extents.corners();\r\n\r\n // Only extend depth to include viewed geometry if it is within the frustum. (if viewing global locations).\r\n if (clipPlanes.classifyPointContainment(viewedExtentCorners, false) === ClipPlaneContainment.StronglyOutside)\r\n extents.setNull();\r\n\r\n let depthRange;\r\n let gridPlane;\r\n if (this.view.viewFlags.grid) {\r\n const gridOrigin = this.view.isSpatialView() ? this.view.iModel.globalOrigin : Point3d.create();\r\n switch(this.view.getGridOrientation()) {\r\n case GridOrientationType.WorldXY:\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, Vector3d.create(0, 0, 1));\r\n break;\r\n case GridOrientationType.WorldYZ:\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, Vector3d.create(1, 0, 0));\r\n break;\r\n case GridOrientationType.WorldXZ:\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, Vector3d.create(0, 1, 0));\r\n break;\r\n\r\n case GridOrientationType.AuxCoord:\r\n if (this.view.auxiliaryCoordinateSystem)\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, this.view.auxiliaryCoordinateSystem.getRotation().rowZ());\r\n\r\n break;\r\n }\r\n }\r\n const globalGeometry = this.view.displayStyle.getGlobalGeometryAndHeightRange();\r\n if (undefined !== globalGeometry) {\r\n const viewZ = this.rotation.getRow(2);\r\n const eyeDepth = this.eyePoint ? viewZ.dotProduct(this.eyePoint) : undefined;\r\n\r\n depthRange = globalGeometry.geometry.getFrustumIntersectionDepthRange(frustum, extents, globalGeometry.heightRange, gridPlane, this.view.maxGlobalScopeFactor > 1);\r\n\r\n if (eyeDepth !== undefined) {\r\n const maxBackgroundFrontBackRatio = 1.0E6;\r\n const frontDist = Math.max(.1, eyeDepth - depthRange.high);\r\n const backDist = eyeDepth - depthRange.low;\r\n if (backDist / frontDist > maxBackgroundFrontBackRatio)\r\n depthRange.high = eyeDepth - backDist / maxBackgroundFrontBackRatio;\r\n }\r\n } else\r\n depthRange = gridPlane ? getFrustumPlaneIntersectionDepthRange(frustum, gridPlane) : Range1d.createNull();\r\n\r\n if (!extents.isNull) {\r\n const viewZ = this.rotation.getRow(2);\r\n const corners = extents.corners();\r\n for (const corner of corners)\r\n depthRange.extendX(viewZ.dotProduct(corner));\r\n }\r\n\r\n if (depthRange.isNull)\r\n return;\r\n\r\n this.rotation.multiplyVectorInPlace(origin); // put origin in view coordinates\r\n origin.z = depthRange.low; // set origin to back of viewed extents\r\n delta.z = Math.max(depthRange.high - depthRange.low, ViewingSpace._minDepth); // and delta to front of viewed extents\r\n this.rotation.multiplyTransposeVectorInPlace(origin);\r\n\r\n if (!view.isCameraOn)\r\n return;\r\n\r\n // if the camera is on, we need to make sure that the viewed volume is not behind the eye\r\n const eyeOrg = this.eyePoint!.minus(origin);\r\n this.rotation.multiplyVectorInPlace(eyeOrg);\r\n\r\n // if the distance from the eye to origin in less than 1 meter, move the origin away from the eye. Usually, this means\r\n // that the camera is outside the viewed extents and pointed away from it. There's nothing to see anyway.\r\n if (eyeOrg.z < 1.0) {\r\n this.rotation.multiplyVectorInPlace(origin);\r\n origin.z -= (2.0 - eyeOrg.z);\r\n this.rotation.multiplyTransposeVectorInPlace(origin);\r\n delta.z = 1.0;\r\n return;\r\n }\r\n\r\n // if part of the viewed extents are behind the eye, don't include that.\r\n if (delta.z > eyeOrg.z)\r\n delta.z = eyeOrg.z;\r\n }\r\n\r\n /* get the mapping from NPC to view\r\n * @internal\r\n */\r\n public calcNpcToView(): Map4d {\r\n const corners = this.getViewCorners();\r\n const map = Map4d.createBoxMap(NpcCorners[Npc._000], NpcCorners[Npc._111], corners.low, corners.high);\r\n\r\n // The map may be undefined if the view rect's width or height is zero.\r\n return undefined === map ? Map4d.createIdentity() : map;\r\n }\r\n\r\n /* Get the extents of this view, in ViewCoordinates, as a Range3d */\r\n public getViewCorners(): Range3d {\r\n const corners = this._viewCorners;\r\n const viewRect = this._viewRect;\r\n corners.high.x = viewRect.right;\r\n corners.low.y = viewRect.bottom; // y's are swapped on the screen!\r\n corners.low.x = 0;\r\n corners.high.y = 0;\r\n corners.low.z = -32767;\r\n corners.high.z = 32767;\r\n return corners;\r\n }\r\n\r\n private constructor(vp: Viewport) {\r\n const view = this._view = vp.view;\r\n const viewRect = vp.viewRect;\r\n this._clientWidth = viewRect.width;\r\n this._clientHeight = viewRect.height;\r\n const origin = view.getOrigin().clone();\r\n const delta = view.getExtents().clone();\r\n this.rotation.setFrom(view.getRotation());\r\n\r\n this.getViewedExtents = () => {\r\n const extents = this._view.getViewedExtents();\r\n vp.forEachTiledGraphicsProvider((provider) => {\r\n provider.forEachTileTreeRef(vp, (ref) => {\r\n ref.unionFitRange(extents);\r\n });\r\n });\r\n\r\n return extents;\r\n };\r\n\r\n // first, make sure none of the deltas are negative\r\n delta.x = Math.abs(delta.x);\r\n delta.y = Math.abs(delta.y);\r\n delta.z = Math.abs(delta.z);\r\n\r\n this.viewOriginUnexpanded.setFrom(origin);\r\n this.viewDeltaUnexpanded.setFrom(delta);\r\n this.viewOrigin.setFrom(origin);\r\n this.viewDelta.setFrom(delta);\r\n this.zClipAdjusted = false;\r\n this.eyePoint = undefined;\r\n\r\n if (view.is3d()) {\r\n if (!view.allow3dManipulations()) {\r\n // we're in a \"2d\" view of a physical model. That means that we must have our orientation with z out of the screen with z=0 at the center.\r\n this.alignWithRootZ(); // make sure we're in a z Up view\r\n\r\n const extents = this.getViewedExtents();\r\n if (extents.isNull) {\r\n extents.low.z = Frustum2d.minimumZExtents.low;\r\n extents.high.z = Frustum2d.minimumZExtents.high;\r\n }\r\n\r\n let zMax = Math.max(Math.abs(extents.low.z), Math.abs(extents.high.z));\r\n zMax = Math.max(zMax, 1.0); // make sure we have at least +-1m. Data may be purely planar\r\n delta.z = 2.0 * zMax;\r\n origin.z = -zMax;\r\n } else {\r\n if (view.isCameraOn)\r\n this.validateCamera();\r\n\r\n if (view.isCameraOn)\r\n this.eyePoint = view.camera.getEyePoint().clone();\r\n\r\n this.adjustZPlanes(origin, delta); // make sure view volume includes entire volume of view\r\n\r\n // if the camera is on, don't allow front plane behind camera\r\n if (this.eyePoint) {\r\n const eyeOrg = this.eyePoint.minus(origin); // vector from eye to origin\r\n this.toViewOrientation(eyeOrg);\r\n\r\n const frontDist = eyeOrg.z - delta.z; // front distance is backDist - delta.z\r\n\r\n // allow ViewState to specify a minimum front dist, but in no case less than 6 inches\r\n const minFrontDist = Math.max(15.2 * Constant.oneCentimeter, view.forceMinFrontDist);\r\n if (frontDist < minFrontDist) {\r\n // camera is too close to front plane, move origin away from eye to maintain a minimum front distance.\r\n this.toViewOrientation(origin);\r\n origin.z -= (minFrontDist - frontDist);\r\n this.fromViewOrientation(origin);\r\n }\r\n }\r\n\r\n // if we moved the z planes, set the \"zClipAdjusted\" flag.\r\n if (!origin.isExactEqual(this.viewOriginUnexpanded) || !delta.isExactEqual(this.viewDeltaUnexpanded))\r\n this.zClipAdjusted = true;\r\n }\r\n } else { // 2d viewport\r\n this.alignWithRootZ();\r\n }\r\n\r\n this.viewOrigin.setFrom(origin);\r\n this.viewDelta.setFrom(delta);\r\n\r\n const newRootToNpc = this.view.computeWorldToNpc(this.rotation, origin, delta, !this.view.displayStyle.getIsBackgroundMapVisible() /* if displaying background map, don't enforce front/back ratio as no Z-Buffer */);\r\n if (newRootToNpc.map === undefined) {\r\n this.frustFraction = 0; // invalid frustum\r\n return;\r\n }\r\n\r\n this.worldToNpcMap.setFrom(newRootToNpc.map);\r\n this.frustFraction = newRootToNpc.frustFraction;\r\n this.worldToViewMap.setFrom(this.calcNpcToView().multiplyMapMap(this.worldToNpcMap));\r\n }\r\n\r\n /** Create from a Viewport. */\r\n public static createFromViewport(vp: Viewport): ViewingSpace | undefined {\r\n return new ViewingSpace(vp);\r\n }\r\n\r\n /** Convert an array of points from CoordSystem.View to CoordSystem.Npc */\r\n public viewToNpcArray(pts: Point3d[]): void {\r\n const corners = this.getViewCorners();\r\n const scrToNpcTran = Transform.createIdentity();\r\n Transform.initFromRange(corners.low, corners.high, undefined, scrToNpcTran);\r\n scrToNpcTran.multiplyPoint3dArrayInPlace(pts);\r\n }\r\n\r\n /** Convert an array of points from CoordSystem.Npc to CoordSystem.View */\r\n public npcToViewArray(pts: Point3d[]): void {\r\n const corners = this.getViewCorners();\r\n for (const p of pts)\r\n corners.fractionToPoint(p.x, p.y, p.z, p);\r\n }\r\n\r\n /** Convert a point from CoordSystem.View to CoordSystem.Npc\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public viewToNpc(pt: Point3d, out?: Point3d): Point3d {\r\n const corners = this.getViewCorners();\r\n const scrToNpcTran = Transform.createIdentity();\r\n Transform.initFromRange(corners.low, corners.high, undefined, scrToNpcTran);\r\n return scrToNpcTran.multiplyPoint3d(pt, out);\r\n }\r\n\r\n /** Convert a point from CoordSystem.Npc to CoordSystem.View\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public npcToView(pt: Point3d, out?: Point3d): Point3d {\r\n const corners = this.getViewCorners();\r\n return corners.fractionToPoint(pt.x, pt.y, pt.z, out);\r\n }\r\n\r\n /** Convert an array of points from CoordSystem.World to CoordSystem.Npc */\r\n public worldToNpcArray(pts: Point3d[]): void { this.worldToNpcMap.transform0.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.Npc to CoordSystem.World */\r\n public npcToWorldArray(pts: Point3d[]): void { this.worldToNpcMap.transform1.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.World to CoordSystem.View */\r\n public worldToViewArray(pts: Point3d[]): void { this.worldToViewMap.transform0.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.World to CoordSystem.View, as Point4ds */\r\n public worldToView4dArray(worldPts: Point3d[], viewPts: Point4d[]): void { this.worldToViewMap.transform0.multiplyPoint3dArray(worldPts, viewPts); }\r\n /** Convert an array of points from CoordSystem.View to CoordSystem.World */\r\n public viewToWorldArray(pts: Point3d[]) { this.worldToViewMap.transform1.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.View as Point4ds to CoordSystem.World */\r\n public view4dToWorldArray(viewPts: Point4d[], worldPts: Point3d[]): void { this.worldToViewMap.transform1.multiplyPoint4dArrayQuietRenormalize(viewPts, worldPts); }\r\n\r\n /**\r\n * Convert a point from CoordSystem.World to CoordSystem.Npc\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public worldToNpc(pt: XYAndZ, out?: Point3d): Point3d { return this.worldToNpcMap.transform0.multiplyPoint3dQuietNormalize(pt, out); }\r\n /**\r\n * Convert a point from CoordSystem.Npc to CoordSystem.World\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public npcToWorld(pt: XYAndZ, out?: Point3d): Point3d { return this.worldToNpcMap.transform1.multiplyPoint3dQuietNormalize(pt, out); }\r\n /**\r\n * Convert a point from CoordSystem.World to CoordSystem.View\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public worldToView(input: XYAndZ, out?: Point3d): Point3d { return this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(input, out); }\r\n /**\r\n * Convert a point from CoordSystem.World to CoordSystem.View as Point4d\r\n * @param input the point to convert\r\n * @param out optional location for result. If undefined, a new Point4d is created.\r\n */\r\n public worldToView4d(input: XYAndZ, out?: Point4d): Point4d { return this.worldToViewMap.transform0.multiplyPoint3d(input, 1.0, out); }\r\n /**\r\n * Convert a point from CoordSystem.View to CoordSystem.World\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public viewToWorld(input: XYAndZ, out?: Point3d): Point3d { return this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(input, out); }\r\n /**\r\n * Convert a point from CoordSystem.View as a Point4d to CoordSystem.View\r\n * @param input the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public view4dToWorld(input: Point4d, out?: Point3d): Point3d { return this.worldToViewMap.transform1.multiplyXYZWQuietRenormalize(input.x, input.y, input.z, input.w, out); }\r\n\r\n /** Get an 8-point Frustum corresponding to the 8 corners of the Viewport in the specified coordinate system.\r\n *\r\n * There are two sets of corners that may be of interest.\r\n * The \"adjusted\" box is the one that is computed by examining the \"viewed extents\" and moving\r\n * the front and back planes to enclose everything in the view.\r\n * The \"unadjusted\" box is the one that is stored in the ViewState.\r\n * @param sys Coordinate system for points\r\n * @param adjustedBox If true, retrieve the adjusted box. Otherwise retrieve the box that came from the view definition.\r\n * @param box optional Frustum for return value\r\n * @return the view frustum\r\n * @note The \"adjusted\" box may be either larger or smaller than the \"unadjusted\" box.\r\n */\r\n public getFrustum(sys: CoordSystem = CoordSystem.World, adjustedBox: boolean = true, box?: Frustum): Frustum {\r\n box = box ? box.initNpc() : new Frustum();\r\n\r\n // if they are looking for the \"unexpanded\" (that is before f/b clipping expansion) box, we need to get the npc\r\n // coordinates that correspond to the unexpanded box in the npc space of the Expanded view (that's the basis for all\r\n // of the root-based maps.)\r\n if (!adjustedBox && this.zClipAdjusted) {\r\n // to get unexpanded box, we have to go recompute rootToNpc from original View.\r\n const ueRootToNpc = this.view.computeWorldToNpc(this.rotation, this.viewOriginUnexpanded, this.viewDeltaUnexpanded);\r\n if (undefined === ueRootToNpc.map)\r\n return box; // invalid frustum\r\n\r\n // get the root corners of the unexpanded box\r\n const ueRootBox = new Frustum();\r\n ueRootToNpc.map.transform1.multiplyPoint3dArrayQuietNormalize(ueRootBox.points);\r\n\r\n // and convert them to npc coordinates of the expanded view\r\n this.worldToNpcArray(ueRootBox.points);\r\n box.setFrom(ueRootBox);\r\n }\r\n\r\n // now convert from NPC space to the specified coordinate system.\r\n switch (sys) {\r\n case CoordSystem.View:\r\n this.npcToViewArray(box.points);\r\n break;\r\n\r\n case CoordSystem.World:\r\n this.npcToWorldArray(box.points);\r\n break;\r\n }\r\n return box;\r\n }\r\n\r\n /** @internal */\r\n public getPixelSizeAtPoint(inPoint?: Point3d) {\r\n const viewPt = !!inPoint ? this.worldToView(inPoint) : this.npcToView(new Point3d(0.5, 0.5, 0.5));\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n return this.viewToWorld(viewPt).distance(this.viewToWorld(viewPt2));\r\n }\r\n\r\n /** @internal */\r\n public getPreloadFrustum(transformOrScale?: Transform | number, result?: Frustum) {\r\n const viewFrustum = this.getFrustum(CoordSystem.World, true);\r\n\r\n if (transformOrScale && transformOrScale instanceof Transform) {\r\n return viewFrustum.transformBy(transformOrScale, result);\r\n } else {\r\n const scale = transformOrScale === undefined ? 2 : transformOrScale;\r\n const expandedFrustum = viewFrustum.clone(result);\r\n expandedFrustum.scaleXYAboutCenter(scale);\r\n return expandedFrustum;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ViewingSpace.js","sourceRoot":"","sources":["../../src/ViewingSpace.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAE8B;AAC9B,oDAAqG;AACrG,2EAAwE;AACxE,+CAA4C;AAE5C,gDAA6C;AAE7C,2CAAwC;AACxC,mEAAgF;AAEhF;;;;;GAKG;AACH,MAAa,YAAY;IAmCvB,sCAAsC;IACtC,IAAW,IAAI,KAAgB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,IAAW,IAAI,CAAC,IAAe,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAKvD,6DAA6D;IAC7D,IAAY,SAAS;QACnB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,WAAW,CAAC,IAAS,EAAE,EAAQ;QAC5C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,MAAM,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;YACpE,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAClD,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC1C,OAAO,eAAe,CAAC;QACzB,CAAC;IACH,CAAC;;AA9eH,oCA+eC;AAzeC;;GAEG;AACW,8BAAiB,GAAG,MAAM,AAAT,CAAU;AACzC;;GAEG;AACW,2BAAc,GAAG,MAAM,AAAT,CAAU;AAoGvB,sBAAS,GAAG,CAAC,AAAJ,CAAK,CAAC,qEAAqE","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 Views\r\n */\r\n\r\nimport {\r\n AxisOrder, ClipPlaneContainment, Constant, Map4d, Matrix3d, Plane3dByOriginAndUnitNormal, Point3d, Point4d, Range1d, Range2d, Range3d, Transform, Vector3d, XYAndZ, XYZ,\r\n} from \"@itwin/core-geometry\";\r\nimport { AxisAlignedBox3d, Frustum, GridOrientationType, Npc, NpcCorners } from \"@itwin/core-common\";\r\nimport { ApproximateTerrainHeights } from \"./ApproximateTerrainHeights\";\r\nimport { CoordSystem } from \"./CoordSystem\";\r\nimport { Viewport } from \"./Viewport\";\r\nimport { ViewRect } from \"./common/ViewRect\";\r\nimport { ViewState } from \"./ViewState\";\r\nimport { Frustum2d } from \"./Frustum2d\";\r\nimport { getFrustumPlaneIntersectionDepthRange } from \"./BackgroundMapGeometry\";\r\n\r\n/** Describes a [[Viewport]]'s viewing volume, plus its size on the screen. A new\r\n * instance of ViewingSpace is created every time the Viewport's frustum changes.\r\n * @see [[Viewport.viewingSpace]].\r\n * @public\r\n * @extensions\r\n */\r\nexport class ViewingSpace {\r\n private readonly _viewRange = new ViewRect(); // scratch variable\r\n private readonly _viewCorners = new Range3d(); // scratch variable\r\n\r\n /** @internal */\r\n public frustFraction = 1.0;\r\n /** Maximum ratio of frontplane to backplane distance for 24 bit non-logarithmic zbuffer\r\n * @internal\r\n */\r\n public static nearScaleNonLog24 = 0.0003;\r\n /** Maximum fraction of frontplane to backplane distance for 24 bit logarithmic zbuffer\r\n * @internal\r\n */\r\n public static nearScaleLog24 = 1.0E-8;\r\n /** View origin, potentially expanded */\r\n public readonly viewOrigin = new Point3d();\r\n /** View delta, potentially expanded */\r\n public readonly viewDelta = new Vector3d();\r\n /** View origin (from ViewState, unexpanded) */\r\n public readonly viewOriginUnexpanded = new Point3d();\r\n /** View delta (from ViewState, unexpanded) */\r\n public readonly viewDeltaUnexpanded = new Vector3d();\r\n /** View rotation matrix (copied from ViewState) */\r\n public readonly rotation = new Matrix3d();\r\n /** Provides conversions between world and view coordinates. */\r\n public readonly worldToViewMap = Map4d.createIdentity();\r\n /** Providers conversions between world and Npc (non-dimensional perspective) coordinates. */\r\n public readonly worldToNpcMap = Map4d.createIdentity();\r\n /** @internal */\r\n public readonly zClipAdjusted: boolean = false; // were the view z clip planes adjusted due to front/back clipping off?\r\n /** Eye point - undefined if not a perspective projection. */\r\n public readonly eyePoint: Point3d | undefined;\r\n\r\n private _view: ViewState;\r\n\r\n /** The ViewState for this Viewport */\r\n public get view(): ViewState { return this._view; }\r\n public set view(view: ViewState) { this._view = view; }\r\n\r\n private readonly _clientWidth: number;\r\n private readonly _clientHeight: number;\r\n\r\n /** Get the rectangle of this Viewport in ViewCoordinates. */\r\n private get _viewRect(): ViewRect {\r\n this._viewRange.init(0, 0, this._clientWidth, this._clientHeight);\r\n return this._viewRange;\r\n }\r\n\r\n private static _copyOutput(from: XYZ, to?: XYZ) {\r\n let pt = from;\r\n if (to) {\r\n to.setFrom(from);\r\n pt = to;\r\n }\r\n\r\n return pt;\r\n }\r\n\r\n /** @internal */\r\n public toViewOrientation(from: XYZ, to?: XYZ) { this.rotation.multiplyVectorInPlace(ViewingSpace._copyOutput(from, to)); }\r\n /** @internal */\r\n public fromViewOrientation(from: XYZ, to?: XYZ) { this.rotation.multiplyTransposeVectorInPlace(ViewingSpace._copyOutput(from, to)); }\r\n\r\n /** Ensure the rotation matrix for this view is aligns the root z with the view out (i.e. a \"2d view\"). */\r\n private alignWithRootZ() {\r\n const zUp = Vector3d.unitZ();\r\n if (zUp.isAlmostEqual(this.rotation.rowZ()))\r\n return;\r\n const r = this.rotation.transpose();\r\n r.setColumn(2, zUp);\r\n Matrix3d.createRigidFromMatrix3d(r, AxisOrder.ZXY, r);\r\n r.transpose(this.rotation);\r\n this.view.setRotation(this.rotation); // Don't let viewState and viewport rotation be different.\r\n }\r\n\r\n private validateCamera() {\r\n const view = this.view;\r\n if (!view.is3d())\r\n return;\r\n\r\n const camera = view.camera;\r\n camera.validateLens();\r\n if (camera.isFocusValid)\r\n return;\r\n\r\n const vDelta = view.getExtents();\r\n const maxDelta = vDelta.x > vDelta.y ? vDelta.x : vDelta.y;\r\n let focusDistance = maxDelta / (2.0 * Math.tan(camera.getLensAngle().radians / 2.0));\r\n\r\n if (focusDistance < vDelta.z / 2.0)\r\n focusDistance = vDelta.z / 2.0;\r\n\r\n const eyePoint = new Point3d(vDelta.x / 2.0, vDelta.y / 2.0, (vDelta.z / 2.0) + focusDistance);\r\n\r\n this.fromViewOrientation(eyePoint);\r\n eyePoint.plus(view.getOrigin(), eyePoint);\r\n camera.setEyePoint(eyePoint);\r\n camera.setFocusDistance(focusDistance);\r\n }\r\n\r\n /** @internal */\r\n public getTerrainHeightRange(): Range1d | undefined {\r\n const frustum = this.getFrustum();\r\n const cartoRange = Range2d.createNull();\r\n for (let i = 0; i < 8; i++) {\r\n const corner = frustum.getCorner(i);\r\n const carto = this.view.iModel.spatialToCartographicFromEcef(corner);\r\n cartoRange.extendXY(carto.longitude, carto.latitude);\r\n }\r\n\r\n return ApproximateTerrainHeights.instance.getMinimumMaximumHeights(cartoRange);\r\n }\r\n\r\n private static _minDepth = 1; // Allowing very small depth will cause frustum calculations to fail.\r\n\r\n /** Compute the bounding box of this viewing space in [[CoordSystem.World]] coordinates, including the extents of any [[TiledGraphicsProvider]]s registered with the [[Viewport]]. */\r\n public readonly getViewedExtents: () => AxisAlignedBox3d;\r\n\r\n /** Adjust the front and back planes to encompass the entire viewed volume */\r\n private adjustZPlanes(origin: Point3d, delta: Vector3d): void {\r\n const view = this.view;\r\n if (!view.is3d()) // only necessary for 3d views\r\n return;\r\n\r\n delta.z = Math.max(delta.z, ViewingSpace._minDepth);\r\n\r\n const extents = this.getViewedExtents();\r\n const frustum = new Frustum();\r\n const worldToNpc = this.view.computeWorldToNpc(this.rotation, this.viewOrigin, this.viewDelta, false).map as Map4d;\r\n\r\n if (worldToNpc === undefined)\r\n return;\r\n\r\n worldToNpc.transform1.multiplyPoint3dArrayQuietNormalize(frustum.points);\r\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\r\n const viewedExtentCorners = extents.corners();\r\n\r\n // Only extend depth to include viewed geometry if it is within the frustum. (if viewing global locations).\r\n if (clipPlanes.classifyPointContainment(viewedExtentCorners, false) === ClipPlaneContainment.StronglyOutside)\r\n extents.setNull();\r\n\r\n let depthRange;\r\n let gridPlane;\r\n if (this.view.viewFlags.grid) {\r\n const gridOrigin = this.view.isSpatialView() ? this.view.iModel.globalOrigin : Point3d.create();\r\n switch(this.view.getGridOrientation()) {\r\n case GridOrientationType.WorldXY:\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, Vector3d.create(0, 0, 1));\r\n break;\r\n case GridOrientationType.WorldYZ:\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, Vector3d.create(1, 0, 0));\r\n break;\r\n case GridOrientationType.WorldXZ:\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, Vector3d.create(0, 1, 0));\r\n break;\r\n\r\n case GridOrientationType.AuxCoord:\r\n if (this.view.auxiliaryCoordinateSystem)\r\n gridPlane = Plane3dByOriginAndUnitNormal.create(gridOrigin, this.view.auxiliaryCoordinateSystem.getRotation().rowZ());\r\n\r\n break;\r\n }\r\n }\r\n const globalGeometry = this.view.displayStyle.getGlobalGeometryAndHeightRange();\r\n if (undefined !== globalGeometry) {\r\n const viewZ = this.rotation.getRow(2);\r\n const eyeDepth = this.eyePoint ? viewZ.dotProduct(this.eyePoint) : undefined;\r\n\r\n depthRange = globalGeometry.geometry.getFrustumIntersectionDepthRange(frustum, extents, globalGeometry.heightRange, gridPlane, this.view.maxGlobalScopeFactor > 1);\r\n\r\n if (eyeDepth !== undefined) {\r\n const maxBackgroundFrontBackRatio = 1.0E6;\r\n const frontDist = Math.max(.1, eyeDepth - depthRange.high);\r\n const backDist = eyeDepth - depthRange.low;\r\n if (backDist / frontDist > maxBackgroundFrontBackRatio)\r\n depthRange.high = eyeDepth - backDist / maxBackgroundFrontBackRatio;\r\n }\r\n } else\r\n depthRange = gridPlane ? getFrustumPlaneIntersectionDepthRange(frustum, gridPlane) : Range1d.createNull();\r\n\r\n if (!extents.isNull) {\r\n const viewZ = this.rotation.getRow(2);\r\n const corners = extents.corners();\r\n for (const corner of corners)\r\n depthRange.extendX(viewZ.dotProduct(corner));\r\n }\r\n\r\n if (depthRange.isNull)\r\n return;\r\n\r\n this.rotation.multiplyVectorInPlace(origin); // put origin in view coordinates\r\n origin.z = depthRange.low; // set origin to back of viewed extents\r\n delta.z = Math.max(depthRange.high - depthRange.low, ViewingSpace._minDepth); // and delta to front of viewed extents\r\n this.rotation.multiplyTransposeVectorInPlace(origin);\r\n\r\n if (!view.isCameraOn)\r\n return;\r\n\r\n // if the camera is on, we need to make sure that the viewed volume is not behind the eye\r\n const eyeOrg = this.eyePoint!.minus(origin);\r\n this.rotation.multiplyVectorInPlace(eyeOrg);\r\n\r\n // if the distance from the eye to origin in less than 1 meter, move the origin away from the eye. Usually, this means\r\n // that the camera is outside the viewed extents and pointed away from it. There's nothing to see anyway.\r\n if (eyeOrg.z < 1.0) {\r\n this.rotation.multiplyVectorInPlace(origin);\r\n origin.z -= (2.0 - eyeOrg.z);\r\n this.rotation.multiplyTransposeVectorInPlace(origin);\r\n delta.z = 1.0;\r\n return;\r\n }\r\n\r\n // if part of the viewed extents are behind the eye, don't include that.\r\n if (delta.z > eyeOrg.z)\r\n delta.z = eyeOrg.z;\r\n }\r\n\r\n /* get the mapping from NPC to view\r\n * @internal\r\n */\r\n public calcNpcToView(): Map4d {\r\n const corners = this.getViewCorners();\r\n const map = Map4d.createBoxMap(NpcCorners[Npc._000], NpcCorners[Npc._111], corners.low, corners.high);\r\n\r\n // The map may be undefined if the view rect's width or height is zero.\r\n return undefined === map ? Map4d.createIdentity() : map;\r\n }\r\n\r\n /* Get the extents of this view, in ViewCoordinates, as a Range3d */\r\n public getViewCorners(): Range3d {\r\n const corners = this._viewCorners;\r\n const viewRect = this._viewRect;\r\n corners.high.x = viewRect.right;\r\n corners.low.y = viewRect.bottom; // y's are swapped on the screen!\r\n corners.low.x = 0;\r\n corners.high.y = 0;\r\n corners.low.z = -32767;\r\n corners.high.z = 32767;\r\n return corners;\r\n }\r\n\r\n private constructor(vp: Viewport) {\r\n const view = this._view = vp.view;\r\n const viewRect = vp.viewRect;\r\n this._clientWidth = viewRect.width;\r\n this._clientHeight = viewRect.height;\r\n const origin = view.getOrigin().clone();\r\n const delta = view.getExtents().clone();\r\n this.rotation.setFrom(view.getRotation());\r\n\r\n this.getViewedExtents = () => {\r\n const extents = this._view.getViewedExtents();\r\n vp.forEachTiledGraphicsProvider((provider) => {\r\n provider.forEachTileTreeRef(vp, (ref) => {\r\n ref.unionFitRange(extents);\r\n });\r\n });\r\n\r\n return extents;\r\n };\r\n\r\n // first, make sure none of the deltas are negative\r\n delta.x = Math.abs(delta.x);\r\n delta.y = Math.abs(delta.y);\r\n delta.z = Math.abs(delta.z);\r\n\r\n this.viewOriginUnexpanded.setFrom(origin);\r\n this.viewDeltaUnexpanded.setFrom(delta);\r\n this.viewOrigin.setFrom(origin);\r\n this.viewDelta.setFrom(delta);\r\n this.zClipAdjusted = false;\r\n this.eyePoint = undefined;\r\n\r\n if (view.is3d()) {\r\n if (!view.allow3dManipulations()) {\r\n // we're in a \"2d\" view of a physical model. That means that we must have our orientation with z out of the screen with z=0 at the center.\r\n this.alignWithRootZ(); // make sure we're in a z Up view\r\n\r\n const extents = this.getViewedExtents();\r\n if (extents.isNull) {\r\n extents.low.z = Frustum2d.minimumZExtents.low;\r\n extents.high.z = Frustum2d.minimumZExtents.high;\r\n }\r\n\r\n let zMax = Math.max(Math.abs(extents.low.z), Math.abs(extents.high.z));\r\n zMax = Math.max(zMax, 1.0); // make sure we have at least +-1m. Data may be purely planar\r\n delta.z = 2.0 * zMax;\r\n origin.z = -zMax;\r\n const ds = this.view.displayStyle;\r\n if (ds.getIsBackgroundMapVisible() && undefined !== ds.getBackgroundMapGeometry())\r\n this.adjustZPlanes(origin, delta); // make sure view volume includes background map\r\n } else {\r\n if (view.isCameraOn)\r\n this.validateCamera();\r\n\r\n if (view.isCameraOn)\r\n this.eyePoint = view.camera.getEyePoint().clone();\r\n\r\n this.adjustZPlanes(origin, delta); // make sure view volume includes entire volume of view\r\n\r\n // if the camera is on, don't allow front plane behind camera\r\n if (this.eyePoint) {\r\n const eyeOrg = this.eyePoint.minus(origin); // vector from eye to origin\r\n this.toViewOrientation(eyeOrg);\r\n\r\n const frontDist = eyeOrg.z - delta.z; // front distance is backDist - delta.z\r\n\r\n // allow ViewState to specify a minimum front dist, but in no case less than 6 inches\r\n const minFrontDist = Math.max(15.2 * Constant.oneCentimeter, view.forceMinFrontDist);\r\n if (frontDist < minFrontDist) {\r\n // camera is too close to front plane, move origin away from eye to maintain a minimum front distance.\r\n this.toViewOrientation(origin);\r\n origin.z -= (minFrontDist - frontDist);\r\n this.fromViewOrientation(origin);\r\n }\r\n }\r\n\r\n // if we moved the z planes, set the \"zClipAdjusted\" flag.\r\n if (!origin.isExactEqual(this.viewOriginUnexpanded) || !delta.isExactEqual(this.viewDeltaUnexpanded))\r\n this.zClipAdjusted = true;\r\n }\r\n } else { // 2d viewport\r\n this.alignWithRootZ();\r\n }\r\n\r\n this.viewOrigin.setFrom(origin);\r\n this.viewDelta.setFrom(delta);\r\n\r\n const newRootToNpc = this.view.computeWorldToNpc(this.rotation, origin, delta, !this.view.displayStyle.getIsBackgroundMapVisible() /* if displaying background map, don't enforce front/back ratio as no Z-Buffer */);\r\n if (newRootToNpc.map === undefined) {\r\n this.frustFraction = 0; // invalid frustum\r\n return;\r\n }\r\n\r\n this.worldToNpcMap.setFrom(newRootToNpc.map);\r\n this.frustFraction = newRootToNpc.frustFraction;\r\n this.worldToViewMap.setFrom(this.calcNpcToView().multiplyMapMap(this.worldToNpcMap));\r\n }\r\n\r\n /** Create from a Viewport. */\r\n public static createFromViewport(vp: Viewport): ViewingSpace | undefined {\r\n return new ViewingSpace(vp);\r\n }\r\n\r\n /** Convert an array of points from CoordSystem.View to CoordSystem.Npc */\r\n public viewToNpcArray(pts: Point3d[]): void {\r\n const corners = this.getViewCorners();\r\n const scrToNpcTran = Transform.createIdentity();\r\n Transform.initFromRange(corners.low, corners.high, undefined, scrToNpcTran);\r\n scrToNpcTran.multiplyPoint3dArrayInPlace(pts);\r\n }\r\n\r\n /** Convert an array of points from CoordSystem.Npc to CoordSystem.View */\r\n public npcToViewArray(pts: Point3d[]): void {\r\n const corners = this.getViewCorners();\r\n for (const p of pts)\r\n corners.fractionToPoint(p.x, p.y, p.z, p);\r\n }\r\n\r\n /** Convert a point from CoordSystem.View to CoordSystem.Npc\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public viewToNpc(pt: Point3d, out?: Point3d): Point3d {\r\n const corners = this.getViewCorners();\r\n const scrToNpcTran = Transform.createIdentity();\r\n Transform.initFromRange(corners.low, corners.high, undefined, scrToNpcTran);\r\n return scrToNpcTran.multiplyPoint3d(pt, out);\r\n }\r\n\r\n /** Convert a point from CoordSystem.Npc to CoordSystem.View\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public npcToView(pt: Point3d, out?: Point3d): Point3d {\r\n const corners = this.getViewCorners();\r\n return corners.fractionToPoint(pt.x, pt.y, pt.z, out);\r\n }\r\n\r\n /** Convert an array of points from CoordSystem.World to CoordSystem.Npc */\r\n public worldToNpcArray(pts: Point3d[]): void { this.worldToNpcMap.transform0.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.Npc to CoordSystem.World */\r\n public npcToWorldArray(pts: Point3d[]): void { this.worldToNpcMap.transform1.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.World to CoordSystem.View */\r\n public worldToViewArray(pts: Point3d[]): void { this.worldToViewMap.transform0.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.World to CoordSystem.View, as Point4ds */\r\n public worldToView4dArray(worldPts: Point3d[], viewPts: Point4d[]): void { this.worldToViewMap.transform0.multiplyPoint3dArray(worldPts, viewPts); }\r\n /** Convert an array of points from CoordSystem.View to CoordSystem.World */\r\n public viewToWorldArray(pts: Point3d[]) { this.worldToViewMap.transform1.multiplyPoint3dArrayQuietNormalize(pts); }\r\n /** Convert an array of points from CoordSystem.View as Point4ds to CoordSystem.World */\r\n public view4dToWorldArray(viewPts: Point4d[], worldPts: Point3d[]): void { this.worldToViewMap.transform1.multiplyPoint4dArrayQuietRenormalize(viewPts, worldPts); }\r\n\r\n /**\r\n * Convert a point from CoordSystem.World to CoordSystem.Npc\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public worldToNpc(pt: XYAndZ, out?: Point3d): Point3d { return this.worldToNpcMap.transform0.multiplyPoint3dQuietNormalize(pt, out); }\r\n /**\r\n * Convert a point from CoordSystem.Npc to CoordSystem.World\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public npcToWorld(pt: XYAndZ, out?: Point3d): Point3d { return this.worldToNpcMap.transform1.multiplyPoint3dQuietNormalize(pt, out); }\r\n /**\r\n * Convert a point from CoordSystem.World to CoordSystem.View\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public worldToView(input: XYAndZ, out?: Point3d): Point3d { return this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(input, out); }\r\n /**\r\n * Convert a point from CoordSystem.World to CoordSystem.View as Point4d\r\n * @param input the point to convert\r\n * @param out optional location for result. If undefined, a new Point4d is created.\r\n */\r\n public worldToView4d(input: XYAndZ, out?: Point4d): Point4d { return this.worldToViewMap.transform0.multiplyPoint3d(input, 1.0, out); }\r\n /**\r\n * Convert a point from CoordSystem.View to CoordSystem.World\r\n * @param pt the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public viewToWorld(input: XYAndZ, out?: Point3d): Point3d { return this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(input, out); }\r\n /**\r\n * Convert a point from CoordSystem.View as a Point4d to CoordSystem.View\r\n * @param input the point to convert\r\n * @param out optional location for result. If undefined, a new Point3d is created.\r\n */\r\n public view4dToWorld(input: Point4d, out?: Point3d): Point3d { return this.worldToViewMap.transform1.multiplyXYZWQuietRenormalize(input.x, input.y, input.z, input.w, out); }\r\n\r\n /** Get an 8-point Frustum corresponding to the 8 corners of the Viewport in the specified coordinate system.\r\n *\r\n * There are two sets of corners that may be of interest.\r\n * The \"adjusted\" box is the one that is computed by examining the \"viewed extents\" and moving\r\n * the front and back planes to enclose everything in the view.\r\n * The \"unadjusted\" box is the one that is stored in the ViewState.\r\n * @param sys Coordinate system for points\r\n * @param adjustedBox If true, retrieve the adjusted box. Otherwise retrieve the box that came from the view definition.\r\n * @param box optional Frustum for return value\r\n * @return the view frustum\r\n * @note The \"adjusted\" box may be either larger or smaller than the \"unadjusted\" box.\r\n */\r\n public getFrustum(sys: CoordSystem = CoordSystem.World, adjustedBox: boolean = true, box?: Frustum): Frustum {\r\n box = box ? box.initNpc() : new Frustum();\r\n\r\n // if they are looking for the \"unexpanded\" (that is before f/b clipping expansion) box, we need to get the npc\r\n // coordinates that correspond to the unexpanded box in the npc space of the Expanded view (that's the basis for all\r\n // of the root-based maps.)\r\n if (!adjustedBox && this.zClipAdjusted) {\r\n // to get unexpanded box, we have to go recompute rootToNpc from original View.\r\n const ueRootToNpc = this.view.computeWorldToNpc(this.rotation, this.viewOriginUnexpanded, this.viewDeltaUnexpanded);\r\n if (undefined === ueRootToNpc.map)\r\n return box; // invalid frustum\r\n\r\n // get the root corners of the unexpanded box\r\n const ueRootBox = new Frustum();\r\n ueRootToNpc.map.transform1.multiplyPoint3dArrayQuietNormalize(ueRootBox.points);\r\n\r\n // and convert them to npc coordinates of the expanded view\r\n this.worldToNpcArray(ueRootBox.points);\r\n box.setFrom(ueRootBox);\r\n }\r\n\r\n // now convert from NPC space to the specified coordinate system.\r\n switch (sys) {\r\n case CoordSystem.View:\r\n this.npcToViewArray(box.points);\r\n break;\r\n\r\n case CoordSystem.World:\r\n this.npcToWorldArray(box.points);\r\n break;\r\n }\r\n return box;\r\n }\r\n\r\n /** @internal */\r\n public getPixelSizeAtPoint(inPoint?: Point3d) {\r\n const viewPt = !!inPoint ? this.worldToView(inPoint) : this.npcToView(new Point3d(0.5, 0.5, 0.5));\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n return this.viewToWorld(viewPt).distance(this.viewToWorld(viewPt2));\r\n }\r\n\r\n /** @internal */\r\n public getPreloadFrustum(transformOrScale?: Transform | number, result?: Frustum) {\r\n const viewFrustum = this.getFrustum(CoordSystem.World, true);\r\n\r\n if (transformOrScale && transformOrScale instanceof Transform) {\r\n return viewFrustum.transformBy(transformOrScale, result);\r\n } else {\r\n const scale = transformOrScale === undefined ? 2 : transformOrScale;\r\n const expandedFrustum = viewFrustum.clone(result);\r\n expandedFrustum.scaleXYAboutCenter(scale);\r\n return expandedFrustum;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -113,7 +113,7 @@ export interface GraphicBranchOptions {
|
|
|
113
113
|
appearanceProvider?: FeatureAppearanceProvider;
|
|
114
114
|
/** @internal Secondary planar classifiers (map layers) */
|
|
115
115
|
secondaryClassifiers?: Map<number, RenderPlanarClassifier>;
|
|
116
|
-
/**
|
|
116
|
+
/** See HitDetail.viewAttachmentId.
|
|
117
117
|
* @internal
|
|
118
118
|
*/
|
|
119
119
|
viewAttachmentId?: Id64String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicBranch.js","sourceRoot":"","sources":["../../../src/render/GraphicBranch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4E;AAK5E,4CAAyC;AAqBzC;;;;;;;GAOG;AACH,MAAa,aAAa;IAqCxB;;OAEG;IACH,YAAmB,cAAuB,KAAK;QAvC/C,qCAAqC;QACrB,YAAO,GAAoB,EAAE,CAAC;QAG9C;;WAEG;QACI,sBAAiB,GAAsB,EAAE,CAAC;QAiC/C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,oCAAoC;IAC7B,GAAG,CAAC,OAAsB;QAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,KAAgB;QAClC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAChD,CAAC;IAED,uFAAuF;IAChF,YAAY,CAAC,KAAgB;QAClC,IAAI,CAAC,iBAAiB,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,oCAAoC;IAC7B,oBAAoB,CAAC,GAAsB;QAChD,IAAI,CAAC,iBAAiB,GAAG,EAAE,GAAG,GAAG,EAAE,CAA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,qBAAqB;IACpC,SAAgB,UAAU,CAAC,MAA6B,EAAE,IAAY;QACpE,IAAI,CAAC,MAAM,CAAC,qBAAqB,IAAI,CAAC,MAAM,CAAC,gBAAgB;YAC3D,OAAO,SAAS,CAAC;QAEnB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;QACzD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1C,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC7D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;gBAC1C,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC/B,QAAQ,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;oBAEnF,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,OAAO;YACL,YAAY,EAAE,QAAQ;YACtB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAnBe,gCAAU,aAmBzB,CAAA;AACH,CAAC,EArBgB,qBAAqB,qCAArB,qBAAqB,QAqBrC","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 Rendering\r\n */\r\n\r\nimport { disposeArray, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\nimport {\r\n FeatureAppearanceProvider, HiddenLine, RealityModelDisplaySettings, RenderSchedule, ViewFlagOverrides, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { FeatureSymbology } from \"./FeatureSymbology\";\r\nimport { RenderClipVolume } from \"./RenderClipVolume\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderPlanarClassifier } from \"./RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"./RenderSystem\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { AnimationNodeId } from \"../common/internal/render/AnimationNodeId\";\r\n\r\n/** Carries information in a GraphicBranchOptions about a GraphicBranch produced by drawing one view into the context of another.\r\n * @internal\r\n */\r\nexport interface GraphicBranchFrustum {\r\n is3d: boolean;\r\n scale: {\r\n x: number;\r\n y: number;\r\n };\r\n}\r\n\r\n/**\r\n * A node in a scene graph. The branch itself is not renderable. Instead it contains a list of RenderGraphics,\r\n * and a transform, symbology overrides, and clip volume which are to be applied when rendering them.\r\n * Branches can be nested to build an arbitrarily-complex scene graph.\r\n * @see [[RenderSystem.createBranch]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class GraphicBranch implements IDisposable /* , RenderMemory.Consumer */ {\r\n /** The child nodes of this branch */\r\n public readonly entries: RenderGraphic[] = [];\r\n /** If true, when the branch is disposed of, the RenderGraphics in its entries array will also be disposed */\r\n public readonly ownsEntries: boolean;\r\n /** Selectively overrides the view's [ViewFlags]($common) while drawing graphics within this branch. The default overrides nothing.\r\n * @see [[setViewFlagOverrides]].\r\n */\r\n public viewFlagOverrides: ViewFlagOverrides = {};\r\n /** Controls how reality models are displayed within this branch.\r\n * @beta\r\n */\r\n public realityModelDisplaySettings?: RealityModelDisplaySettings;\r\n /** @internal */\r\n public realityModelRange?: Range3d;\r\n /** Optional symbology overrides to be applied to all graphics in this branch */\r\n public symbologyOverrides?: FeatureSymbology.Overrides;\r\n /** Optional animation branch Id that incorporates the model Id and, for element timelines, the batch Id.\r\n * @internal\r\n */\r\n public animationId?: string;\r\n /** Identifies the node in the [RenderSchedule.Script]($backend) with which this branch is associated.\r\n * @internal\r\n */\r\n public animationNodeId?: AnimationNodeId | number;\r\n\r\n /** Identifies the \"group\" to which this branch belongs.\r\n * Groups represent cross-cutting subsets of a tile tree's contents.\r\n * For example, if a tile tree contains geometry from multiple models, each model (or smaller groups of multiple models) could be considered a group.\r\n * The top-level branches containing graphics from multiple tiles will each specify the group they represent, and the child branches within each\r\n * tile will likewise specify the group to which they belong.\r\n * When drawing, only the graphics within a tile that correlate with the current group will be drawn.\r\n * Groups cannot nest.\r\n * @internal\r\n */\r\n public groupNodeId?: number;\r\n\r\n /** Constructor\r\n * @param ownsEntries If true, when this branch is [[dispose]]d, all of the [[RenderGraphic]]s it contains will also be disposed.\r\n */\r\n public constructor(ownsEntries: boolean = false) {\r\n this.ownsEntries = ownsEntries;\r\n }\r\n\r\n /** Add a graphic to this branch. */\r\n public add(graphic: RenderGraphic): void {\r\n this.entries.push(graphic);\r\n }\r\n\r\n /** Compute the view flags that result from applying this branch's [[viewFlagOverrides]] to the input flags.\r\n * @param flags The input view flags, e.g., from the view's [[DisplayStyleState]].\r\n * @returns The result of applying [[viewFlagOverrides]] to `flags`.\r\n */\r\n public getViewFlags(flags: ViewFlags): ViewFlags {\r\n return flags.override(this.viewFlagOverrides);\r\n }\r\n\r\n /** Set [[viewFlagOverrides]] to override **all** ViewFlags as specified by `flags`. */\r\n public setViewFlags(flags: ViewFlags): void {\r\n this.viewFlagOverrides = { ...flags };\r\n }\r\n\r\n /** Change [[viewFlagOverrides]]. */\r\n public setViewFlagOverrides(ovr: ViewFlagOverrides): void {\r\n this.viewFlagOverrides = { ...ovr };\r\n }\r\n\r\n /** Disposes of all graphics in this branch, if and only if [[ownsEntries]] is true. */\r\n public dispose() {\r\n this.clear();\r\n }\r\n\r\n /** Returns true if this branch contains no graphics. */\r\n public get isEmpty(): boolean {\r\n return 0 === this.entries.length;\r\n }\r\n\r\n /** Empties the list of [[RenderGraphic]]s contained in this branch, and if the [[ownsEntries]] flag is set, also disposes of them. */\r\n public clear(): void {\r\n if (this.ownsEntries)\r\n disposeArray(this.entries);\r\n else\r\n this.entries.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n for (const entry of this.entries)\r\n entry.collectStatistics(stats);\r\n }\r\n}\r\n\r\n/** Options passed to [[RenderSystem.createGraphicBranch]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicBranchOptions {\r\n /** Clip applied to the graphics in the branch. */\r\n clipVolume?: RenderClipVolume;\r\n /** @internal */\r\n classifierOrDrape?: RenderPlanarClassifier | RenderTextureDrape;\r\n /** Optionally replaces the view's hidden line settings when drawing the branch. */\r\n hline?: HiddenLine.Settings;\r\n /** The iModel from which the graphics originate, if different than that associated with the view. */\r\n iModel?: IModelConnection;\r\n /** An optional transform from the coordinate system of [[iModel]] to those of a different [[IModelConnection]].\r\n * This is used by [[AccuSnap]] when displaying one iModel in the context of another iModel (i.e., the iModel associated\r\n * with the [[Viewport]]).\r\n */\r\n transformFromIModel?: Transform;\r\n /** @internal */\r\n frustum?: GraphicBranchFrustum;\r\n /** Supplements the view's [[FeatureSymbology.Overrides]] for graphics in the branch. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** @internal Secondary planar classifiers (map layers) */\r\n secondaryClassifiers?: Map<number, RenderPlanarClassifier>;\r\n /** The Id of the [ViewAttachment]($backend) from which this branch's graphics originated.\r\n * @internal\r\n */\r\n viewAttachmentId?: Id64String;\r\n /** If true, the view's [DisplayStyleSettings.clipStyle]($common) will be disabled for this branch.\r\n * No [ClipStyle.insideColor]($common), [ClipStyle.outsideColor]($common), or [ClipStyle.intersectionStyle]($common) will be applied.\r\n */\r\n disableClipStyle?: true;\r\n}\r\n\r\n/** Clip/Transform for a branch that are varied over time.\r\n * @internal\r\n */\r\nexport interface AnimationBranchState {\r\n readonly clip?: RenderClipVolume;\r\n readonly omit?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function formatAnimationBranchId(modelId: Id64String, branchId: number): string {\r\n if (branchId < 0)\r\n return modelId;\r\n\r\n return `${modelId}_Node_${branchId.toString()}`;\r\n}\r\n\r\nfunction addAnimationBranch(modelId: Id64String, timeline: RenderSchedule.Timeline, branchId: number, branches: Map<string, AnimationBranchState>, time: number): void {\r\n const clipVector = timeline.getClipVector(time);\r\n const clip = clipVector ? IModelApp.renderSystem.createClipVolume(clipVector) : undefined;\r\n if (clip)\r\n branches.set(formatAnimationBranchId(modelId, branchId), { clip });\r\n}\r\n\r\n/** Mapping from node/branch IDs to animation branch state\r\n * @internal\r\n */\r\nexport interface AnimationBranchStates {\r\n /** Maps node Id to branch state. */\r\n readonly branchStates: Map<string, AnimationBranchState>;\r\n /** Ids of nodes that apply a transform. */\r\n readonly transformNodeIds: ReadonlySet<number>;\r\n}\r\n\r\n/** @internal */\r\nexport namespace AnimationBranchStates {\r\n export function fromScript(script: RenderSchedule.Script, time: number): AnimationBranchStates | undefined {\r\n if (!script.containsModelClipping && !script.requiresBatching)\r\n return undefined;\r\n\r\n const branches = new Map<string, AnimationBranchState>();\r\n for (const model of script.modelTimelines) {\r\n addAnimationBranch(model.modelId, model, -1, branches, time);\r\n for (const elem of model.elementTimelines) {\r\n if (elem.getVisibility(time) <= 0)\r\n branches.set(formatAnimationBranchId(model.modelId, elem.batchId), { omit: true });\r\n else\r\n addAnimationBranch(model.modelId, elem, elem.batchId, branches, time);\r\n }\r\n }\r\n\r\n return {\r\n branchStates: branches,\r\n transformNodeIds: script.transformBatchIds,\r\n };\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GraphicBranch.js","sourceRoot":"","sources":["../../../src/render/GraphicBranch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4E;AAK5E,4CAAyC;AAqBzC;;;;;;;GAOG;A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AAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;oBAEnF,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,OAAO;YACL,YAAY,EAAE,QAAQ;YACtB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAnBe,gCAAU,aAmBzB,CAAA;AACH,CAAC,EArBgB,qBAAqB,qCAArB,qBAAqB,QAqBrC","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 Rendering\r\n */\r\n\r\nimport { disposeArray, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\nimport {\r\n FeatureAppearanceProvider, HiddenLine, RealityModelDisplaySettings, RenderSchedule, ViewFlagOverrides, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { FeatureSymbology } from \"./FeatureSymbology\";\r\nimport { RenderClipVolume } from \"./RenderClipVolume\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderPlanarClassifier } from \"./RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"./RenderSystem\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { AnimationNodeId } from \"../common/internal/render/AnimationNodeId\";\r\n\r\n/** Carries information in a GraphicBranchOptions about a GraphicBranch produced by drawing one view into the context of another.\r\n * @internal\r\n */\r\nexport interface GraphicBranchFrustum {\r\n is3d: boolean;\r\n scale: {\r\n x: number;\r\n y: number;\r\n };\r\n}\r\n\r\n/**\r\n * A node in a scene graph. The branch itself is not renderable. Instead it contains a list of RenderGraphics,\r\n * and a transform, symbology overrides, and clip volume which are to be applied when rendering them.\r\n * Branches can be nested to build an arbitrarily-complex scene graph.\r\n * @see [[RenderSystem.createBranch]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class GraphicBranch implements IDisposable /* , RenderMemory.Consumer */ {\r\n /** The child nodes of this branch */\r\n public readonly entries: RenderGraphic[] = [];\r\n /** If true, when the branch is disposed of, the RenderGraphics in its entries array will also be disposed */\r\n public readonly ownsEntries: boolean;\r\n /** Selectively overrides the view's [ViewFlags]($common) while drawing graphics within this branch. The default overrides nothing.\r\n * @see [[setViewFlagOverrides]].\r\n */\r\n public viewFlagOverrides: ViewFlagOverrides = {};\r\n /** Controls how reality models are displayed within this branch.\r\n * @beta\r\n */\r\n public realityModelDisplaySettings?: RealityModelDisplaySettings;\r\n /** @internal */\r\n public realityModelRange?: Range3d;\r\n /** Optional symbology overrides to be applied to all graphics in this branch */\r\n public symbologyOverrides?: FeatureSymbology.Overrides;\r\n /** Optional animation branch Id that incorporates the model Id and, for element timelines, the batch Id.\r\n * @internal\r\n */\r\n public animationId?: string;\r\n /** Identifies the node in the [RenderSchedule.Script]($backend) with which this branch is associated.\r\n * @internal\r\n */\r\n public animationNodeId?: AnimationNodeId | number;\r\n\r\n /** Identifies the \"group\" to which this branch belongs.\r\n * Groups represent cross-cutting subsets of a tile tree's contents.\r\n * For example, if a tile tree contains geometry from multiple models, each model (or smaller groups of multiple models) could be considered a group.\r\n * The top-level branches containing graphics from multiple tiles will each specify the group they represent, and the child branches within each\r\n * tile will likewise specify the group to which they belong.\r\n * When drawing, only the graphics within a tile that correlate with the current group will be drawn.\r\n * Groups cannot nest.\r\n * @internal\r\n */\r\n public groupNodeId?: number;\r\n\r\n /** Constructor\r\n * @param ownsEntries If true, when this branch is [[dispose]]d, all of the [[RenderGraphic]]s it contains will also be disposed.\r\n */\r\n public constructor(ownsEntries: boolean = false) {\r\n this.ownsEntries = ownsEntries;\r\n }\r\n\r\n /** Add a graphic to this branch. */\r\n public add(graphic: RenderGraphic): void {\r\n this.entries.push(graphic);\r\n }\r\n\r\n /** Compute the view flags that result from applying this branch's [[viewFlagOverrides]] to the input flags.\r\n * @param flags The input view flags, e.g., from the view's [[DisplayStyleState]].\r\n * @returns The result of applying [[viewFlagOverrides]] to `flags`.\r\n */\r\n public getViewFlags(flags: ViewFlags): ViewFlags {\r\n return flags.override(this.viewFlagOverrides);\r\n }\r\n\r\n /** Set [[viewFlagOverrides]] to override **all** ViewFlags as specified by `flags`. */\r\n public setViewFlags(flags: ViewFlags): void {\r\n this.viewFlagOverrides = { ...flags };\r\n }\r\n\r\n /** Change [[viewFlagOverrides]]. */\r\n public setViewFlagOverrides(ovr: ViewFlagOverrides): void {\r\n this.viewFlagOverrides = { ...ovr };\r\n }\r\n\r\n /** Disposes of all graphics in this branch, if and only if [[ownsEntries]] is true. */\r\n public dispose() {\r\n this.clear();\r\n }\r\n\r\n /** Returns true if this branch contains no graphics. */\r\n public get isEmpty(): boolean {\r\n return 0 === this.entries.length;\r\n }\r\n\r\n /** Empties the list of [[RenderGraphic]]s contained in this branch, and if the [[ownsEntries]] flag is set, also disposes of them. */\r\n public clear(): void {\r\n if (this.ownsEntries)\r\n disposeArray(this.entries);\r\n else\r\n this.entries.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n for (const entry of this.entries)\r\n entry.collectStatistics(stats);\r\n }\r\n}\r\n\r\n/** Options passed to [[RenderSystem.createGraphicBranch]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicBranchOptions {\r\n /** Clip applied to the graphics in the branch. */\r\n clipVolume?: RenderClipVolume;\r\n /** @internal */\r\n classifierOrDrape?: RenderPlanarClassifier | RenderTextureDrape;\r\n /** Optionally replaces the view's hidden line settings when drawing the branch. */\r\n hline?: HiddenLine.Settings;\r\n /** The iModel from which the graphics originate, if different than that associated with the view. */\r\n iModel?: IModelConnection;\r\n /** An optional transform from the coordinate system of [[iModel]] to those of a different [[IModelConnection]].\r\n * This is used by [[AccuSnap]] when displaying one iModel in the context of another iModel (i.e., the iModel associated\r\n * with the [[Viewport]]).\r\n */\r\n transformFromIModel?: Transform;\r\n /** @internal */\r\n frustum?: GraphicBranchFrustum;\r\n /** Supplements the view's [[FeatureSymbology.Overrides]] for graphics in the branch. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** @internal Secondary planar classifiers (map layers) */\r\n secondaryClassifiers?: Map<number, RenderPlanarClassifier>;\r\n /** See HitDetail.viewAttachmentId.\r\n * @internal\r\n */\r\n viewAttachmentId?: Id64String;\r\n /** If true, the view's [DisplayStyleSettings.clipStyle]($common) will be disabled for this branch.\r\n * No [ClipStyle.insideColor]($common), [ClipStyle.outsideColor]($common), or [ClipStyle.intersectionStyle]($common) will be applied.\r\n */\r\n disableClipStyle?: true;\r\n}\r\n\r\n/** Clip/Transform for a branch that are varied over time.\r\n * @internal\r\n */\r\nexport interface AnimationBranchState {\r\n readonly clip?: RenderClipVolume;\r\n readonly omit?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function formatAnimationBranchId(modelId: Id64String, branchId: number): string {\r\n if (branchId < 0)\r\n return modelId;\r\n\r\n return `${modelId}_Node_${branchId.toString()}`;\r\n}\r\n\r\nfunction addAnimationBranch(modelId: Id64String, timeline: RenderSchedule.Timeline, branchId: number, branches: Map<string, AnimationBranchState>, time: number): void {\r\n const clipVector = timeline.getClipVector(time);\r\n const clip = clipVector ? IModelApp.renderSystem.createClipVolume(clipVector) : undefined;\r\n if (clip)\r\n branches.set(formatAnimationBranchId(modelId, branchId), { clip });\r\n}\r\n\r\n/** Mapping from node/branch IDs to animation branch state\r\n * @internal\r\n */\r\nexport interface AnimationBranchStates {\r\n /** Maps node Id to branch state. */\r\n readonly branchStates: Map<string, AnimationBranchState>;\r\n /** Ids of nodes that apply a transform. */\r\n readonly transformNodeIds: ReadonlySet<number>;\r\n}\r\n\r\n/** @internal */\r\nexport namespace AnimationBranchStates {\r\n export function fromScript(script: RenderSchedule.Script, time: number): AnimationBranchStates | undefined {\r\n if (!script.containsModelClipping && !script.requiresBatching)\r\n return undefined;\r\n\r\n const branches = new Map<string, AnimationBranchState>();\r\n for (const model of script.modelTimelines) {\r\n addAnimationBranch(model.modelId, model, -1, branches, time);\r\n for (const elem of model.elementTimelines) {\r\n if (elem.getVisibility(time) <= 0)\r\n branches.set(formatAnimationBranchId(model.modelId, elem.batchId), { omit: true });\r\n else\r\n addAnimationBranch(model.modelId, elem, elem.batchId, branches, time);\r\n }\r\n }\r\n\r\n return {\r\n branchStates: branches,\r\n transformNodeIds: script.transformBatchIds,\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -32,7 +32,9 @@ export declare namespace Pixel {
|
|
|
32
32
|
readonly transformFromIModel?: Transform;
|
|
33
33
|
/** @internal */
|
|
34
34
|
readonly tileId?: string;
|
|
35
|
-
/** The Id of the
|
|
35
|
+
/** The Id of the "attached" view, if any, from which the pixel originated.
|
|
36
|
+
* An attached view is a 2d view drawn into the context of another view - for example, a [[ViewAttachment]]($backend)
|
|
37
|
+
* rendered into a [[SheetViewState]], or a [[SpatialViewState]] rendered by a [SectionDrawing]($backend) view.
|
|
36
38
|
* @beta
|
|
37
39
|
*/
|
|
38
40
|
readonly viewAttachmentId?: Id64String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,O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CAA+C;QAC/C,mDAAS,CAAA;IACX,CAAC,EATW,SAAS,GAAT,eAAS,KAAT,eAAS,QASpB;IAED;;;OAGG;IACH,IAAY,QAQX;IARD,WAAY,QAAQ;QAClB,uCAAQ,CAAA;QACR,wDAAwD;QACxD,6CAAgB,CAAA;QAChB,mJAAmJ;QACnJ,qEAA4B,CAAA;QAC5B,wCAAwC;QACxC,qCAAmC,CAAA;IACrC,CAAC,EARW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAQnB;AAeH,CAAC,EAtNgB,KAAK,qBAAL,KAAK,QAsNrB","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 Rendering\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { BatchType, Feature, GeometryClass, ModelFeature } from \"@itwin/core-common\";\r\nimport { HitPriority, ViewAttachmentHitInfo } from \"../HitDetail\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport type { Viewport } from \"../Viewport\";\r\nimport { Transform } from \"@itwin/core-geometry\";\r\n\r\n/** Describes aspects of a pixel as read from a [[Viewport]].\r\n * @see [[Viewport.readPixels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport namespace Pixel {\r\n /** Describes a single pixel within a [[Pixel.Buffer]]. */\r\n export class Data {\r\n /** The feature that produced the pixel. */\r\n public readonly feature?: Feature;\r\n public readonly modelId?: Id64String;\r\n /** The pixel's depth in [[CoordSystem.Npc]] coordinates (0 to 1), or -1 if depth was not written or not requested. */\r\n public readonly distanceFraction: number;\r\n /** The type of geometry that produced the pixel. */\r\n public readonly type: GeometryType;\r\n /** The planarity of the geometry that produced the pixel. */\r\n public readonly planarity: Planarity;\r\n /** @internal */\r\n public readonly batchType?: BatchType;\r\n /** The iModel from which the geometry producing the pixel originated. */\r\n public readonly iModel?: IModelConnection;\r\n /** @internal */\r\n public readonly transformFromIModel?: Transform;\r\n /** @internal */\r\n public readonly tileId?: string;\r\n /** The Id of the [ViewAttachment]($backend), if any, from which the pixel originated.\r\n * @beta\r\n */\r\n public readonly viewAttachmentId?: Id64String;\r\n /** @internal */\r\n public get isClassifier(): boolean {\r\n return undefined !== this.batchType && BatchType.Primary !== this.batchType;\r\n }\r\n\r\n /** @internal */\r\n public constructor(args?: {\r\n feature?: ModelFeature;\r\n distanceFraction?: number;\r\n type?: GeometryType;\r\n planarity?: Planarity;\r\n batchType?: BatchType;\r\n iModel?: IModelConnection;\r\n tileId?: string;\r\n viewAttachmentId?: string;\r\n transformFromIModel?: Transform;\r\n }) {\r\n if (args?.feature)\r\n this.feature = new Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);\r\n\r\n this.modelId = args?.feature?.modelId;\r\n this.distanceFraction = args?.distanceFraction ?? -1;\r\n this.type = args?.type ?? GeometryType.Unknown;\r\n this.planarity = args?.planarity ?? Planarity.Unknown;\r\n this.iModel = args?.iModel;\r\n this.tileId = args?.tileId;\r\n this.viewAttachmentId = args?.viewAttachmentId;\r\n this.transformFromIModel = args?.transformFromIModel;\r\n }\r\n\r\n /** The Id of the element that produced the pixel. */\r\n public get elementId(): Id64String | undefined {\r\n return this.feature?.elementId;\r\n }\r\n\r\n /** The Id of the [SubCategory]($backend) that produced the pixel. */\r\n public get subCategoryId(): Id64String | undefined {\r\n return this.feature?.subCategoryId;\r\n }\r\n\r\n /** The class of geometry that produced the pixel. */\r\n public get geometryClass(): GeometryClass | undefined {\r\n return this.feature?.geometryClass;\r\n }\r\n\r\n /** Computes the [[HitPriority]] of this pixel based on its [[type]] and [[planarity]]. */\r\n public computeHitPriority(): HitPriority {\r\n switch (this.type) {\r\n case Pixel.GeometryType.Surface:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\r\n case Pixel.GeometryType.Linear:\r\n return HitPriority.WireEdge;\r\n case Pixel.GeometryType.Edge:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\r\n case Pixel.GeometryType.Silhouette:\r\n return HitPriority.SilhouetteEdge;\r\n default:\r\n return HitPriority.Unknown;\r\n }\r\n }\r\n\r\n /** Convert this pixel to a [[Pixel.HitProps]] suitable for constructing a [[HitDetail]].\r\n * @param viewport The viewport in which the hit originated.\r\n */\r\n public toHitProps(viewport: Viewport): Pixel.HitProps {\r\n let viewAttachment: ViewAttachmentHitInfo | undefined;\r\n if (this.viewAttachmentId) {\r\n const attachmentViewport = viewport.view.getAttachmentViewport(this.viewAttachmentId);\r\n if (attachmentViewport)\r\n viewAttachment = { viewport: attachmentViewport, id: this.viewAttachmentId };\r\n }\r\n\r\n return {\r\n sourceId: this.elementId ?? Id64.invalid,\r\n priority: this.computeHitPriority(),\r\n distFraction: this.distanceFraction,\r\n subCategoryId: this.subCategoryId,\r\n geometryClass: this.geometryClass,\r\n modelId: this.modelId,\r\n tileId: this.tileId,\r\n isClassifier: this.isClassifier,\r\n sourceIModel: this.iModel,\r\n transformFromSourceIModel: this.transformFromIModel,\r\n viewAttachment,\r\n };\r\n }\r\n }\r\n\r\n /** Describes a subset of [[HitDetailProps]] computed from a [[Pixel.Data]], suitable for constructing a [[HitDetail]].\r\n * For example, the following function creates a `HitDetail` from a `Pixel.Data` and other hit information:\r\n * ```ts\r\n * function makeHitDetail(pixel: Pixel.Data, viewport: ScreenViewport, testPoint: Point3d, hitSource: HitSource, hitPoint: Point3d, distXY: number): HitDetail {\r\n * return new HitDetail({\r\n * ...pixel.toHitProps(viewport),\r\n * viewport, testPoint, hitSource, hitPoint, distXY,\r\n * };\r\n * }\r\n * ```\r\n * @see [[Data.toHitProps]] to convert a [[Pixel.Data]] to a `HitProps`.\r\n * @public\r\n */\r\n export interface HitProps {\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n sourceId: Id64String;\r\n /** The hit geometry priority/classification. */\r\n priority: HitPriority;\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n distFraction: number;\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n subCategoryId?: Id64String;\r\n /** The class of the hit geometry. */\r\n geometryClass?: GeometryClass;\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n modelId?: Id64String;\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n sourceIModel?: IModelConnection;\r\n /** @internal */\r\n transformFromSourceIModel?: Transform;\r\n /** @internal chiefly for debugging */\r\n tileId?: string;\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n isClassifier?: boolean;\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n viewAttachment?: ViewAttachmentHitInfo;\r\n }\r\n\r\n /** Describes the type of geometry that produced the [[Pixel.Data]]. */\r\n export enum GeometryType {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the type could not be determined. */\r\n Unknown, // Geometry was not selected, or type could not be determined\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** A surface produced this pixel. */\r\n Surface,\r\n /** A point primitive or polyline produced this pixel. */\r\n Linear,\r\n /** This pixel was produced by an edge of a surface. */\r\n Edge,\r\n /** This pixel was produced by a silhouette edge of a curved surface. */\r\n Silhouette,\r\n }\r\n\r\n /** Describes the planarity of the foremost geometry which produced the pixel. */\r\n export enum Planarity {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the planarity could not be determined. */\r\n Unknown,\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** Planar geometry produced this pixel. */\r\n Planar,\r\n /** Non-planar geometry produced this pixel. */\r\n NonPlanar,\r\n }\r\n\r\n /**\r\n * Bit-mask by which callers of [[Viewport.readPixels]] specify which aspects are of interest.\r\n * Aspects not specified will be omitted from the returned data.\r\n */\r\n export enum Selector {\r\n None = 0,\r\n /** Select the [[Feature]] which produced each pixel. */\r\n Feature = 1 << 0, // eslint-disable-line @typescript-eslint/no-shadow\r\n /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */\r\n GeometryAndDistance = 1 << 2,\r\n /** Select all aspects of each pixel. */\r\n All = GeometryAndDistance | Feature,\r\n }\r\n\r\n /** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.\r\n * The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\r\n * @see [[Viewport.readPixels]].\r\n */\r\n export interface Buffer {\r\n /** Retrieve the data associated with the pixel at (x,y) in view coordinates. */\r\n getPixel(x: number, y: number): Data;\r\n }\r\n\r\n /** A function which receives the results of a call to [[Viewport.readPixels]].\r\n * @note The contents of the buffer become invalid once the Receiver function returns. Do not store a reference to it.\r\n */\r\n export type Receiver = (pixels: Buffer | undefined) => void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Pixel.js","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuD;AACvD,oDAAqF;AACrF,4CAAkE;AAKlE;;;;GAIG;AACH,IAAiB,KAAK,CAwNrB;AAxND,WAAiB,KAAK;IACpB,0DAA0D;IAC1D,MAAa,IAAI;QAwBf,gBAAgB;QAChB,IAAW,YAAY;YACrB,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,uBAAS,CAAC,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC;QAC9E,CAAC;QAED,gBAAgB;QAChB,YAAmB,IAUlB;YACC,IAAI,IAAI,EAAE,OAAO;gBACf,IAAI,CAAC,OAAO,GAAG,IAAI,qBAAO,CAAC,IAAI,CAAC,O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IACvE,IAAY,YAaX;IAbD,WAAY,YAAY;QACtB,qGAAqG;QACrG,qDAAO,CAAA;QACP,8CAA8C;QAC9C,+CAAI,CAAA;QACJ,qCAAqC;QACrC,qDAAO,CAAA;QACP,yDAAyD;QACzD,mDAAM,CAAA;QACN,uDAAuD;QACvD,+CAAI,CAAA;QACJ,wEAAwE;QACxE,2DAAU,CAAA;IACZ,CAAC,EAbW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAavB;IAED,iFAAiF;IACjF,IAAY,SASX;IATD,WAAY,SAAS;QACnB,0GAA0G;QAC1G,+CAAO,CAAA;QACP,8CAA8C;QAC9C,yCAAI,CAAA;QACJ,2CAA2C;QAC3C,6CAAM,CAAA;QACN,+CAA+C;QAC/C,mDAAS,CAAA;IACX,CAAC,EATW,SAAS,GAAT,eAAS,KAAT,eAAS,QASpB;IAED;;;OAGG;IACH,IAAY,QAQX;IARD,WAAY,QAAQ;QAClB,uCAAQ,CAAA;QACR,wDAAwD;QACxD,6CAAgB,CAAA;QAChB,mJAAmJ;QACnJ,qEAA4B,CAAA;QAC5B,wCAAwC;QACxC,qCAAmC,CAAA;IACrC,CAAC,EARW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAQnB;AAeH,CAAC,EAxNgB,KAAK,qBAAL,KAAK,QAwNrB","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 Rendering\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { BatchType, Feature, GeometryClass, ModelFeature } from \"@itwin/core-common\";\r\nimport { HitPriority, ViewAttachmentHitInfo } from \"../HitDetail\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport type { Viewport } from \"../Viewport\";\r\nimport { Transform } from \"@itwin/core-geometry\";\r\n\r\n/** Describes aspects of a pixel as read from a [[Viewport]].\r\n * @see [[Viewport.readPixels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport namespace Pixel {\r\n /** Describes a single pixel within a [[Pixel.Buffer]]. */\r\n export class Data {\r\n /** The feature that produced the pixel. */\r\n public readonly feature?: Feature;\r\n public readonly modelId?: Id64String;\r\n /** The pixel's depth in [[CoordSystem.Npc]] coordinates (0 to 1), or -1 if depth was not written or not requested. */\r\n public readonly distanceFraction: number;\r\n /** The type of geometry that produced the pixel. */\r\n public readonly type: GeometryType;\r\n /** The planarity of the geometry that produced the pixel. */\r\n public readonly planarity: Planarity;\r\n /** @internal */\r\n public readonly batchType?: BatchType;\r\n /** The iModel from which the geometry producing the pixel originated. */\r\n public readonly iModel?: IModelConnection;\r\n /** @internal */\r\n public readonly transformFromIModel?: Transform;\r\n /** @internal */\r\n public readonly tileId?: string;\r\n /** The Id of the \"attached\" view, if any, from which the pixel originated.\r\n * An attached view is a 2d view drawn into the context of another view - for example, a [[ViewAttachment]]($backend)\r\n * rendered into a [[SheetViewState]], or a [[SpatialViewState]] rendered by a [SectionDrawing]($backend) view.\r\n * @beta\r\n */\r\n public readonly viewAttachmentId?: Id64String;\r\n /** @internal */\r\n public get isClassifier(): boolean {\r\n return undefined !== this.batchType && BatchType.Primary !== this.batchType;\r\n }\r\n\r\n /** @internal */\r\n public constructor(args?: {\r\n feature?: ModelFeature;\r\n distanceFraction?: number;\r\n type?: GeometryType;\r\n planarity?: Planarity;\r\n batchType?: BatchType;\r\n iModel?: IModelConnection;\r\n tileId?: string;\r\n viewAttachmentId?: string;\r\n transformFromIModel?: Transform;\r\n }) {\r\n if (args?.feature)\r\n this.feature = new Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);\r\n\r\n this.modelId = args?.feature?.modelId;\r\n this.distanceFraction = args?.distanceFraction ?? -1;\r\n this.type = args?.type ?? GeometryType.Unknown;\r\n this.planarity = args?.planarity ?? Planarity.Unknown;\r\n this.iModel = args?.iModel;\r\n this.tileId = args?.tileId;\r\n this.viewAttachmentId = args?.viewAttachmentId;\r\n this.transformFromIModel = args?.transformFromIModel;\r\n }\r\n\r\n /** The Id of the element that produced the pixel. */\r\n public get elementId(): Id64String | undefined {\r\n return this.feature?.elementId;\r\n }\r\n\r\n /** The Id of the [SubCategory]($backend) that produced the pixel. */\r\n public get subCategoryId(): Id64String | undefined {\r\n return this.feature?.subCategoryId;\r\n }\r\n\r\n /** The class of geometry that produced the pixel. */\r\n public get geometryClass(): GeometryClass | undefined {\r\n return this.feature?.geometryClass;\r\n }\r\n\r\n /** Computes the [[HitPriority]] of this pixel based on its [[type]] and [[planarity]]. */\r\n public computeHitPriority(): HitPriority {\r\n switch (this.type) {\r\n case Pixel.GeometryType.Surface:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\r\n case Pixel.GeometryType.Linear:\r\n return HitPriority.WireEdge;\r\n case Pixel.GeometryType.Edge:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\r\n case Pixel.GeometryType.Silhouette:\r\n return HitPriority.SilhouetteEdge;\r\n default:\r\n return HitPriority.Unknown;\r\n }\r\n }\r\n\r\n /** Convert this pixel to a [[Pixel.HitProps]] suitable for constructing a [[HitDetail]].\r\n * @param viewport The viewport in which the hit originated.\r\n */\r\n public toHitProps(viewport: Viewport): Pixel.HitProps {\r\n let viewAttachment: ViewAttachmentHitInfo | undefined;\r\n if (this.viewAttachmentId) {\r\n const attachmentViewport = viewport.view.getAttachmentViewport(this.viewAttachmentId);\r\n if (attachmentViewport)\r\n viewAttachment = { viewport: attachmentViewport, id: this.viewAttachmentId };\r\n }\r\n\r\n return {\r\n sourceId: this.elementId ?? Id64.invalid,\r\n priority: this.computeHitPriority(),\r\n distFraction: this.distanceFraction,\r\n subCategoryId: this.subCategoryId,\r\n geometryClass: this.geometryClass,\r\n modelId: this.modelId,\r\n tileId: this.tileId,\r\n isClassifier: this.isClassifier,\r\n sourceIModel: this.iModel,\r\n transformFromSourceIModel: this.transformFromIModel,\r\n viewAttachment,\r\n };\r\n }\r\n }\r\n\r\n /** Describes a subset of [[HitDetailProps]] computed from a [[Pixel.Data]], suitable for constructing a [[HitDetail]].\r\n * For example, the following function creates a `HitDetail` from a `Pixel.Data` and other hit information:\r\n * ```ts\r\n * function makeHitDetail(pixel: Pixel.Data, viewport: ScreenViewport, testPoint: Point3d, hitSource: HitSource, hitPoint: Point3d, distXY: number): HitDetail {\r\n * return new HitDetail({\r\n * ...pixel.toHitProps(viewport),\r\n * viewport, testPoint, hitSource, hitPoint, distXY,\r\n * };\r\n * }\r\n * ```\r\n * @see [[Data.toHitProps]] to convert a [[Pixel.Data]] to a `HitProps`.\r\n * @public\r\n */\r\n export interface HitProps {\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n sourceId: Id64String;\r\n /** The hit geometry priority/classification. */\r\n priority: HitPriority;\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n distFraction: number;\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n subCategoryId?: Id64String;\r\n /** The class of the hit geometry. */\r\n geometryClass?: GeometryClass;\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n modelId?: Id64String;\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n sourceIModel?: IModelConnection;\r\n /** @internal */\r\n transformFromSourceIModel?: Transform;\r\n /** @internal chiefly for debugging */\r\n tileId?: string;\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n isClassifier?: boolean;\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n viewAttachment?: ViewAttachmentHitInfo;\r\n }\r\n\r\n /** Describes the type of geometry that produced the [[Pixel.Data]]. */\r\n export enum GeometryType {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the type could not be determined. */\r\n Unknown, // Geometry was not selected, or type could not be determined\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** A surface produced this pixel. */\r\n Surface,\r\n /** A point primitive or polyline produced this pixel. */\r\n Linear,\r\n /** This pixel was produced by an edge of a surface. */\r\n Edge,\r\n /** This pixel was produced by a silhouette edge of a curved surface. */\r\n Silhouette,\r\n }\r\n\r\n /** Describes the planarity of the foremost geometry which produced the pixel. */\r\n export enum Planarity {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the planarity could not be determined. */\r\n Unknown,\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** Planar geometry produced this pixel. */\r\n Planar,\r\n /** Non-planar geometry produced this pixel. */\r\n NonPlanar,\r\n }\r\n\r\n /**\r\n * Bit-mask by which callers of [[Viewport.readPixels]] specify which aspects are of interest.\r\n * Aspects not specified will be omitted from the returned data.\r\n */\r\n export enum Selector {\r\n None = 0,\r\n /** Select the [[Feature]] which produced each pixel. */\r\n Feature = 1 << 0, // eslint-disable-line @typescript-eslint/no-shadow\r\n /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */\r\n GeometryAndDistance = 1 << 2,\r\n /** Select all aspects of each pixel. */\r\n All = GeometryAndDistance | Feature,\r\n }\r\n\r\n /** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.\r\n * The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\r\n * @see [[Viewport.readPixels]].\r\n */\r\n export interface Buffer {\r\n /** Retrieve the data associated with the pixel at (x,y) in view coordinates. */\r\n getPixel(x: number, y: number): Data;\r\n }\r\n\r\n /** A function which receives the results of a call to [[Viewport.readPixels]].\r\n * @note The contents of the buffer become invalid once the Receiver function returns. Do not store a reference to it.\r\n */\r\n export type Receiver = (pixels: Buffer | undefined) => void;\r\n}\r\n"]}
|
|
@@ -9,7 +9,8 @@ import { DisplayStyle2dState } from "./DisplayStyleState";
|
|
|
9
9
|
import { IModelConnection } from "./IModelConnection";
|
|
10
10
|
import { DisclosedTileTreeSet } from "./tile/internal";
|
|
11
11
|
import { SceneContext } from "./ViewContext";
|
|
12
|
-
import {
|
|
12
|
+
import { Viewport } from "./Viewport";
|
|
13
|
+
import { AttachToViewportArgs, ComputeDisplayTransformArgs, ExtentLimits, ViewState2d, ViewState3d } from "./ViewState";
|
|
13
14
|
/** Strictly for testing.
|
|
14
15
|
* @internal
|
|
15
16
|
*/
|
|
@@ -74,6 +75,10 @@ export declare class DrawingViewState extends ViewState2d {
|
|
|
74
75
|
/** @internal */
|
|
75
76
|
get areAllTileTreesLoaded(): boolean;
|
|
76
77
|
/** @internal */
|
|
77
|
-
get secondaryViewports(): Iterable<
|
|
78
|
+
get secondaryViewports(): Iterable<Viewport>;
|
|
79
|
+
/** @internal */
|
|
80
|
+
getAttachmentViewport(id: Id64String): Viewport | undefined;
|
|
81
|
+
/** @internal */
|
|
82
|
+
computeDisplayTransform(args: ComputeDisplayTransformArgs): Transform | undefined;
|
|
78
83
|
}
|
|
79
84
|
//# sourceMappingURL=DrawingViewState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawingViewState.d.ts","sourceRoot":"","sources":["../../src/DrawingViewState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAyB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EACL,gBAAgB,EAAW,4BAA4B,EAAE,6BAA6B,EAAkB,uBAAuB,EAAE,qBAAqB,EAAqB,cAAc,EAC1L,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAqB,SAAS,EAAkB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAA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iBAAiB,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI;IAMpE,gBAAgB;IACA,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAQxD,gBAAgB;IAChB,IAAoB,qBAAqB,IAAI,OAAO,CAEnD;IAED,gBAAgB;IAChB,IAAoB,kBAAkB,uBAErC;IAED,gBAAgB;IACA,qBAAqB,CAAC,EAAE,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS;IAI3E,gBAAgB;IACA,uBAAuB,CAAC,IAAI,EAAE,2BAA2B,GAAG,SAAS,GAAG,SAAS;CAOlG"}
|
|
@@ -128,14 +128,14 @@ class SectionAttachment {
|
|
|
128
128
|
return this._drawingExtents.z;
|
|
129
129
|
}
|
|
130
130
|
get drawingRange() {
|
|
131
|
-
const frustum3d = this._originalFrustum.transformBy(this.
|
|
131
|
+
const frustum3d = this._originalFrustum.transformBy(this.toDrawing);
|
|
132
132
|
return frustum3d.toRange();
|
|
133
133
|
}
|
|
134
134
|
constructor(view, toDrawing, fromDrawing, toSheet) {
|
|
135
135
|
this._viewRect = new ViewRect(0, 0, 1, 1);
|
|
136
136
|
this._originalFrustum = new Frustum();
|
|
137
137
|
// Save the input for clone(). Attach a copy to the viewport.
|
|
138
|
-
this.
|
|
138
|
+
this.toDrawing = toDrawing;
|
|
139
139
|
this._fromDrawing = fromDrawing;
|
|
140
140
|
this.viewport = OffScreenViewport.createViewport(view, new SectionTarget(this), true);
|
|
141
141
|
this.symbologyOverrides = new FeatureSymbology.Overrides(view);
|
|
@@ -143,13 +143,14 @@ class SectionAttachment {
|
|
|
143
143
|
let clip = this.view.getViewClip();
|
|
144
144
|
if (clip) {
|
|
145
145
|
clip = clip.clone();
|
|
146
|
-
const clipTransform = toSheet ? toSheet.multiplyTransformTransform(this.
|
|
146
|
+
const clipTransform = toSheet ? toSheet.multiplyTransformTransform(this.toDrawing) : this.toDrawing;
|
|
147
147
|
clip.transformInPlace(clipTransform);
|
|
148
148
|
clipVolume = IModelApp.renderSystem.createClipVolume(clip);
|
|
149
149
|
}
|
|
150
150
|
this._branchOptions = {
|
|
151
151
|
clipVolume,
|
|
152
152
|
hline: view.getDisplayStyle3d().settings.hiddenLineSettings,
|
|
153
|
+
viewAttachmentId: view.id,
|
|
153
154
|
frustum: {
|
|
154
155
|
is3d: true,
|
|
155
156
|
scale: { x: 1, y: 1 },
|
|
@@ -159,7 +160,7 @@ class SectionAttachment {
|
|
|
159
160
|
// Save off the original frustum (potentially adjusted by viewport).
|
|
160
161
|
this.viewport.setupFromView();
|
|
161
162
|
this.viewport.viewingSpace.getFrustum(CoordSystem.World, true, this._originalFrustum);
|
|
162
|
-
const drawingFrustum = this._originalFrustum.transformBy(this.
|
|
163
|
+
const drawingFrustum = this._originalFrustum.transformBy(this.toDrawing);
|
|
163
164
|
const drawingRange = drawingFrustum.toRange();
|
|
164
165
|
this._drawingExtents = drawingRange.diagonal();
|
|
165
166
|
this._drawingExtents.z = Math.abs(this._drawingExtents.z);
|
|
@@ -174,7 +175,7 @@ class SectionAttachment {
|
|
|
174
175
|
if (0 === pixelSize)
|
|
175
176
|
return;
|
|
176
177
|
// Adjust offscreen viewport's frustum based on intersection with drawing view frustum.
|
|
177
|
-
const frustum3d = this._originalFrustum.transformBy(this.
|
|
178
|
+
const frustum3d = this._originalFrustum.transformBy(this.toDrawing);
|
|
178
179
|
const frustumRange3d = frustum3d.toRange();
|
|
179
180
|
const frustum2d = context.viewport.getWorldFrustum();
|
|
180
181
|
const frustumRange2d = frustum2d.toRange();
|
|
@@ -207,7 +208,7 @@ class SectionAttachment {
|
|
|
207
208
|
graphics.symbologyOverrides = this.symbologyOverrides;
|
|
208
209
|
for (const graphic of source)
|
|
209
210
|
graphics.entries.push(graphic);
|
|
210
|
-
const branch = context.createGraphicBranch(graphics, this.
|
|
211
|
+
const branch = context.createGraphicBranch(graphics, this.toDrawing, this._branchOptions);
|
|
211
212
|
context.outputGraphic(branch);
|
|
212
213
|
};
|
|
213
214
|
outputGraphics(scene.foreground);
|
|
@@ -380,6 +381,17 @@ export class DrawingViewState extends ViewState2d {
|
|
|
380
381
|
get secondaryViewports() {
|
|
381
382
|
return this._attachment ? [this._attachment.viewport] : super.secondaryViewports;
|
|
382
383
|
}
|
|
384
|
+
/** @internal */
|
|
385
|
+
getAttachmentViewport(id) {
|
|
386
|
+
return id === this._attachment?.view.id ? this._attachment.viewport : undefined;
|
|
387
|
+
}
|
|
388
|
+
/** @internal */
|
|
389
|
+
computeDisplayTransform(args) {
|
|
390
|
+
if (args.viewAttachmentId === undefined || args.viewAttachmentId !== this._attachment?.view.id) {
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
return this._attachment.toDrawing;
|
|
394
|
+
}
|
|
383
395
|
}
|
|
384
396
|
/** Exposed strictly for testing and debugging. Indicates that when loading the view, the spatial view should be displayed even
|
|
385
397
|
* if `SectionDrawing.displaySpatialView` is not `true`.
|