@abi-software/scaffoldvuer 0.2.3-alpha → 0.3.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.
Files changed (48) hide show
  1. package/.eslintrc.js +12 -12
  2. package/CHANGELOG.md +332 -316
  3. package/LICENSE +201 -201
  4. package/README.md +164 -164
  5. package/babel.config.js +14 -14
  6. package/dist/scaffoldvuer-wc.common.js +34 -34
  7. package/dist/scaffoldvuer-wc.umd.js +34 -34
  8. package/dist/scaffoldvuer-wc.umd.min.js +34 -34
  9. package/dist/scaffoldvuer.common.js +373 -364
  10. package/dist/scaffoldvuer.common.js.map +1 -1
  11. package/dist/scaffoldvuer.css +1 -1
  12. package/dist/scaffoldvuer.umd.js +373 -364
  13. package/dist/scaffoldvuer.umd.js.map +1 -1
  14. package/dist/scaffoldvuer.umd.min.js +1 -1
  15. package/dist/scaffoldvuer.umd.min.js.map +1 -1
  16. package/package-lock.json +18121 -18119
  17. package/package.json +89 -89
  18. package/public/index.html +17 -17
  19. package/src/App.vue +669 -669
  20. package/src/ScaffoldVuer-wc.js +13 -13
  21. package/src/app/DropZone.vue +114 -114
  22. package/src/app/ModelsInformation.js +35 -35
  23. package/src/app/ModelsTable.vue +113 -113
  24. package/src/app/TextureDemos.js +114 -114
  25. package/src/assets/_variables.scss +43 -43
  26. package/src/assets/styles.scss +7 -7
  27. package/src/components/OpacityControls.vue +222 -222
  28. package/src/components/PrimitiveControls.vue +158 -0
  29. package/src/components/ScaffoldTooltip.vue +142 -142
  30. package/src/components/ScaffoldVuer.md +44 -44
  31. package/src/components/ScaffoldVuer.vue +2006 -1997
  32. package/src/components/TreeControls.vue +699 -699
  33. package/src/components/index.js +7 -7
  34. package/src/credential.json +12 -0
  35. package/src/main.js +14 -14
  36. package/src/scripts/BaseModule.js +80 -80
  37. package/src/scripts/RendererModule.js +289 -289
  38. package/src/scripts/WebGL.js +94 -94
  39. package/src/scripts/annotation.js +5 -5
  40. package/src/scripts/eventNotifier.js +66 -66
  41. package/src/scripts/graphicsHighlight.js +134 -134
  42. package/src/scripts/organsRenderer.js +587 -587
  43. package/src/scripts/search.js +182 -182
  44. package/src/scripts/utilities.js +146 -146
  45. package/styleguide.config.js +22 -22
  46. package/vue.config.js +41 -41
  47. package/src/components/test.pdf +0 -0
  48. package/src/searchControls.vue +0 -122
