diff --git a/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts b/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts index a56a886e52..6d3a70c1fe 100644 --- a/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +++ b/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts @@ -92,9 +92,7 @@ export declare class AnnotationsPlugin extends Plugin { entity?: Entity; pickResult?: PickResult; occludable?: boolean; - values?: { - String: (string | number); - }; + values?: { [key: string]: string | number }; markerShown?: boolean; labelShown?: boolean; eye?: number[]; @@ -120,12 +118,33 @@ export declare class AnnotationsPlugin extends Plugin { * @param {String} event The annotationCreated event * @param {Function} callback Callback fired on the event */ - on(event: "annotationCreated", callback: (annotationId: string)=> void): void; + on(event: "annotationCreated", callback: (annotationId: string)=> void): void; - /** - * Fires when a annotation is destroyed. - * @param {String} event The annotationDestroyed event - * @param {Function} callback Callback fired on the event - */ - on(event: "annotationDestroyed", callback: (annotationId: string)=> void): void; + /** + * Fires when a annotation is destroyed. + * @param {String} event The annotationDestroyed event + * @param {Function} callback Callback fired on the event + */ + on(event: "annotationDestroyed", callback: (annotationId: string)=> void): void; + + /** + * Fires when a mouse enters a annotation. + * @param {String} event The markerMouseEnter event + * @param {Function} callback Callback fired on the event + */ + on(event: "markerMouseEnter", callback: (annotation: Annotation)=> void): void; + + /** + * Fires when a mouse leave an annotation. + * @param {String} event The markerMouseLeave event + * @param {Function} callback Callback fired on the event + */ + on(event: "markerMouseLeave", callback: (annotation: Annotation)=> void): void; + + /** + * Fires when a mouse leave an annotation. + * @param {String} event The markerClicked event + * @param {Function} callback Callback fired on the event + */ + on(event: "markerClicked", callback: (annotation: Annotation)=> void): void; } diff --git a/types/viewer/Viewer.d.ts b/types/viewer/Viewer.d.ts index 6925c19756..0fa89b10b1 100644 --- a/types/viewer/Viewer.d.ts +++ b/types/viewer/Viewer.d.ts @@ -196,7 +196,7 @@ export declare class Viewer { * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot. * @returns {String} String-encoded image data URI. */ - getSnapshot(params?: any): string; + getSnapshot(params: { width?: number, height?: number, format?: "jpeg" | "png"| "bmp", includeGizmos?: boolean }): string; /** * Exits snapshot mode. diff --git a/types/viewer/scene/PerformanceModel/index.d.ts b/types/viewer/scene/PerformanceModel/index.d.ts new file mode 100644 index 0000000000..409458c015 --- /dev/null +++ b/types/viewer/scene/PerformanceModel/index.d.ts @@ -0,0 +1,2 @@ +export * from "./PerformanceModel"; +export * from "./PerformanceNode"; \ No newline at end of file diff --git a/types/viewer/scene/index.d.ts b/types/viewer/scene/index.d.ts index 4bfe8af65a..d9c3b707b6 100644 --- a/types/viewer/scene/index.d.ts +++ b/types/viewer/scene/index.d.ts @@ -1,6 +1,17 @@ -export * from "./camera"; -export * from "./CameraControl/CameraControl"; export * from "./Component"; export * from "./Entity"; + +export * from "./camera"; +export * from "./CameraControl/CameraControl"; +export * from "./geometry"; +export * from "./marker"; +export * from "./materials"; export * from "./math/math"; -export * from "./PerformanceModel/PerformanceModel"; +export * from "./mementos"; +export * from "./mesh"; +export * from "./nodes"; +export * from "./PerformanceModel"; +export * from "./scene/Scene"; +export * from "./sectionPlane"; +export * from "./viewport"; +export * from "./webgl"; \ No newline at end of file diff --git a/types/viewer/scene/math/math.d.ts b/types/viewer/scene/math/math.d.ts index 2469517348..65ca802106 100644 --- a/types/viewer/scene/math/math.d.ts +++ b/types/viewer/scene/math/math.d.ts @@ -1,36 +1,56 @@ declare const math: { - unglobalizeObjectId(modelId: string, globalId: string): string; - globalizeObjectId(modelId: string, objectId: string): string; - - /** - * Returns a new, uninitialized two-element vector. - * @returns {Number[]} - */ - vec2: (values?: number[]) => number[]; - - /** - * Returns a new, uninitialized three-element vector. - * @returns {Number[]} - */ - vec3: (values?: number[]) => number[]; - - /** - * Returns a new, uninitialized four-element vector. - * @returns {Number[]} - */ - vec4: (values?: number[]) => number[]; - - /** - * Gets the center of a 2D AABB. - * @returns {Number[]} - */ - getAABB2Center(aabb: number[], dest?: (values?: number[]) => number[]): number[]; - - /** - * Gets the center of an AABB. - * @returns {Number[]} - */ - getAABB3Center(aabb: number[], dest?: (values?: number[]) => number[]): number[]; + /** + * The number of radiians in a degree (0.0174532925). + */ + DEGTORAD: 0.017453292; + + /** + * The number of degrees in a radian. + */ + RADTODEG: 57.295779513; + + unglobalizeObjectId(modelId: string, globalId: string): string; + globalizeObjectId(modelId: string, objectId: string): string; + + /** + * Returns a new, uninitialized two-element vector. + * @returns {Number[]} + */ + vec2: (values?: number[]) => number[]; + + /** + * Returns a new, uninitialized three-element vector. + * @returns {Number[]} + */ + vec3: (values?: number[]) => number[]; + + /** + * Returns a new, uninitialized four-element vector. + * @returns {Number[]} + */ + vec4: (values?: number[]) => number[]; + + /** + * Gets the center of a 2D AABB. + * @returns {Number[]} + */ + getAABB2Center(aabb: number[], dest?: (values?: number[]) => number[]): number[]; + + /** + * Gets the center of an AABB. + * @returns {Number[]} + */ + getAABB3Center(aabb: number[], dest?: (values?: number[]) => number[]): number[]; + + /** + * Gets the diagonal size of an AABB3 given as minima and maxima. + */ + getAABB3Diag: (aabb: number[]) => number; + + /** + * Normalizes a three-element vector + */ + normalizeVec3: (v: number[], dest?: any) => number[]; }; export {math}; diff --git a/types/viewer/scene/mementos/CameraMemento.d.ts b/types/viewer/scene/mementos/CameraMemento.d.ts new file mode 100644 index 0000000000..a0ad87ae5e --- /dev/null +++ b/types/viewer/scene/mementos/CameraMemento.d.ts @@ -0,0 +1,28 @@ +import { Scene } from "../scene/Scene"; + +/** + * Saves and restores the state of a {@link Scene}'s {@link Camera}. + */ +export declare class CameraMemento { + /** + * Creates a CameraState. + * + * @param {Scene} [scene] When given, immediately saves the state of the given {@link Scene}'s {@link Camera}. + */ + constructor(scene?: Scene); + + /** + * Saves the state of the given {@link Scene}'s {@link Camera}. + * + * @param {Scene} scene The scene that contains the {@link Camera}. + */ + saveCamera(scene: Scene): void; + + /** + * Restores a {@link Scene}'s {@link Camera} to the state previously captured with {@link CameraMemento#saveCamera}. + * + * @param {Scene} scene The scene. + * @param {Function} [done] When this callback is given, will fly the {@link Camera} to the saved state then fire the callback. Otherwise will just jump the Camera to the saved state. + */ + restoreCamera(scene: Scene, done?: ()=> void): void; +} diff --git a/types/viewer/scene/mementos/ModelMemento.d.ts b/types/viewer/scene/mementos/ModelMemento.d.ts new file mode 100644 index 0000000000..3882d4719f --- /dev/null +++ b/types/viewer/scene/mementos/ModelMemento.d.ts @@ -0,0 +1,44 @@ +import { Scene } from "../scene/Scene"; +import { MetaModel } from '../../metadata/MetaModel'; +/** + * Saves and restores a snapshot of the visual state of the {@link Entity}'s of a model within a {@link Scene}. + */ +export declare class ModelMemento { + /** + * Saves a snapshot of the visual state of the {@link Entity}'s that represent objects within a model. + * + * @param {Scene} scene The scene. + * @param {MetaModel} metaModel Represents the model. Corresponds with an {@link Entity} that represents the model in the scene. + * @param {Object} [mask] Masks what state gets saved. Saves all state when not supplied. + * @param {boolean} [mask.visible] Saves {@link Entity#visible} values when ````true````. + * @param {boolean} [mask.edges] Saves {@link Entity#edges} values when ````true````. + * @param {boolean} [mask.xrayed] Saves {@link Entity#xrayed} values when ````true````. + * @param {boolean} [mask.highlighted] Saves {@link Entity#highlighted} values when ````true````. + * @param {boolean} [mask.selected] Saves {@link Entity#selected} values when ````true````. + * @param {boolean} [mask.clippable] Saves {@link Entity#clippable} values when ````true````. + * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````. + * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````. + * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````. + */ + saveObjects(scene: Scene, metaModel: MetaModel, mask?: { + visible?: boolean; + edges?: boolean; + xrayed?: boolean; + highlighted?: boolean; + selected?: boolean; + clippable?: boolean; + pickable?: boolean; + colorize?: boolean; + opacity?: boolean; + }): void; + + /** + * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}. + * + * Assumes that the model has not been destroyed or modified since saving. + * + * @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}. + * @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}. + */ + restoreObjects(scene: Scene, metaModel: MetaModel): void; +} diff --git a/types/viewer/scene/mementos/ObjectsMemento.d.ts b/types/viewer/scene/mementos/ObjectsMemento.d.ts new file mode 100644 index 0000000000..b2eedc3d6a --- /dev/null +++ b/types/viewer/scene/mementos/ObjectsMemento.d.ts @@ -0,0 +1,39 @@ +import { Scene } from "../scene/Scene"; + +/** + * Saves and restores a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}. + */ +export declare class ObjectsMemento { + /** + * Saves a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}. + * + * @param {Scene} scene The scene. + * @param {Object} [mask] Masks what state gets saved. Saves all state when not supplied. + * @param {boolean} [mask.visible] Saves {@link Entity#visible} values when ````true````. + * @param {boolean} [mask.edges] Saves {@link Entity#edges} values when ````true````. + * @param {boolean} [mask.xrayed] Saves {@link Entity#xrayed} values when ````true````. + * @param {boolean} [mask.highlighted] Saves {@link Entity#highlighted} values when ````true````. + * @param {boolean} [mask.selected] Saves {@link Entity#selected} values when ````true````. + * @param {boolean} [mask.clippable] Saves {@link Entity#clippable} values when ````true````. + * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````. + * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````. + * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````. + */ + saveObjects(scene: Scene, mask?: { + visible?: boolean; + edges?: boolean; + xrayed?: boolean; + highlighted?: boolean; + selected?: boolean; + clippable?: boolean; + pickable?: boolean; + colorize?: boolean; + opacity?: boolean; + }): void; + + /** + * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ObjectsMemento#saveObjects}. + * @param {Scene} scene The scene. + */ + restoreObjects(scene: Scene): void; +} diff --git a/types/viewer/scene/mementos/index.d.ts b/types/viewer/scene/mementos/index.d.ts new file mode 100644 index 0000000000..4bc9eb8585 --- /dev/null +++ b/types/viewer/scene/mementos/index.d.ts @@ -0,0 +1,3 @@ +export * from "./CameraMemento"; +export * from "./ModelMemento"; +export * from "./ObjectsMemento"; diff --git a/types/viewer/scene/viewport/index.d.ts b/types/viewer/scene/viewport/index.d.ts new file mode 100644 index 0000000000..8cc37e0573 --- /dev/null +++ b/types/viewer/scene/viewport/index.d.ts @@ -0,0 +1 @@ +export * from "./Viewport"; diff --git a/types/viewer/scene/webgl/index.d.ts b/types/viewer/scene/webgl/index.d.ts new file mode 100644 index 0000000000..c4d924cd38 --- /dev/null +++ b/types/viewer/scene/webgl/index.d.ts @@ -0,0 +1 @@ +export * from "./PickResult";