Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (fs.existsSync(pathname))
fs.unlinkSync(pathname);
this._iModelDb = IModelDb.createStandalone(pathname, { rootSubject: { name: this._iModelName } });
const definitionModelId: Id64String = IModel.dictionaryId;
this._physicalModelId = PhysicalModel.insert(this._iModelDb, IModel.rootSubjectId, "TestModel");
this._codeSpecId = this._iModelDb.codeSpecs.insert("TestCodeSpec", CodeScopeSpec.Type.Model);
this._categoryId = SpatialCategory.insert(this._iModelDb, definitionModelId, "TestCategory", { color: new ColorDef("blanchedAlmond") });
// Insert a ViewDefinition for the PhysicalModel
const viewName = "Physical View";
const modelSelectorId: Id64String = ModelSelector.insert(this._iModelDb, definitionModelId, viewName, [this._physicalModelId]);
const categorySelectorId: Id64String = CategorySelector.insert(this._iModelDb, definitionModelId, viewName, [this._categoryId]);
const displayStyleId: Id64String = DisplayStyle3d.insert(this._iModelDb, definitionModelId, viewName);
const viewRange = new Range3d(0, 0, 0, 50, 50, 50);
OrthographicViewDefinition.insert(this._iModelDb, definitionModelId, viewName, modelSelectorId, categorySelectorId, displayStyleId, viewRange);
this._iModelDb.updateProjectExtents(new Range3d(-1000, -1000, -1000, 1000, 1000, 1000));
this._iModelDb.saveChanges("Setup new iModel");
this._iModelDb.closeStandalone();
this._iModelDb = undefined;
return pathname;
}
private _initializeLogger(): void {
this._iModelDb = IModelDb.createStandalone(pathname, { rootSubject: { name: this._iModelName } });
const definitionModelId: Id64String = IModel.dictionaryId;
this._physicalModelId = PhysicalModel.insert(this._iModelDb, IModel.rootSubjectId, "TestModel");
this._codeSpecId = this._iModelDb.codeSpecs.insert("TestCodeSpec", CodeScopeSpec.Type.Model);
this._categoryId = SpatialCategory.insert(this._iModelDb, definitionModelId, "TestCategory", { color: new ColorDef("blanchedAlmond") });
// Insert a ViewDefinition for the PhysicalModel
const viewName = "Physical View";
const modelSelectorId: Id64String = ModelSelector.insert(this._iModelDb, definitionModelId, viewName, [this._physicalModelId]);
const categorySelectorId: Id64String = CategorySelector.insert(this._iModelDb, definitionModelId, viewName, [this._categoryId]);
const displayStyleId: Id64String = DisplayStyle3d.insert(this._iModelDb, definitionModelId, viewName);
const viewRange = new Range3d(0, 0, 0, 50, 50, 50);
OrthographicViewDefinition.insert(this._iModelDb, definitionModelId, viewName, modelSelectorId, categorySelectorId, displayStyleId, viewRange);
this._iModelDb.updateProjectExtents(new Range3d(-1000, -1000, -1000, 1000, 1000, 1000));
this._iModelDb.saveChanges("Setup new iModel");
this._iModelDb.closeStandalone();
this._iModelDb = undefined;
return pathname;
}
private _initializeLogger(): void {
public calculateRange(): AxisAlignedBox3d {
const range = new Range3d();
if (!this.isValid)
return range;
this.transform.multiplyRange(Range3d.createRange2d(this.bbox, 0), range);
// low and high are not allowed to be equal
range.ensureMinLengths();
range.low.z = - 1.0; // is the 2dFrustumDepth, which === 1 meter
range.high.z = 1.0;
return range;
}
return this._range.clone(out);
this._range = new Range3d();
const tfs = this._transforms;
if (undefined === tfs) {
assert(false);
return this._range.clone(out);
}
this._transforms = undefined;
const numFloatsPerTransform = 3 * 4;
assert(0 === tfs.length % (3 * 4));
const tf = Transform.createIdentity();
const r = new Range3d();
for (let i = 0; i < tfs.length; i += numFloatsPerTransform) {
tf.setFromJSON({
origin: [tfs[i + 3], tfs[i + 7], tfs[i + 11]],
matrix: [
[tfs[i + 0], tfs[i + 1], tfs[i + 2]],
[tfs[i + 4], tfs[i + 5], tfs[i + 6]],
[tfs[i + 8], tfs[i + 9], tfs[i + 10]],
],
});
reprRange.clone(r);
tf.multiplyRange(r, r);
this._range.extendRange(r);
}
const rtcTransform = Transform.createTranslation(this._rtcCenter);
private getPrimitiveRange(pGeom: PrimitiveGeometryType): Range3d | undefined {
const pRange: Range3d = new Range3d();
pGeom.range(undefined, pRange);
if (pRange.isNull)
return undefined;
return pRange;
}