@@ -1,182 +1,182 @@
1
- /******************************************************************************
2
-
3
- Flatmap viewer and annotation tool
4
-
5
- Copyright (c) 2019 David Brooks
6
-
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
10
-
11
- http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS,
15
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- See the License for the specific language governing permissions and
17
- limitations under the License.
18
-
19
- ******************************************************************************/
20
-
21
-
22
- //==============================================================================
23
-
24
- import MiniSearch from 'minisearch';
25
-
26
- import { createUnqiuesFromObjects } from './utilities';
27
-
28
- //==============================================================================
29
-
30
- // The properties of a feature we index and show
31
-
32
- export const indexedProperties = [
33
- 'label',
34
- 'models',
35
- 'source'
36
- ];
37
-
38
- //==============================================================================
39
-
40
- export class SearchIndex
41
- {
42
- constructor()
43
- {
44
- this._searchEngine = new MiniSearch({
45
- fields: ['path', 'name'],
46
- storeFields: ['path'],
47
- tokenize: (string, _fieldName) => string.split('"'), // indexing tokenizer
48
- });
49
- this._featureIds = [];
50
- this.zincObjects = [];
51
- this.regions = [];
52
- }
53
-
54
- indexMetadata(featureId, metadata)
55
- //================================
56
- {
57
- const textSeen = [];
58
- for (const prop of indexedProperties) {
59
- if (prop in metadata) {
60
- const text = metadata[prop];
61
- if (!textSeen.includes(text)) {
62
- this.addTerm_(featureId, text);
63
- textSeen.push(text);
64
- }
65
- }
66
- }
67
- }
68
-
69
- addZincObject(zincObject, id)
70
- //=======================
71
- {
72
- const path = zincObject.getRegion().getFullPath();
73
- const fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
74
- const item = { path: fullPath, name: zincObject.groupName, id };
75
- this._searchEngine.add(item, {fields: ['path', 'name']});
76
- this.zincObjects.push(zincObject);
77
- }
78
-
79
- addRegion(region, id)
80
- //=======================
81
- {
82
- const item = { path: region.getFullPath(), name: region.getName(), id };
83
- this._searchEngine.add(item, {fields: ['path', 'name']});
84
- this.regions.push(region);
85
- }
86
-
87
- clearResults()
88
- //============
89
- {
90
- this._;
91
- }
92
-
93
- removeAll()
94
- //=======================
95
- {
96
- this._searchEngine.removeAll();
97
- this.zincObjects.length = 0;
98
- this.regions.length = 0;
99
- }
100
-
101
- auto_suggest(text)
102
- //================
103
- {
104
- const results = this._searchEngine.autoSuggest(text, {prefix: true});
105
- return results;
106
- }
107
-
108
- processResults(zincObjects, searchText) {
109
- const result = {
110
- regionPath: undefined,
111
- label: `Search Results for \"`,
112
- };
113
- if (Array.isArray(searchText)) {
114
- result.label += ','.join(searchText);
115
- } else {
116
- result.label += searchText;
117
- }
118
- result.label += `\"`;
119
- if (zincObjects.length === 1) {
120
- if (zincObjects[0].isRegion) {
121
- result.regionPath = zincObjects[0].getFullPath();
122
- } else if (zincObjects[0].isZincObject) {
123
- result.regionPath = zincObjects[0].getRegion().getFullPath();
124
- result.label = zincObjects[0].groupName;
125
- }
126
- }
127
- result["zincObjects"] = createUnqiuesFromObjects(zincObjects);
128
- return result;
129
- }
130
-
131
- search(text) {
132
- const results = this._searchEngine.search(text, {prefix: true});
133
- const zincResults = this.zincObjects.filter(zincObject => results.map(r => r.id).includes(zincObject.uuid));
134
- const regionResults = this.regions.filter(region => results.map(r => r.id).includes(region.uuid));
135
- zincResults.push(...regionResults);
136
- return zincResults;
137
- }
138
-
139
- searchTerms(terms) {
140
- let results = [];
141
- terms.forEach(term => {
142
- const result = this.search(term);
143
- results.push(...result);
144
- });
145
-
146
- return results;
147
- }
148
-
149
- searchAndProcessResult(terms) {
150
- let zincObjectResults = [];
151
- if (Array.isArray(terms)) {
152
- zincObjectResults = this.searchTerms(terms);
153
- } else {
154
- zincObjectResults = this.search(terms);
155
- }
156
- return this.processResults(zincObjectResults, terms);
157
- }
158
-
159
- }
160
-
161
- //==============================================================================
162
-
163
- class SearchResults
164
- {
165
- constructor(results)
166
- {
167
- this.__results = results.sort((a, b) => (b.score - a.score));
168
- this.__featureIds = results.map(r => r.featureId);
169
- }
170
-
171
- get featureIds()
172
- {
173
- return this.__featureIds;
174
- }
175
-
176
- get results()
177
- {
178
- return this.__results;
179
- }
180
- }
181
-
182
- //==============================================================================
1
+ /******************************************************************************
2
+
3
+ Flatmap viewer and annotation tool
4
+
5
+ Copyright (c) 2019 David Brooks
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ******************************************************************************/
20
+
21
+
22
+ //==============================================================================
23
+
24
+ import MiniSearch from 'minisearch';
25
+
26
+ import { createUnqiuesFromObjects } from './utilities';
27
+
28
+ //==============================================================================
29
+
30
+ // The properties of a feature we index and show
31
+
32
+ export const indexedProperties = [
33
+ 'label',
34
+ 'models',
35
+ 'source'
36
+ ];
37
+
38
+ //==============================================================================
39
+
40
+ export class SearchIndex
41
+ {
42
+ constructor()
43
+ {
44
+ this._searchEngine = new MiniSearch({
45
+ fields: ['path', 'name'],
46
+ storeFields: ['path'],
47
+ tokenize: (string, _fieldName) => string.split('"'), // indexing tokenizer
48
+ });
49
+ this._featureIds = [];
50
+ this.zincObjects = [];
51
+ this.regions = [];
52
+ }
53
+
54
+ indexMetadata(featureId, metadata)
55
+ //================================
56
+ {
57
+ const textSeen = [];
58
+ for (const prop of indexedProperties) {
59
+ if (prop in metadata) {
60
+ const text = metadata[prop];
61
+ if (!textSeen.includes(text)) {
62
+ this.addTerm_(featureId, text);
63
+ textSeen.push(text);
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ addZincObject(zincObject, id)
70
+ //=======================
71
+ {
72
+ const path = zincObject.getRegion().getFullPath();
73
+ const fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
74
+ const item = { path: fullPath, name: zincObject.groupName, id };
75
+ this._searchEngine.add(item, {fields: ['path', 'name']});
76
+ this.zincObjects.push(zincObject);
77
+ }
78
+
79
+ addRegion(region, id)
80
+ //=======================
81
+ {
82
+ const item = { path: region.getFullPath(), name: region.getName(), id };
83
+ this._searchEngine.add(item, {fields: ['path', 'name']});
84
+ this.regions.push(region);
85
+ }
86
+
87
+ clearResults()
88
+ //============
89
+ {
90
+ this._;
91
+ }
92
+
93
+ removeAll()
94
+ //=======================
95
+ {
96
+ this._searchEngine.removeAll();
97
+ this.zincObjects.length = 0;
98
+ this.regions.length = 0;
99
+ }
100
+
101
+ auto_suggest(text)
102
+ //================
103
+ {
104
+ const results = this._searchEngine.autoSuggest(text, {prefix: true});
105
+ return results;
106
+ }
107
+
108
+ processResults(zincObjects, searchText) {
109
+ const result = {
110
+ regionPath: undefined,
111
+ label: `Search Results for \"`,
112
+ };
113
+ if (Array.isArray(searchText)) {
114
+ result.label += ','.join(searchText);
115
+ } else {
116
+ result.label += searchText;
117
+ }
118
+ result.label += `\"`;
119
+ if (zincObjects.length === 1) {
120
+ if (zincObjects[0].isRegion) {
121
+ result.regionPath = zincObjects[0].getFullPath();
122
+ } else if (zincObjects[0].isZincObject) {
123
+ result.regionPath = zincObjects[0].getRegion().getFullPath();
124
+ result.label = zincObjects[0].groupName;
125
+ }
126
+ }
127
+ result["zincObjects"] = createUnqiuesFromObjects(zincObjects);
128
+ return result;
129
+ }
130
+
131
+ search(text) {
132
+ const results = this._searchEngine.search(text, {prefix: true});
133
+ const zincResults = this.zincObjects.filter(zincObject => results.map(r => r.id).includes(zincObject.uuid));
134
+ const regionResults = this.regions.filter(region => results.map(r => r.id).includes(region.uuid));
135
+ zincResults.push(...regionResults);
136
+ return zincResults;
137
+ }
138
+
139
+ searchTerms(terms) {
140
+ let results = [];
141
+ terms.forEach(term => {
142
+ const result = this.search(term);
143
+ results.push(...result);
144
+ });
145
+
146
+ return results;
147
+ }
148
+
149
+ searchAndProcessResult(terms) {
150
+ let zincObjectResults = [];
151
+ if (Array.isArray(terms)) {
152
+ zincObjectResults = this.searchTerms(terms);
153
+ } else {
154
+ zincObjectResults = this.search(terms);
155
+ }
156
+ return this.processResults(zincObjectResults, terms);
157
+ }
158
+
159
+ }
160
+
161
+ //==============================================================================
162
+
163
+ class SearchResults
164
+ {
165
+ constructor(results)
166
+ {
167
+ this.__results = results.sort((a, b) => (b.score - a.score));
168
+ this.__featureIds = results.map(r => r.featureId);
169
+ }
170
+
171
+ get featureIds()
172
+ {
173
+ return this.__featureIds;
174
+ }
175
+
176
+ get results()
177
+ {
178
+ return this.__results;
179
+ }
180
+ }
181
+
182
+ //==============================================================================
@@ -1,146 +1,146 @@
1
- export const createListFromPrimitives = (primitives, list) => {
2
- if (primitives) {
3
- let id = "";
4
- primitives.forEach(primitive => {
5
- id = primitive.uuid;
6
- if (primitive.region) {
7
- id = primitive.region.uuid + "/" + id;
8
- }
9
- if (primitive && primitive.getVisibility()) {
10
- list.push(id);
11
- }
12
- });
13
- }
14
- return list;
15
- }
16
-
17
- export const extractAllFullPaths = (item, list) => {
18
- let nodeName = "";
19
- if (item.isRegion) {
20
- nodeName = `__r${item.regionPath}`;
21
- }
22
- if (item.isPrimitives) {
23
- nodeName = `${item.regionPath}/${item.label}`;
24
- }
25
- list.push(nodeName);
26
- if (item.children)
27
- item.children.forEach(child => extractAllFullPaths(child, list));
28
- }
29
-
30
- export const findObjectsWithNames = (rootRegion, names, regionPath, transverse) => {
31
- let targetRegion = rootRegion;
32
- const targetObjects = [];
33
- if (regionPath)
34
- targetRegion = rootRegion.findChildFromPath(regionPath);
35
- if (targetRegion) {
36
- const isArray = Array.isArray(names);
37
- let array = names;
38
- if (!isArray) {
39
- array = [array];
40
- }
41
- array.forEach(name => {
42
- const temp = targetRegion.findObjectsWithGroupName(name, transverse);
43
- targetObjects.push(...temp);
44
- });
45
- }
46
- return targetObjects;
47
- }
48
-
49
- export const getAllObjects = (scene) => {
50
- let objects = scene.getRootRegion().getAllObjects(true);
51
- let id = 1;
52
- return objects.map(object => Object.assign(object, { id: id++ })); // Add id to each object
53
- }
54
-
55
- const findObjectWithUUID = (objects, uuid, remove) => {
56
- const index = objects.findIndex(obj => obj.uuid === uuid);
57
- let object = undefined;
58
- if (index > -1) {
59
- object = objects[index];
60
- if (remove) {
61
- objects.splice(i, 1);
62
- }
63
- }
64
- return object;
65
- }
66
-
67
- export const convertUUIDsToFullPaths = (rootRegion, IDs) => {
68
- const results = [];
69
- if (rootRegion && IDs && IDs.length > 0) {
70
- //a region to primitivs map list
71
- const rpLists = {};
72
- const reIDToPath = {};
73
- const allRegions = [rootRegion, ...rootRegion.getChildRegions(true)];
74
- let region = undefined;
75
- let primitive = undefined;
76
- let regionID = undefined;
77
-
78
- IDs.forEach(id => {
79
- const uuids = id.split("/");
80
- regionID = uuids[0];
81
- region = findObjectWithUUID(allRegions, regionID, false);
82
- if (region) {
83
- if (!reIDToPath[regionID]) {
84
- reIDToPath[regionID] = region.getFullPath();
85
- }
86
- if (uuids[1]) {
87
- if (!rpLists[regionID]) {
88
- rpLists[regionID] = region.getAllObjects(false);
89
- }
90
- primitive = findObjectWithUUID(rpLists[regionID], uuids[1], true);
91
- if (primitive) {
92
- results.push(`${reIDToPath[regionID]}/${primitive.groupName}`);
93
- }
94
- } else {
95
- results.push(`__r/${reIDToPath[regionID]}`);
96
- }
97
- }
98
- });
99
- }
100
- return results;
101
- }
102
-
103
- export const createUnqiuesFromObjects = (zincObjects) => {
104
- if (zincObjects) {
105
- const expanded = [];
106
- zincObjects.forEach(obj => {
107
- if (obj.isZincObject) {
108
- expanded.push(obj);
109
- } else if (obj.isRegion) {
110
- expanded.push(...obj.getAllObjects(true));
111
- }
112
- });
113
- const uniq = Object.values(
114
- expanded.reduce((acc, obj) => ({ ...acc, [obj.uuid]: obj }), {})
115
- );
116
- return uniq;
117
- }
118
- return [];
119
- }
120
-
121
- export const getObjectsFromAnnotations = (scene, annotations) => {
122
- const returned = {label: "Multiple selections", regionPath: "", objects: []};
123
- if (annotations && scene) {
124
- const rpList = {};
125
- const rootRegion = scene.getRootRegion();
126
- if (annotations.length > 0) {
127
- returned.regionPath = annotations[0].data.region;
128
- returned.label = annotations[0].data.group;
129
- }
130
- annotations.forEach(annotation => {
131
- if (!annotation.data.region.includes(returned.regionPath)) {
132
- returned.regionPath = "";
133
- }
134
- if (returned.label !== annotation.data.group) {
135
- returned.label = "Multiple selections";
136
- }
137
- const region = rootRegion.findChildFromPath(annotation.data.region);
138
- if (!rpList[region.uuid]) {
139
- rpList[region.uuid] = region.getAllObjects(false);
140
- }
141
- const obj = findObjectWithUUID(rpList[region.uuid], annotation.data.uuid);
142
- if (obj) returned.objects.push(obj);
143
- });
144
- }
145
- return returned;
146
- }
1
+ export const createListFromPrimitives = (primitives, list) => {
2
+ if (primitives) {
3
+ let id = "";
4
+ primitives.forEach(primitive => {
5
+ id = primitive.uuid;
6
+ if (primitive.region) {
7
+ id = primitive.region.uuid + "/" + id;
8
+ }
9
+ if (primitive && primitive.getVisibility()) {
10
+ list.push(id);
11
+ }
12
+ });
13
+ }
14
+ return list;
15
+ }
16
+
17
+ export const extractAllFullPaths = (item, list) => {
18
+ let nodeName = "";
19
+ if (item.isRegion) {
20
+ nodeName = `__r${item.regionPath}`;
21
+ }
22
+ if (item.isPrimitives) {
23
+ nodeName = `${item.regionPath}/${item.label}`;
24
+ }
25
+ list.push(nodeName);
26
+ if (item.children)
27
+ item.children.forEach(child => extractAllFullPaths(child, list));
28
+ }
29
+
30
+ export const findObjectsWithNames = (rootRegion, names, regionPath, transverse) => {
31
+ let targetRegion = rootRegion;
32
+ const targetObjects = [];
33
+ if (regionPath)
34
+ targetRegion = rootRegion.findChildFromPath(regionPath);
35
+ if (targetRegion) {
36
+ const isArray = Array.isArray(names);
37
+ let array = names;
38
+ if (!isArray) {
39
+ array = [array];
40
+ }
41
+ array.forEach(name => {
42
+ const temp = targetRegion.findObjectsWithGroupName(name, transverse);
43
+ targetObjects.push(...temp);
44
+ });
45
+ }
46
+ return targetObjects;
47
+ }
48
+
49
+ export const getAllObjects = (scene) => {
50
+ let objects = scene.getRootRegion().getAllObjects(true);
51
+ let id = 1;
52
+ return objects.map(object => Object.assign(object, { id: id++ })); // Add id to each object
53
+ }
54
+
55
+ const findObjectWithUUID = (objects, uuid, remove) => {
56
+ const index = objects.findIndex(obj => obj.uuid === uuid);
57
+ let object = undefined;
58
+ if (index > -1) {
59
+ object = objects[index];
60
+ if (remove) {
61
+ objects.splice(i, 1);
62
+ }
63
+ }
64
+ return object;
65
+ }
66
+
67
+ export const convertUUIDsToFullPaths = (rootRegion, IDs) => {
68
+ const results = [];
69
+ if (rootRegion && IDs && IDs.length > 0) {
70
+ //a region to primitivs map list
71
+ const rpLists = {};
72
+ const reIDToPath = {};
73
+ const allRegions = [rootRegion, ...rootRegion.getChildRegions(true)];
74
+ let region = undefined;
75
+ let primitive = undefined;
76
+ let regionID = undefined;
77
+
78
+ IDs.forEach(id => {
79
+ const uuids = id.split("/");
80
+ regionID = uuids[0];
81
+ region = findObjectWithUUID(allRegions, regionID, false);
82
+ if (region) {
83
+ if (!reIDToPath[regionID]) {
84
+ reIDToPath[regionID] = region.getFullPath();
85
+ }
86
+ if (uuids[1]) {
87
+ if (!rpLists[regionID]) {
88
+ rpLists[regionID] = region.getAllObjects(false);
89
+ }
90
+ primitive = findObjectWithUUID(rpLists[regionID], uuids[1], true);
91
+ if (primitive) {
92
+ results.push(`${reIDToPath[regionID]}/${primitive.groupName}`);
93
+ }
94
+ } else {
95
+ results.push(`__r/${reIDToPath[regionID]}`);
96
+ }
97
+ }
98
+ });
99
+ }
100
+ return results;
101
+ }
102
+
103
+ export const createUnqiuesFromObjects = (zincObjects) => {
104
+ if (zincObjects) {
105
+ const expanded = [];
106
+ zincObjects.forEach(obj => {
107
+ if (obj.isZincObject) {
108
+ expanded.push(obj);
109
+ } else if (obj.isRegion) {
110
+ expanded.push(...obj.getAllObjects(true));
111
+ }
112
+ });
113
+ const uniq = Object.values(
114
+ expanded.reduce((acc, obj) => ({ ...acc, [obj.uuid]: obj }), {})
115
+ );
116
+ return uniq;
117
+ }
118
+ return [];
119
+ }
120
+
121
+ export const getObjectsFromAnnotations = (scene, annotations) => {
122
+ const returned = {label: "Multiple selections", regionPath: "", objects: []};
123
+ if (annotations && scene) {
124
+ const rpList = {};
125
+ const rootRegion = scene.getRootRegion();
126
+ if (annotations.length > 0) {
127
+ returned.regionPath = annotations[0].data.region;
128
+ returned.label = annotations[0].data.group;
129
+ }
130
+ annotations.forEach(annotation => {
131
+ if (!annotation.data.region.includes(returned.regionPath)) {
132
+ returned.regionPath = "";
133
+ }
134
+ if (returned.label !== annotation.data.group) {
135
+ returned.label = "Multiple selections";
136
+ }
137
+ const region = rootRegion.findChildFromPath(annotation.data.region);
138
+ if (!rpList[region.uuid]) {
139
+ rpList[region.uuid] = region.getAllObjects(false);
140
+ }
141
+ const obj = findObjectWithUUID(rpList[region.uuid], annotation.data.uuid);
142
+ if (obj) returned.objects.push(obj);
143
+ });
144
+ }
145
+ return returned;
146
+ }