@abi-software/scaffoldvuer 0.1.3 → 0.1.5-1.beta.2

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/package.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.1.3",
3
+ "version": "0.1.51.beta.2",
4
+ "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ABI-Software/scaffoldvuer.git"
8
+ },
9
+ "scripts": {
10
+ "serve": "vue-cli-service serve --port 8081",
11
+ "lint": "vue-cli-service lint --ext .js,.vue src",
12
+ "build-bundle": "vue-cli-service build --target lib --name scaffoldvuer ./src/components/index.js",
13
+ "styleguide": "vue-cli-service styleguidist",
14
+ "styleguide:build": "vue-cli-service styleguidist:build"
15
+ },
4
16
  "main": "./dist/scaffoldvuer.common.js",
5
17
  "files": [
6
18
  "dist/*",
@@ -9,25 +21,36 @@
9
21
  "*.json",
10
22
  "*.js"
11
23
  ],
12
- "scripts": {
13
- "serve": "vue-cli-service serve --port 8081",
14
- "build-bundle": "vue-cli-service build --target lib --name scaffoldvuer ./src/components/index.js",
15
- "lint": "vue-cli-service lint"
16
- },
17
24
  "dependencies": {
25
+ "@abi-software/svg-sprite": "^0.1.13",
26
+ "axios": "^0.21.2",
18
27
  "core-js": "^3.3.2",
19
- "physiomeportal": "^0.4.9",
20
- "vue": "^2.6.10"
28
+ "current-script-polyfill": "^1.0.0",
29
+ "element-ui": "^2.13.0",
30
+ "google-spreadsheet": "^3.1.15",
31
+ "lodash": "^4.17.21",
32
+ "query-string": "^6.11.1",
33
+ "vue": "^2.6.10",
34
+ "vue-drag-resize": "^1.3.2",
35
+ "vue-router": "^3.5.1",
36
+ "zincjs": "^0.41.0-beta.0"
21
37
  },
22
38
  "devDependencies": {
23
39
  "@vue/cli-plugin-babel": "^4.0.0",
24
- "@vue/cli-plugin-eslint": "^4.0.0",
25
- "@vue/cli-service": "^4.0.0",
40
+ "@vue/cli-plugin-eslint": "^4.5.15",
41
+ "@vue/cli-service": "^4.5.13",
26
42
  "babel-eslint": "^10.0.3",
43
+ "babel-plugin-component": "^1.1.1",
44
+ "base64-inline-loader": "^1.1.1",
27
45
  "eslint": "^5.16.0",
28
46
  "eslint-plugin-vue": "^5.0.0",
47
+ "node-sass": "^4.14.1",
48
+ "raw-loader": "^0.5.1",
49
+ "sass-loader": "^8.0.2",
50
+ "vue-cli-plugin-styleguidist": "^4.32.2",
51
+ "vue-styleguidist": "^4.38.1",
29
52
  "vue-template-compiler": "^2.6.10",
30
- "raw-loader": "^0.5.1"
53
+ "webpack-node-externals": "^2.5.2"
31
54
  },
