@loaders.gl/i3s 4.0.0-alpha.4 → 4.0.0-alpha.6

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 (186) hide show
  1. package/dist/arcgis-webscene-loader.d.ts +7 -0
  2. package/dist/arcgis-webscene-loader.d.ts.map +1 -0
  3. package/dist/arcgis-webscene-loader.js +28 -0
  4. package/dist/bundle.d.ts +2 -0
  5. package/dist/bundle.d.ts.map +1 -0
  6. package/dist/bundle.js +2 -2
  7. package/dist/dist.min.js +10631 -0
  8. package/dist/es5/arcgis-webscene-loader.js +40 -0
  9. package/dist/es5/arcgis-webscene-loader.js.map +1 -0
  10. package/dist/es5/bundle.js +6 -0
  11. package/dist/es5/bundle.js.map +1 -0
  12. package/dist/es5/i3s-attribute-loader.js +195 -0
  13. package/dist/es5/i3s-attribute-loader.js.map +1 -0
  14. package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
  15. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
  16. package/dist/es5/i3s-content-loader.js +57 -0
  17. package/dist/es5/i3s-content-loader.js.map +1 -0
  18. package/dist/es5/i3s-loader.js +193 -0
  19. package/dist/es5/i3s-loader.js.map +1 -0
  20. package/dist/es5/i3s-node-page-loader.js +39 -0
  21. package/dist/es5/i3s-node-page-loader.js.map +1 -0
  22. package/dist/es5/index.js +61 -0
  23. package/dist/es5/index.js.map +1 -0
  24. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +312 -0
  25. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  26. package/dist/es5/lib/parsers/constants.js +72 -0
  27. package/dist/es5/lib/parsers/constants.js.map +1 -0
  28. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +158 -0
  29. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  30. package/dist/es5/lib/parsers/parse-i3s-attribute.js +76 -0
  31. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -0
  32. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +65 -0
  33. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  34. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +510 -0
  35. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  36. package/dist/es5/lib/parsers/parse-i3s.js +116 -0
  37. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -0
  38. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
  39. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  40. package/dist/es5/lib/utils/customizeColors.js +159 -0
  41. package/dist/es5/lib/utils/customizeColors.js.map +1 -0
  42. package/dist/es5/lib/utils/url-utils.js +33 -0
  43. package/dist/es5/lib/utils/url-utils.js.map +1 -0
  44. package/dist/es5/types.js +26 -0
  45. package/dist/es5/types.js.map +1 -0
  46. package/dist/es5/workers/i3s-content-nodejs-worker.js +7 -0
  47. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -0
  48. package/dist/es5/workers/i3s-content-worker.js +6 -0
  49. package/dist/es5/workers/i3s-content-worker.js.map +1 -0
  50. package/dist/esm/arcgis-webscene-loader.js +16 -0
  51. package/dist/esm/arcgis-webscene-loader.js.map +1 -0
  52. package/dist/esm/bundle.js +4 -0
  53. package/dist/esm/bundle.js.map +1 -0
  54. package/dist/esm/i3s-attribute-loader.js +119 -0
  55. package/dist/esm/i3s-attribute-loader.js.map +1 -0
  56. package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
  57. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
  58. package/dist/esm/i3s-content-loader.js +31 -0
  59. package/dist/esm/i3s-content-loader.js.map +1 -0
  60. package/dist/esm/i3s-loader.js +87 -0
  61. package/dist/esm/i3s-loader.js.map +1 -0
  62. package/dist/esm/i3s-node-page-loader.js +15 -0
  63. package/dist/esm/i3s-node-page-loader.js.map +1 -0
  64. package/dist/esm/index.js +8 -0
  65. package/dist/esm/index.js.map +1 -0
  66. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
  67. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  68. package/dist/esm/lib/parsers/constants.js +57 -0
  69. package/dist/esm/lib/parsers/constants.js.map +1 -0
  70. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
  71. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  72. package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
  73. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
  74. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
  75. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  76. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
  77. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  78. package/dist/esm/lib/parsers/parse-i3s.js +83 -0
  79. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
  80. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
  81. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  82. package/dist/esm/lib/utils/customizeColors.js +92 -0
  83. package/dist/esm/lib/utils/customizeColors.js.map +1 -0
  84. package/dist/esm/lib/utils/url-utils.js +28 -0
  85. package/dist/esm/lib/utils/url-utils.js.map +1 -0
  86. package/dist/esm/types.js +18 -0
  87. package/dist/esm/types.js.map +1 -0
  88. package/dist/esm/workers/i3s-content-nodejs-worker.js +5 -0
  89. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -0
  90. package/dist/esm/workers/i3s-content-worker.js +4 -0
  91. package/dist/esm/workers/i3s-content-worker.js.map +1 -0
  92. package/dist/i3s-attribute-loader.d.ts +21 -0
  93. package/dist/i3s-attribute-loader.d.ts.map +1 -0
  94. package/dist/i3s-attribute-loader.js +155 -132
  95. package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
  96. package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
  97. package/dist/i3s-building-scene-layer-loader.js +23 -18
  98. package/dist/i3s-content-loader.d.ts +6 -0
  99. package/dist/i3s-content-loader.d.ts.map +1 -0
  100. package/dist/i3s-content-loader.js +30 -22
  101. package/dist/i3s-content-nodejs-worker.js +198 -0
  102. package/dist/i3s-content-nodejs-worker.js.map +7 -0
  103. package/dist/i3s-content-worker.js +1523 -1383
  104. package/dist/i3s-loader.d.ts +11 -0
  105. package/dist/i3s-loader.d.ts.map +1 -0
  106. package/dist/i3s-loader.js +88 -83
  107. package/dist/i3s-node-page-loader.d.ts +7 -0
  108. package/dist/i3s-node-page-loader.d.ts.map +1 -0
  109. package/dist/i3s-node-page-loader.js +20 -20
  110. package/dist/index.d.ts +9 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +19 -6
  113. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +74 -0
  114. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
  115. package/dist/lib/helpers/i3s-nodepages-tiles.js +232 -219
  116. package/dist/lib/parsers/constants.d.ts +40 -0
  117. package/dist/lib/parsers/constants.d.ts.map +1 -0
  118. package/dist/lib/parsers/constants.js +87 -49
  119. package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
  120. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
  121. package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
  122. package/dist/lib/parsers/parse-i3s-attribute.d.ts +12 -0
  123. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
  124. package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
  125. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
  126. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
  127. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -38
  128. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
  129. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
  130. package/dist/lib/parsers/parse-i3s-tile-content.js +458 -461
  131. package/dist/lib/parsers/parse-i3s.d.ts +6 -0
  132. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
  133. package/dist/lib/parsers/parse-i3s.js +92 -73
  134. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
  135. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
  136. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
  137. package/dist/lib/utils/customizeColors.d.ts +14 -0
  138. package/dist/lib/utils/customizeColors.d.ts.map +1 -0
  139. package/dist/lib/utils/customizeColors.js +94 -0
  140. package/dist/lib/utils/url-utils.d.ts +22 -0
  141. package/dist/lib/utils/url-utils.d.ts.map +1 -0
  142. package/dist/lib/utils/url-utils.js +41 -29
  143. package/dist/types.d.ts +1064 -0
  144. package/dist/types.d.ts.map +1 -0
  145. package/dist/types.js +20 -2
  146. package/dist/workers/i3s-content-nodejs-worker.d.ts +2 -0
  147. package/dist/workers/i3s-content-nodejs-worker.d.ts.map +1 -0
  148. package/dist/workers/i3s-content-nodejs-worker.js +6 -0
  149. package/dist/workers/i3s-content-worker.d.ts +2 -0
  150. package/dist/workers/i3s-content-worker.d.ts.map +1 -0
  151. package/dist/workers/i3s-content-worker.js +5 -4
  152. package/package.json +17 -17
  153. package/src/arcgis-webscene-loader.ts +31 -0
  154. package/src/i3s-attribute-loader.ts +9 -9
  155. package/src/i3s-content-loader.ts +19 -6
  156. package/src/i3s-loader.ts +22 -13
  157. package/src/i3s-node-page-loader.ts +6 -10
  158. package/src/index.ts +24 -7
  159. package/src/lib/helpers/i3s-nodepages-tiles.ts +84 -57
  160. package/src/lib/parsers/constants.ts +68 -55
  161. package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
  162. package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
  163. package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
  164. package/src/lib/parsers/parse-i3s-tile-content.ts +227 -200
  165. package/src/lib/parsers/parse-i3s.ts +55 -39
  166. package/src/lib/utils/customizeColors.ts +134 -0
  167. package/src/lib/utils/url-utils.ts +7 -7
  168. package/src/types.ts +874 -86
  169. package/src/workers/i3s-content-nodejs-worker.ts +5 -0
  170. package/dist/bundle.js.map +0 -1
  171. package/dist/i3s-attribute-loader.js.map +0 -1
  172. package/dist/i3s-building-scene-layer-loader.js.map +0 -1
  173. package/dist/i3s-content-loader.js.map +0 -1
  174. package/dist/i3s-loader.js.map +0 -1
  175. package/dist/i3s-node-page-loader.js.map +0 -1
  176. package/dist/index.js.map +0 -1
  177. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  178. package/dist/lib/parsers/constants.js.map +0 -1
  179. package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
  180. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  181. package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  182. package/dist/lib/parsers/parse-i3s.js.map +0 -1
  183. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  184. package/dist/lib/utils/url-utils.js.map +0 -1
  185. package/dist/types.js.map +0 -1
  186. package/dist/workers/i3s-content-worker.js.map +0 -1
