@abi-software/scaffoldvuer 0.4.0-vue3.6 → 1.0.0
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/.eslintrc.js +4 -11
- package/README.md +2 -1
- package/dist/scaffoldvuer.js +17943 -17046
- package/dist/scaffoldvuer.umd.cjs +410 -182
- package/dist/style.css +1 -1
- package/package.json +18 -11
- package/src/App.vue +52 -7
- package/src/app/DropZone.vue +40 -3
- package/src/app/ModelsInformation.js +58 -48
- package/src/app/ModelsTable.vue +11 -11
- package/src/app/TextureDemos.js +123 -6
- package/src/components/OpacityControls.vue +2 -2
- package/src/components/PrimitiveControls.vue +8 -5
- package/src/components/ScaffoldTooltip.vue +9 -0
- package/src/components/ScaffoldVuer.vue +111 -35
- package/src/components/TextureSlidesControls.vue +47 -45
- package/src/components/TreeControls.vue +1 -1
- package/src/components.d.ts +2 -0
- package/src/main.js +14 -2
- package/src/scripts/GraphicsHighlight.js +64 -25
- package/src/scripts/OrgansRenderer.js +3 -7
- package/src/scripts/RendererModule.js +9 -15
- package/src/store/index.js +24 -0
- package/vite.config.js +12 -0
- package/vite.static-build.js +7 -1
- package/vuese-generator.js +65 -0
- package/styleguide.config.js +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,13 +10,17 @@
|
|
|
10
10
|
"serve": "vite --host --force",
|
|
11
11
|
"build-bundle": "vite build",
|
|
12
12
|
"build-static": "vite build -c vite.static-build.js",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"vuese-gen": "node vuese-generator.js",
|
|
14
|
+
"vuese-watch": "node vuese-generator.js watch",
|
|
15
15
|
"changelog": "auto-changelog -p --output CHANGELOG.md --template keepachangelog",
|
|
16
16
|
"version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md",
|
|
17
17
|
"release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
|
|
18
18
|
"release:minor": "npm version minor; npm publish",
|
|
19
|
-
"release:patch": "npm version patch; npm publish"
|
|
19
|
+
"release:patch": "npm version patch; npm publish",
|
|
20
|
+
"docs:dev": "vitepress dev docs",
|
|
21
|
+
"docs:watch": "concurrently \"npm run vuese-watch\" \"npm run docs:dev\"",
|
|
22
|
+
"docs:build": "npm run vuese-gen; vitepress build docs",
|
|
23
|
+
"docs:preview": "vitepress preview docs"
|
|
20
24
|
},
|
|
21
25
|
"type": "module",
|
|
22
26
|
"main": "./dist/scaffoldvuer.umd.cjs",
|
|
@@ -37,34 +41,37 @@
|
|
|
37
41
|
"*.js"
|
|
38
42
|
],
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@abi-software/flatmapvuer": "^0.
|
|
41
|
-
"@abi-software/svg-sprite": "^
|
|
44
|
+
"@abi-software/flatmapvuer": "^1.0.0",
|
|
45
|
+
"@abi-software/svg-sprite": "^1.0.0",
|
|
42
46
|
"@element-plus/icons-vue": "^2.3.1",
|
|
43
47
|
"@vue/compat": "^3.4.15",
|
|
44
|
-
"axios": "^0.21.2",
|
|
45
48
|
"core-js": "^3.22.5",
|
|
46
|
-
"current-script-polyfill": "^1.0.0",
|
|
47
49
|
"element-plus": "^2.4.4",
|
|
48
50
|
"minisearch": "^6.0.1",
|
|
49
|
-
"
|
|
51
|
+
"pinia": "^2.1.7",
|
|
50
52
|
"simple-dropzone": "^0.8.3",
|
|
51
53
|
"unplugin-vue-components": "^0.26.0",
|
|
52
54
|
"vue": "^3.4.15",
|
|
53
55
|
"vue-router": "^4.2.5",
|
|
54
56
|
"vue3-component-svg-sprite": "^0.0.1",
|
|
55
|
-
"zincjs": "^1.
|
|
57
|
+
"zincjs": "^1.5.1-beta.1"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
60
|
"@vitejs/plugin-vue": "^4.6.2",
|
|
61
|
+
"@vuese/markdown-render": "^2.11.3",
|
|
62
|
+
"@vuese/parser": "^2.10.3",
|
|
59
63
|
"auto-changelog": "^2.4.0",
|
|
60
64
|
"babel-eslint": "^10.1.0",
|
|
61
65
|
"babel-plugin-component": "^1.1.1",
|
|
62
66
|
"base64-inline-loader": "^2.0.1",
|
|
67
|
+
"chokidar": "^3.6.0",
|
|
68
|
+
"concurrently": "^8.2.2",
|
|
63
69
|
"eslint": "^8.56.0",
|
|
64
70
|
"eslint-plugin-vue": "^9.19.2",
|
|
65
71
|
"sass": "^1.69.5",
|
|
66
72
|
"vite": "^5.0.10",
|
|
67
|
-
"
|
|
73
|
+
"vite-plugin-node-polyfills": "^0.21.0",
|
|
74
|
+
"vitepress": "^1.0.0-rc.42",
|
|
68
75
|
"webpack-node-externals": "^2.5.2"
|
|
69
76
|
},
|
|
70
77
|
"eslintConfig": {
|
package/src/App.vue
CHANGED
|
@@ -111,7 +111,16 @@
|
|
|
111
111
|
<el-button size="small" @click="featureTextureSlides(true)">
|
|
112
112
|
Body slides
|
|
113
113
|
</el-button>
|
|
114
|
+
<el-button size="small" @click="featureArmSlides(true)">
|
|
115
|
+
Arm slides
|
|
116
|
+
</el-button>
|
|
114
117
|
<el-switch v-model="onClickMarkers" active-text="Markers On Selection" active-color="#8300bf" />
|
|
118
|
+
<el-switch
|
|
119
|
+
v-model="wireframe"
|
|
120
|
+
active-text="wireframe"
|
|
121
|
+
active-color="#8300bf"
|
|
122
|
+
@change="wireframeChanged"
|
|
123
|
+
/>
|
|
115
124
|
</el-row>
|
|
116
125
|
<el-row :gutter="20">
|
|
117
126
|
<el-input v-model="input" type="textarea" autosize placeholder="Please input"
|
|
@@ -126,7 +135,9 @@
|
|
|
126
135
|
</el-popover>
|
|
127
136
|
<el-popover placement="bottom" trigger="click" width="800" popper-class="table-popover" :teleported="false">
|
|
128
137
|
<template #default>
|
|
129
|
-
<
|
|
138
|
+
<Suspense>
|
|
139
|
+
<ModelsTable @viewModelClicked="viewModelClicked" />
|
|
140
|
+
</Suspense>
|
|
130
141
|
</template>
|
|
131
142
|
<template #reference>
|
|
132
143
|
<el-button class="models-button" :icon="ElIconFolderOpened">
|
|
@@ -152,7 +163,7 @@ import { shallowRef } from 'vue';
|
|
|
152
163
|
import { ScaffoldVuer } from "./components/index.js";
|
|
153
164
|
import DropZone from "./app/DropZone.vue";
|
|
154
165
|
import ModelsTable from "./app/ModelsTable.vue";
|
|
155
|
-
import { testSlides, testVolume } from "./app/TextureDemos.js";
|
|
166
|
+
import { testArmSlides, testSlides, testVolume } from "./app/TextureDemos.js";
|
|
156
167
|
import {
|
|
157
168
|
FolderOpened as ElIconFolderOpened,
|
|
158
169
|
Setting as ElIconSetting,
|
|
@@ -199,6 +210,7 @@ export default {
|
|
|
199
210
|
helpMode: false,
|
|
200
211
|
displayMarkers: false,
|
|
201
212
|
onClickMarkers: false,
|
|
213
|
+
wireframe: false,
|
|
202
214
|
syncMode: false,
|
|
203
215
|
currentTime: 0,
|
|
204
216
|
displayMinimap: false,
|
|
@@ -255,6 +267,9 @@ export default {
|
|
|
255
267
|
created: function () {
|
|
256
268
|
texture_prefix = import.meta.env.VITE_TEXTURE_FOOT_PREFIX;
|
|
257
269
|
},
|
|
270
|
+
unmounted: function () {
|
|
271
|
+
this.$refs.dropzone.revokeURLs();
|
|
272
|
+
},
|
|
258
273
|
methods: {
|
|
259
274
|
exportGLTF: function () {
|
|
260
275
|
this.$refs.scaffold.exportGLTF(false).then((data) => {
|
|
@@ -282,9 +297,12 @@ export default {
|
|
|
282
297
|
});
|
|
283
298
|
},
|
|
284
299
|
objectAdded: function (zincObject) {
|
|
285
|
-
if (this._objects.length === 0)
|
|
300
|
+
if (this._objects.length === 0) {
|
|
286
301
|
zincObject.setMarkerMode("on");
|
|
287
|
-
|
|
302
|
+
}
|
|
303
|
+
if (zincObject.isGeometry) {
|
|
304
|
+
zincObject._lod._material.wireframe = this.wireframe;
|
|
305
|
+
}
|
|
288
306
|
this._objects.push(zincObject);
|
|
289
307
|
},
|
|
290
308
|
openMap: function (map) {
|
|
@@ -326,6 +344,23 @@ export default {
|
|
|
326
344
|
this.$refs.scaffold.clearScene();
|
|
327
345
|
testSlides(this.$refs.scaffold, texture_prefix);
|
|
328
346
|
},
|
|
347
|
+
featureArmSlides: async function (overlap) {
|
|
348
|
+
//Test texture
|
|
349
|
+
if (overlap) {
|
|
350
|
+
const url =
|
|
351
|
+
"https://mapcore-bucket1.s3.us-west-2.amazonaws.com/texture/arm1/arm_texture_metadata.json";
|
|
352
|
+
if (this.route.query.url !== encodeURI(url)) {
|
|
353
|
+
this.router.replace({ path: "/", query: { url } });
|
|
354
|
+
this.readyCallback = testArmSlides;
|
|
355
|
+
return;
|
|
356
|
+
} else {
|
|
357
|
+
testArmSlides(this.$refs.scaffold);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
this.$refs.scaffold.clearScene();
|
|
362
|
+
testSlides(this.$refs.scaffold, texture_prefix);
|
|
363
|
+
},
|
|
329
364
|
saveSettings: function () {
|
|
330
365
|
this.sceneSettings.push(this.$refs.scaffold.getState());
|
|
331
366
|
},
|
|
@@ -384,13 +419,23 @@ export default {
|
|
|
384
419
|
cameracontrol.stopAutoTumble();
|
|
385
420
|
}
|
|
386
421
|
},
|
|
422
|
+
wireframeChanged: function (value) {
|
|
423
|
+
this._objects.forEach((zincObject) => {
|
|
424
|
+
if (zincObject.isGeometry) {
|
|
425
|
+
zincObject._lod._material.wireframe = value;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
},
|
|
387
429
|
onReady: function () {
|
|
388
|
-
console.log("ready");
|
|
389
|
-
//window.scaffoldvuer = this.$refs.scaffold;
|
|
390
|
-
this.$refs.dropzone.revokeURLs();
|
|
391
430
|
if (this.readyCallback) {
|
|
392
431
|
this.readyCallback(this.$refs.scaffold, texture_prefix);
|
|
393
432
|
this.readyCallback = undefined;
|
|
433
|
+
} else {
|
|
434
|
+
const url =
|
|
435
|
+
"https://mapcore-bucket1.s3.us-west-2.amazonaws.com/texture/arm1/arm_texture_metadata.json";
|
|
436
|
+
if (this.route.query.url === encodeURI(url)) {
|
|
437
|
+
testArmSlides(this.$refs.scaffold);
|
|
438
|
+
}
|
|
394
439
|
}
|
|
395
440
|
},
|
|
396
441
|
onSelected: function (data) {
|
package/src/app/DropZone.vue
CHANGED
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
import { SimpleDropzone } from "simple-dropzone";
|
|
17
17
|
import path from "path";
|
|
18
18
|
|
|
19
|
+
const getJSON = async (URL) => {
|
|
20
|
+
return fetch(URL)
|
|
21
|
+
.then((response) => response.json())
|
|
22
|
+
.then((responseJson) => {return responseJson});
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
export default {
|
|
20
26
|
name: "DropZone",
|
|
21
27
|
data: function () {
|
|
@@ -33,7 +39,25 @@ export default {
|
|
|
33
39
|
});
|
|
34
40
|
},
|
|
35
41
|
methods: {
|
|
36
|
-
|
|
42
|
+
processTextureFile: function(textureData, flatarray) {
|
|
43
|
+
if (textureData && textureData.images && textureData.images.source) {
|
|
44
|
+
const images = textureData.images.source;
|
|
45
|
+
for (let i = 0; i < images.length; i++) {
|
|
46
|
+
const index = flatarray.findIndex(element => {
|
|
47
|
+
return element[0].includes(images[i]);
|
|
48
|
+
});
|
|
49
|
+
if (index > -1) {
|
|
50
|
+
const objectURL = URL.createObjectURL(flatarray[index][1]);
|
|
51
|
+
this.objectURLs.push(objectURL);
|
|
52
|
+
textureData.images.source[i] = objectURL;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const content = JSON.stringify(textureData);
|
|
56
|
+
let blob = new Blob([content], { type: "application/json" });
|
|
57
|
+
return URL.createObjectURL(blob);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
createMetadataObjectURLs: async function (text, list, flatarray) {
|
|
37
61
|
let content = text;
|
|
38
62
|
for (const [key, file] of Object.entries(list)) {
|
|
39
63
|
if (content.includes(key)) {
|
|
@@ -43,7 +67,19 @@ export default {
|
|
|
43
67
|
this.objectURLs.push(objectURL);
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
|
-
|
|
70
|
+
const data = JSON.parse(content);
|
|
71
|
+
for (let i = 0; i < data.length; i++) {
|
|
72
|
+
if (data[i] && data[i].Type) {
|
|
73
|
+
if (data[i].Type === "Texture") {
|
|
74
|
+
const textureData = await getJSON(data[i].URL);
|
|
75
|
+
URL.revokeObjectURL(data[i].URL);
|
|
76
|
+
const newURL = this.processTextureFile(textureData, flatarray)
|
|
77
|
+
data[i].URL = newURL;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let newContent = JSON.stringify(data);
|
|
82
|
+
let blob = new Blob([newContent], { type: "application/json" });
|
|
47
83
|
const metaURL = URL.createObjectURL(blob);
|
|
48
84
|
this.objectURLs.push(metaURL);
|
|
49
85
|
this.$emit("files-drop", { url: metaURL, format : "metadata" } );
|
|
@@ -60,6 +96,7 @@ export default {
|
|
|
60
96
|
this.objectURLs = [];
|
|
61
97
|
},
|
|
62
98
|
localDrop: function (fileMap) {
|
|
99
|
+
this.revokeURLs();
|
|
63
100
|
const dataMaps = {};
|
|
64
101
|
let list = {};
|
|
65
102
|
let metadata = undefined;
|
|
@@ -94,7 +131,7 @@ export default {
|
|
|
94
131
|
const metaFileURL = URL.createObjectURL(metadata.file);
|
|
95
132
|
fetch(metaFileURL)
|
|
96
133
|
.then((response) => response.text())
|
|
97
|
-
.then((text) => this.createMetadataObjectURLs(text, list));
|
|
134
|
+
.then((text) => this.createMetadataObjectURLs(text, list, flatarray));
|
|
98
135
|
URL.revokeObjectURL(metaFileURL);
|
|
99
136
|
}
|
|
100
137
|
if (gltf) {
|
|
@@ -1,53 +1,63 @@
|
|
|
1
|
-
//import {
|
|
2
|
-
//const sheets = google.sheets('v4');
|
|
3
|
-
|
|
4
|
-
/* eslint-disable no-alert, no-console */
|
|
5
|
-
export default {
|
|
6
|
-
data: function() {
|
|
7
|
-
return {
|
|
8
|
-
tableData: [],
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
methods: {
|
|
12
|
-
createTable: async function(sheetRows, keywords) {
|
|
13
|
-
for (let i = 0; i < sheetRows.length; i++) {
|
|
14
|
-
let mappedData = {};
|
|
15
|
-
for (let j = 0; j < keywords.length; j++) {
|
|
16
|
-
let keyword = keywords[j];
|
|
17
|
-
mappedData[keyword] = sheetRows[i][keyword];
|
|
18
|
-
}
|
|
19
|
-
this.tableData.push(mappedData);
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
getModelsInformation: async function() {
|
|
1
|
+
//import { GoogleSpreadsheet } from 'google-spreadsheet';
|
|
23
2
|
|
|
24
3
|
/*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
await doc.loadInfo(); // loads document properties and worksheets
|
|
44
|
-
const sheet = doc.sheetsByIndex[0];
|
|
45
|
-
const sheetRows = await sheet.getRows();
|
|
46
|
-
const keys = ["Organ", "Species", "Note", "Location",
|
|
47
|
-
"Last modified","Blackfynn dataset", "Published", "Discover"];
|
|
48
|
-
this.createTable(sheetRows, keys);
|
|
49
|
-
*/
|
|
50
|
-
|
|
4
|
+
export default async function(keywords, spreadsheet_id, service_email, service_key) {
|
|
5
|
+
const tableData = [];
|
|
6
|
+
|
|
7
|
+
// const serviceAccountAuth = new JWT({
|
|
8
|
+
// email: service_email,
|
|
9
|
+
// key: service_key,
|
|
10
|
+
// scopes: ['https://www.googleapis.com/auth/spreadsheets'],
|
|
11
|
+
// });
|
|
12
|
+
|
|
13
|
+
const doc = new GoogleSpreadsheet(spreadsheet_id);
|
|
14
|
+
await doc.loadInfo(); // loads document properties and worksheets
|
|
15
|
+
const sheet = doc.sheetsByIndex[0];
|
|
16
|
+
const sheetRows = await sheet.getRows();
|
|
17
|
+
for (let i = 0; i < sheetRows.length; i++) {
|
|
18
|
+
let mappedData = {};
|
|
19
|
+
for (let j = 0; j < keywords.length; j++) {
|
|
20
|
+
let keyword = keywords[j];
|
|
21
|
+
mappedData[keyword] = sheetRows[i][keyword];
|
|
51
22
|
}
|
|
23
|
+
tableData.push(mappedData);
|
|
52
24
|
}
|
|
25
|
+
return tableData;
|
|
26
|
+
}
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export default async function(keywords, spreadsheet_id) {
|
|
30
|
+
const gid = '0';
|
|
31
|
+
const response = await fetch(`https://docs.google.com/spreadsheets/d/${spreadsheet_id}/gviz/tq?tqx=out:json&tq&gid=${gid}`);
|
|
32
|
+
const txt = await response.text();
|
|
33
|
+
|
|
34
|
+
const jsonString = txt.match(/(?<="table":).*(?=}\);)/g)[0];
|
|
35
|
+
const json = JSON.parse(jsonString);
|
|
36
|
+
const tableData = [];
|
|
37
|
+
const labelRow = [];
|
|
38
|
+
json.cols.forEach(colonne => labelRow.push(colonne.label));
|
|
39
|
+
const keywordsIndex = [];
|
|
40
|
+
keywords.forEach(key => keywordsIndex.push(labelRow.indexOf(key)));
|
|
41
|
+
const rawTable = [];
|
|
42
|
+
json.rows.forEach(r => {
|
|
43
|
+
const row = []
|
|
44
|
+
r.c.forEach(cel => {
|
|
45
|
+
let value = '';
|
|
46
|
+
try{value = cel.f ? cel.f : cel.v}
|
|
47
|
+
catch(e){value = ''}
|
|
48
|
+
row.push(value)
|
|
49
|
+
})
|
|
50
|
+
rawTable.push(row)
|
|
51
|
+
})
|
|
52
|
+
rawTable.forEach(row => {
|
|
53
|
+
const mappedData = {};
|
|
54
|
+
keywordsIndex.forEach(index => {
|
|
55
|
+
mappedData[labelRow[index]] = row[index];
|
|
56
|
+
|
|
57
|
+
});
|
|
58
|
+
tableData.push(mappedData);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
return tableData
|
|
53
63
|
}
|
package/src/app/ModelsTable.vue
CHANGED
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
|
|
69
69
|
<script>
|
|
70
70
|
/* eslint-disable no-alert, no-console */
|
|
71
|
-
import
|
|
71
|
+
import getTableData from "./ModelsInformation.js";
|
|
72
|
+
|
|
72
73
|
import {
|
|
73
74
|
ElButton as Button,
|
|
74
75
|
ElInput as Input,
|
|
@@ -84,15 +85,20 @@ export default {
|
|
|
84
85
|
Table,
|
|
85
86
|
TableColumn
|
|
86
87
|
],
|
|
87
|
-
|
|
88
|
+
async setup() {
|
|
89
|
+
const keywords = ["Organ", "Species", "Note", "Location",
|
|
90
|
+
"Last modified","Blackfynn dataset", "Published", "Discover"];
|
|
91
|
+
const spreadsheet_id = import.meta.env.VITE_GOOGLE_SPREADSHEET_ID;
|
|
92
|
+
const service_email = import.meta.env.VITE_GOOGLE_SERVICE_SCAFFOLDVUER_EMAIL;
|
|
93
|
+
const service_key = import.meta.env.VITE_GOOGLE_PRIVATE_SCAFFOLDVUER_KEY;
|
|
94
|
+
const tableData = await getTableData(keywords, spreadsheet_id, service_email, service_key);
|
|
95
|
+
return { tableData };
|
|
96
|
+
},
|
|
88
97
|
data() {
|
|
89
98
|
return {
|
|
90
99
|
search: '',
|
|
91
100
|
}
|
|
92
101
|
},
|
|
93
|
-
created: function() {
|
|
94
|
-
this.getModelsInformation();
|
|
95
|
-
},
|
|
96
102
|
methods: {
|
|
97
103
|
handleView: function(row) {
|
|
98
104
|
this.$emit("viewModelClicked", row.Location);
|
|
@@ -106,9 +112,3 @@ export default {
|
|
|
106
112
|
}
|
|
107
113
|
};
|
|
108
114
|
</script>
|
|
109
|
-
|
|
110
|
-
<style scoped lang="scss">
|
|
111
|
-
@use "element-plus/theme-chalk/src/input";
|
|
112
|
-
@use "element-plus/theme-chalk/src/table";
|
|
113
|
-
@use "element-plus/theme-chalk/src/table-column";
|
|
114
|
-
</style>
|
package/src/app/TextureDemos.js
CHANGED
|
@@ -44,7 +44,7 @@ export const testVolume = async (scaffoldVuer, texture_prefix) => {
|
|
|
44
44
|
const material = texture.getMaterial(options);
|
|
45
45
|
zincObject.createMesh(cube, material, meshOptions);
|
|
46
46
|
scaffoldVuer.addZincObject(zincObject);
|
|
47
|
-
zincObject.
|
|
47
|
+
zincObject.getMorph().matrix.set(
|
|
48
48
|
-100,
|
|
49
49
|
0,
|
|
50
50
|
0,
|
|
@@ -62,10 +62,20 @@ export const testVolume = async (scaffoldVuer, texture_prefix) => {
|
|
|
62
62
|
0,
|
|
63
63
|
1
|
|
64
64
|
);
|
|
65
|
-
//console.log(zincObject.morph.matrix)
|
|
66
65
|
window.texture = zincObject;
|
|
67
66
|
};
|
|
68
67
|
|
|
68
|
+
const addCylinder = (scaffoldVuer) => {
|
|
69
|
+
const THREE = scaffoldVuer.$module.Zinc.THREE;
|
|
70
|
+
const cylinderGeometry = new THREE.CylinderGeometry(50, 50, 200,80);
|
|
71
|
+
const material = new THREE.MeshPhongMaterial( {color: 0xffff00, side : THREE.DoubleSide} );
|
|
72
|
+
const cylinderMesh = new THREE.Mesh( cylinderGeometry, material );
|
|
73
|
+
const zincGeometry = new scaffoldVuer.$module.Zinc.Geometry();
|
|
74
|
+
zincGeometry.setMesh(cylinderMesh, false, false);
|
|
75
|
+
zincGeometry.setName("Cylinder");
|
|
76
|
+
scaffoldVuer.addZincObject(zincGeometry);
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
export const testSlides = async (scaffoldVuer, texture_prefix) => {
|
|
70
80
|
const scaffoldModule = scaffoldVuer.$module;
|
|
71
81
|
const texture = await getTexture(scaffoldModule, texture_prefix);
|
|
@@ -104,11 +114,118 @@ export const testSlides = async (scaffoldVuer, texture_prefix) => {
|
|
|
104
114
|
//textureSlides.morph.matrix.set(-100, 0, 0, 0, 0, -100, 0, 0, 0, 0, -100, 0, -60, -100, 30, 1);
|
|
105
115
|
//textureSlides.morph.matrix.set( -100, 0, 0, -60, 0, -100, 0, -100, 0, 0, -100, 30, 0, 0, 0, 1 );
|
|
106
116
|
|
|
107
|
-
const n = textureSlides.
|
|
117
|
+
const n = textureSlides.getMorph().matrix.clone();
|
|
108
118
|
n.set(-100, 0, 0, -10, 0, -200, 0, 0, 0, 0, -100, 0, 0, 0, 10, 1);
|
|
109
|
-
textureSlides.
|
|
119
|
+
textureSlides.getMorph().applyMatrix4(n);
|
|
110
120
|
scaffoldVuer.addZincObject(textureSlides);
|
|
111
|
-
|
|
112
|
-
window.texture = textureSlides;
|
|
121
|
+
scaffoldVuer.fitWindow();
|
|
122
|
+
//window.texture = textureSlides;
|
|
123
|
+
//addCylinder(scaffoldVuer);
|
|
113
124
|
};
|
|
114
125
|
|
|
126
|
+
const padNumber = (number) => {
|
|
127
|
+
let string = number.toString();
|
|
128
|
+
while(string.length < 4) {
|
|
129
|
+
string = "0" + string;
|
|
130
|
+
}
|
|
131
|
+
return string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const getArmTexture = async (scaffoldModule) => {
|
|
135
|
+
const imgArray = [];
|
|
136
|
+
const prefix = "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/texture/arm1/jpg";
|
|
137
|
+
const texture = new scaffoldModule.Zinc.TextureArray();
|
|
138
|
+
for (let i = 984; i <= 2184;) {
|
|
139
|
+
imgArray.push(`${prefix}/${padNumber(i)}.jpg`);
|
|
140
|
+
i = i + 10 ;
|
|
141
|
+
}
|
|
142
|
+
await texture.loadFromImages(imgArray);
|
|
143
|
+
return texture;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
{
|
|
149
|
+
"id": "mesh-location-orientation",
|
|
150
|
+
"locations": [
|
|
151
|
+
{
|
|
152
|
+
"identifier": 1,
|
|
153
|
+
"label": "dave",
|
|
154
|
+
"orientation": "[10.0, 0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 10.0]",
|
|
155
|
+
"position": "[62.97939922758831, 48.5944672602095, 1.2382504590408302e-14]",
|
|
156
|
+
"scale": "[1, 2, 3]"
|
|
157
|
+
"reference_point": "corner"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"version": "0.1.0"
|
|
161
|
+
}
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
//https://threejs.org/docs/#manual/en/introduction/Matrix-transformations
|
|
165
|
+
const applyTransformation = (scaffoldVuer, mesh, rotation, position, scale, reference) => {
|
|
166
|
+
//if (reference === "centre") {
|
|
167
|
+
// mesh.geometry.translate(-0.5, -0.5, -0.5);
|
|
168
|
+
//}
|
|
169
|
+
const THREE = scaffoldVuer.$module.Zinc.THREE;
|
|
170
|
+
const matrix = new THREE.Matrix4();
|
|
171
|
+
matrix.set(
|
|
172
|
+
rotation[0],
|
|
173
|
+
rotation[1],
|
|
174
|
+
rotation[2],
|
|
175
|
+
0,
|
|
176
|
+
rotation[3],
|
|
177
|
+
rotation[4],
|
|
178
|
+
rotation[5],
|
|
179
|
+
0,
|
|
180
|
+
rotation[6],
|
|
181
|
+
rotation[7],
|
|
182
|
+
rotation[8],
|
|
183
|
+
0,
|
|
184
|
+
0,
|
|
185
|
+
0,
|
|
186
|
+
0,
|
|
187
|
+
0
|
|
188
|
+
);
|
|
189
|
+
const quaternion = new THREE.Quaternion().setFromRotationMatrix(matrix);
|
|
190
|
+
mesh.position.set(...position);
|
|
191
|
+
mesh.quaternion.copy( quaternion );
|
|
192
|
+
mesh.scale.set(...scale);
|
|
193
|
+
mesh.updateMatrix();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
export const testArmSlides = async (scaffoldVuer) => {
|
|
199
|
+
const scaffoldModule = scaffoldVuer.$module;
|
|
200
|
+
const texture = await getArmTexture(scaffoldModule);
|
|
201
|
+
const textureSlides = new scaffoldModule.Zinc.TextureSlides(texture);
|
|
202
|
+
textureSlides.setName("Arm texture");
|
|
203
|
+
textureSlides.createSlides([
|
|
204
|
+
{
|
|
205
|
+
direction: "x",
|
|
206
|
+
value: 0.5,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
direction: "y",
|
|
210
|
+
value: 0.5,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
direction: "z",
|
|
214
|
+
value: 0.5,
|
|
215
|
+
},
|
|
216
|
+
]);
|
|
217
|
+
|
|
218
|
+
const rotation = [
|
|
219
|
+
0, 0, 1,
|
|
220
|
+
0, 1, 0,
|
|
221
|
+
-1, 0, 0
|
|
222
|
+
];
|
|
223
|
+
const position = [0, -1.0, 0.95];
|
|
224
|
+
const scale = [1.6, 1.6, 1.2];
|
|
225
|
+
const reference = "corner";
|
|
226
|
+
applyTransformation(scaffoldVuer, textureSlides.morph, rotation, position, scale, reference);
|
|
227
|
+
scaffoldVuer.addZincObject(textureSlides);
|
|
228
|
+
scaffoldVuer.fitWindow();
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
|
|
@@ -96,14 +96,14 @@ export default {
|
|
|
96
96
|
|
|
97
97
|
.my-slider {
|
|
98
98
|
position: absolute;
|
|
99
|
-
width:
|
|
99
|
+
width: 135px;
|
|
100
100
|
top: -12px;
|
|
101
101
|
left: 50px;
|
|
102
102
|
pointer-events: auto;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.opacity-container {
|
|
106
|
-
width:
|
|
106
|
+
width: 250px;
|
|
107
107
|
height: 93px;
|
|
108
108
|
border-radius: 4px;
|
|
109
109
|
border: solid 1px #d8dce6;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
ref="opacityControls" />
|
|
12
12
|
<texture-slides-controls
|
|
13
13
|
v-show="isTextureSlides"
|
|
14
|
-
class="controls"
|
|
14
|
+
class="texture-controls"
|
|
15
15
|
ref="tSlidesControls" />
|
|
16
16
|
</div>
|
|
17
17
|
<div
|
|
@@ -66,8 +66,11 @@ export default {
|
|
|
66
66
|
} else {
|
|
67
67
|
this.isTextureSlides = false;
|
|
68
68
|
}
|
|
69
|
-
if (object && object.
|
|
70
|
-
|
|
69
|
+
if (object && object.getMorph()) {
|
|
70
|
+
this.material = ref(object.getMorph().material);
|
|
71
|
+
} else {
|
|
72
|
+
this.material = undefined;
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
};
|
|
@@ -88,7 +91,7 @@ export default {
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
&.close {
|
|
91
|
-
right: -
|
|
94
|
+
right: -250px;
|
|
92
95
|
.my-drawer {
|
|
93
96
|
pointer-events: none;
|
|
94
97
|
opacity: 0;
|
|
@@ -102,7 +105,7 @@ export default {
|
|
|
102
105
|
text-align: left;
|
|
103
106
|
border: 1px solid rgb(220, 223, 230);
|
|
104
107
|
background: #ffffff;
|
|
105
|
-
width:
|
|
108
|
+
width:250px;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
.drawer-button {
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
import { ElPopover as Popover } from "element-plus";
|
|
31
31
|
import { Tooltip } from "@abi-software/flatmapvuer";
|
|
32
32
|
import "@abi-software/flatmapvuer/dist/style.css";
|
|
33
|
+
import { mapState } from 'pinia';
|
|
34
|
+
import { useMainStore } from "@/store/index";
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* A component to control the opacity of the target object.
|
|
@@ -67,6 +69,11 @@ export default {
|
|
|
67
69
|
},
|
|
68
70
|
},
|
|
69
71
|
inject: ['scaffoldUrl'],
|
|
72
|
+
provide() {
|
|
73
|
+
return {
|
|
74
|
+
userApiKey: this.userToken,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
70
77
|
data: function () {
|
|
71
78
|
return {
|
|
72
79
|
display: false,
|
|
@@ -74,6 +81,7 @@ export default {
|
|
|
74
81
|
};
|
|
75
82
|
},
|
|
76
83
|
computed: {
|
|
84
|
+
...mapState(useMainStore, ['userToken']),
|
|
77
85
|
position: function () {
|
|
78
86
|
let yOffset = 40;
|
|
79
87
|
if (this.region) {
|
|
@@ -92,6 +100,7 @@ export default {
|
|
|
92
100
|
this.annotationEntry = {
|
|
93
101
|
"featureId": encodeURIComponent(region + this.label),
|
|
94
102
|
"resourceId": encodeURIComponent(this.scaffoldUrl),
|
|
103
|
+
"resource": encodeURIComponent(this.scaffoldUrl),
|
|
95
104
|
};
|
|
96
105
|
}
|
|
97
106
|
}
|