32
55
  "eslintConfig": {
33
56
  "root": true,
package/src/App.vue CHANGED
@@ -1,33 +1,434 @@
1
1
  <template>
2
2
  <div id="app">
3
- <ScaffoldVuer url="https://mapcore-bucket1.s3-us-west-2.amazonaws.com/ISAN/scaffold/use_case4/rat_heart_metadata.json" ref="scaffold"/>
3
+ <link
4
+ rel="stylesheet"
5
+ href="https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap"
6
+ >
7
+ <ScaffoldVuer
8
+ ref="scaffold"
9
+ class="vuer"
10
+ :display-u-i="displayUI"
11
+ :url="url"
12
+ :help-mode="helpMode"
13
+ :display-minimap="displayMinimap"
14
+ :display-markers="displayMarkers"
15
+ :minimap-settings="minimapSettings"
16
+ :show-colour-picker="showColourPicker"
17
+ :render="render"
18
+ :region="region"
19
+ :view-u-r-l="viewURL"
20
+ @scaffold-selected="onSelected"
21
+ @timeChanged="updateCurrentTime"
22
+ />
23
+ <el-popover
24
+ placement="bottom"
25
+ trigger="click"
26
+ width="500"
27
+ class="popover"
28
+ :append-to-body="false"
29
+ >
30
+ <div class="options-container">
31
+ <el-row :gutter="20">
32
+ <p>{{ selectedCoordinates }}</p>
33
+ </el-row>
34
+ <el-row
35
+ class="app-row"
36
+ :gutter="20"
37
+ >
38
+ <p v-if="currentTime!==0">
39
+ time emited is: {{ currentTime.toFixed(2) }}
40
+ </p>
41
+ </el-row>
42
+ <el-row :gutter="20">
43
+ <el-col
44
+ :span="6"
45
+ :offset="2"
46
+ >
47
+ <el-switch
48
+ v-model="displayMarkers"
49
+ active-text="Markers"
50
+ active-icon-class="el-icon-location"
51
+ active-color="#8300bf"
52
+ />
53
+ </el-col>
54
+ <el-col
55
+ :span="6"
56
+ :offset="2"
57
+ >
58
+ <el-switch
59
+ v-model="displayMinimap"
60
+ active-text="Minimap"
61
+ active-icon-class="el-icon-discover"
62
+ active-color="#8300bf"
63
+ />
64
+ </el-col>
65
+ <el-col
66
+ :span="6"
67
+ :offset="2"
68
+ >
69
+ <el-switch
70
+ v-model="tumbleOn"
71
+ active-text="Tumble"
72
+ active-color="#8300bf"
73
+ />
74
+ </el-col>
75
+ </el-row>
76
+ <el-row :gutter="20">
77
+ <el-button
78
+ size="mini"
79
+ @click="helpMode = !helpMode"
80
+ >
81
+ Help Mode
82
+ </el-button>
83
+ <el-button
84
+ size="mini"
85
+ @click="screenCapture()"
86
+ >
87
+ Capture
88
+ </el-button>
89
+ </el-row>
90
+ <el-row :gutter="20">
91
+ <el-button
92
+ size="mini"
93
+ @click="saveSettings()"
94
+ >
95
+ Save Settings
96
+ </el-button>
97
+ <el-button
98
+ size="mini"
99
+ @click="restoreSettings()"
100
+ >
101
+ Restore Settings
102
+ </el-button>
103
+ <el-button
104
+ size="mini"
105
+ @click="exportGLB()"
106
+ >
107
+ Export GLTF
108
+ </el-button>
109
+ </el-row>
110
+ <el-row :gutter="30">
111
+ <el-col
112
+ :span="7"
113
+ :offset="4"
114
+ >
115
+ <el-switch
116
+ v-model="render"
117
+ active-text="Rendering"
118
+ active-color="#8300bf"
119
+ />
120
+ </el-col>
121
+ <el-col
122
+ :span="8"
123
+ :offset="1"
124
+ >
125
+ <el-switch
126
+ v-model="renderInfoOn"
127
+ active-text="Renderer Info"
128
+ active-color="#8300bf"
129
+ />
130
+ </el-col>
131
+ </el-row>
132
+ <template v-if="renderInfoOn && rendererInfo">
133
+ <el-row>
134
+ <el-col
135
+ v-for="(value, name) in rendererInfo.memory"
136
+ :key="name"
137
+ :offset="4"
138
+ :span="6"
139
+ >
140
+ {{ name }} : {{ value }}
141
+ </el-col>
142
+ </el-row>
143
+ <el-row>
144
+ <el-col
145
+ v-for="(value, name) in rendererInfo.render"
146
+ :key="name"
147
+ :offset="1"
148
+ :span="6"
149
+ >
150
+ {{ name }} : {{ value }}
151
+ </el-col>
152
+ </el-row>
153
+ </template>
154
+ <el-input
155
+ v-model="input"
156
+ type="textarea"
157
+ autosize
158
+ placeholder="Please input"
159
+ style="padding-left:5%;width:90%;"
160
+ />
161
+ </div>
162
+ <el-button
163
+ slot="reference"
164
+ icon="el-icon-setting"
165
+ >
166
+ Options
167
+ </el-button>
168
+ </el-popover>
169
+ <el-popover
170
+ placement="bottom"
171
+ trigger="click"
172
+ width="800"
173
+ class="models-popover"
174
+ popper-class="table-popover"
175
+ :append-to-body="false"
176
+ >
177
+ <ModelsTable @viewModelClicked="viewModelClicked" />
178
+ <el-button
179
+ slot="reference"
180
+ icon="el-icon-folder-opened"
181
+ >
182
+ Models
183
+ </el-button>
184
+ </el-popover>
4
185
  </div>
5
186
  </template>
6
187
 
7
188
  <script>
8
- import ScaffoldVuer from './components/ScaffoldVuer.vue'
189
+ /* eslint-disable no-alert, no-console */
190
+ import { ScaffoldVuer } from "./components/index.js";
191
+ import ModelsTable from "./components/ModelsTable.vue";
192
+ import Vue from "vue";
193
+ import { Button, Col, Icon, Input, Popover, Row, Switch } from "element-ui";
194
+ import lang from "element-ui/lib/locale/lang/en";
195
+ import locale from "element-ui/lib/locale";
9
196
 
197
+ locale.use(lang);
198
+ Vue.use(Button);
199
+ Vue.use(Col);
200
+ Vue.use(Icon);
201
+ Vue.use(Input);
202
+ Vue.use(Popover);
203
+ Vue.use(Row);
204
+ Vue.use(Switch);
205
+
206
+ /*
207
+ const alignToObject = function(cameracontrol, scene) {
208
+ var object = scene.findGeometriesWithGroupName("Endocardium of left atrium")[0];
209
+ const boundingBox = object.getBoundingBox();
210
+ if (boundingBox) {
211
+ const radius = boundingBox.min.distanceTo(boundingBox.max)/2.0;
212
+ const centreX = (boundingBox.min.x + boundingBox.max.x) / 2.0;
213
+ const centreY = (boundingBox.min.y + boundingBox.max.y) / 2.0;
214
+ const centreZ = (boundingBox.min.z + boundingBox.max.z) / 2.0;
215
+ const clip_factor = 8.0;
216
+ const endingViewport = cameracontrol.getViewportFromCentreAndRadius(centreX, centreY, centreZ, radius, 40, radius * clip_factor );
217
+ const startingViewport = cameracontrol.getCurrentViewport();
218
+ cameracontrol.cameraTransition(startingViewport, endingViewport, 1500);
219
+ cameracontrol.enableCameraTransition();
220
+ }
221
+ setTimeout(function(){ tumble(cameracontrol) }, 2000);
222
+ }
223
+
224
+ const tumble = function(cameracontrol) {
225
+ cameracontrol.enableAutoTumble();
226
+ cameracontrol.autoTumble([1.0, 0.0], Math.PI / 2, true);
227
+ }
228
+ */
10
229
  export default {
11
- name: 'app',
230
+ name: "App",
12
231
  components: {
13
- ScaffoldVuer
232
+ ScaffoldVuer,
233
+ ModelsTable
234
+ },
235
+ data: function() {
236
+ return {
237
+ url: undefined,
238
+ input: undefined,
239
+ displayUI: true,
240
+ selectedCoordinates: undefined,
241
+ helpMode: false,
242
+ displayMarkers: true,
243
+ currentTime: 0,
244
+ displayMinimap: true,
245
+ tumbleOn: false,
246
+ showColourPicker: true,
247
+ minimapSettings: {
248
+ x_offset: 16,
249
+ y_offset: 50,
250
+ width: 128,
251
+ height: 128,
252
+ align: "top-right"
253
+ },
254
+ render: true,
255
+ region: "",
256
+ viewURL: "",
257
+ renderInfoOn: false,
258
+ rendererInfo: undefined
259
+ };
260
+ },
261
+ watch: {
262
+ input: function() {
263
+ this.parseInput();
264
+ },
265
+ tumbleOn: function(val) {
266
+ this.autoTumble(val);
267
+ },
268
+ "$route.query": {
269
+ handler: "parseQuery",
270
+ deep: true,
271
+ immediate: true
272
+ }
273
+ },
274
+
275
+ mounted: function() {
276
+ this._sceneSettings = [];
277
+ this.selectedCoordinates = this.$refs.scaffold.getDynamicSelectedCoordinates();
278
+ this.rendererInfo = this.$refs.scaffold.getRendererInfo();
279
+ },
280
+ methods: {
281
+ exportGLTF: function() {
282
+ this.$refs.scaffold.exportGLTF(false)
283
+ .then(data =>{
284
+ let dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(data));
285
+ let hrefElement = document.createElement("a");
286
+ document.body.append(hrefElement);
287
+ hrefElement.download = `export.gltf`;
288
+ hrefElement.href = dataStr;
289
+ hrefElement.click();
290
+ hrefElement.remove();
291
+ })
292
+ },
293
+ exportGLB: function() {
294
+ this.$refs.scaffold.exportGLTF(true)
295
+ .then(data =>{
296
+ let blob = new Blob([data], {type: "octet/stream"});
297
+ let url = window.URL.createObjectURL(blob);
298
+ let hrefElement = document.createElement("a");
299
+ document.body.append(hrefElement);
300
+ hrefElement.download = `export.glb`;
301
+ hrefElement.href = url;
302
+ hrefElement.click();
303
+ hrefElement.remove();
304
+ })
305
+ },
306
+ saveSettings: function() {
307
+ this._sceneSettings.push(this.$refs.scaffold.getState());
308
+ },
309
+ restoreSettings: function() {
310
+ if (this._sceneSettings.length > 0)
311
+ this.$refs.scaffold.setState(this._sceneSettings.pop());
312
+ },
313
+ viewModelClicked: function(location) {
314
+ this.input = location;
315
+ },
316
+ screenCapture: function() {
317
+ this.$refs.scaffold.captureScreenshot("capture.png");
318
+ },
319
+ autoTumble: function(flag) {
320
+ let cameracontrol = this.$refs.scaffold.$module.scene.getZincCameraControls();
321
+ if (flag) {
322
+ this.displayUI = false;
323
+ cameracontrol.enableAutoTumble();
324
+ cameracontrol.autoTumble([1.0, 0.0], Math.PI / 2, true);
325
+ } else {
326
+ this.displayUI = true;
327
+ cameracontrol.stopAutoTumble();
328
+ }
329
+ },
330
+ onSelected: function(data) {
331
+ if (data && data[0].data.group) {
332
+ delete this.$route.query["viewURL"];
333
+ this.$router.replace({
334
+ query: { ...this.$route.query, region: data[0].data.group }
335
+ });
336
+ }
337
+ },
338
+ parseInput: function() {
339
+ if (this.$route.query.url !== this.input)
340
+ this.$router.replace({
341
+ query: { ...this.$route.query, url: this.input }
342
+ });
343
+ },
344
+ updateCurrentTime: function(val) {
345
+ this.currentTime = val;
346
+ },
347
+ parseQuery: function(query) {
348
+ if (query.url) {
349
+ this.url = query.url;
350
+ } else {
351
+ this.url =
352
+ "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json";
353
+ }
354
+ this.input = this.url;
355
+ if (query.region) {
356
+ this.region = query.region;
357
+ } else {
358
+ this.region = "";
359
+ }
360
+ if (query.viewURL) {
361
+ this.viewURL = query.viewURL;
362
+ } else {
363
+ this.viewURL = "";
364
+ }
365
+ }
14
366
  }
15
- }
367
+ };
16
368
  </script>