package/src/types.ts CHANGED
@@ -1,10 +1,167 @@
1
- import type {GLTFMaterial} from '@loaders.gl/gltf';
2
- import type {Quaternion, Vector3} from '@math.gl/core';
3
- import type {Mesh} from '@loaders.gl/gltf';
1
+ import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';
2
+ import type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';
3
+ import {Tile3D, Tileset3D} from '@loaders.gl/tiles';
4
4
 
5
- export type Tileset = {[key: string]: any};
6
- export type NodePage = {[key: string]: any};
7
- export type Tile = {[key: string]: any};
5
+ export enum DATA_TYPE {
6
+ UInt8 = 'UInt8',
7
+ UInt16 = 'UInt16',
8
+ UInt32 = 'UInt32',
9
+ UInt64 = 'UInt64',
10
+ Int16 = 'Int16',
11
+ Int32 = 'Int32',
12
+ Int64 = 'Int64',
13
+ Float32 = 'Float32',
14
+ Float64 = 'Float64'
15
+ }
16
+
17
+ export type COLOR = [number, number, number, number];
18
+
19
+ /**
20
+ * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md
21
+ */
22
+ // TODO Replace "[key: string]: any" with actual defenition
23
+ export interface I3STilesetHeader extends SceneLayer3D {
24
+ /** Not in spec, but is necessary for woking */
25
+ url?: string;
26
+ [key: string]: any;
27
+ }
28
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePage.cmn.md */
29
+ export type NodePage = {
30
+ /** Array of nodes. */
31
+ nodes: NodeInPage[];
32
+ };
33
+ /**
34
+ * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/mesh.cmn.md
35
+ */
36
+ type NodeMesh = {
37
+ /**
38
+ * The material definition.
39
+ */
40
+ material: MeshMaterial;
41
+ /** The geometry definition. */
42
+ geometry: MeshGeometry;
43
+ /** The attribute set definition. */
44
+ attribute: meshAttribute;
45
+ };
46
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshMaterial.cmn.md */
47
+ export type MeshMaterial = {
48
+ /** The index in layer.materialDefinitions array. */
49
+ definition: number;
50
+ /** Resource id for the material textures. i.e: layers/0/nodes/{material.resource}/textures/{tex_name}. Is required if material declares any textures. */
51
+ resource?: number;
52
+ /** Estimated number of texel for the highest resolution base color texture. */
53
+ texelCountHint?: number;
54
+ };
55
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshGeometry.cmn.md */
56
+ export type MeshGeometry = {
57
+ /** The index in layer.geometryDefinitions array */
58
+ definition: number;
59
+ /** The resource locator to be used to query geometry resources: layers/0/nodes/{this.resource}/geometries/{layer.geometryDefinitions[this.definition].geometryBuffers[0 or 1]}. */
60
+ resource: number;
61
+ /** Number of vertices in the geometry buffer of this mesh for the umcompressed mesh buffer. Please note that Draco compressed meshes may have less vertices due to de-duplication (actual number of vertices is part of the Draco binary blob). Default=0 */
62
+ vertexCount?: number;
63
+ /** Number of features for this mesh. Default=0. (Must omit or set to 0 if mesh doesn't use features.) */
64
+ featureCount?: number;
65
+ };
66
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshAttribute.cmn.md */
67
+ type meshAttribute = {
68
+ /** The resource identifier to be used to locate attribute resources of this mesh. i.e. layers/0/nodes/<resource id>/attributes/... */
69
+ resource: number;
70
+ };
71
+
72
+ export type I3STextureFormat = 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';
73
+
74
+ // TODO Replace "[key: string]: any" with actual defenition
75
+ export type I3STileHeader = {
76
+ isDracoGeometry: boolean;
77
+ textureUrl?: string;
78
+ url?: string;
79
+ textureFormat?: I3STextureFormat;
80
+ textureLoaderOptions?: any;
81
+ materialDefinition?: I3SMaterialDefinition;
82
+ mbs: Mbs;
83
+ obb?: Obb;
84
+ lodSelection?: LodSelection[];
85
+ [key: string]: any;
86
+ };
87
+
88
+ export type I3SParseOptions = {
89
+ /** ArcGIS access token */
90
+ token?: string;
91
+ /** Is 3DSceneLayer json expected in response */
92
+ isTileset?: string;
93
+ /** Is 3DNodeIndexDocument json expected in response */
94
+ isTileHeader?: string;
95
+ /** Tile3D instance. This property used only to load tile content */
96
+ /** Tile-specific options */
97
+ _tileOptions?: I3STileOptions;
98
+ /** Tileset-specific options */
99
+ _tilesetOptions?: I3STilesetOptions;
100
+ /** Load Draco Compressed geometry if available */
101
+ useDracoGeometry?: boolean;
102
+ /** Load compressed textures if available */
103
+ useCompressedTextures?: boolean;
104
+ /** Set false if don't need to parse textures */
105
+ decodeTextures?: boolean;
106
+ /** deck.gl compatible coordinate system.
107
+ * https://github.com/visgl/deck.gl/blob/master/docs/developer-guide/coordinate-systems.md
108
+ * Supported coordinate systems: METER_OFFSETS, LNGLAT_OFFSETS
109
+ */
110
+ coordinateSystem?: number;
111
+ colorsByAttribute?: {
112
+ attributeName: string;
113
+ minValue: number;
114
+ maxValue: number;
115
+ minColor: COLOR;
116
+ maxColor: COLOR;
117
+ };
118
+
119
+ /** @deprecated */
120
+ tile?: Tile3D | I3STileOptions;
121
+ /** Tileset3D instance. This property used only to load tile content */
122
+ /** @deprecated */
123
+ tileset?: Tileset3D | I3STilesetOptions;
124
+ };
125
+
126
+ export type I3STileOptions = {
127
+ isDracoGeometry: boolean;
128
+ textureUrl?: string;
129
+ textureFormat?: I3STextureFormat;
130
+ textureLoaderOptions?: any;
131
+ materialDefinition?: I3SMaterialDefinition;
132
+ attributeUrls: string[];
133
+ mbs: Mbs;
134
+ };
135
+
136
+ export type I3STilesetOptions = {
137
+ store: Store;
138
+ attributeStorageInfo: AttributeStorageInfo[];
139
+ fields: Field[];
140
+ };
141
+
142
+ // TODO Replace "[key: string]: any" with actual defenition
143
+ export type I3STileContent = {
144
+ attributes: I3SMeshAttributes;
145
+ indices: TypedArray | null;
146
+ featureIds: number[] | TypedArray;
147
+ vertexCount: number;
148
+ modelMatrix: Matrix4;
149
+ coordinateSystem: number;
150
+ byteLength: number;
151
+ texture: TileContentTexture;
152
+ [key: string]: any;
153
+ };
154
+
155
+ export type TileContentTexture =
156
+ | ArrayBuffer
157
+ | {
158
+ compressed: boolean;
159
+ mipmaps: boolean;
160
+ width: number;
161
+ height: number;
162
+ data: TextureLevel[];
163
+ }
164
+ | null;
8
165
 
