type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
MethodDeclaration
/** Cancel a previously requested snap. */ public cancelSnap(sessionId: string): void { const request = this._snaps.get(sessionId); if (undefined !== request) { request.cancelSnap(); this._snaps.delete(sessionId); } }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the IModel coordinate corresponding to each GeoCoordinate point in the input */ public async getIModelCoordinatesFromGeoCoordinates(requestContext: ClientRequestContext, props: string): Promise<IModelCoordinatesResponseProps> { requestContext.enter(); const resultString: string = this.nativeDb.getIModelCoordinatesFromGeoCoordinates(props); return JSON.parse(resultString) as IModelCoordinatesResponseProps; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the GeoCoordinate (longitude, latitude, elevation) corresponding to each IModel Coordinate point in the input */ public async getGeoCoordinatesFromIModelCoordinates(requestContext: ClientRequestContext, props: string): Promise<GeoCoordinatesResponseProps> { requestContext.enter(); const resultString: string = this.nativeDb.getGeoCoordinatesFromIModelCoordinates(props); return JSON.parse(resultString) as GeoCoordinatesResponseProps; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Export meshes suitable for graphics APIs from arbitrary geometry in elements in this IModelDb. * * Requests can be slow when processing many elements so it is expected that this function be used on a dedicated backend. * * Vertices are exported in the IModelDb's world coordinate system, which is right-handed with Z pointing up. * * The results of changing [ExportGraphicsProps]($imodeljs-backend) during the [ExportGraphicsProps.onGraphics]($imodeljs-backend) callback are not defined. * * Example that prints the mesh for element 1 to stdout in [OBJ format](https://en.wikipedia.org/wiki/Wavefront_.obj_file) * ``` * const onGraphics: ExportGraphicsFunction = (info: ExportGraphicsInfo) => { * const mesh: ExportGraphicsMesh = info.mesh; * for (let i = 0; i < mesh.points.length; i += 3) { * process.stdout.write(`v ${mesh.points[i]} ${mesh.points[i + 1]} ${mesh.points[i + 2]}\n`); * process.stdout.write(`vn ${mesh.normals[i]} ${mesh.normals[i + 1]} ${mesh.normals[i + 2]}\n`); * } * * for (let i = 0; i < mesh.params.length; i += 2) { * process.stdout.write(`vt ${mesh.params[i]} ${mesh.params[i + 1]}\n`); * } * * for (let i = 0; i < mesh.indices.length; i += 3) { * const p1 = mesh.indices[i]; * const p2 = mesh.indices[i + 1]; * const p3 = mesh.indices[i + 2]; * process.stdout.write(`f ${p1}/${p1}/${p1} ${p2}/${p2}/${p2} ${p3}/${p3}/${p3}\n`); * } * }; * * iModel.exportGraphics(({ onGraphics, elementIdArray: ["0x1"] })); * ``` * @returns 0 if successful, status otherwise * @beta Waiting for feedback from community before finalizing. */ public exportGraphics(exportProps: ExportGraphicsProps): DbResult { return this.nativeDb.exportGraphics(exportProps); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the Model with the specified identifier. * @param modelId The Model identifier. * @throws [[IModelError]] */ public getModelProps<T extends ModelProps>(modelId: Id64String): T { const json = this.getModelJson(JSON.stringify({ id: modelId.toString() })); return JSON.parse(json) as T; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the Model with the specified identifier. * @param modelId The Model identifier. * @throws [[IModelError]] */ public getModel<T extends Model>(modelId: Id64String): T { return this._iModel.constructEntity<T>(this.getModelProps(modelId)); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Read the properties for a Model as a json string. * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code". * @return a json string with the properties of the model. */ public getModelJson(modelIdArg: string): string { if (!this._iModel.briefcase) throw this._iModel.newNotOpenError(); const val = this._iModel.nativeDb.getModel(modelIdArg); if (val.error) throw new IModelError(val.error.status, "Model=" + modelIdArg); return val.result!; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the sub-model of the specified Element. * See [[IModelDb.Elements.queryElementIdByCode]] for more on how to find an element by Code. * @param modeledElementId Identifies the modeled element. * @throws [[IModelError]] */ public getSubModel<T extends Model>(modeledElementId: Id64String | GuidString | Code): T { const modeledElement = this._iModel.elements.getElement(modeledElementId); if (modeledElement.id === IModel.rootSubjectId) throw new IModelError(IModelStatus.NotFound, "Root subject does not have a sub-model", Logger.logWarning, loggerCategory); return this.getModel<T>(modeledElement.id); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Create a new model in memory. * See the example in [[InformationPartitionElement]]. * @param modelProps The properties to use when creating the model. * @throws [[IModelError]] if there is a problem creating the model. */ public createModel<T extends Model>(modelProps: ModelProps): T { return this._iModel.constructEntity<T>(modelProps); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Insert a new model. * @param props The data for the new model. * @returns The newly inserted model's Id. * @throws [[IModelError]] if unable to insert the model. */ public insertModel(props: ModelProps): Id64String { if (props.isPrivate === undefined) // temporarily work around bug in addon props.isPrivate = false; const jsClass = this._iModel.getJsClass<typeof Model>(props.classFullName); if (IModelStatus.Success !== jsClass.onInsert(props)) return Id64.invalid; const val = this._iModel.nativeDb.insertModel(JSON.stringify(props)); if (val.error) throw new IModelError(val.error.status, "inserting model", Logger.logWarning, loggerCategory); props.id = Id64.fromJSON(JSON.parse(val.result!).id); jsClass.onInserted(props.id); return props.id; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Update an existing model. * @param props the properties of the model to change * @throws [[IModelError]] if unable to update the model. */ public updateModel(props: ModelProps): void { const jsClass = this._iModel.getJsClass<typeof Model>(props.classFullName); if (IModelStatus.Success !== jsClass.onUpdate(props)) return; const error = this._iModel.nativeDb.updateModel(JSON.stringify(props)); if (error !== IModelStatus.Success) throw new IModelError(error, "updating model id=" + props.id, Logger.logWarning, loggerCategory); jsClass.onUpdated(props); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Delete one or more existing models. * @param ids The Ids of the models to be deleted * @throws [[IModelError]] */ public deleteModel(ids: Id64Arg): void { Id64.toIdSet(ids).forEach((id) => { const props = this.getModelProps(id); const jsClass = this._iModel.getJsClass<typeof Model>(props.classFullName); if (IModelStatus.Success !== jsClass.onDelete(props)) return; const error = this._iModel.nativeDb.deleteModel(id); if (error !== IModelStatus.Success) throw new IModelError(error, "", Logger.logWarning, loggerCategory); jsClass.onDeleted(props); }); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Read element data from iModel as a json string * @param elementIdArg a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code". * @return a json string with the properties of the element. */ public getElementJson<T extends ElementProps>(elementIdArg: string): T { const val = this._iModel.nativeDb.getElement(elementIdArg); if (val.error) throw new IModelError(val.error.status, "reading element=" + elementIdArg, Logger.logWarning, loggerCategory); return val.result! as T; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Get properties of an Element by Id, FederationGuid, or Code * @throws [[IModelError]] if the element is not found. */ public getElementProps<T extends ElementProps>(elementId: Id64String | GuidString | Code | ElementLoadProps): T { if (typeof elementId === "string") elementId = Id64.isId64(elementId) ? { id: elementId } : { federationGuid: elementId }; else if (elementId instanceof Code) elementId = { code: elementId }; return this.getElementJson<T>(JSON.stringify(elementId)); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Get an element by Id, FederationGuid, or Code * @param elementId either the element's Id, Code, or FederationGuid, or an ElementLoadProps * @throws [[IModelError]] if the element is not found. */ public getElement<T extends Element>(elementId: Id64String | GuidString | Code | ElementLoadProps): T { if (typeof elementId === "string") elementId = Id64.isId64(elementId) ? { id: elementId } : { federationGuid: elementId }; else if (elementId instanceof Code) elementId = { code: elementId }; return this._iModel.constructEntity<T>(this.getElementJson(JSON.stringify(elementId))); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Query for the Id of the element that has a specified code. * This method is for the case where you know the element's Code. * If you only know the code *value*, then in the simplest case, you can query on that * and filter the results. * In the simple case, call [[IModelDb.queryEntityIds]], specifying the code value in the where clause of the query params. * Or, you can execute an ECSQL select statement. See * [frequently used ECSQL queries]($docs/learning/backend/ECSQL-queries.md) for an example. * @param code The code to look for * @returns The element that uses the code or undefined if the code is not used. * @throws IModelError if the code is invalid */ public queryElementIdByCode(code: Code): Id64String | undefined { if (Id64.isInvalid(code.spec)) throw new IModelError(IModelStatus.InvalidCodeSpec, "Invalid CodeSpec", Logger.logWarning, loggerCategory); if (code.value === undefined) throw new IModelError(IModelStatus.InvalidCode, "Invalid Code", Logger.logWarning, loggerCategory); return this._iModel.withPreparedStatement(`SELECT ECInstanceId FROM ${Element.classFullName} WHERE CodeSpec.Id=? AND CodeScope.Id=? AND CodeValue=?`, (stmt: ECSqlStatement) => { stmt.bindId(1, code.spec); stmt.bindId(2, Id64.fromString(code.scope)); stmt.bindString(3, code.value!); if (DbResult.BE_SQLITE_ROW !== stmt.step()) return undefined; return Id64.fromJSON(stmt.getRow().id); }); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Create a new instance of an element. * @param elProps The properties of the new element. * @throws [[IModelError]] if there is a problem creating the element. */ public createElement<T extends Element>(elProps: ElementProps): T { return this._iModel.constructEntity<T>(elProps); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Insert a new element into the iModel. * @param elProps The properties of the new element. * @returns The newly inserted element's Id. * @throws [[IModelError]] if unable to insert the element. */ public insertElement(elProps: ElementProps): Id64String { const iModel = this._iModel; const jsClass = iModel.getJsClass(elProps.classFullName) as unknown as typeof Element; if (IModelStatus.Success !== jsClass.onInsert(elProps, iModel)) return Id64.invalid; const val = iModel.nativeDb.insertElement(JSON.stringify(elProps)); if (val.error) throw new IModelError(val.error.status, "Problem inserting element", Logger.logWarning, loggerCategory); elProps.id = Id64.fromJSON(JSON.parse(val.result!).id); jsClass.onInserted(elProps, iModel); return elProps.id; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Update some properties of an existing element. * @param el the properties of the element to update. * @throws [[IModelError]] if unable to update the element. */ public updateElement(elProps: ElementProps): void { const iModel = this._iModel; const jsClass = iModel.getJsClass<typeof Element>(elProps.classFullName); if (IModelStatus.Success !== jsClass.onUpdate(elProps, iModel)) return; const error = iModel.nativeDb.updateElement(JSON.stringify(elProps)); if (error !== IModelStatus.Success) throw new IModelError(error, "", Logger.logWarning, loggerCategory); jsClass.onUpdated(elProps, iModel); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** * Delete one or more elements from this iModel. * @param ids The set of Ids of the element(s) to be deleted * @throws [[IModelError]] */ public deleteElement(ids: Id64Arg): void { const iModel = this._iModel; Id64.toIdSet(ids).forEach((id) => { const props = this.getElementProps(id); const jsClass = iModel.getJsClass<typeof Element>(props.classFullName); if (IModelStatus.Success !== jsClass.onDelete(props, iModel)) return; const error = iModel.nativeDb.deleteElement(id); if (error !== IModelStatus.Success) throw new IModelError(error, "", Logger.logWarning, loggerCategory); jsClass.onDeleted(props, iModel); }); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Query for the child elements of the specified element. * @returns Returns an array of child element identifiers. * @throws [[IModelError]] */ public queryChildren(elementId: Id64String): Id64String[] { const rows: any[] = this._iModel.executeQuery(`SELECT ECInstanceId FROM ${Element.classFullName} WHERE Parent.Id=?`, [elementId]); const childIds: Id64String[] = []; for (const row of rows) childIds.push(Id64.fromJSON(row.id)); return childIds; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the root subject element. */ public getRootSubject(): Subject { return this.getElement(IModel.rootSubjectId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Query for aspects of a particular class (polymorphically) associated with this element. * @throws [[IModelError]] */ private _queryAspects(elementId: Id64String, aspectClassName: string): ElementAspect[] { const rows = this._iModel.executeQuery(`SELECT * FROM ${aspectClassName} WHERE Element.Id=?`, [elementId]); if (rows.length === 0) { return []; } const aspects: ElementAspect[] = []; for (const row of rows) { aspects.push(this._queryAspect(row.id, row.className.replace(".", ":"))); } return aspects; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Query for aspect by ECInstanceId * @throws [[IModelError]] */ private _queryAspect(aspectInstanceId: Id64String, aspectClassName: string): ElementAspect { const rows = this._iModel.executeQuery(`SELECT * FROM ${aspectClassName} WHERE ECInstanceId=?`, [aspectInstanceId]); if (rows.length !== 1) { throw new IModelError(IModelStatus.NotFound, "ElementAspect not found", Logger.logError, loggerCategory, () => ({ aspectInstanceId, aspectClassName })); } const aspectProps: ElementAspectProps = rows[0]; // start with everything that SELECT * returned aspectProps.classFullName = aspectProps.className.replace(".", ":"); // add in property required by EntityProps aspectProps.className = undefined; // clear property from SELECT * that we don't want in the final instance return this._iModel.constructEntity<ElementAspect>(aspectProps); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the ElementAspect instances (by class name) that are related to the specified element. * @throws [[IModelError]] */ public getAspects(elementId: Id64String, aspectClassName: string): ElementAspect[] { const aspects: ElementAspect[] = this._queryAspects(elementId, aspectClassName); return aspects; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Insert a new ElementAspect into the iModel. * @param aspectProps The properties of the new ElementAspect. * @throws [[IModelError]] if unable to insert the ElementAspect. */ public insertAspect(aspectProps: ElementAspectProps): void { if (!this._iModel.briefcase) throw this._iModel.newNotOpenError(); const status = this._iModel.nativeDb.insertElementAspect(JSON.stringify(aspectProps)); if (status !== IModelStatus.Success) throw new IModelError(status, "Error inserting ElementAspect", Logger.logWarning, loggerCategory); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Update an exist ElementAspect within the iModel. * @param aspectProps The properties to use to update the ElementAspect. * @throws [[IModelError]] if unable to update the ElementAspect. */ public updateAspect(aspectProps: ElementAspectProps): void { if (!this._iModel.briefcase) throw this._iModel.newNotOpenError(); const status = this._iModel.nativeDb.updateElementAspect(JSON.stringify(aspectProps)); if (status !== IModelStatus.Success) throw new IModelError(status, "Error updating ElementAspect", Logger.logWarning, loggerCategory); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Delete one or more ElementAspects from this iModel. * @param ids The set of Ids of the element(s) to be deleted * @throws [[IModelError]] */ public deleteAspect(ids: Id64Arg): void { Id64.toIdSet(ids).forEach((id) => { const status = this._iModel.nativeDb.deleteElementAspect(id); if (status !== IModelStatus.Success) throw new IModelError(status, "Error deleting ElementAspect", Logger.logWarning, loggerCategory); }); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Query for the array of ViewDefinitionProps of the specified class and matching the specified IsPrivate setting. * @param className Query for view definitions of this class. * @param wantPrivate If true, include private view definitions. */ public queryViewDefinitionProps(className: string = "BisCore.ViewDefinition", limit = IModelDb.defaultLimit, offset = 0, wantPrivate: boolean = false): ViewDefinitionProps[] { const where: string = (wantPrivate === false) ? "IsPrivate=FALSE" : ""; const ids = this._iModel.queryEntityIds({ from: className, limit, offset, where }); const props: ViewDefinitionProps[] = []; const imodel = this._iModel; ids.forEach((id) => { try { props.push(imodel.elements.getElementProps<ViewDefinitionProps>(id)); } catch (err) { } }); return props; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Iterate all ViewDefinitions matching the supplied query. * @param params Specifies the query by which views are selected. * @param callback Function invoked for each ViewDefinition matching the query. Return false to terminate iteration, true to continue. * @return true if all views were iterated, false if iteration was terminated early due to callback returning false. * * **Example: Finding all views of a specific DrawingModel** * ``` ts * [[include:IModelDb.Views.iterateViews]] * ``` */ public iterateViews(params: ViewQueryParams, callback: (view: ViewDefinition) => boolean): boolean { const ids = this._iModel.queryEntityIds(params); let finished = true; for (const id of ids) { try { const view = this._iModel.elements.getElement(id); if (undefined !== view && view instanceof ViewDefinition) { finished = callback(view); if (!finished) break; } } catch (err) { } } return finished; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
public getViewStateData(viewDefinitionId: string): ViewStateProps { const viewStateData: ViewStateProps = {} as any; const elements = this._iModel.elements; const viewDefinitionElement = elements.getElement<ViewDefinition>(viewDefinitionId); viewStateData.viewDefinitionProps = viewDefinitionElement.toJSON(); viewStateData.categorySelectorProps = elements.getElementProps<CategorySelectorProps>(viewStateData.viewDefinitionProps.categorySelectorId); viewStateData.displayStyleProps = elements.getElementProps<DisplayStyleProps>(viewStateData.viewDefinitionProps.displayStyleId); if (viewStateData.viewDefinitionProps.modelSelectorId !== undefined) viewStateData.modelSelectorProps = elements.getElementProps<ModelSelectorProps>(viewStateData.viewDefinitionProps.modelSelectorId); else if (viewDefinitionElement instanceof SheetViewDefinition) { viewStateData.sheetProps = elements.getElementProps<SheetProps>(viewDefinitionElement.baseModelId); viewStateData.sheetAttachments = Array.from(this._iModel.queryEntityIds({ from: "BisCore.ViewAttachment", where: "Model.Id=" + viewDefinitionElement.baseModelId, })); } return viewStateData; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
private getViewThumbnailArg(viewDefinitionId: Id64String): string { const viewProps: FilePropertyProps = { namespace: "dgn_View", name: "Thumbnail", id: viewDefinitionId }; return JSON.stringify(viewProps); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the thumbnail for a view. * @param viewDefinitionId The Id of the view for thumbnail * @return the ThumbnailProps, or undefined if no thumbnail exists. */ public getThumbnail(viewDefinitionId: Id64String): ThumbnailProps | undefined { const viewArg = this.getViewThumbnailArg(viewDefinitionId); const sizeProps = this._iModel.nativeDb.queryFileProperty(viewArg, true) as string; if (undefined === sizeProps) return undefined; const out = JSON.parse(sizeProps) as ThumbnailProps; out.image = this._iModel.nativeDb.queryFileProperty(viewArg, false) as Uint8Array; return out; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Save a thumbnail for a view. * @param viewDefinitionId The Id of the view for thumbnail * @param thumbnail The thumbnail data. * @returns 0 if successful */ public saveThumbnail(viewDefinitionId: Id64String, thumbnail: ThumbnailProps): number { const viewArg = this.getViewThumbnailArg(viewDefinitionId); const props = { format: thumbnail.format, height: thumbnail.height, width: thumbnail.width }; return this._iModel.nativeDb.saveFileProperty(viewArg, JSON.stringify(props), thumbnail.image); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Set the default view property the iModel * @param viewId The Id of the ViewDefinition to use as the default */ public setDefaultViewId(viewId: Id64String): void { const spec = { namespace: "dgn_View", name: "DefaultView" }; const blob32 = new Uint32Array(2); blob32[0] = Id64.getLowerUint32(viewId); blob32[1] = Id64.getUpperUint32(viewId); const blob8 = new Uint8Array(blob32.buffer); this._iModel.saveFileProperty(spec, undefined, blob8); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ public async requestTileTreeProps(requestContext: ClientRequestContext, id: string): Promise<TileTreeProps> { requestContext.enter(); if (!this._iModel.briefcase) throw this._iModel.newNotOpenError(); return new Promise<TileTreeProps>((resolve, reject) => { requestContext.enter(); this._iModel.nativeDb.getTileTree(id, (ret: IModelJsNative.ErrorStatusOrResult<IModelStatus, any>) => { if (undefined !== ret.error) reject(new IModelError(ret.error.status, "TreeId=" + id)); else resolve(ret.result! as TileTreeProps); }); }); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
private pollTileContent(resolve: (arg0: Uint8Array) => void, reject: (err: Error) => void, treeId: string, tileId: string, requestContext: ClientRequestContext) { requestContext.enter(); if (!this._iModel.briefcase) { reject(this._iModel.newNotOpenError()); return; } const ret = this._iModel.nativeDb.pollTileContent(treeId, tileId); if (undefined !== ret.error) { reject(new IModelError(ret.error.status, "TreeId=" + treeId + " TileId=" + tileId)); } else if (typeof ret.result !== "number") { // if type is not a number, it's the TileContent interface const res = ret.result as IModelJsNative.TileContent; const iModelGuid = this._iModel.getGuid(); const tileSizeThreshold = IModelHost.logTileSizeThreshold; const tileSize = res.content.length; if (tileSize > tileSizeThreshold) { Logger.logWarning(loggerCategory, "Tile size (in bytes) larger than specified threshold", () => ({ tileSize, tileSizeThreshold, treeId, tileId, iModelGuid })); } const loadTimeThreshold = IModelHost.logTileLoadTimeThreshold; const loadTime = res.elapsedSeconds; if (loadTime > loadTimeThreshold) { Logger.logWarning(loggerCategory, "Tile load time (in seconds) greater than specified threshold", () => ({ loadTime, loadTimeThreshold, treeId, tileId, iModelGuid })); } resolve(res.content); } else { // if the type is a number, it's the TileContentState enum // ###TODO: Decide appropriate timeout interval. May want to switch on state (new vs loading vs pending) setTimeout(() => this.pollTileContent(resolve, reject, treeId, tileId, requestContext), 10); } }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ public async requestTileContent(requestContext: ClientRequestContext, treeId: string, tileId: string): Promise<Uint8Array> { requestContext.enter(); if (!this._iModel.briefcase) throw this._iModel.newNotOpenError(); return new Promise<Uint8Array>((resolve, reject) => { this.pollTileContent(resolve, reject, treeId, tileId, requestContext); }); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
private _getElementClass(elClassName: string): typeof Element { return this._iModel.getJsClass(elClassName) as unknown as typeof Element; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
private _getRelationshipClass(relClassName: string): typeof Relationship { return this._iModel.getJsClass<typeof Relationship>(relClassName); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void { this._getElementClass(elClassName).onBeforeOutputsHandled(elId, this._iModel); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onAllInputsHandled(elClassName: string, elId: Id64String): void { this._getElementClass(elClassName).onAllInputsHandled(elId, this._iModel); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onRootChanged(props: RelationshipProps): void { this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onValidateOutput(props: RelationshipProps): void { this._getRelationshipClass(props.classFullName).onValidateOutput(props, this._iModel); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onDeletedDependency(props: RelationshipProps): void { this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onBeginValidate() { this.validationErrors.length = 0; }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** @internal */ protected _onEndValidate() { }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Dependency handlers may call method this to report a validation error. * @param error The error. If error.fatal === true, the transaction will cancel rather than commit. */ public reportError(error: ValidationError) { this.validationErrors.push(error); this._nativeDb.logTxnError(error.fatal); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the description of the operation that would be reversed by calling reverseTxns(1). * This is useful for showing the operation that would be undone, for example in a menu. */ public getUndoString(): string { return this._nativeDb.getUndoString(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get a description of the operation that would be reinstated by calling reinstateTxn. * This is useful for showing the operation that would be redone, in a pull-down menu for example. */ public getRedoString(): string { return this._nativeDb.getRedoString(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Begin a new multi-Txn operation. This can be used to cause a series of Txns, that would normally * be considered separate actions for undo, to be grouped into a single undoable operation. This means that when reverseTxns(1) is called, * the entire group of changes are undone together. Multi-Txn operations can be nested, and until the outermost operation is closed, * all changes constitute a single operation. * @note This method must always be paired with a call to endMultiTxnAction. */ public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** End a multi-Txn operation */ public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */ public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Reverse (undo) the most recent operation(s) to this IModelDb. * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will * be reinstated together when/if ReinstateTxn is called. * @note If there are any outstanding uncommitted changes, they are reversed. * @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So, * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made. * @note If numOperations is too large only the operations are reversible are reversed. */ public reverseTxns(numOperations: number): IModelStatus { return this._nativeDb.reverseTxns(numOperations); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Reverse the most recent operation. */ public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Reverse all changes back to the beginning of the session. */ public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Reverse all changes back to a previously saved TxnId. * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId. * @returns Success if the transactions were reversed, error status otherwise. * @see [[getCurrentTxnId]] [[cancelTo]] */ public reverseTo(txnId: TxnIdString) { return this._nativeDb.reverseTo(txnId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId. * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]] * @returns Success if the transactions were reversed and cleared, error status otherwise. */ public cancelTo(txnId: TxnIdString) { return this._nativeDb.cancelTo(txnId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it * may take multiple calls to this method to reinstate all reversed operations. * @returns Success if a reversed transaction was reinstated, error status otherwise. * @note If there are any outstanding uncommitted changes, they are reversed before the Txn is reinstated. */ public reinstateTxn(): IModelStatus { return this._nativeDb.reinstateTxn(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the Id of the first transaction, if any. */ public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the successor of the specified TxnId */ public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the predecessor of the specified TxnId */ public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the Id of the current (tip) transaction. */ public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Get the description that was supplied when the specified transaction was saved. */ public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Test if a TxnId is valid */ public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
MethodDeclaration
/** Make a description of the changeset by combining all local txn comments. */ public describeChangeSet(endTxnId?: TxnIdString): string { if (endTxnId === undefined) endTxnId = this.getCurrentTxnId(); const changes = []; const seen = new Set<string>(); let txnId = this.queryFirstTxnId(); while (this.isTxnIdValid(txnId)) { const txnDesc = this.getTxnDescription(txnId); if ((txnDesc.length === 0) || seen.has(txnDesc)) { txnId = this.queryNextTxnId(txnId); continue; } changes.push(txnDesc); seen.add(txnDesc); txnId = this.queryNextTxnId(txnId); } return JSON.stringify(changes); }
Ranjith-K-Soman/imodeljs
core/backend/src/IModelDb.ts
TypeScript
ArrowFunction
() => { return ( <View style={styles.footerContainer}> <Button size='small' style={styles.footerControl}> Accept </Button> <Button size='small' status='basic'> Cancel </Button> </View>
ihranova/react-native-ui-kitten
src/playground/src/ui/screen/showcases/card/cardHeaderFooter.component.tsx
TypeScript
ArrowFunction
() => ( <CardHeader title='Title'
ihranova/react-native-ui-kitten
src/playground/src/ui/screen/showcases/card/cardHeaderFooter.component.tsx
TypeScript
ArrowFunction
() => ( <Layout style={styles.container}> <Card header
ihranova/react-native-ui-kitten
src/playground/src/ui/screen/showcases/card/cardHeaderFooter.component.tsx
TypeScript
FunctionDeclaration
export function getActiveEditor(accessor: ServicesAccessor): IActiveCodeEditor | null { let activeTextEditorControl = accessor.get(IEditorService).activeTextEditorControl; if (isDiffEditor(activeTextEditorControl)) { if (activeTextEditorControl.getOriginalEditor().hasTextFocus()) { activeTextEditorControl = activeTextEditorControl.getOriginalEditor(); } else { activeTextEditorControl = activeTextEditorControl.getModifiedEditor(); } } if (!isCodeEditor(activeTextEditorControl) || !activeTextEditorControl.hasModel()) { return null; } return activeTextEditorControl; }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
range => { if ((range.startLineNumber <= hoverLine) && (range.endLineNumber >= hoverLine)) { const beforeRange = new Range(range.startLineNumber, 1, hoverLine, 1); const hoverRange = new Range(hoverLine, 1, hoverLine, 1); const afterRange = new Range(hoverLine, 1, range.endLineNumber, 1); commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, beforeRange, this.decorationOptions, info.commentingRanges, true)); commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, hoverRange, this.hoverDecorationOptions, info.commentingRanges, true)); commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, afterRange, this.decorationOptions, info.commentingRanges, true)); } else { commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, range, this.decorationOptions, info.commentingRanges)); } }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
(decoration, index) => decoration.id = this.decorationIds[index]
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
action => { return (action.range.startLineNumber <= commentRange.startLineNumber) && (commentRange.endLineNumber <= action.range.endLineNumber); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
actions => actions.action
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
count => { if (count === 0) { this.clearEditorListeners(); } else if (!this._editorDisposables) { this.registerEditorListeners(); } }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
ownerId => { delete this._pendingCommentCache[ownerId]; this.beginCompute(); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
_ => this.beginCompute()
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
e => { const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri; if (editorURI && editorURI.toString() === e.resource.toString()) { this.setComments(e.commentInfos.filter(commentInfo => commentInfo !== null)); } }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
commentInfo => commentInfo !== null
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
e => this.onModelChanged(e)
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
e => this.onEditorMouseMove(e)
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
e => this.onEditorChangeCursorPosition(e.position)
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
() => this.onEditorChangeCursorPosition(this.editor.getPosition())
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
disposable => disposable.dispose()
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
token => { const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri; if (editorURI) { return this.commentService.getDocumentComments(editorURI); } return Promise.resolve([]); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
commentInfos => { this.setComments(coalesce(commentInfos)); this._computePromise = null; }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
() => { const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri; if (editorURI) { return this.commentService.getDocumentComments(editorURI); } return Promise.resolve([]); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
commentInfos => { const meaningfulCommentInfos = coalesce(commentInfos); this._commentingRangeDecorator.update(this.editor, meaningfulCommentInfos); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
(err) => { onUnexpectedError(err); return null; }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
widget => widget.commentThread.threadId === threadId
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
_ => { this.revealCommentThread(threadId, commentUniqueId, false); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
(a, b) => { if (reverse) { const temp = a; a = b; b = temp; } if (a.commentThread.range.startLineNumber < b.commentThread.range.startLineNumber) { return -1; } if (a.commentThread.range.startLineNumber > b.commentThread.range.startLineNumber) { return 1; } if (a.commentThread.range.startColumn < b.commentThread.range.startColumn) { return -1; } if (a.commentThread.range.startColumn > b.commentThread.range.startColumn) { return 1; } return 0; }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
widget => { let lineValueOne = reverse ? after.lineNumber : widget.commentThread.range.startLineNumber; let lineValueTwo = reverse ? widget.commentThread.range.startLineNumber : after.lineNumber; let columnValueOne = reverse ? after.column : widget.commentThread.range.startColumn; let columnValueTwo = reverse ? widget.commentThread.range.startColumn : after.column; if (lineValueOne > lineValueTwo) { return true; } if (lineValueOne < lineValueTwo) { return false; } if (columnValueOne > columnValueTwo) { return true; } return false; }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
widget => widget.dispose()
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
e => this.onEditorMouseDown(e)
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
e => this.onEditorMouseUp(e)
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
() => { if (this._computeCommentingRangeScheduler) { this._computeCommentingRangeScheduler.cancel(); } this._computeCommentingRangeScheduler = null; }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
async () => { this.beginComputeCommentingRanges(); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
async e => { const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri; if (!editorURI) { return; } if (this._computePromise) { await this._computePromise; } let commentInfo = this._commentInfos.filter(info => info.owner === e.owner); if (!commentInfo || !commentInfo.length) { return; } let added = e.added.filter(thread => thread.resource && thread.resource.toString() === editorURI.toString()); let removed = e.removed.filter(thread => thread.resource && thread.resource.toString() === editorURI.toString()); let changed = e.changed.filter(thread => thread.resource && thread.resource.toString() === editorURI.toString()); removed.forEach(thread => { let matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId && zoneWidget.commentThread.threadId !== ''); if (matchedZones.length) { let matchedZone = matchedZones[0]; let index = this._commentWidgets.indexOf(matchedZone); this._commentWidgets.splice(index, 1); matchedZone.dispose(); } }); changed.forEach(thread => { let matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId); if (matchedZones.length) { let matchedZone = matchedZones[0]; matchedZone.update(thread); } }); added.forEach(thread => { let matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId); if (matchedZones.length) { return; } let matchedNewCommentThreadZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && (zoneWidget.commentThread as any).commentThreadHandle === -1 && Range.equalsRange(zoneWidget.commentThread.range, thread.range)); if (matchedNewCommentThreadZones.length) { matchedNewCommentThreadZones[0].update(thread); return; } const pendingCommentText = this._pendingCommentCache[e.owner] && this._pendingCommentCache[e.owner][thread.threadId!]; this.displayCommentThread(e.owner, thread, pendingCommentText); this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread); }); }
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript
ArrowFunction
info => info.owner === e.owner
CUBETIQ/vscode
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
TypeScript