17
369
 
18
- <style>
370
+ <style lang="scss">
371
+ @import "~element-ui/packages/theme-chalk/src/button";
372
+ @import "~element-ui/packages/theme-chalk/src/col";
373
+ @import "~element-ui/packages/theme-chalk/src/icon";
374
+ @import "~element-ui/packages/theme-chalk/src/input";
375
+ @import "~element-ui/packages/theme-chalk/src/switch";
376
+ @import "~element-ui/packages/theme-chalk/src/popover";
377
+ @import "~element-ui/packages/theme-chalk/src/row";
378
+
19
379
  #app {
20
- font-family: 'Avenir', Helvetica, Arial, sans-serif;
380
+ font-family: "Asap", sans-serif;
21
381
  -webkit-font-smoothing: antialiased;
22
382
  -moz-osx-font-smoothing: grayscale;
23
383
  text-align: center;
24
384
  color: #2c3e50;
25
- height:100%;
385
+ height: 100%;
26
386
  width: 100%;
27
- position:absolute;
387
+ position: absolute;
388
+ overflow: hidden;
28
389
  }
29
390
 
30
391
  body {
31
392
  margin: 0px;
32
393
  }
394
+
395
+ .options-container {
396
+ text-align: center;
397
+ .el-row {
398
+ margin-bottom: 8px;
399
+ &:last-child {
400
+ margin-bottom: 0;
401
+ }
402
+ }
403
+ }
404
+
405
+ .vuer {
406
+ position: absolute;
407
+ width: 100%;
408
+ height: 100%;
409
+ }
410
+
411
+ .popover {
412
+ top: 5px;
413
+ right: 10px;
414
+ position: absolute;
415
+ }
416
+
417
+ .app-row {
418
+ .el-row {
419
+ margin-bottom: 5px;
420
+ &:last-child {
421
+ margin-bottom: 0;
422
+ }
423
+ }
424
+ }
425
+
426
+ .models-popover {
427
+ top: 5px;
428
+ position: absolute;
429
+ }
430
+
431
+ .table-popover {
432
+ opacity: 0.9;
433
+ }
33
434
  </style>