9
166
  export type BoundingVolumes = {
10
167
  mbs: Mbs;
@@ -14,33 +171,154 @@ export type BoundingVolumes = {
14
171
  export type Obb = {
15
172
  center: number[] | Vector3;
16
173
  halfSize: number[] | Vector3;
17
- quaternion: Quaternion;
174
+ quaternion: number[] | Quaternion;
18
175
  };
19
176
 
20
177
  export type Mbs = [number, number, number, number];
21
178
 
22
- // SceneLayer3D based on I3S specification https://github.com/Esri/i3s-spec/tree/master/docs/1.7
23
- // TODO Add description for each property
24
-
179
+ /** SceneLayer3D based on I3S specification - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md */
25
180
  export type SceneLayer3D = {
181
+ /** Unique numeric ID of the layer. */
26
182
  id: number;
183
+ /** The relative URL to the 3DSceneLayerResource. Only present as part of the SceneServiceInfo resource. */
27
184
  href?: string;
28
- layerType: string;
185
+ /** The user-visible layer type */
186
+ layerType: '3DObject' | 'IntegratedMesh';
187
+ /** The spatialReference of the layer including the vertical coordinate reference system (CRS). Well Known Text (WKT) for CRS is included to support custom CRS. */
29
188
  spatialReference?: SpatialReference;
189
+ /** Enables consuming clients to quickly determine whether this layer is compatible (with respect to its horizontal and vertical coordinate system) with existing content. */
30
190
  heightModelInfo?: HeightModelInfo;
191
+ /** The ID of the last update session in which any resource belonging to this layer has been updated. */
31
192
  version: string;
193
+ /** The name of this layer. */
32
194
  name?: string;
195
+ /** The time of the last update. */
196
+ serviceUpdateTimeStamp?: {lastUpdate: number};
197
+ /** The display alias to be used for this layer. */
198
+ alias?: string;
199
+ /** Description string for this layer. */
200
+ description?: string;
201
+ /** Copyright and usage information for the data in this layer. */
202
+ copyrightText?: string;
203
+ /** Capabilities supported by this layer. */
33
204
  capabilities: string[];
205
+ /** ZFactor to define conversion factor for elevation unit. */
206
+ ZFactor?: number;
207
+ /** Indicates if any styling information represented as drawingInfo is captured as part of the binary mesh representation. */
208
+ cachedDrawingInfo?: CachedDrawingInfo;
209
+ /** An object containing drawing information. */
210
+ drawingInfo?: DrawingInfo;
211
+ /** An object containing elevation drawing information. If absent, any content of the scene layer is drawn at its z coordinate. */
212
+ elevationInfo?: ElevationInfo;
213
+ /** PopupInfo of the scene layer. */
214
+ popupInfo?: PopupInfo;
215
+ /** Indicates if client application will show the popup information. Default is FALSE. */
216
+ disablePopup: boolean;
217
+ /**
218
+ * The store object describes the exact physical storage of a layer and
219
+ * enables the client to detect when multiple layers are served from
220
+ * the same store.
221
+ */
34
222
  store: Store;
35
- nodePages?: NodePages;
36
- materialDefinitions?: GLTFMaterial[];
37
- textureSetDefinitions?: TextureSetDefinition[];
38
- geometryDefinitions?: GeometryDefinitions;
39
- attributeStorageInfo?: AttributeStorageInfo[];
223
+ /** A collection of objects that describe each attribute field regarding its field name, datatype, and a user friendly name {name,type,alias}. */
40
224
  fields?: Field[];
41
- popupInfo?: PopupInfo;
225
+ /** Provides the schema and layout used for storing attribute content in binary format in I3S. */
226
+ attributeStorageInfo?: AttributeStorageInfo[];
227
+ /** Contains the statistical information for a layer. */
228
+ statisticsInfo?: StatisticsInfo[];
229
+ /** The paged-access index description. */
230
+ nodePages?: NodePageDefinition;
231
+ /** List of materials classes used in this layer. */
232
+ materialDefinitions?: I3SMaterialDefinition[];
233
+ /** Defines the set of textures that can be referenced by meshes. */
234
+ textureSetDefinitions?: TextureSetDefinition[];
235
+ /** Define the layouts of mesh geometry and its attributes */
236
+ geometryDefinitions?: GeometryDefinition[];
237
+ /** 3D extent. */
238
+ fullExtent?: FullExtent;
42
239
  };
43
-
240
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/cachedDrawingInfo.cmn.md */
241
+ export type CachedDrawingInfo = {
242
+ /** If true, the drawingInfo is captured as part of the binary scene layer representation. */
243
+ color: boolean;
244
+ };
245
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/drawingInfo.cmn.md */
246
+ export type DrawingInfo = {
247
+ /** An object defining the symbology for the layer. See more information about supported renderer types in ArcGIS clients. */
248
+ renderer: any;
249
+ /** Scale symbols for the layer. */
250
+ scaleSymbols: boolean;
251
+ };
252
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/elevationInfo.cmn.md */
253
+ export type ElevationInfo = {
254
+ mode: 'relativeToGround' | 'absoluteHeight' | 'onTheGround' | 'relativeToScene';
255
+ /** Offset is always added to the result of the above logic except for onTheGround where offset is ignored. */
256
+ offset: number;
257
+ /** A string value indicating the unit for the values in elevationInfo */
258
+ unit: string;
259
+ };
260
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statisticsInfo.cmn.md */
261
+ export type StatisticsInfo = {
262
+ /** Key indicating the resource of the statistics. */
263
+ key: string;
264
+ /** Name of the field of the statistical information. */
265
+ name: string;
266
+ /** The URL to the statistics information. */
267
+ href: string;
268
+ };
269
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md */
270
+ export type NodePageDefinition = {
271
+ /** Number of nodes per page for this layer. Must be a power-of-two less than 4096 */
272
+ nodesPerPage: number;
273
+ /** Index of the root node. Default = 0. */
274
+ rootIndex?: number;
275
+ /** Defines the meaning of nodes[].lodThreshold for this layer. */
276
+ lodSelectionMetricType: 'maxScreenThresholdSQ';
277
+ };
278
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */
279
+ export type I3SMaterialDefinition = {
280
+ /** A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply. */
281
+ pbrMetallicRoughness: I3SPbrMetallicRoughness;
282
+ /** The normal texture map. */
283
+ normalTexture?: I3SMaterialTexture;
284
+ /** The occlusion texture map. */
285
+ occlusionTexture?: I3SMaterialTexture;
286
+ /** The emissive texture map. */
287
+ emissiveTexture?: I3SMaterialTexture;
288
+ /** The emissive color of the material. */
289
+ emissiveFactor?: [number, number, number];
290
+ /** Defines the meaning of the alpha-channel/alpha-mask. */
291
+ alphaMode: 'opaque' | 'mask' | 'blend';
292
+ /** The alpha cutoff value of the material. */
293
+ alphaCutoff?: number;
294
+ /** Specifies whether the material is double sided. */
295
+ doubleSided?: boolean;
296
+ /** Winding order is counterclockwise. */
297
+ cullFace?: 'none' | 'front' | 'back';
298
+ };
299
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/pbrMetallicRoughness.cmn.md */
300
+ export type I3SPbrMetallicRoughness = {
301
+ /** The material's base color factor. default=[1,1,1,1] */
302
+ baseColorFactor?: [number, number, number, number];
303
+ /** The base color texture. */
304
+ baseColorTexture?: I3SMaterialTexture;
305
+ /** the metalness of the material. default=1.0 */
306
+ metallicFactor: number;
307
+ /** the roughness of the material. default=1.0 */
308
+ roughnessFactor: number;
309
+ /** the metallic-roughness texture. */
310
+ metallicRoughnessTexture?: I3SMaterialTexture;
311
+ };
312
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialTexture.cmn.md */
313
+ export type I3SMaterialTexture = {
314
+ /** The index in layer.textureSetDefinitions. */
315
+ textureSetDefinitionId: number;
316
+ /** The set index of texture's TEXCOORD attribute used for texture coordinate mapping. Default is 0. Deprecated. */
317
+ texCoord?: number;
318
+ /** The normal texture: scalar multiplier applied to each normal vector of the normal texture. For occlusion texture,scalar multiplier controlling the amount of occlusion applied. Default=1 */
319
+ factor?: number;
320
+ };
321
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/attributeStorageInfo.cmn.md */
44
322
  export type AttributeStorageInfo = {
45
323
  key: string;
46
324
  name: string;
@@ -51,6 +329,7 @@ export type AttributeStorageInfo = {
51
329
  objectIds?: AttributeValue;
52
330
  };
53
331
 
332
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/field.cmn.md */
54
333
  export type Field = {
55
334
  name: string;
56
335
  type: ESRIField;
@@ -69,6 +348,7 @@ export type ESRIField =
69
348
  | 'esriFieldTypeSmallInteger'
70
349
  | 'esriFieldTypeString';
71
350
 
351
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/popupInfo.cmn.md */
72
352
  export type PopupInfo = {
73
353
  title?: string;
74
354
  description?: string;
@@ -78,15 +358,16 @@ export type PopupInfo = {
78
358
  popupElements?: {text?: string; type?: string; fieldInfos?: FieldInfo[]}[];
79
359
  };
80
360
 
81
- // Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
361
+ /**
362
+ * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
363
+ */
82
364
  export type Node3DIndexDocument = {
83
365
  id: string;
84
366
  version?: string;
85
- path?: string;
86
367
  level?: number;
87
368
  mbs?: Mbs;
88
369
  obb?: Obb;
89
- lodSelection?: LodSelection;
370
+ lodSelection?: LodSelection[];
90
371
  children?: NodeReference[];
91
372
  neighbors?: NodeReference[];
92
373
  parentNode?: NodeReference;
@@ -99,6 +380,26 @@ export type Node3DIndexDocument = {
99
380
  expires?: string;
100
381
  };
101
382
 
383
+ /**
384
+ * Minimal I3S node data is needed for loading
385
+ */
386
+ export type I3SMinimalNodeData = {
387
+ id: string;
388
+ url?: string;
389
+ transform?: number[];
390
+ lodSelection?: LodSelection[];
391
+ obb?: Obb;
392
+ mbs?: Mbs;
393
+ contentUrl?: string;
394
+ textureUrl?: string;
395
+ attributeUrls?: string[];
396
+ materialDefinition?: I3SMaterialDefinition;
397
+ textureFormat?: I3STextureFormat;
398
+ textureLoaderOptions?: {[key: string]: any};
399
+ children?: NodeReference[];
400
+ isDracoGeometry: boolean;
401
+ };
402
+
102
403
  export type LodSelection = {
103
404
  metricType?: string;
104
405
  maxError: number;
@@ -122,58 +423,125 @@ export type Resource = {
122
423
  nodePath?: string;
123
424
  };
124
425
 
125
- export type I3SGeometry = {
126
- geometry: ArrayBuffer | null;
127
- compressedGeometry?: ArrayBuffer | null;
128
- texture: any | null;
129
- sharedResources: SharedResources | null;
130
- meshMaterial?: GLTFMaterial | null;
131
- vertexCount: number | null;
132
- attributes: any | null;
133
- featureCount: number | null;
134
- geometryBuffer?: ArrayBuffer;
135
- };
136
-
137
426
  export type MaxScreenThresholdSQ = {
138
427
  maxError: number;
139
428
  };
140
429
 
430
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/node.cmn.md */
141
431
  export type NodeInPage = {
142
- index?: number;
143
- lodThreshold: number;
432
+ /**
433
+ * The index in the node array. May be different than material, geometry and attribute resource id. See mesh for more information.
434
+ */
435
+ index: number;
436
+ /**
437
+ * The index of the parent node in the node array.
438
+ */
439
+ parentIndex?: number;
440
+ /**
441
+ * When to switch LoD. See https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md for more information.
442
+ */
443
+ lodThreshold?: number;
444
+ /**
445
+ * Oriented bounding box for this node.
446
+ */
144
447
  obb: Obb;
145
- children: any[];
146
- mesh: Mesh;
448
+ /**
449
+ * index of the children nodes indices.
450
+ */
451
+ children?: number[];
452
+ /**
453
+ * The mesh for this node. WARNING: only SINGLE mesh is supported at version 1.7 (i.e. length must be 0 or 1).
454
+ */
455
+ mesh?: NodeMesh;
147
456
  };
148
457
 
458
+ /**
459
+ * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md
460
+ */
461
+ export type MaterialDefinitionInfo = {
462
+ /** A name for the material as assigned in the creating application. */
463
+ name?: string;
464
+ /** Indicates the material type, chosen from the supported values. */
465
+ type?: 'standard' | 'water' | 'billboard' | 'leafcard' | 'reference';
466
+ /** The href that resolves to the shared resource bundle in which the material definition is contained. */
467
+ $ref?: string;
468
+ /** Parameter defined for the material.
469
+ * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialParams.cmn.md
470
+ */
471
+ params: {
472
+ /** Indicates transparency of this material; 0 = opaque, 1 = fully transparent. */
473
+ transparency?: number;
474
+ /** Indicates reflectivity of this material. */
475
+ reflectivity?: number;
476
+ /** Indicates shininess of this material. */
477
+ shininess?: number;
478
+ /** Ambient color of this material. Ambient color is the color of an object where it is in shadow.
479
+ * This color is what the object reflects when illuminated by ambient light rather than direct light. */
480
+ ambient?: number[];
481
+ /** Diffuse color of this material. Diffuse color is the most instinctive meaning of the color of an object.
482
+ * It is that essential color that the object reveals under pure white light. It is perceived as the color
483
+ * of the object itself rather than a reflection of the light. */
484
+ diffuse?: number[];
485
+ /** Specular color of this material. Specular color is the color of the light of a specular reflection
486
+ * (specular reflection is the type of reflection that is characteristic of light reflected from a shiny
487
+ * surface). */
488
+ specular?: number[];
489
+ /** Rendering mode. */
490
+ renderMode: 'textured' | 'solid' | 'untextured' | 'wireframe';
491
+ /** TRUE if features with this material should cast shadows. */
492
+ castShadows?: boolean;
493
+ /** TRUE if features with this material should receive shadows */
494
+ receiveShadows?: boolean;
495
+ /** Indicates the material culling options {back, front, none}. */
496
+ cullFace?: string;
497
+ /** This flag indicates that the vertex color attribute of the geometry should be used to color the geometry
498
+ * for rendering. If texture is present, the vertex colors are multiplied by this color.
499
+ * e.g. pixel_color = [interpolated]vertex_color * texel_color. Default is false. */
500
+ vertexColors?: boolean;
501
+ /** This flag indicates that the geometry has uv region vertex attributes. These are used for adressing
502
+ * subtextures in a texture atlas. The uv coordinates are relative to this subtexture in this case.
503
+ * This is mostly useful for repeated textures in a texture atlas. Default is false. */
504
+ vertexRegions?: boolean;
505
+ /** Indicates whether Vertex Colors also contain a transparency channel. Default is false. */
506
+ useVertexColorAlpha?: boolean;
507
+ };
508
+ };
509
+
510
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/sharedResource.cmn.md */
149
511
  export type SharedResources = {
150
- materialDefinitions?: GLTFMaterial[];
151
- textureDefinitions?: TextureDefinitionInfo[];
152
- nodePath: string;
512
+ /** Materials describe how a Feature or a set of Features is to be rendered. */
513
+ materialDefinitions?: {[key: string]: MaterialDefinitionInfo};
514
+ /** A Texture is a set of images, with some parameters specific to the texture/uv mapping to geometries. */
515
+ textureDefinitions?: {[key: string]: TextureDefinitionInfo};
153
516
  };
154
517
 
155
- export type TextureImage = {
518
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/image.cmn.md */
519
+ type TextureImage = {
520
+ /** A unique ID for each image. Generated using the BuildID function. */
156
521
  id: string;
522
+ /** width of this image, in pixels. */
157
523
  size?: number;
524
+ /** The maximum size of a single pixel in world units.
525
+ * This property is used by the client to pick the image to load and render. */
158
526
  pixelInWorldUnits?: number;
527
+ /** The href to the image(s), one per encoding, in the same order as the encodings. */
159
528
  href?: string[];
529
+ /** The byte offset of this image's encodings. There is one per encoding,
530
+ * in the same order as the encodings, in the block in which this texture image resides. */
160
531
  byteOffset?: string[];
532
+ /** The length in bytes of this image's encodings. There is one per encoding,
533
+ * in the same order as the encodings. */
161
534
  length?: number[];
162
- mimeType?: string;
163
- bufferView?: {
164
- data: ArrayBuffer;
165
- };
166
- image?: {
167
- height: number;
168
- width: number;
169
- };
170
535
  };
171
536
 
172
537
  export type Attribute = 'OBJECTID' | 'string' | 'double' | 'Int32' | string;
173
538
 
174
539
  export type Extent = [number, number, number, number];
175
540
 
176
- export type FeatureAttribute = {[key: string]: any};
541
+ export type FeatureAttribute = {
542
+ id: AttributeValue;
543
+ faceRange: AttributeValue;
544
+ };
177
545
 
178
546
  export type BuildingSceneLayerTileset = {
179
547
  header: BuildingSceneLayer;
@@ -257,33 +625,56 @@ type FilterModeWireFrame = {
257
625
  edges: Edges;
258
626
  };
259
627
 
260
- type SpatialReference = {
261
- wkid: number;
628
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md */
629
+ export type SpatialReference = {
630
+ /** The current WKID value of the vertical coordinate system. */
631
+ latestVcsWkid: number;
632
+ /** dentifies the current WKID value associated with the same spatial reference. */
262
633
  latestWkid: number;
634
+ /** The WKID value of the vertical coordinate system. */
263
635
  vcsWkid: number;
264
- latestVcsWkid: number;
636
+ /** WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS. */
637
+ wkid: number;
638
+ /** WKT, or Well-Known Text, of the CRS. Specify either WKT or WKID of the CRS but not both. */
265
639
  wkt?: string;
266
640
  };
267
641
 
268
- type FullExtent = {
269
- xmin: number; // left
270
- xmax: number; // right
271
- ymin: number; // bottom
272
- ymax: number; // top
273
- zmin: number; // lowest elevation
274
- zmax: number; // highest elevation
642
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md */
643
+ export type FullExtent = {
644
+ /** left longitude in decimal degrees */
645
+ xmin: number;
646
+ /** right longitude in decimal degrees */
647
+ xmax: number;
648
+ /** bottom latitude in decimal degrees*/
649
+ ymin: number;
650
+ /** top latitude in decimal degrees*/
651
+ ymax: number;
652
+ /** lowest elevation in meters */
653
+ zmin: number;
654
+ /** highest elevation in meters */
655
+ zmax: number;
275
656
  spatialReference?: SpatialReference;
276
657
  };
277
658
 
278
- type TextureDefinitionInfo = {
279
- encoding: string[];
659
+ /**
660
+ * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md
661
+ */
662
+ export type TextureDefinitionInfo = {
663
+ /** MIMEtype - The encoding/content type that is used by all images in this map */
664
+ encoding?: string[];
665
+ /** UV wrapping modes, from {none, repeat, mirror}. */
280
666
  wrap?: string[];
667
+ /** TRUE if the Map represents a texture atlas. */
281
668
  atlas?: boolean;
669
+ /** The name of the UV set to be used as texture coordinates. */
282
670
  uvSet?: string;
671
+ /** Indicates channels description. */
283
672
  channels?: 'rbg' | 'rgba' | string;
673
+ /** An image is a binary resource, containing a single raster that can be used to texture a feature or symbol. */
284
674
  images: TextureImage[];
285
675
  };
286
676
 
677
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/domain.cmn.md */
287
678
  type Domain = {
288
679
  type: string;
289
680
  name: string;
@@ -294,7 +685,9 @@ type Domain = {
294
685
  mergePolicy?: string;
295
686
  splitPolicy?: string;
296
687
  };
297
-
688
+ /**
689
+ * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/store.cmn.md
690
+ */
298
691
  type Store = {
299
692
  id: string | number;
300
693
  profile: string;
@@ -311,41 +704,109 @@ type Store = {
311
704
  lodModel: string;
312
705
  defaultGeometrySchema: DefaultGeometrySchema;
313
706
  };
314
-
707
+ /**
708
+ * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md
709
+ */
315
710
  type DefaultGeometrySchema = {
316
- vartexCount: number;
317
- featureCount: number;
318
- position: Float32Array;
319
- normal: Float32Array;
320
- uv0: Float32Array;
321
- color: Uint8Array;
322
- id: Float32Array;
323
- faceRange: Uint32Array;
324
- region: Uint16Array;
325
- };
326
-
327
- // TODO change string to possible values from https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md
711
+ geometryType?: 'triangles';
712
+ topology: 'PerAttributeArray' | 'Indexed';
713
+ header: HeaderAttribute[];
714
+ ordering: string[];
715
+ vertexAttributes: VertexAttribute;
716
+ faces?: VertexAttribute;
717
+ featureAttributeOrder: string[];
718
+ featureAttributes: FeatureAttribute;
719
+ // TODO Do we realy need this Property?
720
+ attributesOrder?: string[];
721
+ };
722
+ /**
723
+ * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/headerAttribute.cmn.md
724
+ */
725
+ export type HeaderAttribute = {
726
+ property: HeaderAttributeProperty.vertexCount | HeaderAttributeProperty.featureCount | string;
727
+ type:
728
+ | DATA_TYPE.UInt8
729
+ | DATA_TYPE.UInt16
730
+ | DATA_TYPE.UInt32
731
+ | DATA_TYPE.UInt64
732
+ | DATA_TYPE.Int16
733
+ | DATA_TYPE.Int32
734
+ | DATA_TYPE.Int64
735
+ | DATA_TYPE.Float32
736
+ | DATA_TYPE.Float64;
737
+ };
738
+ export enum HeaderAttributeProperty {
739
+ vertexCount = 'vertexCount',
740
+ featureCount = 'featureCount'
741
+ }
742
+ export type VertexAttribute = {
743
+ position: GeometryAttribute;
744
+ normal: GeometryAttribute;
745
+ uv0: GeometryAttribute;
746
+ color: GeometryAttribute;
747
+ region?: GeometryAttribute;
748
+ };
749
+ export type GeometryAttribute = {
750
+ byteOffset?: number;
751
+ valueType:
752
+ | DATA_TYPE.UInt8
753
+ | DATA_TYPE.UInt16
754
+ | DATA_TYPE.Int16
755
+ | DATA_TYPE.Int32
756
+ | DATA_TYPE.Int64
757
+ | DATA_TYPE.Float32
758
+ | DATA_TYPE.Float64;
759
+ valuesPerElement: number;
760
+ };
761
+ export type I3SMeshAttributes = {
762
+ [key: string]: I3SMeshAttribute;
763
+ };
764
+ export interface I3SMeshAttribute extends MeshAttribute {
765
+ type?: number;
766
+ metadata?: any;
767
+ }
768
+ /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md */
328
769
  type HeightModelInfo = {
329
- heightModel: string;
770
+ heightModel: 'gravity_related_height' | 'ellipsoidal';
330
771
  vertCRS: string;
331
- heightUnit: string;
772
+ heightUnit:
773
+ | 'meter'
774
+ | 'us-foot'
775
+ | 'foot'
776
+ | 'clarke-foot'
777
+ | 'clarke-yard'
778
+ | 'clarke-link'
779
+ | 'sears-yard'
780
+ | 'sears-foot'
781
+ | 'sears-chain'
782
+ | 'benoit-1895-b-chain'
783
+ | 'indian-yard'
784
+ | 'indian-1937-yard'
785
+ | 'gold-coast-foot'
786
+ | 'sears-1922-truncated-chain'
787
+ | 'us-inch'
788
+ | 'us-mile'
789
+ | 'us-yard'
790
+ | 'millimeter'
791
+ | 'decimeter'
792
+ | 'centimeter'
793
+ | 'kilometer';
332
794
  };
333
795
 
334
- type NodePages = {
335
- nodesPerPage: number;
336
- lodSelectionMetricType: string;
337
- };
796
+ export type TextureSetDefinitionFormats = {name: string; format: I3STextureFormat}[];
338
797
 
798
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinition.cmn.md */
339
799
  type TextureSetDefinition = {
340
- formats: {name: string; format: string}[];
800
+ formats: TextureSetDefinitionFormats;
341
801
  atlas?: boolean;
342
802
  };
343
803
 
344
- type GeometryDefinitions = {
804
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryDefinition.cmn.md */
805
+ type GeometryDefinition = {
345
806
  topology: 'triangle' | string;
346
807
  geometryBuffers: GeometryBuffer[];
347
808
  };
348
-
809
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryBuffer.cmn.md */
349
810
  type GeometryBuffer = {
350
811
  offset?: number;
351
812
  position?: GeometryBufferItem;
@@ -362,9 +823,336 @@ type GeometryBufferItem = {type: string; component: number; encoding?: string; b
362
823
 
363
824
  type AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};
364
825
 
365
- type FieldInfo = {
826
+ export type FieldInfo = {
366
827
  fieldName: string;
367
828
  visible: boolean;
368
829
  isEditable: boolean;
369
830
  label: string;
370
831
  };
832
+
833
+ export type ArcGisWebSceneData = {
834
+ header: ArcGisWebScene;
835
+ layers: OperationalLayer[];
836
+ unsupportedLayers: OperationalLayer[];
837
+ };
838
+
839
+ /**
840
+ * ArcGis WebScene spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/
841
+ */
842
+ export type ArcGisWebScene = {
843
+ /**
844
+ * @todo add type.
845
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/applicationProperties/
846
+ * Configuration of application and UI elements.
847
+ */
848
+ applicationProperties?: any;
849
+ /**
850
+ * Operational layers contain business data which are used to make thematic scenes.
851
+ */
852
+ operationalLayers: OperationalLayer[];
853
+ /**
854
+ * Basemaps give the web scene a geographic context.
855
+ */
856
+ baseMap: BaseMap;
857
+ /**
858
+ * Ground defines the main surface of the web scene, based on elevation layers.
859
+ */
860
+ ground: Ground;
861
+ /**
862
+ * An object that defines the characteristics of the vertical coordinate system used by the web scene.
863
+ */
864
+ heightModelInfo: HeightModelInfo;
865
+ /**
866
+ * Root element in the web scene specifying a string value indicating the web scene version.
867
+ * Valid values: 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27
868
+ */
869
+ version: string;
870
+ /**
871
+ * String value indicating the application which authored the webmap
872
+ */
873
+ authoringApp: string;
874
+ /**
875
+ * String value indicating the authoring App's version number.
876
+ */
877
+ authoringAppVersion: string;
878
+ /**
879
+ * A presentation consists of multiple slides, where each slide is a specific view into the web scene.
880
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/presentation/
881
+ * @todo Add presentation type.
882
+ */
883
+ presentation: ArcGisPresentation;
884
+ /**
885
+ * An object that provides information about the initial environment settings and viewpoint of the web scene.
886
+ */
887
+ initialState: InitialState;
888
+ /**
889
+ * An object used to specify the spatial reference of the given geometry.
890
+ */
891
+ spatialReference: SpatialReference;
892
+ viewingMode: 'global' | 'local';
893
+ /**
894
+ * @todo add type.
895
+ * Defines area to be clipped for display.
896
+ */
897
+ clippingArea?: any;
898
+ /**
899
+ * @todo add type.
900
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapFloorInfo/
901
+ * Contains floor-awareness information for the web scene.
902
+ */
903
+ mapFloorInfo?: any;
904
+ /**
905
+ * @todo add type.
906
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapRangeInfo/
907
+ * Map Range Information
908
+ */
909
+ mapRangeInfo?: any;
910
+ /**
911
+ * @todo add type.
912
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/table/
913
+ * An array of table objects.
914
+ */
915
+ tables?: any;
916
+ /**
917
+ * @todo add type.
918
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/transportationNetwork/
919
+ * Used to specify the transportation networks of the scene.
920
+ */
921
+ transportationNetworks?: any;
922
+ /**
923
+ * @todo add type.
924
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/widgets/
925
+ * The widgets object contains widgets that should be exposed to the user.
926
+ */
927
+ widgets?: any;
928
+ };
929
+
930
+ /**
931
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Presentation.html
932
+ */
933
+ type ArcGisPresentation = {
934
+ slides: Slide[];
935
+ };
936
+
937
+ /**
938
+ * A slide stores a snapshot of several pre-set properties of the WebScene and SceneView,
939
+ * such as the basemap, viewpoint and visible layers.
940
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html
941
+ */
942
+ type Slide = {
943
+ id: string;
944
+ title: {
945
+ text: string;
946
+ };
947
+ thumbnail: {
948
+ url: string;
949
+ };
950
+ description: {
951
+ text: string;
952
+ };
953
+ ground: {
954
+ transparency: number;
955
+ };
956
+ baseMap: ArcGisBaseMap;
957
+ visibleLayers: ArcGisVisibleLayer[];
958
+ viewpoint: ArcGisViewPoint;
959
+ };
960
+
961
+ /**
962
+ * The basemap of the scene. Only the base and reference layers of the basemap are stored in a slide.
963
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html
964
+ */
965
+ type ArcGisBaseMap = {
966
+ id: string;
967
+ title: string;
968
+ baseMapLayers: ArcGisBaseMapLayer[];
969
+ };
970
+
971
+ /**
972
+ * The visible layers of the scene.
973
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#visibleLayers
974
+ */
975
+ type ArcGisVisibleLayer = {
976
+ id: string;
977
+ sublayerIds: number[];
978
+ };
979
+ /**
980
+ * The basemap of the scene.
981
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html
982
+ */
983
+ type ArcGisBaseMapLayer = {
984
+ id: string;
985
+ title: string;
986
+ url: string;
987
+ layerType: string;
988
+ visibility: boolean;
989
+ };
990
+
991
+ /**
992
+ * The viewpoint of the slide. This acts like a bookmark, saving a predefined location or point of view from which to view the scene.
993
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html
994
+ */
995
+ type ArcGisViewPoint = {
996
+ scale: number;
997
+ rotation?: number;
998
+ /**
999
+ * Spec - https://developers.arcgis.com/web-scene-specification/objects/viewpoint/
1000
+ */
1001
+ targetGeometry: any;
1002
+ camera: ArcGisCamera;
1003
+ };
1004
+
1005
+ /**
1006
+ * The camera defines the position, tilt, and heading of the point from which the SceneView's visible extent is observed.
1007
+ * It is not associated with device hardware. This class only applies to 3D SceneViews.
1008
+ * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html
1009
+ */
1010
+ export type ArcGisCamera = {
1011
+ position: {
1012
+ x: number;
1013
+ y: number;
1014
+ z: number;
1015
+ };
1016
+ spatialReference: {
1017
+ wkid: number;
1018
+ latestWkid: number;
1019
+ };
1020
+ heading: number;
1021
+ tilt: number;
1022
+ };
1023
+
1024
+ /**
1025
+ * Operational layers contain your data. Usually, a basemap sits beneath your operational layers to give them geographic context.
1026
+ * Spec- https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/
1027
+ */
1028
+ export type OperationalLayer = {
1029
+ id: string;
1030
+ opacity: number;
1031
+ title: string;
1032
+ url: string;
1033
+ visibility: boolean;
1034
+ itemId: string;
1035
+ layerType: string;
1036
+ LayerDefinition: LayerDefinition;
1037
+ screenSizePerspective: boolean;
1038
+ showLabels?: boolean;
1039
+ disablePopup?: boolean;
1040
+ showLegend?: boolean;
1041
+ layers?: OperationalLayer[];
1042
+ };
1043
+
1044
+ type LayerDefinition = {
1045
+ elevationInfo: ElevationInfo;
1046
+ drawingInfo: DrawingInfo;
1047
+ };
1048
+
1049
+ type BaseMap = {
1050
+ id: string;
1051
+ title: string;
1052
+ baseMapLayers: BaseMapLayer[];
1053
+ elevationLayers: ElevationLayer[];
1054
+ };
1055
+
1056
+ type BaseMapLayer = {
1057
+ id: string;
1058
+ opacity: number;
1059
+ title: string;
1060
+ url: string;
1061
+ visibility: boolean;
1062
+ layerType: string;
1063
+ };
1064
+
1065
+ type ElevationLayer = {
1066
+ id: string;
1067
+ listMode: string;
1068
+ title: string;
1069
+ url: string;
1070
+ visibility: boolean;
1071
+ layerType: string;
1072
+ };
1073
+
1074
+ type Ground = {
1075
+ layers: ElevationLayer[];
1076
+ transparency: number;
1077
+ navigationConstraint: NavigationConstraint;
1078
+ };
1079
+
1080
+ type NavigationConstraint = {
1081
+ type: string;
1082
+ };
1083
+
1084
+ type InitialState = {
1085
+ environment: Enviroment;
1086
+ viewpoint: ViewPoint;
1087
+ };
1088
+
1089
+ type Enviroment = {
1090
+ lighting: Lighting;
1091
+ atmosphereEnabled?: string;
1092
+ starsEnabled?: string;
1093
+ };
1094
+
1095
+ type Lighting = {
1096
+ datetime?: number;
1097
+ displayUTCOffset?: number;
1098
+ };
1099
+
1100
+ type ViewPoint = {
1101
+ camera: Camera;
1102
+ };
1103
+
1104
+ type Camera = {
1105
+ position: CameraPosition;
1106
+ heading: number;
1107
+ tilt: number;
1108
+ };
1109
+
1110
+ type CameraPosition = {
1111
+ spatialReference: SpatialReference;
1112
+ x: number;
1113
+ y: number;
1114
+ z: number;
1115
+ };
1116
+
1117
+ /**
1118
+ * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statsInfo.cmn.md
1119
+ */
1120
+ export type StatsInfo = {
1121
+ /** Represents the count of the value. */
1122
+ totalValuesCount?: number;
1123
+ /** Minimum attribute value for the entire layer. */
1124
+ min?: number;
1125
+ /** Maximum attribute value for the entire layer. */
1126
+ max?: number;
1127
+ /** Count for the entire layer. */
1128
+ count?: number;
1129
+ /** Sum of the attribute values over the entire layer. */
1130
+ sum?: number;
1131
+ /** Representing average or mean value. For example, sum/count. */
1132
+ avg?: number;
1133
+ /** Representing the standard deviation. */
1134
+ stddev?: number;
1135
+ /** Representing variance. For example, stats.stddev *stats.stddev. */
1136
+ variance?: number;
1137
+ /** Represents the histogram. */
1138
+ histogram?: Histogram;
1139
+ /** An array of most frequently used values within the point cloud scene layer. */
1140
+ mostFrequentValues?: ValueCount[];
1141
+ };
1142
+
1143
+ /** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/histogram.cmn.md */
1144
+ export type Histogram = {
1145
+ /** Minimum attribute value for the entire layer. */
1146
+ minimum: number;
1147
+ /** Maximum attribute value for the entire layer. Maximum array size for stats.histo.counts is 256. */
1148
+ maximum: number;
1149
+ /** Count for the entire layer. */
1150
+ counts: number[];
1151
+ };
1152
+
1153
+ export type ValueCount = {
1154
+ /** Type of the attribute values after decompression, if applicable. Please note that string is not supported for point cloud scene layer attributes. */
1155
+ value: number | string;
1156
+ /** Count of the number of values. May exceed 32 bits. */
1157
+ count: number;
1158
+ };