@loaders.gl/tile-converter 3.3.0-alpha.3 → 3.3.0-alpha.5
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/dist/3d-tiles-attributes-worker.d.ts +1 -1
- package/dist/3d-tiles-attributes-worker.js +2 -2
- package/dist/3d-tiles-attributes-worker.js.map +2 -2
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +8 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +57 -43
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +21 -17
- package/dist/converter.min.js +21 -21
- package/dist/deps-installer/deps-installer.d.ts +5 -1
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +21 -1
- package/dist/dist.min.js +662 -1018
- package/dist/es5/3d-tiles-attributes-worker.js +2 -2
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +115 -101
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +27 -19
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +70 -6
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +4 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +153 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +40 -44
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +55 -36
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +10 -2
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +364 -435
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +2 -2
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +59 -44
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +25 -15
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +21 -2
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +4 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +138 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +19 -21
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +55 -36
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +9 -2
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +93 -183
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/i3s-attributes-worker.d.ts +5 -1
- package/dist/i3s-attributes-worker.d.ts.map +1 -1
- package/dist/i3s-attributes-worker.js +3 -3
- package/dist/i3s-attributes-worker.js.map +2 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +2 -3
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +2 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +32 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +162 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +5 -4
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +29 -27
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +50 -30
- package/dist/i3s-converter/helpers/node-pages.d.ts +4 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +9 -2
- package/dist/i3s-converter/i3s-converter.d.ts +24 -48
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +88 -186
- package/dist/i3s-converter/types.d.ts +4 -0
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/workers/3d-tiles-attributes-worker.js +1 -1
- package/package.json +15 -15
- package/src/3d-tiles-attributes-worker.ts +1 -1
- package/src/3d-tiles-converter/3d-tiles-converter.ts +71 -55
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +25 -18
- package/src/deps-installer/deps-installer.ts +29 -2
- package/src/i3s-attributes-worker.ts +5 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +13 -6
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +182 -0
- package/src/i3s-converter/helpers/geometry-converter.ts +45 -36
- package/src/i3s-converter/helpers/gltf-attributes.ts +54 -33
- package/src/i3s-converter/helpers/node-pages.ts +10 -2
- package/src/i3s-converter/i3s-converter.ts +125 -210
- package/src/i3s-converter/types.ts +4 -0
- package/src/workers/3d-tiles-attributes-worker.ts +1 -1
|
@@ -31,4 +31,142 @@ export function checkPropertiesLength(featureIds, propertyTable) {
|
|
|
31
31
|
|
|
32
32
|
return needFlatten;
|
|
33
33
|
}
|
|
34
|
+
const STRING_TYPE = 'string';
|
|
35
|
+
const SHORT_INT_TYPE = 'Int32';
|
|
36
|
+
const DOUBLE_TYPE = 'double';
|
|
37
|
+
const OBJECT_ID_TYPE = 'OBJECTID';
|
|
38
|
+
export function getAttributeType(key, attribute) {
|
|
39
|
+
if (key === OBJECT_ID_TYPE) {
|
|
40
|
+
return OBJECT_ID_TYPE;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof attribute === STRING_TYPE) {
|
|
44
|
+
return STRING_TYPE;
|
|
45
|
+
} else if (typeof attribute === 'number') {
|
|
46
|
+
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return STRING_TYPE;
|
|
50
|
+
}
|
|
51
|
+
export function createdStorageAttribute(attributeIndex, key, attributeType) {
|
|
52
|
+
const storageAttribute = {
|
|
53
|
+
key: "f_".concat(attributeIndex),
|
|
54
|
+
name: key,
|
|
55
|
+
ordering: ['attributeValues'],
|
|
56
|
+
header: [{
|
|
57
|
+
property: 'count',
|
|
58
|
+
valueType: 'UInt32'
|
|
59
|
+
}],
|
|
60
|
+
attributeValues: {
|
|
61
|
+
valueType: 'Int32',
|
|
62
|
+
valuesPerElement: 1
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
switch (attributeType) {
|
|
67
|
+
case OBJECT_ID_TYPE:
|
|
68
|
+
setupIdAttribute(storageAttribute);
|
|
69
|
+
break;
|
|
70
|
+
|
|
71
|
+
case STRING_TYPE:
|
|
72
|
+
setupStringAttribute(storageAttribute);
|
|
73
|
+
break;
|
|
74
|
+
|
|
75
|
+
case DOUBLE_TYPE:
|
|
76
|
+
setupDoubleAttribute(storageAttribute);
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case SHORT_INT_TYPE:
|
|
80
|
+
break;
|
|
81
|
+
|
|
82
|
+
default:
|
|
83
|
+
setupStringAttribute(storageAttribute);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return storageAttribute;
|
|
87
|
+
}
|
|
88
|
+
export function getFieldAttributeType(attributeType) {
|
|
89
|
+
switch (attributeType) {
|
|
90
|
+
case OBJECT_ID_TYPE:
|
|
91
|
+
return 'esriFieldTypeOID';
|
|
92
|
+
|
|
93
|
+
case STRING_TYPE:
|
|
94
|
+
return 'esriFieldTypeString';
|
|
95
|
+
|
|
96
|
+
case SHORT_INT_TYPE:
|
|
97
|
+
return 'esriFieldTypeInteger';
|
|
98
|
+
|
|
99
|
+
case DOUBLE_TYPE:
|
|
100
|
+
return 'esriFieldTypeDouble';
|
|
101
|
+
|
|
102
|
+
default:
|
|
103
|
+
return 'esriFieldTypeString';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function createFieldAttribute(key, fieldAttributeType) {
|
|
107
|
+
return {
|
|
108
|
+
name: key,
|
|
109
|
+
type: fieldAttributeType,
|
|
110
|
+
alias: key
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function createPopupInfo(propertyTable) {
|
|
114
|
+
const title = '{OBJECTID}';
|
|
115
|
+
const mediaInfos = [];
|
|
116
|
+
const fieldInfos = [];
|
|
117
|
+
const popupElements = [];
|
|
118
|
+
const expressionInfos = [];
|
|
119
|
+
|
|
120
|
+
for (const key in propertyTable) {
|
|
121
|
+
fieldInfos.push({
|
|
122
|
+
fieldName: key,
|
|
123
|
+
visible: true,
|
|
124
|
+
isEditable: false,
|
|
125
|
+
label: key
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
popupElements.push({
|
|
130
|
+
fieldInfos,
|
|
131
|
+
type: 'fields'
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
title,
|
|
135
|
+
mediaInfos,
|
|
136
|
+
popupElements,
|
|
137
|
+
fieldInfos,
|
|
138
|
+
expressionInfos
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function setupStringAttribute(storageAttribute) {
|
|
143
|
+
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
144
|
+
storageAttribute.header.push({
|
|
145
|
+
property: 'attributeValuesByteCount',
|
|
146
|
+
valueType: 'UInt32'
|
|
147
|
+
});
|
|
148
|
+
storageAttribute.attributeValues = {
|
|
149
|
+
valueType: 'String',
|
|
150
|
+
encoding: 'UTF-8',
|
|
151
|
+
valuesPerElement: 1
|
|
152
|
+
};
|
|
153
|
+
storageAttribute.attributeByteCounts = {
|
|
154
|
+
valueType: 'UInt32',
|
|
155
|
+
valuesPerElement: 1
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function setupIdAttribute(storageAttribute) {
|
|
160
|
+
storageAttribute.attributeValues = {
|
|
161
|
+
valueType: 'Oid32',
|
|
162
|
+
valuesPerElement: 1
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function setupDoubleAttribute(storageAttribute) {
|
|
167
|
+
storageAttribute.attributeValues = {
|
|
168
|
+
valueType: 'Float64',
|
|
169
|
+
valuesPerElement: 1
|
|
170
|
+
};
|
|
171
|
+
}
|
|
34
172
|
//# sourceMappingURL=feature-attributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":["flattenPropertyTableByFeatureIds","featureIds","propertyTable","resultPropertyTable","propertyName","properties","getPropertiesByFeatureIds","resultProperties","featureId","property","push","checkPropertiesLength","needFlatten","attribute","Object","values","length"],"mappings":"AAeA,OAAO,SAASA,gCAAT,CACLC,UADK,EAELC,aAFK,EAGa;AAClB,QAAMC,mBAAqC,GAAG,EAA9C;;AACA,OAAK,MAAMC,YAAX,IAA2BF,aAA3B,EAA0C;AACxC,UAAMG,UAAU,GAAGH,aAAa,CAACE,YAAD,CAAhC;AACAD,IAAAA,mBAAmB,CAACC,YAAD,CAAnB,GAAoCE,yBAAyB,CAACD,UAAD,EAAaJ,UAAb,CAA7D;AACD;;AAED,SAAOE,mBAAP;AACD;;AAOD,SAASG,yBAAT,CAAmCD,UAAnC,EAAsDJ,UAAtD,EAAmF;AACjF,QAAMM,gBAAqB,GAAG,EAA9B;;AAEA,OAAK,MAAMC,SAAX,IAAwBP,UAAxB,EAAoC;AAClC,UAAMQ,QAAQ,GAAGJ,UAAU,CAACG,SAAD,CAAV,IAAyB,IAA1C;AACAD,IAAAA,gBAAgB,CAACG,IAAjB,CAAsBD,QAAtB;AACD;;AAED,SAAOF,gBAAP;AACD;;AASD,OAAO,SAASI,qBAAT,CACLV,UADK,EAELC,aAFK,EAGI;AACT,MAAIU,WAAW,GAAG,KAAlB;;AAEA,OAAK,MAAMC,SAAX,IAAwBC,MAAM,CAACC,MAAP,CAAcb,aAAd,CAAxB,EAAsD;AACpD,QAAID,UAAU,CAACe,MAAX,KAAsBH,SAAS,CAACG,MAApC,EAA4C;AAC1CJ,MAAAA,WAAW,GAAG,IAAd;AACD;AACF;;AAED,SAAOA,WAAP;AACD","sourcesContent":["import type {FeatureTableJson} from '@loaders.gl/3d-tiles';\n\n/**\n * Takes attributes from property table based on featureIds.\n * If there is no property value for particular featureId (index) the property will be null.\n * Example:\n * Initial data:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']\n * Result:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'null']\n * @param featureIds\n * @param propertyTable\n */\nexport function flattenPropertyTableByFeatureIds(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): FeatureTableJson {\n const resultPropertyTable: FeatureTableJson = {};\n for (const propertyName in propertyTable) {\n const properties = propertyTable[propertyName];\n resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);\n }\n\n return resultPropertyTable;\n}\n\n/**\n * Getting properties by featureId index\n * @param properties\n * @param featureIds\n */\nfunction getPropertiesByFeatureIds(properties: any[], featureIds: number[]): any[] {\n const resultProperties: any = [];\n\n for (const featureId of featureIds) {\n const property = properties[featureId] || null;\n resultProperties.push(property);\n }\n\n return resultProperties;\n}\n\n/**\n * Check that all attributes in propertyTable have the same length as FeatureIds.\n * If there are differencies between lengths we should flatten property table based on exiesting featureIds.\n * @param featureIds\n * @param propertyTable\n * @returns\n */\nexport function checkPropertiesLength(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): boolean {\n let needFlatten = false;\n\n for (const attribute of Object.values(propertyTable)) {\n if (featureIds.length !== attribute.length) {\n needFlatten = true;\n }\n }\n\n return needFlatten;\n}\n"],"file":"feature-attributes.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":["flattenPropertyTableByFeatureIds","featureIds","propertyTable","resultPropertyTable","propertyName","properties","getPropertiesByFeatureIds","resultProperties","featureId","property","push","checkPropertiesLength","needFlatten","attribute","Object","values","length","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","getAttributeType","key","Number","isInteger","createdStorageAttribute","attributeIndex","attributeType","storageAttribute","name","ordering","header","valueType","attributeValues","valuesPerElement","setupIdAttribute","setupStringAttribute","setupDoubleAttribute","getFieldAttributeType","createFieldAttribute","fieldAttributeType","type","alias","createPopupInfo","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","unshift","encoding","attributeByteCounts"],"mappings":"AAuBA,OAAO,SAASA,gCAAT,CACLC,UADK,EAELC,aAFK,EAGa;AAClB,QAAMC,mBAAqC,GAAG,EAA9C;;AACA,OAAK,MAAMC,YAAX,IAA2BF,aAA3B,EAA0C;AACxC,UAAMG,UAAU,GAAGH,aAAa,CAACE,YAAD,CAAhC;AACAD,IAAAA,mBAAmB,CAACC,YAAD,CAAnB,GAAoCE,yBAAyB,CAACD,UAAD,EAAaJ,UAAb,CAA7D;AACD;;AAED,SAAOE,mBAAP;AACD;;AAOD,SAASG,yBAAT,CAAmCD,UAAnC,EAAsDJ,UAAtD,EAAmF;AACjF,QAAMM,gBAAqB,GAAG,EAA9B;;AAEA,OAAK,MAAMC,SAAX,IAAwBP,UAAxB,EAAoC;AAClC,UAAMQ,QAAQ,GAAGJ,UAAU,CAACG,SAAD,CAAV,IAAyB,IAA1C;AACAD,IAAAA,gBAAgB,CAACG,IAAjB,CAAsBD,QAAtB;AACD;;AAED,SAAOF,gBAAP;AACD;;AASD,OAAO,SAASI,qBAAT,CACLV,UADK,EAELC,aAFK,EAGI;AACT,MAAIU,WAAW,GAAG,KAAlB;;AAEA,OAAK,MAAMC,SAAX,IAAwBC,MAAM,CAACC,MAAP,CAAcb,aAAd,CAAxB,EAAsD;AACpD,QAAID,UAAU,CAACe,MAAX,KAAsBH,SAAS,CAACG,MAApC,EAA4C;AAC1CJ,MAAAA,WAAW,GAAG,IAAd;AACD;AACF;;AAED,SAAOA,WAAP;AACD;AAGD,MAAMK,WAAW,GAAG,QAApB;AAEA,MAAMC,cAAc,GAAG,OAAvB;AAE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AjB,CAAwBrB,IAAxB,CAA6B;AAACD,IAAAA,QAAQ,EAAE,0BAAX;AAAuCuB,IAAAA,SAAS,EAAE;AAAlD,GAA7B;AACAJ,EAAAA,gBAAgB,CAACK,eAAjB,GAAmC;AACjCD,IAAAA,SAAS,EAAE,QADsB;AAEjCsB,IAAAA,QAAQ,EAAE,OAFuB;AAGjCpB,IAAAA,gBAAgB,EAAE;AAHe,GAAnC;AAKAN,EAAAA,gBAAgB,CAAC2B,mBAAjB,GAAuC;AACrCvB,IAAAA,SAAS,EAAE,QAD0B;AAErCE,IAAAA,gBAAgB,EAAE;AAFmB,GAAvC;AAID;;AAMD,SAASC,gBAAT,CAA0BP,gBAA1B,EAAwE;AACtEA,EAAAA,gBAAgB,CAACK,eAAjB,GAAmC;AACjCD,IAAAA,SAAS,EAAE,OADsB;AAEjCE,IAAAA,gBAAgB,EAAE;AAFe,GAAnC;AAID;;AAMD,SAASG,oBAAT,CAA8BT,gBAA9B,EAA4E;AAC1EA,EAAAA,gBAAgB,CAACK,eAAjB,GAAmC;AACjCD,IAAAA,SAAS,EAAE,SADsB;AAEjCE,IAAAA,gBAAgB,EAAE;AAFe,GAAnC;AAID","sourcesContent":["import type {FeatureTableJson} from '@loaders.gl/3d-tiles';\nimport {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\n/**\n * Takes attributes from property table based on featureIds.\n * If there is no property value for particular featureId (index) the property will be null.\n * Example:\n * Initial data:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']\n * Result:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'null']\n * @param featureIds\n * @param propertyTable\n */\nexport function flattenPropertyTableByFeatureIds(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): FeatureTableJson {\n const resultPropertyTable: FeatureTableJson = {};\n for (const propertyName in propertyTable) {\n const properties = propertyTable[propertyName];\n resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);\n }\n\n return resultPropertyTable;\n}\n\n/**\n * Getting properties by featureId index\n * @param properties\n * @param featureIds\n */\nfunction getPropertiesByFeatureIds(properties: any[], featureIds: number[]): any[] {\n const resultProperties: any = [];\n\n for (const featureId of featureIds) {\n const property = properties[featureId] || null;\n resultProperties.push(property);\n }\n\n return resultProperties;\n}\n\n/**\n * Check that all attributes in propertyTable have the same length as FeatureIds.\n * If there are differencies between lengths we should flatten property table based on exiesting featureIds.\n * @param featureIds\n * @param propertyTable\n * @returns\n */\nexport function checkPropertiesLength(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): boolean {\n let needFlatten = false;\n\n for (const attribute of Object.values(propertyTable)) {\n if (featureIds.length !== attribute.length) {\n needFlatten = true;\n }\n }\n\n return needFlatten;\n}\n\n/** String data type name for feature attributes */\nconst STRING_TYPE = 'string';\n/** Integer data type name for feature attributes */\nconst SHORT_INT_TYPE = 'Int32';\n/** Double data type name for feature attributes */\nconst DOUBLE_TYPE = 'double';\n/** Type of attribute that is linked with feature ids */\nconst OBJECT_ID_TYPE = 'OBJECTID';\n/**\n * Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param key - attribute's key\n * @param attribute - attribute's type in propertyTable\n */\nexport function getAttributeType(key: string, attribute: string): string {\n if (key === OBJECT_ID_TYPE) {\n return OBJECT_ID_TYPE;\n }\n if (typeof attribute === STRING_TYPE) {\n return STRING_TYPE;\n } else if (typeof attribute === 'number') {\n return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;\n }\n return STRING_TYPE;\n}\n\n/**\n * Generate storage attribute for map segmentation.\n * @param attributeIndex - order index of attribute (f_0, f_1 ...).\n * @param key - attribute key from propertyTable.\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\nexport function createdStorageAttribute(\n attributeIndex: number,\n key: string,\n attributeType: Attribute\n): AttributeStorageInfo {\n const storageAttribute = {\n key: `f_${attributeIndex}`,\n name: key,\n ordering: ['attributeValues'],\n header: [{property: 'count', valueType: 'UInt32'}],\n attributeValues: {valueType: 'Int32', valuesPerElement: 1}\n };\n\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n}\n\n/**\n * Find and return attribute type based on key form propertyTable.\n * @param attributeType\n */\nexport function getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case STRING_TYPE:\n return 'esriFieldTypeString';\n case SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n}\n\n/**\n * Setup field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\nexport function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n}\n\n/**\n * Generate popup info to show metadata on the map.\n * @param propertyTable - table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\nexport function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos: FieldInfo[] = [];\n const popupElements: {\n fieldInfos: FieldInfo[];\n type: string;\n }[] = [];\n const expressionInfos = [];\n\n for (const key in propertyTable) {\n fieldInfos.push({\n fieldName: key,\n visible: true,\n isEditable: false,\n label: key\n });\n }\n popupElements.push({\n fieldInfos,\n type: 'fields'\n });\n\n return {\n title,\n mediaInfos,\n popupElements,\n fieldInfos,\n expressionInfos\n };\n}\n\n/**\n * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\nfunction setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\n // @ts-expect-error\n storageAttribute.ordering.unshift('attributeByteCounts');\n storageAttribute.header.push({property: 'attributeValuesByteCount', valueType: 'UInt32'});\n storageAttribute.attributeValues = {\n valueType: 'String',\n encoding: 'UTF-8',\n valuesPerElement: 1\n };\n storageAttribute.attributeByteCounts = {\n valueType: 'UInt32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n}\n"],"file":"feature-attributes.js"}
|
|
@@ -22,7 +22,7 @@ const BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ['CUSTOM_ATTRIBUTE_2', '_BATCHID', '
|
|
|
22
22
|
const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
|
|
23
23
|
const EXT_MESH_FEATURES = 'EXT_mesh_features';
|
|
24
24
|
let scratchVector = new Vector3();
|
|
25
|
-
export default async function convertB3dmToI3sGeometry(tileContent,
|
|
25
|
+
export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel, workerSource) {
|
|
26
26
|
var _tileContent$gltf;
|
|
27
27
|
|
|
28
28
|
const useCartesianPositions = generateBoundingVolumes;
|
|
@@ -41,7 +41,6 @@ export default async function convertB3dmToI3sGeometry(tileContent, nodeId, prop
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const result = [];
|
|
44
|
-
let nodesCounter = nodeId;
|
|
45
44
|
let {
|
|
46
45
|
materials = []
|
|
47
46
|
} = tileContent.gltf || {
|
|
@@ -71,19 +70,19 @@ export default async function convertB3dmToI3sGeometry(tileContent, nodeId, prop
|
|
|
71
70
|
material,
|
|
72
71
|
texture
|
|
73
72
|
} = materialAndTextureList[i];
|
|
73
|
+
const nodeId = addNodeToNodePage();
|
|
74
74
|
result.push(await _makeNodeResources({
|
|
75
75
|
convertedAttributes,
|
|
76
76
|
material,
|
|
77
77
|
texture,
|
|
78
78
|
tileContent,
|
|
79
|
-
nodeId
|
|
79
|
+
nodeId,
|
|
80
80
|
featuresHashArray,
|
|
81
81
|
propertyTable,
|
|
82
82
|
attributeStorageInfo,
|
|
83
83
|
draco,
|
|
84
84
|
workerSource
|
|
85
85
|
}));
|
|
86
|
-
nodesCounter++;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
if (!result.length) {
|
|
@@ -158,6 +157,7 @@ async function _makeNodeResources({
|
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
return {
|
|
160
|
+
nodeId,
|
|
161
161
|
geometry: fileBuffer,
|
|
162
162
|
compressedGeometry,
|
|
163
163
|
texture,
|
|
@@ -174,6 +174,7 @@ export async function convertAttributes(attributesData, useCartesianPositions) {
|
|
|
174
174
|
const {
|
|
175
175
|
gltfMaterials,
|
|
176
176
|
nodes,
|
|
177
|
+
images,
|
|
177
178
|
cartographicOrigin,
|
|
178
179
|
cartesianModelMatrix
|
|
179
180
|
} = attributesData;
|
|
@@ -193,7 +194,7 @@ export async function convertAttributes(attributesData, useCartesianPositions) {
|
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
197
|
+
convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
197
198
|
|
|
198
199
|
for (const attrKey of attributesMap.keys()) {
|
|
199
200
|
const attributes = attributesMap.get(attrKey);
|
|
@@ -216,10 +217,10 @@ export async function convertAttributes(attributesData, useCartesianPositions) {
|
|
|
216
217
|
return attributesMap;
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
function convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
220
|
+
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
220
221
|
if (nodes) {
|
|
221
222
|
for (const node of nodes) {
|
|
222
|
-
convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
|
|
223
|
+
convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
}
|
|
@@ -252,16 +253,15 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
252
253
|
return transformationMatrix;
|
|
253
254
|
}
|
|
254
255
|
|
|
255
|
-
function convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
256
|
+
function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
256
257
|
const transformationMatrix = getCompositeTransformationMatrix(node, matrix);
|
|
257
258
|
const mesh = node.mesh;
|
|
258
|
-
const images = node.images;
|
|
259
259
|
|
|
260
260
|
if (mesh) {
|
|
261
261
|
convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
convertNodes(node.children || [], cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
264
|
+
convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
@@ -825,10 +825,8 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
|
|
|
825
825
|
return orderedFeatureIndices;
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
export function getPropertyTable(
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
const batchTableJson = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content = sourceTile.content) === null || _sourceTile$content === void 0 ? void 0 : _sourceTile$content.batchTableJson;
|
|
828
|
+
export function getPropertyTable(tileContent) {
|
|
829
|
+
const batchTableJson = tileContent === null || tileContent === void 0 ? void 0 : tileContent.batchTableJson;
|
|
832
830
|
|
|
833
831
|
if (batchTableJson) {
|
|
834
832
|
return batchTableJson;
|
|
@@ -837,7 +835,7 @@ export function getPropertyTable(sourceTile) {
|
|
|
837
835
|
const {
|
|
838
836
|
extensionName,
|
|
839
837
|
extension
|
|
840
|
-
} = getPropertyTableExtension(
|
|
838
|
+
} = getPropertyTableExtension(tileContent);
|
|
841
839
|
|
|
842
840
|
switch (extensionName) {
|
|
843
841
|
case EXT_MESH_FEATURES:
|
|
@@ -856,11 +854,11 @@ export function getPropertyTable(sourceTile) {
|
|
|
856
854
|
}
|
|
857
855
|
}
|
|
858
856
|
|
|
859
|
-
function getPropertyTableExtension(
|
|
860
|
-
var
|
|
857
|
+
function getPropertyTableExtension(tileContent) {
|
|
858
|
+
var _tileContent$gltf3, _tileContent$gltf5, _tileContent$gltf5$ex;
|
|
861
859
|
|
|
862
860
|
const extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
|
|
863
|
-
const extensionsUsed =
|
|
861
|
+
const extensionsUsed = tileContent === null || tileContent === void 0 ? void 0 : (_tileContent$gltf3 = tileContent.gltf) === null || _tileContent$gltf3 === void 0 ? void 0 : _tileContent$gltf3.extensionsUsed;
|
|
864
862
|
|
|
865
863
|
if (!extensionsUsed) {
|
|
866
864
|
return {
|
|
@@ -871,8 +869,8 @@ function getPropertyTableExtension(sourceTile) {
|
|
|
871
869
|
|
|
872
870
|
let extensionName = '';
|
|
873
871
|
|
|
874
|
-
for (const extensionItem of
|
|
875
|
-
var
|
|
872
|
+
for (const extensionItem of (tileContent === null || tileContent === void 0 ? void 0 : (_tileContent$gltf4 = tileContent.gltf) === null || _tileContent$gltf4 === void 0 ? void 0 : _tileContent$gltf4.extensionsUsed) || []) {
|
|
873
|
+
var _tileContent$gltf4;
|
|
876
874
|
|
|
877
875
|
if (extensionsWithPropertyTables.includes(extensionItem)) {
|
|
878
876
|
extensionName = extensionItem;
|
|
@@ -880,7 +878,7 @@ function getPropertyTableExtension(sourceTile) {
|
|
|
880
878
|
}
|
|
881
879
|
}
|
|
882
880
|
|
|
883
|
-
const extension =
|
|
881
|
+
const extension = tileContent === null || tileContent === void 0 ? void 0 : (_tileContent$gltf5 = tileContent.gltf) === null || _tileContent$gltf5 === void 0 ? void 0 : (_tileContent$gltf5$ex = _tileContent$gltf5.extensions) === null || _tileContent$gltf5$ex === void 0 ? void 0 : _tileContent$gltf5$ex[extensionName];
|
|
884
882
|
return {
|
|
885
883
|
extensionName,
|
|
886
884
|
extension
|