@@ -0,0 +1,43 @@
1
+ // Primary colors
2
+ $purple: #8300BF;
3
+ $darkBlue: #24245B;
4
+ $grey: #303133;
5
+
6
+ // Secondary colors
7
+ $lightPurple: #BC00FC;
8
+ $blue: #0026FF;
9
+
10
+ // Status colors
11
+ $success: #5e9f69;
12
+ $warning: #FF8400;
13
+ $danger: #b51d09;
14
+
15
+ // Text colors
16
+ $neutralGrey: #616161;
17
+ $mediumGrey: #606266;
18
+ $lightGrey: #909399;
19
+
20
+ // Line colors
21
+ $lineColor1: #DCDFE6;
22
+ $lineColor2: #E4E7ED;
23
+
24
+ // Background colors
25
+ $background: #F5F7FA;
26
+ $cochlear: #FFFFFF;
27
+
28
+ //Search box colors
29
+ $darkGrey: #606266;
30
+
31
+ $app-primary-color: $purple;
32
+ $app-secondary-color: $darkBlue;
33
+ $text-color: $grey;
34
+ $input-text: $grey;
35
+
36
+ $system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
37
+ $font-family: 'Asap', sans-serif;
38
+
39
+ // Viewport Sizes
40
+ $viewport-sm: 20rem;
41
+ $viewport-md: 47rem;
42
+ $viewport-lg: 64rem;
43
+ $viewport-xlg: 120rem;
@@ -0,0 +1,7 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap');
2
+
3
+ @import '_variables';
4
+
5
+ /* icon font path, required */
6
+ $--color-primary: $app-primary-color !default;
7
+ $--font-path: '~element-ui/lib/theme-chalk/fonts';
@@ -0,0 +1,35 @@
1
+ const { GoogleSpreadsheet } = require('google-spreadsheet');
2
+
3
+ /* eslint-disable no-alert, no-console */
4
+ export default {
5
+ data: function() {
6
+ return {
7
+ tableData: [],
8
+ };
9
+ },
10
+ methods: {
11
+ createTable: async function(sheetRows, keywords) {
12
+ for (let i = 0; i < sheetRows.length; i++) {
13
+ let mappedData = {};
14
+ for (let j = 0; j < keywords.length; j++) {
15
+ let keyword = keywords[j];
16
+ mappedData[keyword] = sheetRows[i][keyword];
17
+ }
18
+ this.tableData.push(mappedData);
19
+ }
20
+ },
21
+ getModelsInformation: async function() {
22
+ const doc = new GoogleSpreadsheet(process.env.VUE_APP_GOOGLE_SPREADSHEET_ID);
23
+ await doc.useServiceAccountAuth({
24
+ client_email: process.env.VUE_APP_GOOGLE_SERVICE_SCAFFOLDVUER_EMAIL,
25
+ private_key: process.env.VUE_APP_GOOGLE_PRIVATE_SCAFFOLDVUER_KEY,
26
+ });
27
+ await doc.loadInfo(); // loads document properties and worksheets
28
+ const sheet = doc.sheetsByIndex[0];
29
+ const sheetRows = await sheet.getRows();
30
+ const keys = ["Organ", "Species", "Note", "Location",
31
+ "Last modified","Blackfynn dataset", "Published", "Discover"];
32
+ this.createTable(sheetRows, keys);
33
+ }
34
+ }
35
+ }