@itwin/core-backend 5.0.0-dev.104 → 5.0.0-dev.106
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/lib/cjs/CheckpointManager.d.ts +9 -15
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +6 -44
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/internal/HubMock.d.ts.map +1 -1
- package/lib/cjs/internal/HubMock.js +12 -12
- package/lib/cjs/internal/HubMock.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +1 -4
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -5
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/esm/CheckpointManager.d.ts +9 -15
- package/lib/esm/CheckpointManager.d.ts.map +1 -1
- package/lib/esm/CheckpointManager.js +7 -45
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/internal/HubMock.d.ts.map +1 -1
- package/lib/esm/internal/HubMock.js +13 -13
- package/lib/esm/internal/HubMock.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +1 -4
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -4
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +5 -1
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +26 -5
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/hubaccess/CheckpointManager.test.js +4 -3
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +5 -40
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +3 -2
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/package.json +12 -12
|
@@ -6,8 +6,9 @@ import { assert } from "chai";
|
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as sinon from "sinon";
|
|
8
8
|
import { Guid } from "@itwin/core-bentley";
|
|
9
|
-
import {
|
|
9
|
+
import { V2CheckpointManager } from "../../CheckpointManager";
|
|
10
10
|
import { IModelJsFs } from "../../IModelJsFs";
|
|
11
|
+
import { IModelTestUtils } from "../IModelTestUtils";
|
|
11
12
|
describe("Checkpoint Manager", () => {
|
|
12
13
|
afterEach(() => {
|
|
13
14
|
sinon.restore();
|
|
@@ -22,7 +23,7 @@ describe("Checkpoint Manager", () => {
|
|
|
22
23
|
localFile: path.join(V2CheckpointManager.getFolder(), Guid.createValue()),
|
|
23
24
|
checkpoint,
|
|
24
25
|
};
|
|
25
|
-
const db =
|
|
26
|
+
const db = IModelTestUtils.tryOpenLocalFile(request);
|
|
26
27
|
assert.isUndefined(db);
|
|
27
28
|
});
|
|
28
29
|
it("open a bad bim file should return undefined", async () => {
|
|
@@ -44,7 +45,7 @@ describe("Checkpoint Manager", () => {
|
|
|
44
45
|
localFile: outputFile,
|
|
45
46
|
checkpoint,
|
|
46
47
|
};
|
|
47
|
-
const db =
|
|
48
|
+
const db = IModelTestUtils.tryOpenLocalFile(request);
|
|
48
49
|
assert.isUndefined(db);
|
|
49
50
|
});
|
|
50
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckpointManager.test.js","sourceRoot":"","sources":["../../../../src/test/hubaccess/CheckpointManager.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CheckpointManager.test.js","sourceRoot":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M,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC;YAChC,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAExC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;QAChG,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;YACnC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAEpC,UAAU,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAEhD,2BAA2B;QAC3B,MAAM,OAAO,GAAG;YACd,SAAS,EAAE,UAAU;YACrB,UAAU;SACX,CAAC;QACF,MAAM,EAAE,GAAG,eAAe,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { assert } from \"chai\";\nimport * as path from \"path\";\nimport * as sinon from \"sinon\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { V2CheckpointManager } from \"../../CheckpointManager\";\nimport { IModelJsFs } from \"../../IModelJsFs\";\nimport { _hubAccess, _nativeDb } from \"../../internal/Symbols\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\n\ndescribe(\"Checkpoint Manager\", () => {\n\n afterEach(() => {\n sinon.restore();\n });\n\n it(\"open missing local file should return undefined\", async () => {\n const checkpoint = {\n iTwinId: \"5678\",\n iModelId: \"910\",\n changeset: { id: \"1234\" },\n };\n const request = {\n localFile: path.join(V2CheckpointManager.getFolder(), Guid.createValue()),\n checkpoint,\n };\n const db = IModelTestUtils.tryOpenLocalFile(request);\n assert.isUndefined(db);\n });\n\n it(\"open a bad bim file should return undefined\", async () => {\n const checkpoint = {\n iTwinId: \"5678\",\n iModelId: \"910\",\n changeset: { id: \"1234\" },\n };\n\n // Setup a local file\n const folder = path.join(V2CheckpointManager.getFolder(), checkpoint.iModelId);\n if (!IModelJsFs.existsSync(folder))\n IModelJsFs.recursiveMkDirSync(folder);\n\n const outputFile = path.join(V2CheckpointManager.getFolder(), `${checkpoint.changeset.id}.bim`);\n if (IModelJsFs.existsSync(outputFile))\n IModelJsFs.unlinkSync(outputFile);\n\n IModelJsFs.writeFileSync(outputFile, \"Testing\");\n\n // Attempt to open the file\n const request = {\n localFile: outputFile,\n checkpoint,\n };\n const db = IModelTestUtils.tryOpenLocalFile(request);\n assert.isUndefined(db);\n });\n});\n"]}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { assert } from "chai";
|
|
6
6
|
import * as fs from "fs";
|
|
7
7
|
import { DbResult, Id64 } from "@itwin/core-bentley";
|
|
8
|
-
import { Code, ColorDef,
|
|
8
|
+
import { Code, ColorDef, FillDisplay, GeometryClass, GeometryParams, GeometryStreamBuilder, ImageSourceFormat, IModel, LineStyle, TextureMapUnits, } from "@itwin/core-common";
|
|
9
9
|
import { Angle, Box, GrowableXYArray, GrowableXYZArray, LineSegment3d, LineString3d, Loop, Point3d, PolyfaceBuilder, Range3d, Sphere, StrokeOptions, Vector3d, } from "@itwin/core-geometry";
|
|
10
|
-
import { ExportGraphics, ExportGraphicsMeshVisitor,
|
|
10
|
+
import { ExportGraphics, ExportGraphicsMeshVisitor, LineStyleDefinition, PhysicalObject, RenderMaterialElement, SnapshotDb, Texture, } from "../../core-backend";
|
|
11
11
|
import { GeometryPart } from "../../Element";
|
|
12
12
|
import { IModelTestUtils } from "../IModelTestUtils";
|
|
13
13
|
describe("exportGraphics", () => {
|
|
@@ -294,45 +294,10 @@ describe("exportGraphics", () => {
|
|
|
294
294
|
testMesh(triangle, triangleParams);
|
|
295
295
|
testMesh(cube, cubeParams);
|
|
296
296
|
});
|
|
297
|
-
it("export elements from local bim file", () => {
|
|
298
|
-
// edit these values to run
|
|
299
|
-
const outBimFileName = "out.bim"; // will be written to core\backend\lib\cjs\test\output\ExportGraphics
|
|
300
|
-
const outFBFileName = ""; // e.g., "c:\\tmp\\foo.fb"
|
|
301
|
-
const inBimFilePathName = ""; // e.g., "c:\\tmp\\foo.bim"
|
|
302
|
-
const elementIds = []; // e.g., ["0x2000000000c", "0x2000000000a"]
|
|
303
|
-
if (outBimFileName !== "" && inBimFilePathName !== "" && elementIds.length > 0) {
|
|
304
|
-
const testFileName = IModelTestUtils.prepareOutputFile("ExportGraphics", outBimFileName);
|
|
305
|
-
const myIModel = IModelTestUtils.createSnapshotFromSeed(testFileName, inBimFilePathName);
|
|
306
|
-
if (outFBFileName !== "") {
|
|
307
|
-
for (const elementId of elementIds) {
|
|
308
|
-
myIModel.elementGeometryRequest({ elementId, onGeometry: (info) => {
|
|
309
|
-
for (const entry of info.entryArray) {
|
|
310
|
-
// examine entry here, e.g.:
|
|
311
|
-
if (entry.opcode === ElementGeometryOpcode.BsplineSurface)
|
|
312
|
-
IModelJsFs.writeFileSync(outFBFileName, entry.data);
|
|
313
|
-
}
|
|
314
|
-
} });
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
const infos = [];
|
|
318
|
-
const exportGraphicsOptions = {
|
|
319
|
-
elementIdArray: elementIds,
|
|
320
|
-
onGraphics: (info) => infos.push(info),
|
|
321
|
-
};
|
|
322
|
-
if (DbResult.BE_SQLITE_OK === myIModel.exportGraphics(exportGraphicsOptions)) {
|
|
323
|
-
// examine infos here, e.g.:
|
|
324
|
-
// for (const info of infos)
|
|
325
|
-
// console.log(JSON.stringify(IModelJson.Writer.toIModelJson(ExportGraphics.convertToIndexedPolyface(info.mesh))));
|
|
326
|
-
}
|
|
327
|
-
myIModel.close();
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
297
|
it("verifies export of 3d linestyle as parts", () => {
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const testFileName = IModelTestUtils.prepareOutputFile("ExportGraphics", outBimFileName);
|
|
335
|
-
const myIModel = IModelTestUtils.createSnapshotFromSeed(testFileName, inBimFilePathName);
|
|
298
|
+
const resolvedBimFile = IModelTestUtils.resolveAssetFile("3dLinestyle.bim");
|
|
299
|
+
assert.isNotEmpty(resolvedBimFile);
|
|
300
|
+
const myIModel = SnapshotDb.openFile(resolvedBimFile);
|
|
336
301
|
const elementIdArray = ["0x5a"];
|
|
337
302
|
const infos = [];
|
|
338
303
|
const partInstanceArray = [];
|