How to use the @bentley/imodeljs-common.IModelToken.fromJSON function in @bentley/imodeljs-common

To help you get started, we’ve selected a few @bentley/imodeljs-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / core / frontend / src / IModelConnection.ts View on Github external
private constructor(iModel: IModelProps, openMode: OpenMode) {
    super(iModel.iModelToken ? IModelToken.fromJSON(iModel.iModelToken) : undefined);
    super.initialize(iModel.name!, iModel);
    this.isBlank = undefined === iModel.iModelToken; // to differentiate between previously-open-but-now-closed vs. blank
    this.openMode = openMode;
    this.models = new IModelConnection.Models(this);
    this.elements = new IModelConnection.Elements(this);
    this.codeSpecs = new IModelConnection.CodeSpecs(this);
    this.views = new IModelConnection.Views(this);
    this.selectionSet = new SelectionSet(this);
    this.hilited = new HiliteSet(this);
    this.tiles = new IModelConnection.Tiles(this);
    this.subcategories = new SubCategoriesCache(this);
    this.geoServices = new GeoServices(this);
    this.displayedExtents = Range3d.fromJSON(this.projectExtents);
  }
github imodeljs / imodeljs / integration-tests / core / src / backend / RpcImpl.ts View on Github external
public async extractChangeSummaries(tokenProps: IModelTokenProps, options: any): Promise {
    const requestContext = ClientRequestContext.current as AuthorizedClientRequestContext;
    const iModelToken = IModelToken.fromJSON(tokenProps);
    await ChangeSummaryManager.extractChangeSummaries(requestContext, IModelDb.find(iModelToken), options as ChangeSummaryExtractOptions);
  }
github imodeljs / imodeljs / example-code / app / src / backend / RobotWorldRpcImpl.ts View on Github external
public async queryObstaclesHitByRobot(tokenProps: IModelTokenProps, rid: Id64String): Promise {
    const iModelDb: IModelDb = IModelDb.find(IModelToken.fromJSON(tokenProps));
    return RobotWorldEngine.queryObstaclesHitByRobot(iModelDb, rid);
  }
}
github imodeljs / imodeljs / example-code / app / src / backend / RobotWorldRpcImpl.ts View on Github external
public async moveRobot(tokenProps: IModelTokenProps, id: Id64String, location: XYZProps): Promise {
    RobotWorldEngine.moveRobot(IModelDb.find(IModelToken.fromJSON(tokenProps)), id, Point3d.fromJSON(location));
  }
github imodeljs / imodeljs / core / backend / src / rpc-impl / IModelWriteRpcImpl.ts View on Github external
public async saveChanges(tokenProps: IModelTokenProps, description?: string): Promise {
    const iModelToken = IModelToken.fromJSON(tokenProps);
    IModelDb.find(iModelToken).saveChanges(description);
  }
  public async updateProjectExtents(tokenProps: IModelTokenProps, newExtents: AxisAlignedBox3dProps): Promise {
github imodeljs / imodeljs / core / backend / src / rpc-impl / WipRpcImpl.ts View on Github external
public async detachChangeCache(tokenProps: IModelTokenProps): Promise {
    const iModelToken = IModelToken.fromJSON(tokenProps);
    const iModel: IModelDb = IModelDb.find(iModelToken);
    if (ChangeSummaryManager.isChangeCacheAttached(iModel))
      ChangeSummaryManager.detachChangeCache(iModel);
  }
github imodeljs / imodeljs / core / backend / src / rpc-impl / WipRpcImpl.ts View on Github external
public async isChangesetProcessed(tokenProps: IModelTokenProps, changesetId: string): Promise {
    const iModelToken = IModelToken.fromJSON(tokenProps);
    return ChangedElementsManager.isProcessed(iModelToken.iModelId!, changesetId);
  }
}
github imodeljs / imodeljs / core / backend / src / rpc-impl / IModelReadRpcImpl.ts View on Github external
public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelTokenProps, props: string): Promise {
    const iModelToken = IModelToken.fromJSON(tokenProps);
    const iModelDb = IModelDb.find(iModelToken);
    const requestContext = ClientRequestContext.current;
    return iModelDb.getGeoCoordinatesFromIModelCoordinates(requestContext, props);
  }
}
github imodeljs / imodeljs / core / backend / src / rpc-impl / WipRpcImpl.ts View on Github external
public async attachChangeCache(tokenProps: IModelTokenProps): Promise {
    const iModelToken = IModelToken.fromJSON(tokenProps);
    ChangeSummaryManager.attachChangeCache(IModelDb.find(iModelToken));
  }
github imodeljs / imodeljs / core / backend / src / rpc-impl / WipRpcImpl.ts View on Github external
public async getChangedElements(tokenProps: IModelTokenProps, startChangesetId: string, endChangesetId: string): Promise {
    const iModelToken = IModelToken.fromJSON(tokenProps);
    return ChangedElementsManager.getChangedElements(iModelToken.iModelId!, startChangesetId, endChangesetId);
  }