@babylonjs/viewer 5.0.0 → 5.0.3
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/configuration/configuration.d.ts +107 -107
- package/configuration/configuration.js +15 -15
- package/configuration/configurationCompatibility.d.ts +8 -8
- package/configuration/configurationCompatibility.js +65 -65
- package/configuration/configurationContainer.d.ts +10 -10
- package/configuration/configurationContainer.js +9 -9
- package/configuration/globals.d.ts +6 -6
- package/configuration/globals.js +17 -17
- package/configuration/index.d.ts +2 -2
- package/configuration/index.js +3 -3
- package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
- package/configuration/interfaces/cameraConfiguration.js +1 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
- package/configuration/interfaces/colorGradingConfiguration.js +1 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
- package/configuration/interfaces/environmentMapConfiguration.js +1 -1
- package/configuration/interfaces/groundConfiguration.d.ts +24 -24
- package/configuration/interfaces/groundConfiguration.js +1 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
- package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
- package/configuration/interfaces/index.d.ts +15 -15
- package/configuration/interfaces/index.js +15 -15
- package/configuration/interfaces/lightConfiguration.d.ts +60 -60
- package/configuration/interfaces/lightConfiguration.js +1 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
- package/configuration/interfaces/modelConfiguration.d.ts +65 -65
- package/configuration/interfaces/modelConfiguration.js +1 -1
- package/configuration/interfaces/observersConfiguration.d.ts +5 -5
- package/configuration/interfaces/observersConfiguration.js +1 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
- package/configuration/interfaces/sceneConfiguration.js +1 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
- package/configuration/interfaces/skyboxConfiguration.js +1 -1
- package/configuration/interfaces/templateConfiguration.d.ts +67 -67
- package/configuration/interfaces/templateConfiguration.js +1 -1
- package/configuration/interfaces/vrConfiguration.d.ts +16 -16
- package/configuration/interfaces/vrConfiguration.js +1 -1
- package/configuration/loader.d.ts +4 -4
- package/configuration/loader.js +16 -16
- package/configuration/mappers.d.ts +42 -42
- package/configuration/mappers.js +190 -190
- package/configuration/renderOnlyLoader.d.ts +33 -33
- package/configuration/renderOnlyLoader.js +161 -161
- package/configuration/types/default.d.ts +6 -6
- package/configuration/types/default.js +120 -120
- package/configuration/types/environmentMap.d.ts +5 -5
- package/configuration/types/environmentMap.js +13 -13
- package/configuration/types/extended.d.ts +6 -6
- package/configuration/types/extended.js +316 -316
- package/configuration/types/index.d.ts +13 -13
- package/configuration/types/index.js +49 -49
- package/configuration/types/minimal.d.ts +6 -6
- package/configuration/types/minimal.js +42 -42
- package/configuration/types/renderOnlyDefault.d.ts +30 -30
- package/configuration/types/renderOnlyDefault.js +30 -30
- package/configuration/types/shadowLight.d.ts +9 -9
- package/configuration/types/shadowLight.js +63 -63
- package/helper/index.d.ts +26 -26
- package/helper/index.js +62 -62
- package/index.d.ts +30 -30
- package/index.js +45 -45
- package/initializer.d.ts +11 -11
- package/initializer.js +34 -34
- package/interfaces.d.ts +5 -5
- package/interfaces.js +1 -1
- package/labs/environmentSerializer.d.ts +126 -126
- package/labs/environmentSerializer.js +190 -190
- package/labs/texture.d.ts +183 -183
- package/labs/texture.js +300 -300
- package/labs/viewerLabs.d.ts +51 -51
- package/labs/viewerLabs.js +133 -133
- package/loader/modelLoader.d.ts +47 -47
- package/loader/modelLoader.js +189 -189
- package/loader/plugins/applyMaterialConfig.d.ts +12 -12
- package/loader/plugins/applyMaterialConfig.js +15 -15
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
- package/loader/plugins/index.d.ts +18 -18
- package/loader/plugins/index.js +42 -42
- package/loader/plugins/loaderPlugin.d.ts +24 -24
- package/loader/plugins/loaderPlugin.js +1 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
- package/loader/plugins/msftLodLoaderPlugin.js +20 -20
- package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
- package/loader/plugins/telemetryLoaderPlugin.js +35 -35
- package/managers/observablesManager.d.ts +66 -66
- package/managers/observablesManager.js +34 -34
- package/managers/sceneManager.d.ts +243 -243
- package/managers/sceneManager.js +1388 -1388
- package/managers/telemetryManager.d.ts +57 -57
- package/managers/telemetryManager.js +113 -113
- package/model/modelAnimation.d.ts +215 -215
- package/model/modelAnimation.js +232 -232
- package/model/viewerModel.d.ts +228 -228
- package/model/viewerModel.js +669 -669
- package/optimizer/custom/extended.d.ts +11 -11
- package/optimizer/custom/extended.js +98 -98
- package/optimizer/custom/index.d.ts +8 -8
- package/optimizer/custom/index.js +24 -24
- package/package.json +5 -5
- package/renderOnlyIndex.d.ts +11 -11
- package/renderOnlyIndex.js +17 -17
- package/templating/eventManager.d.ts +35 -35
- package/templating/eventManager.js +65 -65
- package/templating/plugins/hdButtonPlugin.d.ts +9 -9
- package/templating/plugins/hdButtonPlugin.js +21 -21
- package/templating/plugins/printButton.d.ts +9 -9
- package/templating/plugins/printButton.js +40 -40
- package/templating/templateManager.d.ts +190 -190
- package/templating/templateManager.js +553 -553
- package/templating/viewerTemplatePlugin.d.ts +21 -21
- package/templating/viewerTemplatePlugin.js +68 -68
- package/viewer/defaultViewer.d.ts +122 -122
- package/viewer/defaultViewer.js +665 -665
- package/viewer/renderOnlyViewer.d.ts +8 -8
- package/viewer/renderOnlyViewer.js +43 -43
- package/viewer/viewer.d.ts +254 -254
- package/viewer/viewer.js +777 -777
- package/viewer/viewerManager.d.ts +55 -55
- package/viewer/viewerManager.js +87 -87
- package/viewer/viewerWithTemplate.d.ts +9 -9
- package/viewer/viewerWithTemplate.js +19 -19
package/configuration/mappers.js
CHANGED
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
2
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
3
|
-
import { kebabToCamel } from "../helper/index.js";
|
|
4
|
-
/**
|
|
5
|
-
* This is a simple HTML mapper.
|
|
6
|
-
* This mapper parses a single HTML element and returns the configuration from its attributes.
|
|
7
|
-
* it parses numbers and boolean values to the corresponding variable types.
|
|
8
|
-
* The following HTML element:
|
|
9
|
-
* <div test="1" random-flag="true" a.string.object="test"> will result in the following configuration:
|
|
10
|
-
*
|
|
11
|
-
* {
|
|
12
|
-
* test: 1, //a number!
|
|
13
|
-
* randomFlag: boolean, //camelCase and boolean
|
|
14
|
-
* a: {
|
|
15
|
-
* string: {
|
|
16
|
-
* object: "test" //dot-separated object levels
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
*/
|
|
21
|
-
var HTMLMapper = /** @class */ (function () {
|
|
22
|
-
function HTMLMapper() {
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Map a specific element and get configuration from it
|
|
26
|
-
* @param element the HTML element to analyze.
|
|
27
|
-
*/
|
|
28
|
-
HTMLMapper.prototype.map = function (element) {
|
|
29
|
-
var config = {};
|
|
30
|
-
var _loop_1 = function (attrIdx) {
|
|
31
|
-
var attr = element.attributes.item(attrIdx);
|
|
32
|
-
if (!attr) {
|
|
33
|
-
return "continue";
|
|
34
|
-
}
|
|
35
|
-
// map "object.property" to the right configuration place.
|
|
36
|
-
var split = attr.nodeName.split(".");
|
|
37
|
-
split.reduce(function (currentConfig, key, idx) {
|
|
38
|
-
//convert html-style to json-style
|
|
39
|
-
var camelKey = kebabToCamel(key);
|
|
40
|
-
if (idx === split.length - 1) {
|
|
41
|
-
var val = attr.nodeValue; // firefox warns nodeValue is deprecated, but I found no sign of it anywhere.
|
|
42
|
-
if (val === "true") {
|
|
43
|
-
val = true;
|
|
44
|
-
}
|
|
45
|
-
else if (val === "false") {
|
|
46
|
-
val = false;
|
|
47
|
-
}
|
|
48
|
-
else if (val === "undefined") {
|
|
49
|
-
val = undefined;
|
|
50
|
-
}
|
|
51
|
-
else if (val === "null") {
|
|
52
|
-
val = null;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
var isnum = !isNaN(parseFloat(val)) && isFinite(val); ///^\d+$/.test(val);
|
|
56
|
-
if (isnum) {
|
|
57
|
-
var number = parseFloat(val);
|
|
58
|
-
if (!isNaN(number)) {
|
|
59
|
-
val = number;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
currentConfig[camelKey] = val;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
currentConfig[camelKey] = currentConfig[camelKey] || {};
|
|
67
|
-
}
|
|
68
|
-
return currentConfig[camelKey];
|
|
69
|
-
}, config);
|
|
70
|
-
};
|
|
71
|
-
for (var attrIdx = 0; attrIdx < element.attributes.length; ++attrIdx) {
|
|
72
|
-
_loop_1(attrIdx);
|
|
73
|
-
}
|
|
74
|
-
return config;
|
|
75
|
-
};
|
|
76
|
-
return HTMLMapper;
|
|
77
|
-
}());
|
|
78
|
-
/**
|
|
79
|
-
* A simple string-to-JSON mapper.
|
|
80
|
-
* This is the main mapper, used to analyze downloaded JSON-Configuration or JSON payload
|
|
81
|
-
*/
|
|
82
|
-
var JSONMapper = /** @class */ (function () {
|
|
83
|
-
function JSONMapper() {
|
|
84
|
-
}
|
|
85
|
-
JSONMapper.prototype.map = function (rawSource) {
|
|
86
|
-
return JSON.parse(rawSource);
|
|
87
|
-
};
|
|
88
|
-
return JSONMapper;
|
|
89
|
-
}());
|
|
90
|
-
/**
|
|
91
|
-
* The DOM Mapper will traverse an entire DOM Tree and will load the configuration from the
|
|
92
|
-
* DOM elements and attributes.
|
|
93
|
-
*/
|
|
94
|
-
var DOMMapper = /** @class */ (function () {
|
|
95
|
-
function DOMMapper() {
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* The mapping function that will convert HTML data to a viewer configuration object
|
|
99
|
-
* @param baseElement the baseElement from which to start traversing
|
|
100
|
-
* @returns a ViewerConfiguration object from the provided HTML Element
|
|
101
|
-
*/
|
|
102
|
-
DOMMapper.prototype.map = function (baseElement) {
|
|
103
|
-
var htmlMapper = new HTMLMapper();
|
|
104
|
-
var config = htmlMapper.map(baseElement);
|
|
105
|
-
var traverseChildren = function (element, partConfig) {
|
|
106
|
-
var children = element.children;
|
|
107
|
-
if (children.length) {
|
|
108
|
-
for (var i = 0; i < children.length; ++i) {
|
|
109
|
-
var item = children.item(i);
|
|
110
|
-
// use the HTML Mapper to read configuration from a single element
|
|
111
|
-
var configMapped = htmlMapper.map(item);
|
|
112
|
-
var key = kebabToCamel(item.nodeName.toLowerCase());
|
|
113
|
-
if (item.attributes.getNamedItem("array") && item.attributes.getNamedItem("array").nodeValue === "true") {
|
|
114
|
-
partConfig[key] = [];
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
if (element.attributes.getNamedItem("array") && element.attributes.getNamedItem("array").nodeValue === "true") {
|
|
118
|
-
partConfig.push(configMapped);
|
|
119
|
-
}
|
|
120
|
-
else if (partConfig[key]) {
|
|
121
|
-
//exists already! probably an array
|
|
122
|
-
element.setAttribute("array", "true");
|
|
123
|
-
var oldItem = partConfig[key];
|
|
124
|
-
partConfig = [oldItem, configMapped];
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
partConfig[key] = configMapped;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
traverseChildren(item, partConfig[key] || configMapped);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return partConfig;
|
|
134
|
-
};
|
|
135
|
-
traverseChildren(baseElement, config);
|
|
136
|
-
return config;
|
|
137
|
-
};
|
|
138
|
-
return DOMMapper;
|
|
139
|
-
}());
|
|
140
|
-
/**
|
|
141
|
-
* The MapperManager manages the different implemented mappers.
|
|
142
|
-
* It allows the user to register new mappers as well and use them to parse their own configuration data
|
|
143
|
-
*/
|
|
144
|
-
var MapperManager = /** @class */ (function () {
|
|
145
|
-
function MapperManager() {
|
|
146
|
-
this._mappers = {
|
|
147
|
-
html: new HTMLMapper(),
|
|
148
|
-
json: new JSONMapper(),
|
|
149
|
-
dom: new DOMMapper(),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get a specific configuration mapper.
|
|
154
|
-
*
|
|
155
|
-
* @param type the name of the mapper to load
|
|
156
|
-
*/
|
|
157
|
-
MapperManager.prototype.getMapper = function (type) {
|
|
158
|
-
if (!this._mappers[type]) {
|
|
159
|
-
Tools.Error("No mapper defined for " + type);
|
|
160
|
-
}
|
|
161
|
-
return this._mappers[type];
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* Use this function to register your own configuration mapper.
|
|
165
|
-
* After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.
|
|
166
|
-
* @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper
|
|
167
|
-
* @param mapper The implemented mapper
|
|
168
|
-
*/
|
|
169
|
-
MapperManager.prototype.registerMapper = function (type, mapper) {
|
|
170
|
-
this._mappers[type] = mapper;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* Dispose the mapper manager and all of its mappers.
|
|
174
|
-
*/
|
|
175
|
-
MapperManager.prototype.dispose = function () {
|
|
176
|
-
this._mappers = {};
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* The default mapper is the JSON mapper.
|
|
180
|
-
*/
|
|
181
|
-
MapperManager.DefaultMapper = "json";
|
|
182
|
-
return MapperManager;
|
|
183
|
-
}());
|
|
184
|
-
export { MapperManager };
|
|
185
|
-
/**
|
|
186
|
-
* mapperManager is a singleton of the type MapperManager.
|
|
187
|
-
* The mapperManager can be disposed directly with calling mapperManager.dispose()
|
|
188
|
-
* or indirectly with using BabylonViewer.disposeAll()
|
|
189
|
-
*/
|
|
190
|
-
export var mapperManager = new MapperManager();
|
|
1
|
+
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
2
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
3
|
+
import { kebabToCamel } from "../helper/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* This is a simple HTML mapper.
|
|
6
|
+
* This mapper parses a single HTML element and returns the configuration from its attributes.
|
|
7
|
+
* it parses numbers and boolean values to the corresponding variable types.
|
|
8
|
+
* The following HTML element:
|
|
9
|
+
* <div test="1" random-flag="true" a.string.object="test"> will result in the following configuration:
|
|
10
|
+
*
|
|
11
|
+
* {
|
|
12
|
+
* test: 1, //a number!
|
|
13
|
+
* randomFlag: boolean, //camelCase and boolean
|
|
14
|
+
* a: {
|
|
15
|
+
* string: {
|
|
16
|
+
* object: "test" //dot-separated object levels
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
var HTMLMapper = /** @class */ (function () {
|
|
22
|
+
function HTMLMapper() {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Map a specific element and get configuration from it
|
|
26
|
+
* @param element the HTML element to analyze.
|
|
27
|
+
*/
|
|
28
|
+
HTMLMapper.prototype.map = function (element) {
|
|
29
|
+
var config = {};
|
|
30
|
+
var _loop_1 = function (attrIdx) {
|
|
31
|
+
var attr = element.attributes.item(attrIdx);
|
|
32
|
+
if (!attr) {
|
|
33
|
+
return "continue";
|
|
34
|
+
}
|
|
35
|
+
// map "object.property" to the right configuration place.
|
|
36
|
+
var split = attr.nodeName.split(".");
|
|
37
|
+
split.reduce(function (currentConfig, key, idx) {
|
|
38
|
+
//convert html-style to json-style
|
|
39
|
+
var camelKey = kebabToCamel(key);
|
|
40
|
+
if (idx === split.length - 1) {
|
|
41
|
+
var val = attr.nodeValue; // firefox warns nodeValue is deprecated, but I found no sign of it anywhere.
|
|
42
|
+
if (val === "true") {
|
|
43
|
+
val = true;
|
|
44
|
+
}
|
|
45
|
+
else if (val === "false") {
|
|
46
|
+
val = false;
|
|
47
|
+
}
|
|
48
|
+
else if (val === "undefined") {
|
|
49
|
+
val = undefined;
|
|
50
|
+
}
|
|
51
|
+
else if (val === "null") {
|
|
52
|
+
val = null;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
var isnum = !isNaN(parseFloat(val)) && isFinite(val); ///^\d+$/.test(val);
|
|
56
|
+
if (isnum) {
|
|
57
|
+
var number = parseFloat(val);
|
|
58
|
+
if (!isNaN(number)) {
|
|
59
|
+
val = number;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
currentConfig[camelKey] = val;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
currentConfig[camelKey] = currentConfig[camelKey] || {};
|
|
67
|
+
}
|
|
68
|
+
return currentConfig[camelKey];
|
|
69
|
+
}, config);
|
|
70
|
+
};
|
|
71
|
+
for (var attrIdx = 0; attrIdx < element.attributes.length; ++attrIdx) {
|
|
72
|
+
_loop_1(attrIdx);
|
|
73
|
+
}
|
|
74
|
+
return config;
|
|
75
|
+
};
|
|
76
|
+
return HTMLMapper;
|
|
77
|
+
}());
|
|
78
|
+
/**
|
|
79
|
+
* A simple string-to-JSON mapper.
|
|
80
|
+
* This is the main mapper, used to analyze downloaded JSON-Configuration or JSON payload
|
|
81
|
+
*/
|
|
82
|
+
var JSONMapper = /** @class */ (function () {
|
|
83
|
+
function JSONMapper() {
|
|
84
|
+
}
|
|
85
|
+
JSONMapper.prototype.map = function (rawSource) {
|
|
86
|
+
return JSON.parse(rawSource);
|
|
87
|
+
};
|
|
88
|
+
return JSONMapper;
|
|
89
|
+
}());
|
|
90
|
+
/**
|
|
91
|
+
* The DOM Mapper will traverse an entire DOM Tree and will load the configuration from the
|
|
92
|
+
* DOM elements and attributes.
|
|
93
|
+
*/
|
|
94
|
+
var DOMMapper = /** @class */ (function () {
|
|
95
|
+
function DOMMapper() {
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The mapping function that will convert HTML data to a viewer configuration object
|
|
99
|
+
* @param baseElement the baseElement from which to start traversing
|
|
100
|
+
* @returns a ViewerConfiguration object from the provided HTML Element
|
|
101
|
+
*/
|
|
102
|
+
DOMMapper.prototype.map = function (baseElement) {
|
|
103
|
+
var htmlMapper = new HTMLMapper();
|
|
104
|
+
var config = htmlMapper.map(baseElement);
|
|
105
|
+
var traverseChildren = function (element, partConfig) {
|
|
106
|
+
var children = element.children;
|
|
107
|
+
if (children.length) {
|
|
108
|
+
for (var i = 0; i < children.length; ++i) {
|
|
109
|
+
var item = children.item(i);
|
|
110
|
+
// use the HTML Mapper to read configuration from a single element
|
|
111
|
+
var configMapped = htmlMapper.map(item);
|
|
112
|
+
var key = kebabToCamel(item.nodeName.toLowerCase());
|
|
113
|
+
if (item.attributes.getNamedItem("array") && item.attributes.getNamedItem("array").nodeValue === "true") {
|
|
114
|
+
partConfig[key] = [];
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
if (element.attributes.getNamedItem("array") && element.attributes.getNamedItem("array").nodeValue === "true") {
|
|
118
|
+
partConfig.push(configMapped);
|
|
119
|
+
}
|
|
120
|
+
else if (partConfig[key]) {
|
|
121
|
+
//exists already! probably an array
|
|
122
|
+
element.setAttribute("array", "true");
|
|
123
|
+
var oldItem = partConfig[key];
|
|
124
|
+
partConfig = [oldItem, configMapped];
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
partConfig[key] = configMapped;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
traverseChildren(item, partConfig[key] || configMapped);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return partConfig;
|
|
134
|
+
};
|
|
135
|
+
traverseChildren(baseElement, config);
|
|
136
|
+
return config;
|
|
137
|
+
};
|
|
138
|
+
return DOMMapper;
|
|
139
|
+
}());
|
|
140
|
+
/**
|
|
141
|
+
* The MapperManager manages the different implemented mappers.
|
|
142
|
+
* It allows the user to register new mappers as well and use them to parse their own configuration data
|
|
143
|
+
*/
|
|
144
|
+
var MapperManager = /** @class */ (function () {
|
|
145
|
+
function MapperManager() {
|
|
146
|
+
this._mappers = {
|
|
147
|
+
html: new HTMLMapper(),
|
|
148
|
+
json: new JSONMapper(),
|
|
149
|
+
dom: new DOMMapper(),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get a specific configuration mapper.
|
|
154
|
+
*
|
|
155
|
+
* @param type the name of the mapper to load
|
|
156
|
+
*/
|
|
157
|
+
MapperManager.prototype.getMapper = function (type) {
|
|
158
|
+
if (!this._mappers[type]) {
|
|
159
|
+
Tools.Error("No mapper defined for " + type);
|
|
160
|
+
}
|
|
161
|
+
return this._mappers[type];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Use this function to register your own configuration mapper.
|
|
165
|
+
* After a mapper is registered, it can be used to parse the specific type fo configuration to the standard ViewerConfiguration.
|
|
166
|
+
* @param type the name of the mapper. This will be used to define the configuration type and/or to get the mapper
|
|
167
|
+
* @param mapper The implemented mapper
|
|
168
|
+
*/
|
|
169
|
+
MapperManager.prototype.registerMapper = function (type, mapper) {
|
|
170
|
+
this._mappers[type] = mapper;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Dispose the mapper manager and all of its mappers.
|
|
174
|
+
*/
|
|
175
|
+
MapperManager.prototype.dispose = function () {
|
|
176
|
+
this._mappers = {};
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* The default mapper is the JSON mapper.
|
|
180
|
+
*/
|
|
181
|
+
MapperManager.DefaultMapper = "json";
|
|
182
|
+
return MapperManager;
|
|
183
|
+
}());
|
|
184
|
+
export { MapperManager };
|
|
185
|
+
/**
|
|
186
|
+
* mapperManager is a singleton of the type MapperManager.
|
|
187
|
+
* The mapperManager can be disposed directly with calling mapperManager.dispose()
|
|
188
|
+
* or indirectly with using BabylonViewer.disposeAll()
|
|
189
|
+
*/
|
|
190
|
+
export var mapperManager = new MapperManager();
|
|
191
191
|
//# sourceMappingURL=mappers.js.map
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import type { ViewerConfiguration } from "./configuration";
|
|
2
|
-
/**
|
|
3
|
-
* The configuration loader will load the configuration object from any source and will use the defined mapper to
|
|
4
|
-
* parse the object and return a conform ViewerConfiguration.
|
|
5
|
-
* It is a private member of the scene.
|
|
6
|
-
*/
|
|
7
|
-
export declare class RenderOnlyConfigurationLoader {
|
|
8
|
-
private _enableCache;
|
|
9
|
-
private _configurationCache;
|
|
10
|
-
private _loadRequests;
|
|
11
|
-
constructor(_enableCache?: boolean);
|
|
12
|
-
private _getConfigurationTypeExcludeTemplate;
|
|
13
|
-
protected getExtendedConfig(type: string | undefined): ViewerConfiguration;
|
|
14
|
-
/**
|
|
15
|
-
* load a configuration object that is defined in the initial configuration provided.
|
|
16
|
-
* The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
|
|
17
|
-
*
|
|
18
|
-
* @param initConfig the initial configuration that has the definitions of further configuration to load.
|
|
19
|
-
* @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
|
|
20
|
-
* @returns A promise that delivers the extended viewer configuration, when done.
|
|
21
|
-
*/
|
|
22
|
-
loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
|
|
23
|
-
/**
|
|
24
|
-
* Dispose the configuration loader. This will cancel file requests, if active.
|
|
25
|
-
*/
|
|
26
|
-
dispose(): void;
|
|
27
|
-
/**
|
|
28
|
-
* This function will process the initial configuration and make needed changes for the viewer to work.
|
|
29
|
-
* @param config the mutable(!) initial configuration to process
|
|
30
|
-
*/
|
|
31
|
-
private _processInitialConfiguration;
|
|
32
|
-
private _loadFile;
|
|
33
|
-
}
|
|
1
|
+
import type { ViewerConfiguration } from "./configuration";
|
|
2
|
+
/**
|
|
3
|
+
* The configuration loader will load the configuration object from any source and will use the defined mapper to
|
|
4
|
+
* parse the object and return a conform ViewerConfiguration.
|
|
5
|
+
* It is a private member of the scene.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RenderOnlyConfigurationLoader {
|
|
8
|
+
private _enableCache;
|
|
9
|
+
private _configurationCache;
|
|
10
|
+
private _loadRequests;
|
|
11
|
+
constructor(_enableCache?: boolean);
|
|
12
|
+
private _getConfigurationTypeExcludeTemplate;
|
|
13
|
+
protected getExtendedConfig(type: string | undefined): ViewerConfiguration;
|
|
14
|
+
/**
|
|
15
|
+
* load a configuration object that is defined in the initial configuration provided.
|
|
16
|
+
* The viewer configuration can extend different types of configuration objects and have an extra configuration defined.
|
|
17
|
+
*
|
|
18
|
+
* @param initConfig the initial configuration that has the definitions of further configuration to load.
|
|
19
|
+
* @param callback an optional callback that will be called sync, if noconfiguration needs to be loaded or configuration is payload-only
|
|
20
|
+
* @returns A promise that delivers the extended viewer configuration, when done.
|
|
21
|
+
*/
|
|
22
|
+
loadConfiguration(initConfig?: ViewerConfiguration, callback?: (config: ViewerConfiguration) => void): Promise<ViewerConfiguration>;
|
|
23
|
+
/**
|
|
24
|
+
* Dispose the configuration loader. This will cancel file requests, if active.
|
|
25
|
+
*/
|
|
26
|
+
dispose(): void;
|
|
27
|
+
/**
|
|
28
|
+
* This function will process the initial configuration and make needed changes for the viewer to work.
|
|
29
|
+
* @param config the mutable(!) initial configuration to process
|
|
30
|
+
*/
|
|
31
|
+
private _processInitialConfiguration;
|
|
32
|
+
private _loadFile;
|
|
33
|
+
}
|