@vertexvis/viewer 0.23.0-canary.9 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{queries-d2fa5d81.js → queries-d6dc6d9a.js} +26 -1
- package/dist/cjs/queries-d6dc6d9a.js.map +1 -0
- package/dist/cjs/vertex-viewer.cjs.entry.js +1 -1
- package/dist/collection/lib/scenes/scene.js +25 -0
- package/dist/collection/lib/scenes/scene.js.map +1 -1
- package/dist/components/queries.js +25 -0
- package/dist/components/queries.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/{queries-4bc18b75.js → queries-4ee5e8a6.js} +26 -1
- package/dist/esm/queries-4ee5e8a6.js.map +1 -0
- package/dist/esm/vertex-viewer.entry.js +1 -1
- package/dist/types/lib/scenes/scene.d.ts +25 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-1e5bc643.js → p-7153557a.js} +1 -1
- package/dist/viewer/{p-1e5bc643.js.map → p-7153557a.js.map} +1 -1
- package/dist/viewer/{p-4719bda1.entry.js → p-78b176a9.entry.js} +2 -2
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/readme.md +4 -4
- package/dist/cjs/queries-d2fa5d81.js.map +0 -1
- package/dist/esm/queries-4bc18b75.js.map +0 -1
- /package/dist/viewer/{p-4719bda1.entry.js.map → p-78b176a9.entry.js.map} +0 -0
package/dist/viewer/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2025 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
export{C as Camera,c as ColorMaterial,a as CrossSectioner,I as ItemOperationBuilder,l as LoadableResource,M as ModelViewController,P as PmiAnnotationOperationsBuilder,b as PmiAnnotationsQueryExecutor,k as PmiController,R as Raycaster,d as RootQuery,S as Scene,e as SceneElementQueryExecutor,f as SceneElementsOperationExecutor,g as SceneItemOperationsBuilder,h as SceneItemQueryExecutor,i as SceneItemsOperationExecutor,s as SceneViewStateIdentifier,j as SynchronizedClock}from"./p-
|
|
4
|
+
export{C as Camera,c as ColorMaterial,a as CrossSectioner,I as ItemOperationBuilder,l as LoadableResource,M as ModelViewController,P as PmiAnnotationOperationsBuilder,b as PmiAnnotationsQueryExecutor,k as PmiController,R as Raycaster,d as RootQuery,S as Scene,e as SceneElementQueryExecutor,f as SceneElementsOperationExecutor,g as SceneItemOperationsBuilder,h as SceneItemQueryExecutor,i as SceneItemsOperationExecutor,s as SceneViewStateIdentifier,j as SynchronizedClock}from"./p-7153557a.js";export{S as SceneTreeController}from"./p-27242771.js";export{f as fromNodeProto,i as isLoadedRow}from"./p-8b3dca96.js";export{S as SCENE_ITEM_NAME_METADATA_KEY}from"./p-3b6c73ee.js";export{C as CursorManager,b as boxQueryCursor,l as labelPinCursor,m as measurementCursor,a as measurementWithArrowCursor,p as pinCursor}from"./p-86fc3c19.js";export{M as MeasurementController,a as MeasurementEntity}from"./p-ac9cc6c0.js";export{M as MeasurementModel}from"./p-44f841fe.js";export{M as MeasurementOverlayManager}from"./p-081f0350.js";export{m as makeMinimumDistanceResult}from"./p-37208d54.js";import{v as r,q as o,m as t}from"./p-f33675bf.js";export{T as TransformController}from"./p-26459eda.js";export{A as AngleUnits,g as AreaUnits,c as CrossSectioning,D as DistanceUnits,F as FrameCameraBase,a as ReceivedFrame,b as ReceivedFrameImage,d as ReceivedFrameScene,e as ReceivedOrthographicCamera,f as ReceivedPerspectiveCamera,S as StandardView}from"./p-cbd730f0.js";export{E as EntityType}from"./p-509b1811.js";export{A as ArrowMarkup,C as CircleMarkup,F as FreeformMarkup}from"./p-dbf0dfd8.js";export{V as Viewport}from"./p-ba8357ef.js";export{V as VolumeIntersectionQueryController,a as VolumeIntersectionQueryModel}from"./p-da05fe41.js";import"./p-52065eb9.js";import"./p-ebded896.js";import"./p-bcce32b5.js";import"./p-89ac0b58.js";import"./p-7b723934.js";import"./p-ff6e7563.js";import"./p-8219c788.js";import"./p-e9f2c9df.js";import"./p-5a9f0243.js";const n=.9999;function u(e){const a=r.create(0,e.z,-e.y);const o=r.create(-e.z,0,e.x);const s=r.magnitudeSquared(a)>r.magnitudeSquared(o)?a:o;return r.normalize(r.cross(e,s))}function x(e,a){const s=r.dot(e,a);if(s>n){const r=u(e);const a=o.fromAxisAngle(r,Math.PI);return t.makeRotation(a)}else if(s<=-n){return t.makeIdentity()}else{const s=r.angleTo(a,e);const n=r.normalize(r.cross(e,a));return t.makeRotation(o.fromAxisAngle(n,s+Math.PI))}}function y(e,a,o,s){const n=x(e,o);const i=t.makeTranslation(s);return t.multiply(t.multiply(i,n),t.makeTranslation(r.negate(a)))}const O=Object.freeze({__proto__:null,ALMOST_ONE:n,calculateOrthogonalCoordinate:u,computeRotationMatrix:x,computeTransformationDelta:y});export{O as TransformationDelta};
|
|
5
5
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright (c) 2025 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import{c as e,u as t,a as s,b as n}from"./p-52065eb9.js";import{I as i,a as r,b as o}from"./p-ebded896.js";import{s as a,u,p as c,r as h}from"./p-7b723934.js";import{w as l}from"./p-89ac0b58.js";import{r as d,c as p}from"./p-ff6e7563.js";import{m as w,a as v,b as f}from"./p-8219c788.js";import{b as m,v as y,m as b,q as x,r as I,a as g,p as O,d as j}from"./p-f33675bf.js";import{t as S,v as B,L as R,w as A,h as E,f as V,i as q,u as T,e as k}from"./p-cbd730f0.js";import"./p-509b1811.js";import{t as C}from"./p-e9f2c9df.js";const P={opacity:255,glossiness:4,diffuse:{r:0,g:0,b:0,a:0},ambient:{r:0,g:0,b:0,a:0},specular:{r:0,g:0,b:0,a:0},emissive:{r:0,g:0,b:0,a:0}};const M=(e,t,s,n)=>Object.assign(Object.assign({},P),{opacity:n!==null&&n!==void 0?n:P.opacity,diffuse:{r:e,g:t,b:s,a:0}});const _=(t,s)=>{const n=e.fromHexString(t);return Object.assign(Object.assign({},P),{opacity:s!==null&&s!==void 0?s:P.opacity,diffuse:n!=null?Object.assign({},n):Object.assign({},P.diffuse)})};const D=Object.freeze({__proto__:null,defaultColor:P,create:M,fromHex:_});function U(e){var s;const n=t.parse(e);if(n.scheme!=="urn"||n.path==null){throw new Error("Invalid URN. Expected URN scheme.")}const[r,o,a,...u]=n.path.split(/[:/]/);if(r!=="vertexvis"&&r!=="vertex"){throw new Error("Invalid URN. Expected URN to be vertex namespace")}if(r==="vertexvis"){console.warn("vertexvis namespace is deprecated. Use 'vertex' for the namespace urn instead")}switch(o){case"stream-key":const e=z(n.query);const t=(s=F(u.join("/")))!==null&&s!==void 0?s:e.find((e=>e.type==="scene-view-state"));return{resource:{type:"stream-key",id:a},subResource:t,queries:e.filter((e=>e.type!=="scene-view-state"))};default:throw new i(`Invalid URN. Unknown resource type ${o}`)}}function F(e){if(e!=null){const[t,s]=e.split("/");switch(t){case"scene-view-states":return{type:"scene-view-state",id:s};default:return undefined}}}function z(e){if(e!=null){return e.split("&").map((e=>{const[t,s]=e.split("=");switch(t){case"supplied-id":return{type:"supplied-id",id:s};case"scene-view-state":return{type:"scene-view-state",id:s};default:throw new Error("Invalid URN. Unknown query value type")}}))}else{return[]}}const N=Object.freeze({__proto__:null,fromUrn:U});function H(e){return e.id!=null}function L(e){return e.suppliedId!=null}const Y=Object.freeze({__proto__:null,isSceneViewStateId:H,isSceneViewStateSuppliedId:L});class Q{constructor(e,t=new Date){this.knownRemoteTime=e;this.knownLocalTime=t}localOffset(){return this.duration(this.knownLocalTime,this.localNow())}localTime(e){const t=typeof e==="number"?new Date(this.knownLocalTime.getTime()+e):e;const s=this.duration(this.knownRemoteTime,t);return this.addDuration(this.knownLocalTime,s)}remoteOffset(e=new Date){return this.duration(this.remoteTime(this.knownLocalTime),this.remoteTime(e))}remoteNow(){return this.remoteTime(this.localNow())}remoteTime(e){const t=typeof e==="number"?new Date(this.knownLocalTime.getTime()+e):e;const s=this.duration(this.knownLocalTime,t);return this.addDuration(this.knownRemoteTime,s)}addDuration(e,t){return new Date(e.getTime()+t)}duration(e,t){return t.getTime()-e.getTime()}localNow(){return new Date(Date.now())}}class W{constructor(e,t,s,n){this.client=e;this.stream=t;this.jwtProvider=s;this.deviceIdProvider=n}async listByItem(e,{hasAnnotations:t,cursor:n,size:i=50}={}){const r=await d((async r=>{const o=this.deviceIdProvider();const h=await p(this.jwtProvider,o);const d=new a.ListItemModelViewsRequest;const{msb:w,lsb:v}=s.toMsbLsb(e);const f=new u.Uuid2l;f.setMsb(w);f.setLsb(v);d.setItemId(f);if(t!=null){const e=new l.BoolValue;e.setValue(t);d.setHasAnnotations(e)}const m=new c.Pager;m.setLimit(i);if(n!=null){m.setCursor(n)}d.setPage(m);this.client.listItemModelViews(d,h,r)}));return w(r.toObject())}async load(e,t){const s=v({modelViewId:t,sceneItemId:e});this.stream.updateModelView({itemModelView:s},true)}async unload(){this.stream.updateModelView({},true)}}class ${constructor(e,t,s){this.client=e;this.jwtProvider=t;this.deviceIdProvider=s}async listAnnotations({modelViewId:e,cursor:t,size:n=50}={}){const i=await d((async i=>{const r=this.deviceIdProvider();const o=await p(this.jwtProvider,r);const h=new a.ListPmiAnnotationsRequest;if(e!=null){const{msb:t,lsb:n}=s.toMsbLsb(e);const i=new u.Uuid2l;i.setMsb(t);i.setLsb(n);h.setModelViewId(i)}const l=new c.Pager;l.setLimit(n);if(t!=null){l.setCursor(t)}h.setPage(l);this.client.listPmiAnnotations(h,o,i)}));return f(i.toObject())}}const G=1e3*10;class J{constructor(e,t,s,n=G){this.stream=e;this.predicate=t;this.transform=s;this.timeout=n;this.listeners=[];this.handleMessage=this.handleMessage.bind(this)}on(e){this.listeners=[...this.listeners,e];if(this.eventDisposable==null||this.requestDisposable==null){this.addListeners()}}off(e){this.listeners=this.listeners.filter((t=>t!==e));if(this.listeners.length===0){this.removeListeners()}}once(){let e;return n.timeout(this.timeout,new Promise((t=>{e=s=>{t(s);this.off(e)};this.on(e)}))).finally((()=>{this.off(e)}))}handleMessage(e){if(this.predicate(e)){const t=this.transform(e);if(t!=null){this.listeners.forEach((e=>e(t)))}}}addListeners(){this.eventDisposable=this.stream.onEvent(this.handleMessage);this.requestDisposable=this.stream.onRequest(this.handleMessage)}removeListeners(){var e,t;(e=this.eventDisposable)===null||e===void 0?void 0:e.dispose();(t=this.requestDisposable)===null||t===void 0?void 0:t.dispose()}}class K{constructor(e,t,{animationId:s,correlationId:n},i){this.data=undefined;this.onAnimationCompleted=new J(e,(e=>{var t,n,i;return((i=(n=(t=e.event)===null||t===void 0?void 0:t.animationCompleted)===null||n===void 0?void 0:n.animationId)===null||i===void 0?void 0:i.hex)===s}),(e=>{var t,s,n;return((n=(s=(t=e.event)===null||t===void 0?void 0:t.animationCompleted)===null||s===void 0?void 0:s.animationId)===null||n===void 0?void 0:n.hex)||undefined}),i);this.onFrameReceived=new J(e,(e=>{var t,s,i;return!!((i=(s=(t=e.request)===null||t===void 0?void 0:t.drawFrame)===null||s===void 0?void 0:s.frameCorrelationIds)===null||i===void 0?void 0:i.some((e=>e===n)))}),(e=>{var s;return((s=e.request)===null||s===void 0?void 0:s.drawFrame)!=null?t(e.request.drawFrame):undefined}),i)}}function X(e){if(typeof e==="string"){return{sceneViewStateId:{hex:e}}}else if(H(e)){return{sceneViewStateId:{hex:e.id}}}else if(L(e)){return{sceneViewStateSuppliedId:{value:e.suppliedId}}}else{throw new Error("Unable to build scene view state identifier, input must be a string or `SceneViewStateIdentifier`.")}}function Z(e,t){switch(e.type){case"and":case"or":return{operand:{itemCollection:{queries:e.expressions.map((e=>({sceneItemQuery:ne(e)})))}}};case"not":return{not:{expression:Z(e.query,t)}};case"item-id":case"supplied-id":return{operand:{item:{sceneItemQuery:ne(e)}}};case"all":return{operand:{root:{}}};case"scene-tree-range":return{operand:{sceneTreeRange:{start:e.range.start,end:e.range.end}}};case"metadata":if(e.removeHiddenItems){return{and:{first:{operand:{metadata:{valueFilter:e.filter,keys:e.keys,exactMatch:e.exactMatch}}},second:{operand:{override:{visibility:{visibilityState:true}}}}}}}else{return{operand:{metadata:{valueFilter:e.filter,keys:e.keys,exactMatch:e.exactMatch}}}}case"all-selected":return{operand:{override:{selection:{}}}};case"all-visible":return{operand:{override:{visibility:{visibilityState:true}}}};case"point":return{operand:{point:{point:e.point,viewport:t.dimensions}}};case"volume-intersection":return{operand:{volume:{frustumByRectangle:{rectangle:e.rectangle},exclusive:e.exclusive,viewport:t.dimensions}}};default:return{}}}function ee(e,t){switch(e.type){case"and":const t=e.expressions.length;if(t===1){return ee({type:"annotation-id",value:e.expressions[0].value})}else if(t!==2){throw new Error("Incorrect number of query expressions provided.")}return{and:{first:ee(e.expressions[0]),second:ee(e.expressions[1])}};case"or":const n=e.expressions.length;if(n===1){return ee({type:"annotation-id",value:e.expressions[0].value})}else if(n!==2){throw new Error("Incorrect number of query expressions provided.")}return{or:{first:ee(e.expressions[0]),second:ee(e.expressions[1])}};case"not":return{not:{expression:ee(e.query)}};case"annotation-id":const{msb:i,lsb:r}=s.toMsbLsb(e.value);return{operand:{annotation:{id:new B.protobuf.core.Uuid2l({msb:R.fromString(i),lsb:R.fromString(r)})}}};case"all":return{operand:{all:{}}};default:return{}}}function te(e,t,s){const n=re(t);const i=Z(e,s);return{sceneItemOperation:{queryExpression:i,operationTypes:n}}}function se(e,t,s){const n=oe(t);const i=ee(e);return{pmiAnnotationOperation:{queryExpression:i,operationTypes:n}}}function ne(e){switch(e.type){case"item-id":return{id:new B.protobuf.core.Uuid({hex:e.value})};case"supplied-id":return{suppliedId:e.value};default:return{}}}function ie(e,t,s,n){const i={frameCorrelationId:{value:e},animation:s?{duration:C(s.milliseconds)}:undefined,baseCamera:n!=null?S(n):undefined};switch(t.flyTo.type){case"supplied":{return Object.assign(Object.assign({},i),{itemSuppliedId:t.flyTo.data})}case"internal":{return Object.assign(Object.assign({},i),{itemId:new B.protobuf.core.Uuid({hex:t.flyTo.data})})}case"camera":{return Object.assign(Object.assign({},i),{camera:S(t.flyTo.data)})}case"bounding-box":{return Object.assign(Object.assign({},i),{boundingBox:{xmin:t.flyTo.data.min.x,xmax:t.flyTo.data.max.x,ymin:t.flyTo.data.min.y,ymax:t.flyTo.data.max.y,zmin:t.flyTo.data.min.z,zmax:t.flyTo.data.max.z}})}default:return{}}}function re(e){return e.map((e=>{var t,s;switch(e.type){case"change-material":return{changeMaterial:{materialOverride:{colorMaterial:{d:e.material.opacity,ns:e.material.glossiness,ka:e.material.ambient,kd:e.material.diffuse,ks:e.material.specular,ke:e.material.emissive}}}};case"clear-override":return{clearMaterial:{}};case"change-transform":return{changeTransform:{transform:Object.assign({},e.transform)}};case"clear-transform":return{clearTransform:{cascade:e.cascade}};case"hide":return{changeVisibility:{visible:false}};case"show":return{changeVisibility:{visible:true}};case"select":return{changeSelection:{selected:true}};case"deselect":return{changeSelection:{selected:false}};case"change-phantom":return{changePhantom:{phantom:(t=e.phantomState)!==null&&t!==void 0?t:true}};case"clear-phantom":return{changePhantom:{phantom:false}};case"change-end-item":return{changeEndItem:{endItem:(s=e.endItemState)!==null&&s!==void 0?s:true}};case"clear-end-item":return{changeEndItem:{endItem:false}};case"view-rendition-by-id":return{viewRendition:{id:new B.protobuf.core.Uuid({hex:e.id})}};case"view-rendition-by-supplied-id":return{viewRendition:{suppliedId:e.suppliedId}};case"view-default-rendition":return{viewDefaultRendition:{}};case"clear-rendition":return{clearRendition:{}};case"view-representation":if(e.id==="empty"){return{viewRepresentation:{predefinedId:h.RepresentationPredefinedId.REPRESENTATION_PREDEFINED_ID_EMPTY}}}else if(e.id==="entire-part"){return{viewRepresentation:{predefinedId:h.RepresentationPredefinedId.REPRESENTATION_PREDEFINED_ID_ENTIRE_PART}}}else{return{viewRepresentation:{id:new B.protobuf.core.Uuid({hex:e.id})}}}case"clear-representation":return{clearRepresentation:{}};default:return{}}}))}function oe(e){return e.map((e=>{switch(e.type){case"show":return{changeVisibility:{visible:true}};case"hide":return{changeVisibility:{visible:false}};case"select":return{changeSelection:{selected:true}};case"deselect":return{changeSelection:{selected:false}};default:return{}}}))}function ae(e){return e.map((e=>{switch(e){case"camera":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_CAMERA;case"material_overrides":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_MATERIAL_OVERRIDE;case"selection":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_SELECTION;case"visibility":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_VISIBILITY;case"transforms":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_TRANSFORM;case"cross_section":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_CROSS_SECTION;case"phantom":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_PHANTOM;case"shading":return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_SHADING;default:return B.protobuf.stream.SceneViewStateFeature.SCENE_VIEW_STATE_FEATURE_INVALID}}))}class ue{constructor(e){this.flyToOptions=e}build(){return this.flyToOptions}}class ce{withItemId(e){return new ue({flyTo:{type:"internal",data:e}})}withSuppliedId(e){return new ue({flyTo:{type:"supplied",data:e}})}withCamera(e){return new ue({flyTo:{type:"camera",data:e}})}withBoundingBox(e){return new ue({flyTo:{type:"bounding-box",data:e}})}build(){return this.flyToOptions}}class he{constructor(e,t,s,n,i,r){this.stream=e;this.aspect=t;this.data=s;this.boundingBox=n;this.decodeFrame=i;this.flyToOptions=r}fitToBoundingBox(e){return this.flyTo({boundingBox:e})}signedDistanceToBoundingBoxCenter(e){const{position:t,viewVector:s}=A(this.data);const n=m.center(e!==null&&e!==void 0?e:this.boundingBox);const i=y.subtract(n,t);return y.dot(s,i)/y.magnitude(s)}flyTo(e){if(typeof e!=="function"){return this.updateFlyToOptions({flyTo:this.buildFlyToType(e)})}else{return this.updateFlyToOptions(e(new ce).build())}}viewAll(){return this.fitToBoundingBox(this.boundingBox)}async render(e){var t,n,i;if(this.flyToOptions==null&&e!=null){this.flyToOptions={flyTo:{type:"camera",data:this.data}}}try{const r=s.create();if(this.flyToOptions!=null){const s=ie(r,this.flyToOptions,e===null||e===void 0?void 0:e.animation,this.toFrameCamera());const o=await this.stream.flyTo(s,true);return new K(this.stream,this.decodeFrame,{correlationId:r,animationId:((n=(t=o.flyTo)===null||t===void 0?void 0:t.animationId)===null||n===void 0?void 0:n.hex)||undefined},((i=e===null||e===void 0?void 0:e.animation)===null||i===void 0?void 0:i.milliseconds)!=null?e.animation.milliseconds+G:undefined)}else{this.stream.replaceCamera({camera:S(this.data),frameCorrelationId:{value:r}});return new K(this.stream,this.decodeFrame,{correlationId:r})}}catch(e){console.warn("Error when performing render: ",e);throw e}}rotateAroundAxis(e,t){return this.rotateAroundAxisAtPoint(e,this.data.lookAt,t)}alignTo(e,t){const s=y.normalize(y.cross(this.up,y.normalize(this.viewVector)));const n=y.normalize(y.cross(y.normalize(this.viewVector),s));const i=y.angleTo(t,n)>Math.PI/2?y.negate(n):n;const r=y.isEqual(i,t)?s:y.normalize(y.cross(i,t));const o=y.transformMatrix(this.viewVector,b.makeRotation(x.fromAxisAngle(r,y.angleTo(t,i))));const a=I.create({origin:e,direction:y.normalize(o)});const u=I.at(a,y.magnitude(this.viewVector));return this.update({position:e,lookAt:u,up:t})}standardView(e){return this.update({position:e.position,viewVector:y.subtract(y.origin(),e.position),lookAt:y.origin(),up:e.up})}standardViewFixedLookAt(e){const t=I.create({origin:this.lookAt,direction:y.normalize(e.position)});const s=I.at(t,y.magnitude(this.viewVector));return this.update({up:e.up,position:s,viewVector:y.subtract(this.lookAt,s)})}buildFlyToType(e){if(e.boundingBox!=null){return{type:"bounding-box",data:e.boundingBox}}else if(e.camera!=null){return{type:"camera",data:e.camera}}else if(e.itemId!=null){return{type:"internal",data:e.itemId}}else if(e.itemSuppliedId!=null){return{type:"supplied",data:e.itemSuppliedId}}else{throw new Error("Fly to must specify at least one option.")}}computeClippingPlanes(e){return E(this.boundingBox,e)}}class le extends he{constructor(e,t,s,n,i,r){super(e,t,s,n,i,r);this.perspectiveData=s}moveBy(e){return this.update({position:y.add(this.position,e),lookAt:y.add(this.lookAt,e)})}rotateAroundAxisAtPoint(e,t,s){return this.update({position:y.rotateAboutAxis(e,this.position,s,t),lookAt:y.rotateAboutAxis(e,this.lookAt,s,t),up:y.rotateAboutAxis(e,this.up,s,y.origin())})}update(e){var t;const s=(t=e.fovY)!==null&&t!==void 0?t:this.fovY;return new le(this.stream,this.aspect,Object.assign(Object.assign(Object.assign({},this.perspectiveData),e),{fovY:s}),this.boundingBox,this.decodeFrame,this.flyToOptions)}toFrameCamera(){var e;return new V(this.position,this.lookAt,this.up,this.near,this.far,this.aspectRatio,(e=this.fovY)!==null&&e!==void 0?e:45)}get viewVector(){return y.subtract(this.lookAt,this.position)}get position(){return Object.assign({},this.perspectiveData.position)}get up(){return Object.assign({},this.perspectiveData.up)}get lookAt(){return Object.assign({},this.perspectiveData.lookAt)}get fovY(){return this.perspectiveData.fovY}get aspectRatio(){return this.aspect}get near(){const{near:e}=this.computeClippingPlanes(this.perspectiveData);return e}get far(){const{far:e}=this.computeClippingPlanes(this.perspectiveData);return e}updateFlyToOptions(e){return new le(this.stream,this.aspect,this.perspectiveData,this.boundingBox,this.decodeFrame,e)}}class de extends he{constructor(e,t,s,n,i,r){super(e,t,s,n,i,r);this.orthographicData=s}moveBy(e){const t=y.add(this.lookAt,e);return this.update({lookAt:t,rotationPoint:t})}rotateAroundAxisAtPoint(e,t,s){const n=y.rotateAboutAxis(e,this.lookAt,s,t);const i=y.rotateAboutAxis(e,this.position,s,t);const r=q(y.subtract(n,i),g.create(this.boundingBox));return this.update({viewVector:r,lookAt:n,up:y.rotateAboutAxis(e,this.up,s,y.origin())})}update(e){return new de(this.stream,this.aspect,Object.assign(Object.assign({},this.orthographicData),e),this.boundingBox,this.decodeFrame,this.flyToOptions)}toFrameCamera(){const e=g.create(this.boundingBox);const t=q(this.viewVector,e);const s=T(this.lookAt,t,e.center);return new k(t,s,this.up,this.near,this.far,this.aspectRatio,this.fovHeight,this.rotationPoint)}get viewVector(){return Object.assign({},this.orthographicData.viewVector)}get position(){return y.add(this.lookAt,y.negate(this.viewVector))}get rotationPoint(){const e=this.orthographicData.rotationPoint;if(e!=null){return e}else{return undefined}}get up(){return Object.assign({},this.orthographicData.up)}get lookAt(){return Object.assign({},this.orthographicData.lookAt)}get fovHeight(){return this.orthographicData.fovHeight}get aspectRatio(){return this.aspect}get near(){const{near:e}=this.computeClippingPlanes(this.orthographicData);return e}get far(){const{far:e}=this.computeClippingPlanes(this.orthographicData);return e}updateFlyToOptions(e){return new de(this.stream,this.aspect,this.orthographicData,this.boundingBox,this.decodeFrame,e)}}class pe{constructor(e,t){this.stream=e;this.data=t}async update(e){const t=await this.stream.updateCrossSectioning({crossSectioning:{sectionPlanes:e.sectionPlanes,highlightColor:e.highlightColor,lineWidth:(e===null||e===void 0?void 0:e.lineWidth)!=null?{value:e.lineWidth}:null}},true);return t.updateCrossSectioning||undefined}current(){return this.data}}class we{constructor(e=[]){this.operations=e}build(){return this.operations.concat()}materialOverride(e){return new we(this.operations.concat([{type:"change-material",material:e}]))}show(){return new we(this.operations.concat([{type:"show"}]))}hide(){return new we(this.operations.concat([{type:"hide"}]))}select(){return new we(this.operations.concat([{type:"select"}]))}deselect(){return new we(this.operations.concat([{type:"deselect"}]))}clearMaterialOverrides(){return new we(this.operations.concat([{type:"clear-override"}]))}transform(e){return new we(this.operations.concat([{type:"change-transform",transform:e}]))}clearTransforms(e=true){return new we(this.operations.concat([{type:"clear-transform",cascade:e}]))}setPhantom(e){return new we(this.operations.concat([{type:"change-phantom",phantomState:e}]))}clearPhantom(){return new we(this.operations.concat([{type:"clear-phantom"}]))}setEndItem(e){return new we(this.operations.concat([{type:"change-end-item",endItemState:e}]))}clearEndItem(){return new we(this.operations.concat([{type:"clear-end-item"}]))}viewRenditionById(e){return new we(this.operations.concat([{type:"view-rendition-by-id",id:e}]))}viewRenditionBySuppliedId(e){return new we(this.operations.concat([{type:"view-rendition-by-supplied-id",suppliedId:e}]))}viewDefaultRendition(){return new we(this.operations.concat([{type:"view-default-rendition"}]))}clearRendition(){return new we(this.operations.concat([{type:"clear-rendition"}]))}viewRepresentation(e){return new we(this.operations.concat({type:"view-representation",id:e}))}clearRepresentation(){return new we(this.operations.concat({type:"clear-representation"}))}}class ve{constructor(e=[]){this.operations=e}build(){return this.operations.concat()}show(){return new ve(this.operations.concat([{type:"show"}]))}hide(){return new ve(this.operations.concat([{type:"hide"}]))}select(){return new ve(this.operations.concat([{type:"select"}]))}deselect(){return new ve(this.operations.concat([{type:"deselect"}]))}}class fe{constructor(e,t){this.stream=e;this.imageScaleProvider=t}async hitItems(e,t){const s=this.imageScaleProvider();const n=await this.stream.hitItems({point:O.scale(e,(s===null||s===void 0?void 0:s.x)||1,(s===null||s===void 0?void 0:s.y)||1),includeMetadata:t===null||t===void 0?void 0:t.includeMetadata},true);return n.hitItems||undefined}}const me=1e3*30;class ye{constructor(e,t,s,n){this.onFrameDrawn=new J(e,(e=>{var t,n,i;return!!((i=(n=(t=e.request)===null||t===void 0?void 0:t.drawFrame)===null||n===void 0?void 0:n.frameCorrelationIds)===null||i===void 0?void 0:i.some((e=>e===s)))}),(e=>{var s;return((s=e.request)===null||s===void 0?void 0:s.drawFrame)!=null?t(e.request.drawFrame):undefined}),n!==null&&n!==void 0?n:me)}}class be{constructor(e,t,s,n){this.stream=e;this.decodeFrame=t;this.sceneId=s;this.sceneViewId=n}async applySceneViewState(e,t={}){const s=X(e);await this.animateToSceneViewState(s,t);return await this.stream.loadSceneViewState(Object.assign(Object.assign({},s),{frameCorrelationId:t.suppliedCorrelationId?{value:t.suppliedCorrelationId}:undefined}),true)}async applyPartialSceneViewState(e,t,s={}){const n=X(e);const i=ae(t);if(t.includes("camera")){await this.animateToSceneViewState(n,s)}return await this.stream.loadSceneViewState(Object.assign(Object.assign({},n),{frameCorrelationId:s.suppliedCorrelationId?{value:s.suppliedCorrelationId}:undefined,sceneViewStateFeatureSubset:i}),true)}async animateToSceneViewState(e,t){var n,i,r;if(t.animation!=null){const o=s.create();const a=await this.stream.flyTo({sceneViewStateIdentifier:e,animation:{duration:C(t.animation.milliseconds)},frameCorrelationId:{value:o}},true);if(t.waitForAnimation==null||t.waitForAnimation){const e=new K(this.stream,this.decodeFrame,{animationId:(r=(i=(n=a.flyTo)===null||n===void 0?void 0:n.animationId)===null||i===void 0?void 0:i.hex)!==null&&r!==void 0?r:undefined,correlationId:o},t.animation.milliseconds+G);await e.onAnimationCompleted.once()}}}}class xe{constructor(e,t){this.query=e;this.builder=t!==null&&t!==void 0?t:new we}isItemBuilder(){return true}isAnnotationBuilder(){return false}materialOverride(e){if(typeof e==="string"){return new xe(this.query,this.builder.materialOverride(_(e)))}else{return new xe(this.query,this.builder.materialOverride(e))}}hide(){return new xe(this.query,this.builder.hide())}show(){return new xe(this.query,this.builder.show())}select(){return new xe(this.query,this.builder.select())}deselect(){return new xe(this.query,this.builder.deselect())}clearMaterialOverrides(){return new xe(this.query,this.builder.clearMaterialOverrides())}transform(e){if(Array.isArray(e)){if(e.length!==16){throw new r("Matrix provided must contain exactly 16 values (4x4).")}return new xe(this.query,this.builder.transform({r0:{x:e[0],y:e[1],z:e[2],w:e[3]},r1:{x:e[4],y:e[5],z:e[6],w:e[7]},r2:{x:e[8],y:e[9],z:e[10],w:e[11]},r3:{x:e[12],y:e[13],z:e[14],w:e[15]}}))}else{return new xe(this.query,this.builder.transform(e))}}clearTransforms(e=true){return new xe(this.query,this.builder.clearTransforms(e))}setPhantom(e){return new xe(this.query,this.builder.setPhantom(e))}clearPhantom(){return new xe(this.query,this.builder.clearPhantom())}setEndItem(e){return new xe(this.query,this.builder.setEndItem(e))}clearEndItem(){return new xe(this.query,this.builder.clearEndItem())}viewRenditionById(e){return new xe(this.query,this.builder.viewRenditionById(e))}viewRenditionBySuppliedId(e){return new xe(this.query,this.builder.viewRenditionBySuppliedId(e))}viewDefaultRendition(){return new xe(this.query,this.builder.viewDefaultRendition())}clearRendition(){return new xe(this.query,this.builder.clearRendition())}viewRepresentation(e){return new xe(this.query,this.builder.viewRepresentation(e))}clearRepresentation(){return new xe(this.query,this.builder.clearRepresentation())}build(){return{query:this.query,operations:this.builder.build()}}}class Ie{constructor(e,t){this.query=e;this.builder=t!==null&&t!==void 0?t:new ve}isItemBuilder(){return false}isAnnotationBuilder(){return true}hide(){return new Ie(this.query,this.builder.hide())}show(){return new Ie(this.query,this.builder.show())}select(){return new Ie(this.query,this.builder.select())}deselect(){return new Ie(this.query,this.builder.deselect())}build(){return{query:this.query,operations:this.builder.build()}}}class ge{constructor(e,t,s,n,i,r){this.sceneViewId=e;this.stream=t;this.decodeFrame=s;this.dimensions=n;this.sceneItemQueryOperations=i;this.pmiAnnotationQueryOperations=r}async execute(e){var t;const n=this.sceneItemQueryOperations.map((e=>te(e.query,e.operations,{dimensions:this.dimensions})));const i=this.pmiAnnotationQueryOperations.map((e=>se(e.query,e.operations)));const r=(t=e===null||e===void 0?void 0:e.suppliedCorrelationId)!==null&&t!==void 0?t:s.create();const o={sceneViewId:{hex:this.sceneViewId},elementOperations:[...n,...i],suppliedCorrelationId:{value:r}};await this.stream.createSceneAlteration(o)}}class Oe extends ge{async execute(e){var t;if(e===null||e===void 0?void 0:e.awaitCorrelatedFrame){const n=(t=e.suppliedCorrelationId)!==null&&t!==void 0?t:s.create();const i=new ye(this.stream,this.decodeFrame,n);await super.execute(Object.assign(Object.assign({},e),{suppliedCorrelationId:n}));await i.onFrameDrawn.once()}else{await super.execute(e)}}}class je extends ge{async execute(e){var t;if(e===null||e===void 0?void 0:e.skipAwaitCorrelatedFrame){await super.execute(e)}else{const n=(t=e===null||e===void 0?void 0:e.suppliedCorrelationId)!==null&&t!==void 0?t:s.create();const i=new ye(this.stream,this.decodeFrame,n);await super.execute(Object.assign(Object.assign({},e),{suppliedCorrelationId:n}));await i.onFrameDrawn.once()}}}class Se{constructor(e,t,s,n,i,r,o){this.stream=e;this.frame=t;this.decodeFrame=s;this.imageScaleProvider=n;this.dimensions=i;this.sceneId=r;this.sceneViewId=o;this.sceneViewStateLoader=new be(e,s,r,o)}async applySceneViewState(e,t={}){return await this.sceneViewStateLoader.applySceneViewState(e,t)}async applyPartialSceneViewState(e,t,s={}){return await this.sceneViewStateLoader.applyPartialSceneViewState(e,t,s)}async reset(e={}){return await this.stream.resetSceneView({includeCamera:e.includeCamera,frameCorrelationId:e.suppliedCorrelationId?{value:e.suppliedCorrelationId}:undefined},true)}items(e){const t=e(new We);const s=Array.isArray(t)?t:[t];const n=s.filter((e=>e.isItemBuilder()));const i=n.reduce(((e,t)=>e.concat(t.build())),[]);return new Oe(this.sceneViewId,this.stream,this.decodeFrame,this.dimensions,i,[])}elements(e){const t=e(new Ye);const s=Array.isArray(t)?t:[t];const n=s.filter((e=>e.isItemBuilder()));const i=n.reduce(((e,t)=>e.concat(t.build())),[]);const r=s.filter((e=>e.isAnnotationBuilder()));const o=r.reduce(((e,t)=>e.concat(t.build())),[]);return new je(this.sceneViewId,this.stream,this.decodeFrame,this.dimensions,i,o)}camera(){const{scene:e}=this.frame;if(e.camera.isOrthographic()){return new de(this.stream,j.aspectRatio(this.viewport()),{viewVector:e.camera.viewVector,lookAt:e.camera.lookAt,up:e.camera.up,fovHeight:e.camera.fovHeight,rotationPoint:e.camera.lookAt},this.frame.scene.boundingBox,this.decodeFrame)}else if(e.camera.isPerspective()){return new le(this.stream,j.aspectRatio(this.viewport()),{position:e.camera.position,lookAt:e.camera.lookAt,up:e.camera.up,fovY:e.camera.fovY},this.frame.scene.boundingBox,this.decodeFrame)}else{throw new o("Cannot retrieve camera. Scene has an unknown or invalid camera type.")}}isOrthographic(){const{scene:e}=this.frame;return e.camera.isOrthographic()}boundingBox(){return this.frame.scene.boundingBox}crossSectioning(){return new pe(this.stream,this.frame.scene.crossSection)}raycaster(){return new fe(this.stream,this.imageScaleProvider)}viewport(){return this.frame.dimensions}scale(){return this.imageScaleProvider()||O.create(1,1)}}class Be{constructor(e){this.inverted=e}build(){if(this.inverted){return{type:"not",query:this.queryExpressionBuilder()}}else{return this.queryExpressionBuilder()}}}class Re{constructor(e=false){this.inverted=e}all(){return new qe}not(){return new Ae(!this.inverted)}withItemIds(e){return new De(e,"item-id",this.inverted)}withSuppliedIds(e){return new De(e,"supplied-id",this.inverted)}withItemId(e){return new Ue({type:"item-id",value:e},this.inverted)}withSuppliedId(e){return new Ue({type:"supplied-id",value:e},this.inverted)}withSceneTreeRange(e){return new Te(e,this.inverted)}withMetadata(e,t,s,n){return new ke(e,t,s,this.inverted,n)}withSelected(){return new Ce(this.inverted)}withVisible(){return new Pe(this.inverted)}withPoint(e){return new Me(e,this.inverted)}withVolumeIntersection(e,t){return new _e(e,this.inverted,t)}}class Ae extends Re{constructor(e){super(e)}}class Ee{constructor(e=false){this.inverted=e}all(){return new qe}not(){return new Ve(!this.inverted)}withAnnotationIds(e){return new De(e,"annotation-id",this.inverted)}withAnnotationId(e){return new Ne({type:"annotation-id",value:e},this.inverted)}}class Ve extends Ee{constructor(e){super(e)}}class qe extends Be{constructor(e=false){super(e)}queryExpressionBuilder(){return{type:"all"}}}class Te extends Be{constructor(e,t){super(t);this.range=e}queryExpressionBuilder(){return{type:"scene-tree-range",range:this.range}}}class ke extends Be{constructor(e,t,s,n,i){super(n);this.filter=e;this.keys=t;this.exactMatch=s;this.removeHiddenItems=i}queryExpressionBuilder(){return{type:"metadata",filter:this.filter,keys:this.keys,exactMatch:this.exactMatch,removeHiddenItems:this.removeHiddenItems}}}class Ce extends Be{constructor(e){super(e)}queryExpressionBuilder(){return{type:"all-selected"}}}class Pe extends Be{constructor(e){super(e)}queryExpressionBuilder(){return{type:"all-visible"}}}class Me extends Be{constructor(e,t){super(t);this.point=e}queryExpressionBuilder(){return{type:"point",point:this.point}}}class _e extends Be{constructor(e,t,s){super(t);this.rectangle=e;this.exclusive=s}queryExpressionBuilder(){return{type:"volume-intersection",rectangle:this.rectangle,exclusive:!!this.exclusive}}}class De extends Be{constructor(e,t,s){super(s);this.ids=e;this.type=t}queryExpressionBuilder(){return{type:"or",expressions:this.ids.map((e=>({type:this.type,value:e})))}}}class Ue extends Be{constructor(e,t){super(t);this.query=e}queryExpressionBuilder(){return Object.assign({},this.query)}and(){return new ze([this.query],this.inverted)}or(){return new Fe([this.query],this.inverted)}}class Fe extends Be{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"or",expressions:[...this.expressions]}}withItemId(e){return new Fe([...this.expressions,{type:"item-id",value:e}],this.inverted)}withSuppliedId(e){return new Fe([...this.expressions,{type:"supplied-id",value:e}],this.inverted)}or(){return this}}class ze extends Be{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"and",expressions:[...this.expressions]}}withItemId(e){return new ze([...this.expressions,{type:"item-id",value:e}],this.inverted)}withSuppliedId(e){return new ze([...this.expressions,{type:"supplied-id",value:e}],this.inverted)}and(){return this}}class Ne extends Be{constructor(e,t){super(t);this.query=e}queryExpressionBuilder(){return Object.assign({},this.query)}and(){return new Le([this.query],this.inverted)}or(){return new He([this.query],this.inverted)}}class He extends Be{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"or",expressions:[...this.expressions]}}withAnnotationId(e){return new He([...this.expressions,{type:"annotation-id",value:e}],this.inverted)}or(){return this}}class Le extends Be{constructor(e,t){super(t);this.expressions=e}queryExpressionBuilder(){return{type:"and",expressions:[...this.expressions]}}withAnnotationId(e){return new Le([...this.expressions,{type:"annotation-id",value:e}],this.inverted)}and(){return this}}class Ye{get items(){return new We}get annotations(){return new Qe}}class Qe{where(e){const t=e(new Ee).build();return new Ie(t)}}class We{where(e){const t=e(new Re).build();return new xe(t)}}export{he as C,we as I,W as M,Ie as P,fe as R,Se as S,pe as a,Qe as b,D as c,Re as d,Ye as e,je as f,xe as g,We as h,Oe as i,Q as j,$ as k,N as l,U as m,Y as s};
|
|
5
|
-
//# sourceMappingURL=p-
|
|
5
|
+
//# sourceMappingURL=p-7153557a.js.map
|