@geode/opengeodeweb-viewer 0.1.0-rc.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 - 2024 Geode-solutions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # OpenGeodeWeb-Viewer
2
+
3
+ OpenSource Python framework for remote visualisation
@@ -0,0 +1,81 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const glob = require("glob");
4
+ const process = require("process");
5
+ const { log } = require("console");
6
+
7
+ const findDirectoryPath = (targetDirectoryName) => {
8
+ const pathToCheck = path.join(process.cwd(), targetDirectoryName);
9
+ const folders = fs
10
+ .readdirSync(pathToCheck, { withFileTypes: true })
11
+ .filter(
12
+ (folder) => folder.isDirectory() && !folder.name.endsWith(".egg-info")
13
+ )
14
+ .map((folder) => ({
15
+ name: folder.name,
16
+ path: path.join(pathToCheck, folder.name),
17
+ }));
18
+ const rpcDirectory = path.join(folders[0].path, "rpc");
19
+ return [rpcDirectory, folders[0].name];
20
+ };
21
+
22
+ const [directoryPath, project_name] = findDirectoryPath("src/");
23
+
24
+ const outputFile = path.join(process.cwd(), "schemas.json");
25
+
26
+ function return_json_schema(directoryPath, folder_path, project_name) {
27
+ const folders = fs
28
+ .readdirSync(path.normalize(directoryPath), { withFileTypes: true })
29
+ .filter((folder) => folder.isDirectory())
30
+ .map((folder) => ({
31
+ name: folder.name,
32
+ path: path.join(directoryPath, folder.name),
33
+ }));
34
+ var folders_schemas = {};
35
+ folders.forEach((folder) => {
36
+ if (folder.name == "schemas") {
37
+ const jsonFiles = glob.sync(path.join(folder.path, "**/*.json"));
38
+ var schemas = {};
39
+ jsonFiles.forEach((filePath) => {
40
+ try {
41
+ const fileContent = fs.readFileSync(filePath, "utf8");
42
+ var jsonData = JSON.parse(fileContent);
43
+ var filename = filePath
44
+ .replace(/^.*[\\/]/, "")
45
+ .replace(/\.[^/.]+$/, "");
46
+ var rpc = jsonData["rpc"];
47
+ jsonData["$id"] = project_name + folder_path + "." + rpc;
48
+ schemas[filename] = jsonData;
49
+ } catch (error) {
50
+ console.error(
51
+ `Erreur lors de la lecture du fichier ${filePath}:`,
52
+ error
53
+ );
54
+ }
55
+ });
56
+ folders_schemas = Object.keys(schemas).reduce((acc, key) => {
57
+ const currentSchema = schemas[key];
58
+ const modifiedSchema = {
59
+ $id: path.join(folder_path, currentSchema["$id"]),
60
+ ...currentSchema,
61
+ };
62
+ acc[key] = modifiedSchema;
63
+ return acc;
64
+ }, folders_schemas);
65
+ } else {
66
+ var new_folder_path = folder_path + "/" + folder.name;
67
+ var test = return_json_schema(folder.path, new_folder_path, project_name);
68
+ folders_schemas[folder.name] = test;
69
+ }
70
+ });
71
+ return folders_schemas;
72
+ }
73
+
74
+ if (fs.existsSync(outputFile)) {
75
+ fs.unlinkSync(outputFile);
76
+ }
77
+
78
+ const finalJson = {};
79
+ finalJson[project_name] = return_json_schema(directoryPath, "", project_name);
80
+
81
+ fs.writeFileSync(outputFile, JSON.stringify(finalJson, null, 2));
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@geode/opengeodeweb-viewer",
3
+ "scripts": {
4
+ "json": "node generate_schemas.js"
5
+ },
6
+ "dependencies": {
7
+ "glob": "^10.3.10"
8
+ },
9
+ "exports": {
10
+ "./schemas.json": {
11
+ "import": "./schemas.json",
12
+ "require": "./schemas.json"
13
+ }
14
+ },
15
+ "version": "0.1.0-rc.1",
16
+ "description": "",
17
+ "main": "generate_schemas.js",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/Geode-solutions/OpenGeodeWeb-Viewer.git"
21
+ },
22
+ "author": {
23
+ "name": "Geode-solutions",
24
+ "email": "contact@geode-solutions.com",
25
+ "url": "https://geode-solutions.com/"
26
+ },
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/Geode-solutions/OpenGeodeWeb-Viewer/issues"
30
+ },
31
+ "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Viewer",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "files": [
36
+ "schemas.json"
37
+ ]
38
+ }
package/schemas.json ADDED
@@ -0,0 +1,230 @@
1
+ {
2
+ "opengeodeweb_viewer": {
3
+ "update_data": {
4
+ "$id": "opengeodeweb_viewer.update_data",
5
+ "rpc": "update_data",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "type": "string"
10
+ }
11
+ },
12
+ "required": [
13
+ "id"
14
+ ],
15
+ "additionalProperties": false
16
+ },
17
+ "toggle_point_visibility": {
18
+ "$id": "opengeodeweb_viewer.toggle_point_visibility",
19
+ "rpc": "toggle_point_visibility",
20
+ "type": "object",
21
+ "properties": {
22
+ "id": {
23
+ "type": "string"
24
+ },
25
+ "visibility": {
26
+ "type": "boolean"
27
+ }
28
+ },
29
+ "required": [
30
+ "id",
31
+ "visibility"
32
+ ],
33
+ "additionalProperties": false
34
+ },
35
+ "toggle_object_visibility": {
36
+ "$id": "opengeodeweb_viewer.toggle_object_visibility",
37
+ "rpc": "toggle_object_visibility",
38
+ "type": "object",
39
+ "properties": {
40
+ "id": {
41
+ "type": "string"
42
+ },
43
+ "is_visible": {
44
+ "type": "boolean"
45
+ }
46
+ },
47
+ "required": [
48
+ "id",
49
+ "is_visible"
50
+ ],
51
+ "additionalProperties": false
52
+ },
53
+ "toggle_edge_visibility": {
54
+ "$id": "opengeodeweb_viewer.toggle_edge_visibility",
55
+ "rpc": "toggle_edge_visibility",
56
+ "type": "object",
57
+ "properties": {
58
+ "id": {
59
+ "type": "string"
60
+ },
61
+ "visibility": {
62
+ "type": "boolean"
63
+ }
64
+ },
65
+ "required": [
66
+ "id",
67
+ "visibility"
68
+ ],
69
+ "additionalProperties": false
70
+ },
71
+ "set_vertex_attribute": {
72
+ "$id": "opengeodeweb_viewer.set_vertex_attribute",
73
+ "rpc": "set_vertex_attribute",
74
+ "type": "object",
75
+ "properties": {
76
+ "id": {
77
+ "type": "string"
78
+ },
79
+ "name": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "required": [
84
+ "id",
85
+ "name"
86
+ ],
87
+ "additionalProperties": false
88
+ },
89
+ "set_color": {
90
+ "$id": "opengeodeweb_viewer.set_color",
91
+ "rpc": "set_color",
92
+ "type": "object",
93
+ "properties": {
94
+ "id": {
95
+ "type": "string"
96
+ },
97
+ "red": {
98
+ "type": "uint8"
99
+ },
100
+ "green": {
101
+ "type": "uint8"
102
+ },
103
+ "blue": {
104
+ "type": "uint8"
105
+ }
106
+ },
107
+ "required": [
108
+ "id",
109
+ "red",
110
+ "green",
111
+ "blue"
112
+ ],
113
+ "additionalProperties": false
114
+ },
115
+ "reset_camera": {
116
+ "$id": "opengeodeweb_viewer.reset_camera",
117
+ "rpc": "reset_camera",
118
+ "type": "object",
119
+ "properties": {},
120
+ "required": [],
121
+ "additionalProperties": false
122
+ },
123
+ "reset": {
124
+ "$id": "opengeodeweb_viewer.reset",
125
+ "rpc": "reset",
126
+ "type": "object",
127
+ "properties": {},
128
+ "required": [],
129
+ "additionalProperties": false
130
+ },
131
+ "point_size": {
132
+ "$id": "opengeodeweb_viewer.point_size",
133
+ "rpc": "point_size",
134
+ "type": "object",
135
+ "properties": {
136
+ "id": {
137
+ "type": "string"
138
+ },
139
+ "size": {
140
+ "type": "float64"
141
+ }
142
+ },
143
+ "required": [
144
+ "id",
145
+ "size"
146
+ ],
147
+ "additionalProperties": false
148
+ },
149
+ "get_point_position": {
150
+ "$id": "opengeodeweb_viewer.get_point_position",
151
+ "rpc": "get_point_position",
152
+ "type": "object",
153
+ "properties": {
154
+ "x": {
155
+ "type": "int16"
156
+ },
157
+ "y": {
158
+ "type": "int16"
159
+ }
160
+ },
161
+ "required": [
162
+ "x",
163
+ "y"
164
+ ],
165
+ "additionalProperties": false
166
+ },
167
+ "delete_object_pipeline": {
168
+ "$id": "opengeodeweb_viewer.delete_object_pipeline",
169
+ "rpc": "delete_object_pipeline",
170
+ "type": "object",
171
+ "properties": {
172
+ "id": {
173
+ "type": "string"
174
+ }
175
+ },
176
+ "required": [
177
+ "id"
178
+ ],
179
+ "additionalProperties": false
180
+ },
181
+ "create_visualization": {
182
+ "$id": "opengeodeweb_viewer.create_visualization",
183
+ "rpc": "create_visualization",
184
+ "type": "object",
185
+ "properties": {},
186
+ "required": [],
187
+ "additionalProperties": false
188
+ },
189
+ "create_object_pipeline": {
190
+ "$id": "opengeodeweb_viewer.create_object_pipeline",
191
+ "rpc": "create_object_pipeline",
192
+ "type": "object",
193
+ "properties": {
194
+ "id": {
195
+ "type": "string"
196
+ },
197
+ "file_name": {
198
+ "type": "string"
199
+ }
200
+ },
201
+ "required": [
202
+ "id",
203
+ "file_name"
204
+ ],
205
+ "additionalProperties": false
206
+ },
207
+ "apply_textures": {
208
+ "$id": "opengeodeweb_viewer.toggle_object_visibility",
209
+ "rpc": "toggle_object_visibility",
210
+ "type": "object",
211
+ "properties": {
212
+ "id": {
213
+ "type": "string"
214
+ },
215
+ "textures": {
216
+ "type": "array",
217
+ "elements": {
218
+ "type": "string"
219
+ },
220
+ "minItems": 1
221
+ }
222
+ },
223
+ "required": [
224
+ "id",
225
+ "textures"
226
+ ],
227
+ "additionalProperties": false
228
+ }
229
+ }
230
+ }