@geode/opengeodeweb-front 0.0.21 → 0.0.22
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/components/Launcher.vue
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script setup>
|
|
19
19
|
import { VueRecaptcha } from "vue-recaptcha"
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const websocket_store = use_websocket_store()
|
|
22
22
|
const cloud_store = use_cloud_store()
|
|
23
23
|
const { is_cloud_running, is_captcha_validated, is_connexion_launched } = storeToRefs(cloud_store)
|
|
24
24
|
|
|
@@ -29,9 +29,9 @@ const props = defineProps({
|
|
|
29
29
|
const { site_key } = toRefs(props)
|
|
30
30
|
|
|
31
31
|
watch(is_captcha_validated, async (value) => {
|
|
32
|
-
if (value === true) {
|
|
32
|
+
if (value === true && process.client) {
|
|
33
33
|
await cloud_store.create_connexion()
|
|
34
|
-
|
|
34
|
+
await websocket_store.ws_connect()
|
|
35
35
|
}
|
|
36
36
|
})
|
|
37
37
|
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import vtkRemoteView from '@kitware/vtk.js/Rendering/Misc/RemoteView';
|
|
9
|
-
import {
|
|
9
|
+
import { useElementSize } from '@vueuse/core'
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const { picking_mode } = storeToRefs(
|
|
11
|
+
const viewer_store = use_viewer_store()
|
|
12
|
+
const { picking_mode } = storeToRefs(viewer_store)
|
|
13
13
|
|
|
14
14
|
function get_x_y (event) {
|
|
15
15
|
if (picking_mode.value === true) {
|
|
16
16
|
const { offsetX, offsetY } = event
|
|
17
|
-
|
|
17
|
+
viewer_store.set_picked_point(offsetX, offsetY)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -27,7 +27,7 @@ const viewer = ref(null)
|
|
|
27
27
|
const { width, height } = useElementSize(viewer)
|
|
28
28
|
|
|
29
29
|
function resize () {
|
|
30
|
-
view.getCanvasView().setSize(
|
|
30
|
+
view.getCanvasView().setSize(1, 1)
|
|
31
31
|
view.resize();
|
|
32
32
|
}
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -5,29 +5,40 @@
|
|
|
5
5
|
"release:major": "npm version $(semver $npm_package_version -i major) && npm publish --tag latest",
|
|
6
6
|
"release:minor": "npm version $(semver $npm_package_version -i minor) && npm publish --tag latest",
|
|
7
7
|
"release:patch": "npm version $(semver $npm_package_version -i patch) && npm publish --tag latest",
|
|
8
|
-
"release:beta": "npm version $(semver $npm_package_version -i prerelease --preid $(npm whoami) ) && npm publish --tag rc"
|
|
8
|
+
"release:beta": "npm version $(semver $npm_package_version -i prerelease --preid $(npm whoami) ) && npm publish --tag rc",
|
|
9
|
+
"lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore ."
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"nuxt": "^3.6.5"
|
|
12
|
+
"nuxt": "^3.6.5",
|
|
13
|
+
"eslint": "^8.47.0",
|
|
14
|
+
"eslint-plugin-import": "^2.28.1",
|
|
15
|
+
"eslint-plugin-nuxt": "^4.0.0",
|
|
16
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
17
|
+
"eslint-plugin-prettier-vue": "^4.2.0",
|
|
18
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
19
|
+
"eslint-plugin-vuetify": "^2.0.5"
|
|
12
20
|
},
|
|
13
21
|
"overrides": {
|
|
14
22
|
"vue": "latest"
|
|
15
23
|
},
|
|
16
24
|
"description": "OpenSource Vue/Vuetify framework for web applications",
|
|
17
25
|
"type": "module",
|
|
18
|
-
"version": "0.0.
|
|
26
|
+
"version": "0.0.22",
|
|
19
27
|
"main": "./nuxt.config.js",
|
|
20
28
|
"dependencies": {
|
|
29
|
+
"@kitware/vtk.js": "^28.8.0",
|
|
21
30
|
"@mdi/font": "^7.2.96",
|
|
22
31
|
"@pinia/nuxt": "^0.4.11",
|
|
23
|
-
"@types/node": "^20.5.
|
|
32
|
+
"@types/node": "^20.5.3",
|
|
24
33
|
"@vueuse/components": "^10.3.0",
|
|
25
34
|
"@vueuse/core": "^10.3.0",
|
|
35
|
+
"lodash": "^4.17.21",
|
|
26
36
|
"pinia": "^2.1.6",
|
|
27
|
-
"sass": "^1.
|
|
37
|
+
"sass": "^1.66.1",
|
|
28
38
|
"semver": "^7.5.4",
|
|
29
39
|
"vue-recaptcha": "^2.0.3",
|
|
30
|
-
"vuetify": "^3.3.
|
|
40
|
+
"vuetify": "^3.3.14",
|
|
41
|
+
"wslink": "^1.11.0"
|
|
31
42
|
},
|
|
32
43
|
"repository": {
|
|
33
44
|
"type": "git",
|
package/stores/cloud.js
CHANGED
|
@@ -14,9 +14,9 @@ export const use_cloud_store = defineStore('cloud', {
|
|
|
14
14
|
const public_runtime_config = useRuntimeConfig().public
|
|
15
15
|
var geode_url = `${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}`
|
|
16
16
|
if (process.env.NODE_ENV == 'production') {
|
|
17
|
-
geode_url = geode_url + `/${state.ID}`
|
|
18
|
-
// /!\ ADD /geode LATER /!\
|
|
17
|
+
geode_url = geode_url + `/${state.ID}/geode`
|
|
19
18
|
}
|
|
19
|
+
console.log("geode_url",geode_url)
|
|
20
20
|
return geode_url
|
|
21
21
|
},
|
|
22
22
|
viewer_url: (state) => {
|
|
@@ -25,6 +25,7 @@ export const use_cloud_store = defineStore('cloud', {
|
|
|
25
25
|
if (process.env.NODE_ENV == 'production') {
|
|
26
26
|
viewer_url = viewer_url + `/${state.ID}/viewer`
|
|
27
27
|
}
|
|
28
|
+
viewer_url = viewer_url + '/ws'
|
|
28
29
|
return viewer_url
|
|
29
30
|
},
|
|
30
31
|
},
|
|
@@ -36,8 +37,7 @@ export const use_cloud_store = defineStore('cloud', {
|
|
|
36
37
|
if (ID === null || typeof ID === 'undefined') {
|
|
37
38
|
return this.create_backend()
|
|
38
39
|
} else {
|
|
39
|
-
const
|
|
40
|
-
const { data, error } = await useFetch(`${config.public.API_URL}/${ID}/ping`, { method: 'POST' })
|
|
40
|
+
const { data, error } = await useFetch(`${this.geode_url}/ping`, { method: 'POST' })
|
|
41
41
|
console.log("error", error)
|
|
42
42
|
if (data.value !== null) {
|
|
43
43
|
this.ID = ID
|
|
@@ -51,7 +51,8 @@ export const use_cloud_store = defineStore('cloud', {
|
|
|
51
51
|
async create_backend () {
|
|
52
52
|
const errors_store = use_errors_store()
|
|
53
53
|
const config = useRuntimeConfig()
|
|
54
|
-
const
|
|
54
|
+
const public_runtime_config = config.public
|
|
55
|
+
const { data, error } = await useFetch(`${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}/createbackend`, { method: 'POST' })
|
|
55
56
|
if (data.value !== null) {
|
|
56
57
|
this.ID = data.value.ID
|
|
57
58
|
localStorage.setItem('ID', data.value.ID)
|
|
@@ -68,8 +69,7 @@ export const use_cloud_store = defineStore('cloud', {
|
|
|
68
69
|
},
|
|
69
70
|
async do_ping () {
|
|
70
71
|
const errors_store = use_errors_store()
|
|
71
|
-
const
|
|
72
|
-
const { data, error } = await useFetch(`${config.public.API_URL}/${this.ID}/ping`, { method: 'POST' })
|
|
72
|
+
const { data, error } = await useFetch(`${this.geode_url}/ping`, { method: 'POST' })
|
|
73
73
|
if (data.value !== null) {
|
|
74
74
|
this.is_cloud_running = true
|
|
75
75
|
} else {
|
package/stores/viewer.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
|
|
3
|
+
export const use_viewer_store = defineStore('viewer', {
|
|
4
|
+
state: () => ({
|
|
5
|
+
picking_mode: false,
|
|
6
|
+
picked_point: { x: null, y: null }
|
|
7
|
+
}),
|
|
8
|
+
actions: {
|
|
9
|
+
toggle_picking_mode (value) {
|
|
10
|
+
this.picking_mode = value
|
|
11
|
+
},
|
|
12
|
+
async set_picked_point (x, y) {
|
|
13
|
+
const response = await get_point_position({ x, y })
|
|
14
|
+
const { x: world_x, y: world_y } = response
|
|
15
|
+
this.picked_point.x = world_x
|
|
16
|
+
this.picked_point.y = world_y
|
|
17
|
+
this.picking_mode = false
|
|
18
|
+
},
|
|
19
|
+
async create_object_pipeline (params) {
|
|
20
|
+
const websocket_store = use_websocket_store()
|
|
21
|
+
if (websocket_store.client) {
|
|
22
|
+
use_websocket_store().client
|
|
23
|
+
.getRemote()
|
|
24
|
+
.vtk.create_object_pipeline(params)
|
|
25
|
+
.catch(console.error);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
async toggle_object_visibility (params) {
|
|
29
|
+
const websocket_store = use_websocket_store()
|
|
30
|
+
if (websocket_store.client) {
|
|
31
|
+
use_websocket_store().client
|
|
32
|
+
.getRemote()
|
|
33
|
+
.vtk.toggle_object_visibility(params)
|
|
34
|
+
.catch(console.error);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
async apply_textures (params) {
|
|
38
|
+
const websocket_store = use_websocket_store()
|
|
39
|
+
if (websocket_store.client) {
|
|
40
|
+
websocket_store.$patch({ busy: true })
|
|
41
|
+
use_websocket_store().client
|
|
42
|
+
.getRemote()
|
|
43
|
+
.vtk.apply_textures(params)
|
|
44
|
+
.catch(console.error);
|
|
45
|
+
|
|
46
|
+
websocket_store.$patch({ busy: false })
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
async get_point_position (params) {
|
|
50
|
+
const websocket_store = use_websocket_store()
|
|
51
|
+
if (websocket_store.client) {
|
|
52
|
+
websocket_store.$patch({ busy: true })
|
|
53
|
+
const response = await use_websocket_store().client
|
|
54
|
+
.getRemote()
|
|
55
|
+
.vtk.get_point_position(params)
|
|
56
|
+
.catch(console.error);
|
|
57
|
+
console.log('response', response)
|
|
58
|
+
websocket_store.$patch({ busy: false })
|
|
59
|
+
return response
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
async update_data (params) {
|
|
63
|
+
const websocket_store = use_websocket_store()
|
|
64
|
+
if (websocket_store.client) {
|
|
65
|
+
websocket_store.$patch({ busy: true })
|
|
66
|
+
const response = await use_websocket_store().client
|
|
67
|
+
.getRemote()
|
|
68
|
+
.vtk.update_data(params)
|
|
69
|
+
.catch(console.error);
|
|
70
|
+
console.log('response', response)
|
|
71
|
+
websocket_store.$patch({ busy: false })
|
|
72
|
+
return response
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
async reset () {
|
|
76
|
+
const websocket_store = use_websocket_store()
|
|
77
|
+
if (websocket_store.client) {
|
|
78
|
+
websocket_store.$patch({ busy: true })
|
|
79
|
+
const response = await use_websocket_store().client
|
|
80
|
+
.getRemote()
|
|
81
|
+
.vtk.reset()
|
|
82
|
+
.catch(console.error);
|
|
83
|
+
console.log('response', response)
|
|
84
|
+
websocket_store.$patch({ busy: false })
|
|
85
|
+
return response
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import _ from 'lodash'
|
|
3
|
+
|
|
4
|
+
import vtkWSLinkClient from '@kitware/vtk.js/IO/Core/WSLinkClient'
|
|
5
|
+
import SmartConnect from 'wslink/src/SmartConnect'
|
|
6
|
+
|
|
7
|
+
import '@kitware/vtk.js/Rendering/OpenGL/Profiles/Geometry'
|
|
8
|
+
import { connectImageStream } from '@kitware/vtk.js/Rendering/Misc/RemoteView'
|
|
9
|
+
import protocols from '@/protocols'
|
|
10
|
+
|
|
11
|
+
// Bind vtkWSLinkClient to our SmartConnect
|
|
12
|
+
vtkWSLinkClient.setSmartConnectClass(SmartConnect);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export const use_websocket_store = defineStore('websocket', {
|
|
16
|
+
state: () => ({
|
|
17
|
+
client: {},
|
|
18
|
+
config: null,
|
|
19
|
+
busy: false,
|
|
20
|
+
is_client_created: false
|
|
21
|
+
}),
|
|
22
|
+
actions: {
|
|
23
|
+
ws_connect () {
|
|
24
|
+
const config = { application: 'cone' };
|
|
25
|
+
const cloud_store = use_cloud_store()
|
|
26
|
+
config.sessionURL = cloud_store.viewer_url
|
|
27
|
+
|
|
28
|
+
const { client } = this
|
|
29
|
+
if (this.is_client_created && client.isConnected()) {
|
|
30
|
+
client.disconnect(-1);
|
|
31
|
+
this.is_client_created = false;
|
|
32
|
+
}
|
|
33
|
+
let clientToConnect = client;
|
|
34
|
+
if (_.isEmpty(clientToConnect)) {
|
|
35
|
+
clientToConnect = vtkWSLinkClient.newInstance({ protocols });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Connect to busy store
|
|
39
|
+
clientToConnect.onBusyChange((count) => {
|
|
40
|
+
this.buzy = count
|
|
41
|
+
});
|
|
42
|
+
clientToConnect.beginBusy();
|
|
43
|
+
|
|
44
|
+
// Error
|
|
45
|
+
clientToConnect.onConnectionError((httpReq) => {
|
|
46
|
+
const message =
|
|
47
|
+
(httpReq && httpReq.response && httpReq.response.error) ||
|
|
48
|
+
`Connection error`;
|
|
49
|
+
console.error(message);
|
|
50
|
+
console.log(httpReq);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Close
|
|
54
|
+
clientToConnect.onConnectionClose((httpReq) => {
|
|
55
|
+
const message =
|
|
56
|
+
(httpReq && httpReq.response && httpReq.response.error) ||
|
|
57
|
+
`Connection close`;
|
|
58
|
+
console.error(message);
|
|
59
|
+
console.log(httpReq);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Connect
|
|
63
|
+
clientToConnect
|
|
64
|
+
.connect(config)
|
|
65
|
+
.then((validClient) => {
|
|
66
|
+
connectImageStream(validClient.getConnection().getSession());
|
|
67
|
+
this.client = validClient
|
|
68
|
+
clientToConnect.endBusy();
|
|
69
|
+
|
|
70
|
+
// Now that the client is ready let's setup the server for us
|
|
71
|
+
this.ws_initialize_server()
|
|
72
|
+
this.client.getRemote().vtk.reset().catch(console.error);
|
|
73
|
+
this.is_client_created = true;
|
|
74
|
+
})
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
console.error(error);
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
ws_initialize_server () {
|
|
80
|
+
|
|
81
|
+
if (!_.isEmpty(this.client)) {
|
|
82
|
+
this.client
|
|
83
|
+
.getRemote()
|
|
84
|
+
.vtk.create_visualization()
|
|
85
|
+
.catch(console.error);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
reset_camera () {
|
|
89
|
+
if (!_.isEmpty(this.client)) {
|
|
90
|
+
this.client.getRemote().vtk.reset_camera().catch(console.error);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
})
|