6fc7c06e9c
* Quick hack to demo how an offline loader would work with as little complication as possible * Further simplified yielding objects in offline mode * Commented out the URL thing * Implemented SpeckleOfflineLoader. JSON parsing is implemented at object-loader level, completely isolated from the rest of the implementation in order to avoid regression * Isolated ObjectLoader creation in base SpeckleLoader class so any extended classes can overwrite the way the object loader is created and used * Removed the big json sample file * Updated version * Removed unused functions from objectloader * Restored viewer package version * Fixed typo * Renamed and moved the sample offline Speckle JSON * Replaced the default JSON object sample with a much smaller one since we don't want to increase the sandbox's build size by 10 megs * Fixed a linting error
2 lines
9.3 KiB
TypeScript
2 lines
9.3 KiB
TypeScript
export const JSONSpeckleStream = `[{"id":"1d060c69832c77c34ccc08e7955c132d","units":"m","__closure":{"0a135c3f8fed261b1f540c180b52f569":3,"1facfaaf1d3682707edd9ac20ef34e62":3,"7b7d7d6668f9d548d23ae5ea6d49446a":1,"a09d3408a23af65371a50ffad57eca90":2,"a153e0873c37979646e67eb006ff1819":4,"accbfcb15d2b5745afa12fa52b86e66e":4,"b06794644292db07098f51981aa76e65":4,"dd31d125d7941a1cbffc78566e9f59ba":4},"speckle_type":"Base","applicationId":null,"totalChildrenCount":8,"Alex Test Steam [ main @ 328bd99997 ]":{"referencedId":"7b7d7d6668f9d548d23ae5ea6d49446a","speckle_type":"reference"}},{"id": "0a135c3f8fed261b1f540c180b52f569", "area": null, "bbox": {"id": "21877013d5dcd72305f7a48fd40c68a5", "area": 0, "units": "m", "xSize": {"id": "b2b2f19648b14a25a70f493e34780b94", "end": 0, "start": 0, "units": "m", "speckle_type": "Objects.Primitive.Interval", "applicationId": null, "totalChildrenCount": 0}, "ySize": {"id": "b2b2f19648b14a25a70f493e34780b94", "end": 0, "start": 0, "units": "m", "speckle_type": "Objects.Primitive.Interval", "applicationId": null, "totalChildrenCount": 0}, "zSize": {"id": "b2b2f19648b14a25a70f493e34780b94", "end": 0, "start": 0, "units": "m", "speckle_type": "Objects.Primitive.Interval", "applicationId": null, "totalChildrenCount": 0}, "volume": 0, "basePlane": {"id": "e9886620f7f7ca05d7a4fb51e98b79a2", "xdir": {"x": 0, "y": 0, "z": 0, "id": "4409121ecaa12c2c28391835ece503a9", "units": "m", "speckle_type": "Objects.Geometry.Vector", "applicationId": null, "totalChildrenCount": 0}, "ydir": {"x": 0, "y": 0, "z": 0, "id": "4409121ecaa12c2c28391835ece503a9", "units": "m", "speckle_type": "Objects.Geometry.Vector", "applicationId": null, "totalChildrenCount": 0}, "units": "m", "normal": {"x": 0, "y": 0, "z": 0, "id": "4409121ecaa12c2c28391835ece503a9", "units": "m", "speckle_type": "Objects.Geometry.Vector", "applicationId": null, "totalChildrenCount": 0}, "origin": {"x": 0, "y": 0, "z": 0, "id": "83e6d188175d85974ec7062cdfa036f9", "units": "m", "speckle_type": "Objects.Geometry.Point", "applicationId": null, "totalChildrenCount": 0}, "speckle_type": "Objects.Geometry.Plane", "applicationId": null, "totalChildrenCount": 0}, "speckle_type": "Objects.Geometry.Box", "applicationId": null, "totalChildrenCount": 0}, "name": "Cube.001", "faces": [{"referencedId": "a153e0873c37979646e67eb006ff1819", "speckle_type": "reference"}], "units": "m", "colors": [{"referencedId": "b06794644292db07098f51981aa76e65", "speckle_type": "reference"}], "volume": null, "vertices": [{"referencedId": "accbfcb15d2b5745afa12fa52b86e66e", "speckle_type": "reference"}], "__closure": {"a153e0873c37979646e67eb006ff1819": 1, "accbfcb15d2b5745afa12fa52b86e66e": 1, "b06794644292db07098f51981aa76e65": 1}, "properties": {"name": "Cube.001", "transform": {"id": "999547f8a000fc8d955a5fb2d47c72bb", "units": "m", "value": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], "speckle_type": "Objects.Other.Transform", "applicationId": null, "totalChildrenCount": 0}}, "speckle_type": "Objects.Geometry.Mesh", "applicationId": null, "renderMaterial": {"id": "59b104f8217bceb1d1029ba4897c5693", "name": "Material", "units": "m", "diffuse": -1, "opacity": 1, "emissive": -16777216, "metalness": 0, "roughness": 0.5, "speckle_type": "Objects.Other.RenderMaterial", "applicationId": null, "totalChildrenCount": 0}, "textureCoordinates": [{"referencedId": "b06794644292db07098f51981aa76e65", "speckle_type": "reference"}], "totalChildrenCount": 3},{"id": "1facfaaf1d3682707edd9ac20ef34e62", "area": null, "bbox": {"id": "21877013d5dcd72305f7a48fd40c68a5", "area": 0, "units": "m", "xSize": {"id": "b2b2f19648b14a25a70f493e34780b94", "end": 0, "start": 0, "units": "m", "speckle_type": "Objects.Primitive.Interval", "applicationId": null, "totalChildrenCount": 0}, "ySize": {"id": "b2b2f19648b14a25a70f493e34780b94", "end": 0, "start": 0, "units": "m", "speckle_type": "Objects.Primitive.Interval", "applicationId": null, "totalChildrenCount": 0}, "zSize": {"id": "b2b2f19648b14a25a70f493e34780b94", "end": 0, "start": 0, "units": "m", "speckle_type": "Objects.Primitive.Interval", "applicationId": null, "totalChildrenCount": 0}, "volume": 0, "basePlane": {"id": "e9886620f7f7ca05d7a4fb51e98b79a2", "xdir": {"x": 0, "y": 0, "z": 0, "id": "4409121ecaa12c2c28391835ece503a9", "units": "m", "speckle_type": "Objects.Geometry.Vector", "applicationId": null, "totalChildrenCount": 0}, "ydir": {"x": 0, "y": 0, "z": 0, "id": "4409121ecaa12c2c28391835ece503a9", "units": "m", "speckle_type": "Objects.Geometry.Vector", "applicationId": null, "totalChildrenCount": 0}, "units": "m", "normal": {"x": 0, "y": 0, "z": 0, "id": "4409121ecaa12c2c28391835ece503a9", "units": "m", "speckle_type": "Objects.Geometry.Vector", "applicationId": null, "totalChildrenCount": 0}, "origin": {"x": 0, "y": 0, "z": 0, "id": "83e6d188175d85974ec7062cdfa036f9", "units": "m", "speckle_type": "Objects.Geometry.Point", "applicationId": null, "totalChildrenCount": 0}, "speckle_type": "Objects.Geometry.Plane", "applicationId": null, "totalChildrenCount": 0}, "speckle_type": "Objects.Geometry.Box", "applicationId": null, "totalChildrenCount": 0}, "name": "Cube", "faces": [{"referencedId": "a153e0873c37979646e67eb006ff1819", "speckle_type": "reference"}], "units": "m", "colors": [{"referencedId": "b06794644292db07098f51981aa76e65", "speckle_type": "reference"}], "volume": null, "vertices": [{"referencedId": "dd31d125d7941a1cbffc78566e9f59ba", "speckle_type": "reference"}], "__closure": {"a153e0873c37979646e67eb006ff1819": 1, "b06794644292db07098f51981aa76e65": 1, "dd31d125d7941a1cbffc78566e9f59ba": 1}, "properties": {"name": "Cube", "transform": {"id": "999547f8a000fc8d955a5fb2d47c72bb", "units": "m", "value": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], "speckle_type": "Objects.Other.Transform", "applicationId": null, "totalChildrenCount": 0}}, "speckle_type": "Objects.Geometry.Mesh", "applicationId": null, "renderMaterial": {"id": "59b104f8217bceb1d1029ba4897c5693", "name": "Material", "units": "m", "diffuse": -1, "opacity": 1, "emissive": -16777216, "metalness": 0, "roughness": 0.5, "speckle_type": "Objects.Other.RenderMaterial", "applicationId": null, "totalChildrenCount": 0}, "textureCoordinates": [{"referencedId": "b06794644292db07098f51981aa76e65", "speckle_type": "reference"}], "totalChildrenCount": 3},{"id": "7b7d7d6668f9d548d23ae5ea6d49446a", "units": "m", "__closure": {"0a135c3f8fed261b1f540c180b52f569": 2, "1facfaaf1d3682707edd9ac20ef34e62": 2, "a09d3408a23af65371a50ffad57eca90": 1, "a153e0873c37979646e67eb006ff1819": 3, "accbfcb15d2b5745afa12fa52b86e66e": 3, "b06794644292db07098f51981aa76e65": 3, "dd31d125d7941a1cbffc78566e9f59ba": 3}, "Collection": {"referencedId": "a09d3408a23af65371a50ffad57eca90", "speckle_type": "reference"}, "speckle_type": "Base", "applicationId": null, "totalChildrenCount": 7},{"id": "a09d3408a23af65371a50ffad57eca90", "units": "m", "@objects": [{"referencedId": "1facfaaf1d3682707edd9ac20ef34e62", "speckle_type": "reference"}, {"referencedId": "0a135c3f8fed261b1f540c180b52f569", "speckle_type": "reference"}], "__closure": {"0a135c3f8fed261b1f540c180b52f569": 1, "1facfaaf1d3682707edd9ac20ef34e62": 1, "a153e0873c37979646e67eb006ff1819": 2, "accbfcb15d2b5745afa12fa52b86e66e": 2, "b06794644292db07098f51981aa76e65": 2, "dd31d125d7941a1cbffc78566e9f59ba": 2}, "speckle_type": "Base", "applicationId": null, "totalChildrenCount": 6},{"id": "a153e0873c37979646e67eb006ff1819", "data": [1, 10, 12, 14, 8, 1, 9, 15, 18, 16, 1, 17, 19, 22, 20, 1, 21, 23, 13, 11, 1, 2, 6, 4, 0, 1, 7, 3, 1, 5], "units": "m", "speckle_type": "Speckle.Core.Models.DataChunk", "applicationId": null, "totalChildrenCount": 0},{"id": "accbfcb15d2b5745afa12fa52b86e66e", "data": [-3.1788320541381836, -1, -1, -3.1788320541381836, -1, 1, -3.1788320541381836, 1, -1, -3.1788320541381836, 1, 1, -1.1788320541381836, -1, -1, -1.1788320541381836, -1, 1, -1.1788320541381836, 1, -1, -1.1788320541381836, 1, 1, -3.1788320541381836, 1, -1, -3.1788320541381836, 1, -1, -3.1788320541381836, -1, -1, -3.1788320541381836, -1, -1, -3.1788320541381836, -1, 1, -3.1788320541381836, -1, 1, -3.1788320541381836, 1, 1, -3.1788320541381836, 1, 1, -1.1788320541381836, 1, -1, -1.1788320541381836, 1, -1, -1.1788320541381836, 1, 1, -1.1788320541381836, 1, 1, -1.1788320541381836, -1, -1, -1.1788320541381836, -1, -1, -1.1788320541381836, -1, 1, -1.1788320541381836, -1, 1], "units": "m", "speckle_type": "Speckle.Core.Models.DataChunk", "applicationId": null, "totalChildrenCount": 0},{"id": "b06794644292db07098f51981aa76e65", "data": [], "units": "m", "speckle_type": "Speckle.Core.Models.DataChunk", "applicationId": null, "totalChildrenCount": 0},{"id": "dd31d125d7941a1cbffc78566e9f59ba", "data": [1.2236602306365967, -1, -1, 1.2236602306365967, -1, 1, 1.2236602306365967, 1, -1, 1.2236602306365967, 1, 1, 3.2236602306365967, -1, -1, 3.2236602306365967, -1, 1, 3.2236602306365967, 1, -1, 3.2236602306365967, 1, 1, 1.2236602306365967, 1, -1, 1.2236602306365967, 1, -1, 1.2236602306365967, -1, -1, 1.2236602306365967, -1, -1, 1.2236602306365967, -1, 1, 1.2236602306365967, -1, 1, 1.2236602306365967, 1, 1, 1.2236602306365967, 1, 1, 3.2236602306365967, 1, -1, 3.2236602306365967, 1, -1, 3.2236602306365967, 1, 1, 3.2236602306365967, 1, 1, 3.2236602306365967, -1, -1, 3.2236602306365967, -1, -1, 3.2236602306365967, -1, 1, 3.2236602306365967, -1, 1], "units": "m", "speckle_type": "Speckle.Core.Models.DataChunk", "applicationId": null, "totalChildrenCount": 0}]`
|