@loaders.gl/i3s 3.1.0-alpha.4 → 3.1.0-beta.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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +10364 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +89 -138
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +8 -36
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +10 -36
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +56 -176
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +8 -51
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js +13 -5
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +172 -325
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +71 -25
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +34 -68
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +28 -59
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +314 -415
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +31 -70
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +4 -8
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +17 -14
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +19 -0
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +44 -14
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +5 -2
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +3 -3
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/constants.js +55 -15
- package/dist/esm/lib/parsers/constants.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +9 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +3 -1
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +87 -61
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +4 -4
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/lib/utils/url-utils.js +3 -3
- package/dist/esm/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/types.js +13 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-attribute-loader.d.ts +14 -0
- package/dist/i3s-attribute-loader.d.ts.map +1 -0
- package/dist/i3s-attribute-loader.js +177 -0
- package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
- package/dist/i3s-building-scene-layer-loader.js +26 -0
- package/dist/i3s-content-loader.d.ts +6 -0
- package/dist/i3s-content-loader.d.ts.map +1 -0
- package/dist/i3s-content-loader.js +28 -0
- package/dist/i3s-content-worker.js +7657 -2
- package/dist/i3s-loader.d.ts +6 -0
- package/dist/i3s-loader.d.ts.map +1 -0
- package/dist/i3s-loader.js +100 -0
- package/dist/i3s-node-page-loader.d.ts +6 -0
- package/dist/i3s-node-page-loader.d.ts.map +1 -0
- package/dist/i3s-node-page-loader.js +26 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +73 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -0
- package/dist/lib/parsers/constants.d.ts +56 -0
- package/dist/lib/parsers/constants.d.ts.map +1 -0
- package/dist/lib/parsers/constants.js +107 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +10 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-attribute.js +98 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +46 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-tile-content.js +508 -0
- package/dist/lib/parsers/parse-i3s.d.ts +4 -0
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s.js +84 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +20 -0
- package/dist/lib/utils/url-utils.d.ts +22 -0
- package/dist/lib/utils/url-utils.d.ts.map +1 -0
- package/dist/lib/utils/url-utils.js +44 -0
- package/dist/types.d.ts +429 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/workers/i3s-content-worker.d.ts +2 -0
- package/dist/workers/i3s-content-worker.d.ts.map +1 -0
- package/dist/workers/i3s-content-worker.js +5 -0
- package/package.json +14 -12
- package/src/i3s-attribute-loader.ts +56 -19
- package/src/i3s-loader.ts +4 -1
- package/src/index.ts +1 -0
- package/src/lib/parsers/constants.ts +73 -18
- package/src/lib/parsers/parse-i3s-attribute.ts +19 -1
- package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
- package/src/lib/parsers/parse-i3s-tile-content.ts +159 -109
- package/src/lib/utils/url-utils.ts +1 -1
- package/src/types.ts +153 -22
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
- package/dist/i3s-content-worker.js.map +0 -1
package/dist/esm/types.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let DATA_TYPE;
|
|
2
|
+
|
|
3
|
+
(function (DATA_TYPE) {
|
|
4
|
+
DATA_TYPE["UInt8"] = "UInt8";
|
|
5
|
+
DATA_TYPE["UInt16"] = "UInt16";
|
|
6
|
+
DATA_TYPE["UInt32"] = "UInt32";
|
|
7
|
+
DATA_TYPE["UInt64"] = "UInt64";
|
|
8
|
+
DATA_TYPE["Int16"] = "Int16";
|
|
9
|
+
DATA_TYPE["Int32"] = "Int32";
|
|
10
|
+
DATA_TYPE["Int64"] = "Int64";
|
|
11
|
+
DATA_TYPE["Float32"] = "Float32";
|
|
12
|
+
DATA_TYPE["Float64"] = "Float64";
|
|
13
|
+
})(DATA_TYPE || (DATA_TYPE = {}));
|
|
2
14
|
//# sourceMappingURL=types.js.map
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/types.ts"],"names":["DATA_TYPE"],"mappings":"AAKA,WAAYA,SAAZ;;WAAYA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,KAAAA,S","sourcesContent":["import type {GLTFMaterial} from '@loaders.gl/gltf';\nimport type {Matrix4, Quaternion, Vector3} from '@math.gl/core';\nimport type {Mesh} from '@loaders.gl/gltf';\nimport type {TypedArray} from '@loaders.gl/schema';\n\nexport enum DATA_TYPE {\n UInt8 = 'UInt8',\n UInt16 = 'UInt16',\n UInt32 = 'UInt32',\n UInt64 = 'UInt64',\n Int16 = 'Int16',\n Int32 = 'Int32',\n Int64 = 'Int64',\n Float32 = 'Float32',\n Float64 = 'Float64'\n}\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md\n */\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type Tileset = {\n /**\n * The store object describes the exact physical storage of a layer and enables the client to detect when multiple layers are served from the same store.\n */\n store: Store;\n [key: string]: any;\n};\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type NodePage = {[key: string]: any};\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type Tile = {\n content: TileContent;\n isDracoGeometry: boolean;\n textureUrl: string;\n url: string;\n /**\n * Resource reference describing a featureData document.\n */\n attributeData: Resource[];\n textureFormat: 'jpeg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';\n textureLoaderOptions: any;\n materialDefinition: GLTFMaterial;\n mbs: Mbs;\n};\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type TileContent = {\n featureData: DefaultGeometrySchema;\n attributes: NormalizedAttributes;\n indices: NormalizedAttribute | null;\n featureIds: number[] | TypedArray;\n vertexCount: number;\n modelMatrix: Matrix4;\n coordinateSystem: number;\n byteLength: number;\n texture: TileContentTexture;\n [key: string]: any;\n};\n\nexport type TileContentTexture =\n | ArrayBuffer\n | {\n compressed: boolean;\n mipmaps: boolean;\n width: number;\n height: number;\n data: any;\n }\n | null;\n\nexport type BoundingVolumes = {\n mbs: Mbs;\n obb: Obb;\n};\n\nexport type Obb = {\n center: number[] | Vector3;\n halfSize: number[] | Vector3;\n quaternion: Quaternion;\n};\n\nexport type Mbs = [number, number, number, number];\n\n// SceneLayer3D based on I3S specification https://github.com/Esri/i3s-spec/tree/master/docs/1.7\n// TODO Add description for each property\n\nexport type SceneLayer3D = {\n id: number;\n href?: string;\n layerType: string;\n spatialReference?: SpatialReference;\n heightModelInfo?: HeightModelInfo;\n version: string;\n name?: string;\n capabilities: string[];\n store: Store;\n nodePages?: NodePages;\n materialDefinitions?: GLTFMaterial[];\n textureSetDefinitions?: TextureSetDefinition[];\n geometryDefinitions?: GeometryDefinitions;\n attributeStorageInfo?: AttributeStorageInfo[];\n fields?: Field[];\n popupInfo?: PopupInfo;\n};\n\nexport type AttributeStorageInfo = {\n key: string;\n name: string;\n header: {property: string; valueType: string}[];\n ordering?: string[];\n attributeValues?: AttributeValue;\n attributeByteCounts?: AttributeValue;\n objectIds?: AttributeValue;\n};\n\nexport type Field = {\n name: string;\n type: ESRIField;\n alias?: string;\n domain?: Domain;\n};\n\nexport type ESRIField =\n | 'esriFieldTypeDate'\n | 'esriFieldTypeSingle'\n | 'esriFieldTypeDouble'\n | 'esriFieldTypeGUID'\n | 'esriFieldTypeGlobalID'\n | 'esriFieldTypeInteger'\n | 'esriFieldTypeOID'\n | 'esriFieldTypeSmallInteger'\n | 'esriFieldTypeString';\n\nexport type PopupInfo = {\n title?: string;\n description?: string;\n expressionInfos?: any[];\n fieldInfos?: FieldInfo[];\n mediaInfos?: any[];\n popupElements?: {text?: string; type?: string; fieldInfos?: FieldInfo[]}[];\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\nexport type Node3DIndexDocument = {\n id: string;\n version?: string;\n path?: string;\n level?: number;\n mbs?: Mbs;\n obb?: Obb;\n lodSelection?: LodSelection;\n children?: NodeReference[];\n neighbors?: NodeReference[];\n parentNode?: NodeReference;\n sharedResource?: Resource;\n featureData?: Resource[];\n geometryData?: Resource[];\n textureData?: Resource[];\n attributeData?: Resource[];\n created?: string;\n expires?: string;\n};\n\nexport type LodSelection = {\n metricType?: string;\n maxError: number;\n};\n\nexport type NodeReference = {\n id: string;\n version?: string;\n mbs?: Mbs;\n obb?: Obb;\n href?: string;\n};\n\nexport type Resource = {\n href: string;\n layerContent?: string[];\n featureRange?: number[];\n multiTextureBundle?: string;\n vertexElements?: number[];\n faceElements?: number[];\n nodePath?: string;\n};\n\nexport type I3SGeometry = {\n geometry: ArrayBuffer | null;\n compressedGeometry?: ArrayBuffer | null;\n texture: any | null;\n sharedResources: SharedResources | null;\n meshMaterial?: GLTFMaterial | null;\n vertexCount: number | null;\n attributes: any | null;\n featureCount: number | null;\n geometryBuffer?: ArrayBuffer;\n};\n\nexport type MaxScreenThresholdSQ = {\n maxError: number;\n};\n\nexport type NodeInPage = {\n index?: number;\n lodThreshold: number;\n obb: Obb;\n children: any[];\n mesh: Mesh;\n};\n\nexport type SharedResources = {\n materialDefinitions?: GLTFMaterial[];\n textureDefinitions?: TextureDefinitionInfo[];\n nodePath: string;\n};\n\nexport type TextureImage = {\n id: string;\n size?: number;\n pixelInWorldUnits?: number;\n href?: string[];\n byteOffset?: string[];\n length?: number[];\n mimeType?: string;\n bufferView?: {\n data: ArrayBuffer;\n };\n image?: {\n height: number;\n width: number;\n };\n};\n\nexport type Attribute = 'OBJECTID' | 'string' | 'double' | 'Int32' | string;\n\nexport type Extent = [number, number, number, number];\n\nexport type FeatureAttribute = {\n id: AttributeValue;\n faceRange: AttributeValue;\n};\n\nexport type BuildingSceneLayerTileset = {\n header: BuildingSceneLayer;\n sublayers: BuildingSceneSublayer[];\n};\n\nexport type BuildingSceneLayer = {\n id: number;\n name: string;\n version: string;\n alias?: string;\n layerType: 'Building';\n description?: string;\n copyrightText?: string;\n fullExtent: FullExtent;\n spatialReference: SpatialReference;\n heightModelInfo?: HeightModelInfo;\n sublayers: BuildingSceneSublayer[];\n filters?: Filter[];\n activeFilterID?: string;\n statisticsHRef?: string;\n};\n\nexport type BuildingSceneSublayer = {\n id: number;\n name: string;\n alias?: string;\n discipline?: 'Mechanical' | 'Architectural' | 'Piping' | 'Electrical' | 'Structural';\n modelName?: string;\n layerType: 'group' | '3DObject' | 'Point';\n visibility?: boolean;\n sublayers?: BuildingSceneSublayer[];\n isEmpty?: boolean;\n url?: string;\n};\n\ntype Filter = {\n id: string;\n name: string;\n description: string;\n isDefaultFilter?: boolean;\n isVisible?: boolean;\n filterBlocks: FilterBlock[];\n filterAuthoringInfo?: FilterAuthoringInfo;\n};\n\ntype FilterAuthoringInfo = {\n type: string;\n filterBlocks: FilterBlockAuthoringInfo[];\n};\n\ntype FilterBlockAuthoringInfo = {\n filterTypes: FilterType[];\n};\n\ntype FilterType = {\n filterType: string;\n filterValues: string[];\n};\n\ntype FilterBlock = {\n title: string;\n filterMode: FilterModeSolid | FilterModeWireFrame;\n filterExpression: string;\n};\n\ntype Edges = {\n type: string;\n color: number[];\n size: number;\n transparency: number;\n extensionLength: number;\n};\n\ntype FilterModeSolid = {\n type: 'solid';\n};\n\ntype FilterModeWireFrame = {\n type: 'wireFrame';\n edges: Edges;\n};\n\ntype SpatialReference = {\n wkid: number;\n latestWkid: number;\n vcsWkid: number;\n latestVcsWkid: number;\n wkt?: string;\n};\n\ntype FullExtent = {\n xmin: number; // left\n xmax: number; // right\n ymin: number; // bottom\n ymax: number; // top\n zmin: number; // lowest elevation\n zmax: number; // highest elevation\n spatialReference?: SpatialReference;\n};\n\ntype TextureDefinitionInfo = {\n encoding: string[];\n wrap?: string[];\n atlas?: boolean;\n uvSet?: string;\n channels?: 'rbg' | 'rgba' | string;\n images: TextureImage[];\n};\n\ntype Domain = {\n type: string;\n name: string;\n description?: string;\n fieldType?: string;\n range?: [number, number];\n codedValues?: {name: string; code: string | number}[];\n mergePolicy?: string;\n splitPolicy?: string;\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/store.cmn.md\n */\ntype Store = {\n id: string | number;\n profile: string;\n version: number | string;\n resourcePattern: string[];\n rootNode: string;\n extent: number[];\n indexCRS: string;\n vertexCRS: string;\n normalReferenceFrame: string;\n attributeEncoding: string;\n textureEncoding: string[];\n lodType: string;\n lodModel: string;\n defaultGeometrySchema: DefaultGeometrySchema;\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md\n */\ntype DefaultGeometrySchema = {\n geometryType?: 'triangles';\n topology: 'PerAttributeArray' | 'Indexed';\n header: {\n property: 'vertexCount' | 'featureCount' | string;\n type:\n | DATA_TYPE.UInt8\n | DATA_TYPE.UInt16\n | DATA_TYPE.UInt32\n | DATA_TYPE.UInt64\n | DATA_TYPE.Int16\n | DATA_TYPE.Int32\n | DATA_TYPE.Int64\n | DATA_TYPE.Float32\n | DATA_TYPE.Float64;\n }[];\n ordering: string[];\n vertexAttributes: VertexAttribute;\n faces?: VertexAttribute;\n featureAttributeOrder: string[];\n featureAttributes: FeatureAttribute;\n // TODO Do we realy need this Property?\n attributesOrder?: string[];\n};\nexport type VertexAttribute = {\n position: GeometryAttribute;\n normal: GeometryAttribute;\n uv0: GeometryAttribute;\n color: GeometryAttribute;\n region?: GeometryAttribute;\n};\nexport type GeometryAttribute = {\n byteOffset?: number;\n valueType:\n | DATA_TYPE.UInt8\n | DATA_TYPE.UInt16\n | DATA_TYPE.Int16\n | DATA_TYPE.Int32\n | DATA_TYPE.Int64\n | DATA_TYPE.Float32\n | DATA_TYPE.Float64;\n valuesPerElement: number;\n};\nexport type NormalizedAttributes = {\n [key: string]: NormalizedAttribute;\n};\nexport type NormalizedAttribute = {\n value: number[] | TypedArray;\n type: number;\n size: number;\n normalized?: boolean;\n metadata?: any;\n};\ntype HeightModelInfo = {\n heightModel: 'gravity_related_height' | 'ellipsoidal';\n vertCRS: string;\n heightUnit:\n | 'meter'\n | 'us-foot'\n | 'foot'\n | 'clarke-foot'\n | 'clarke-yard'\n | 'clarke-link'\n | 'sears-yard'\n | 'sears-foot'\n | 'sears-chain'\n | 'benoit-1895-b-chain'\n | 'indian-yard'\n | 'indian-1937-yard'\n | 'gold-coast-foot'\n | 'sears-1922-truncated-chain'\n | 'us-inch'\n | 'us-mile'\n | 'us-yard'\n | 'millimeter'\n | 'decimeter'\n | 'centimeter'\n | 'kilometer';\n};\n\ntype NodePages = {\n nodesPerPage: number;\n lodSelectionMetricType: string;\n};\n\ntype TextureSetDefinition = {\n formats: {name: string; format: string}[];\n atlas?: boolean;\n};\n\ntype GeometryDefinitions = {\n topology: 'triangle' | string;\n geometryBuffers: GeometryBuffer[];\n};\n\ntype GeometryBuffer = {\n offset?: number;\n position?: GeometryBufferItem;\n normal?: GeometryBufferItem;\n uv0?: GeometryBufferItem;\n color?: GeometryBufferItem;\n uvRegion?: GeometryBufferItem;\n featureId?: GeometryBufferItem;\n faceRange?: GeometryBufferItem;\n compressedAttributes?: {encoding: string; attributes: string[]};\n};\n\ntype GeometryBufferItem = {type: string; component: number; encoding?: string; binding: string};\n\ntype AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};\n\ntype FieldInfo = {\n fieldName: string;\n visible: boolean;\n isEditable: boolean;\n label: string;\n};\n"],"file":"types.js"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Loader for I3S attributes
|
|
4
|
+
*/
|
|
5
|
+
export declare const I3SAttributeLoader: LoaderWithParser;
|
|
6
|
+
/**
|
|
7
|
+
* Load attributes based on feature id
|
|
8
|
+
* @param {Object} tile
|
|
9
|
+
* @param {number} featureId
|
|
10
|
+
* @param {Object} options
|
|
11
|
+
* @returns {Promise}
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadFeatureAttributes(tile: any, featureId: any, options?: {}): Promise<{} | null>;
|
|
14
|
+
//# sourceMappingURL=i3s-attribute-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i3s-attribute-loader.d.ts","sourceRoot":"","sources":["../src/i3s-attribute-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAU/D;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAUhC,CAAC;AAOF;;;;;;GAMG;AAEH,wBAAsB,qBAAqB,CAAC,IAAI,KAAA,EAAE,SAAS,KAAA,EAAE,OAAO,KAAK,sBA+BxE"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadFeatureAttributes = exports.I3SAttributeLoader = void 0;
|
|
4
|
+
const core_1 = require("@loaders.gl/core");
|
|
5
|
+
const parse_i3s_attribute_1 = require("./lib/parsers/parse-i3s-attribute");
|
|
6
|
+
const url_utils_1 = require("./lib/utils/url-utils");
|
|
7
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
10
|
+
const EMPTY_VALUE = '';
|
|
11
|
+
const REJECTED_STATUS = 'rejected';
|
|
12
|
+
/**
|
|
13
|
+
* Loader for I3S attributes
|
|
14
|
+
*/
|
|
15
|
+
exports.I3SAttributeLoader = {
|
|
16
|
+
name: 'I3S Attribute',
|
|
17
|
+
id: 'i3s-attribute',
|
|
18
|
+
module: 'i3s',
|
|
19
|
+
version: VERSION,
|
|
20
|
+
mimeTypes: ['application/binary'],
|
|
21
|
+
parse,
|
|
22
|
+
extensions: ['bin'],
|
|
23
|
+
options: {},
|
|
24
|
+
binary: true
|
|
25
|
+
};
|
|
26
|
+
async function parse(data, options) {
|
|
27
|
+
data = (0, parse_i3s_attribute_1.parseI3STileAttribute)(data, options);
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Load attributes based on feature id
|
|
32
|
+
* @param {Object} tile
|
|
33
|
+
* @param {number} featureId
|
|
34
|
+
* @param {Object} options
|
|
35
|
+
* @returns {Promise}
|
|
36
|
+
*/
|
|
37
|
+
// eslint-disable-next-line complexity
|
|
38
|
+
async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
39
|
+
const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
|
|
40
|
+
if (!attributeStorageInfo || !attributeUrls || !featureId) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
let attributes = [];
|
|
44
|
+
const attributeLoadPromises = [];
|
|
45
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
const url = (0, url_utils_1.getUrlWithToken)(attributeUrls[index], options.i3s?.token);
|
|
48
|
+
const attributeName = attributeStorageInfo[index].name;
|
|
49
|
+
const attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
50
|
+
const loadOptions = { ...options, attributeName, attributeType };
|
|
51
|
+
const promise = (0, core_1.load)(url, exports.I3SAttributeLoader, loadOptions);
|
|
52
|
+
attributeLoadPromises.push(promise);
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
attributes = await Promise.allSettled(attributeLoadPromises);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// do nothing
|
|
59
|
+
}
|
|
60
|
+
if (!attributes.length) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
64
|
+
}
|
|
65
|
+
exports.loadFeatureAttributes = loadFeatureAttributes;
|
|
66
|
+
/**
|
|
67
|
+
* Gets attributes data from tile.
|
|
68
|
+
* @param tile
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
function getAttributesData(tile) {
|
|
72
|
+
const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
|
|
73
|
+
const attributeUrls = tile.header?.attributeUrls;
|
|
74
|
+
const tilesetFields = tile.tileset?.tileset?.fields || [];
|
|
75
|
+
return { attributeStorageInfo, attributeUrls, tilesetFields };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get attribute value type based on property names
|
|
79
|
+
* @param {Object} attribute
|
|
80
|
+
* @returns {String}
|
|
81
|
+
*/
|
|
82
|
+
function getAttributeValueType(attribute) {
|
|
83
|
+
if (attribute.hasOwnProperty('objectIds')) {
|
|
84
|
+
return 'Oid32';
|
|
85
|
+
}
|
|
86
|
+
else if (attribute.hasOwnProperty('attributeValues')) {
|
|
87
|
+
return attribute.attributeValues.valueType;
|
|
88
|
+
}
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Find in attributeStorageInfo attribute name responsible for feature ids list.
|
|
93
|
+
* @param attributeStorageInfo
|
|
94
|
+
* @returns Feature ids attribute name
|
|
95
|
+
*/
|
|
96
|
+
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
97
|
+
const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
|
|
98
|
+
return objectIdsAttribute?.name;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Generates mapping featureId to feature attributes
|
|
102
|
+
* @param {Array} attributes
|
|
103
|
+
* @param {Object} attributeStorageInfo
|
|
104
|
+
* @param {number} featureId
|
|
105
|
+
* @returns {Object}
|
|
106
|
+
*/
|
|
107
|
+
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
108
|
+
const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
109
|
+
const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
|
|
110
|
+
if (!objectIds) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
|
|
114
|
+
if (attributeIndex < 0) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Generates attribute object for feature mapping by feature id
|
|
121
|
+
* @param {Array} attributes
|
|
122
|
+
* @param {Number} featureIdIndex
|
|
123
|
+
* @param {Object} attributeStorageInfo
|
|
124
|
+
* @returns {Object}
|
|
125
|
+
*/
|
|
126
|
+
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
127
|
+
const attributesObject = {};
|
|
128
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
129
|
+
const attributeName = attributeStorageInfo[index].name;
|
|
130
|
+
const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
|
|
131
|
+
const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
132
|
+
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
|
|
133
|
+
}
|
|
134
|
+
return attributesObject;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get coded values list from tileset.
|
|
138
|
+
* @param attributeName
|
|
139
|
+
* @param tilesetFields
|
|
140
|
+
*/
|
|
141
|
+
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
142
|
+
const attributeField = tilesetFields
|
|
143
|
+
.find(field => field.name === attributeName || field.alias === attributeName);
|
|
144
|
+
return attributeField?.domain?.codedValues || [];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Return attribute value if it presents in atrributes list
|
|
148
|
+
* @param {array} attributes
|
|
149
|
+
* @param {number} index
|
|
150
|
+
* @param {string} attributesName
|
|
151
|
+
*/
|
|
152
|
+
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
153
|
+
const attributeObject = attributes[index];
|
|
154
|
+
if (attributeObject.status === REJECTED_STATUS) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return attributeObject.value[attributesName];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Do formatting of attribute values or return empty string.
|
|
161
|
+
* @param {Array} attribute
|
|
162
|
+
* @param {Number} featureIdIndex
|
|
163
|
+
* @returns {String}
|
|
164
|
+
*/
|
|
165
|
+
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
166
|
+
let value = EMPTY_VALUE;
|
|
167
|
+
if (attribute && (featureIdIndex in attribute)) {
|
|
168
|
+
// eslint-disable-next-line no-control-regex
|
|
169
|
+
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
170
|
+
}
|
|
171
|
+
// Check if coded values are existed. If so we use them.
|
|
172
|
+
if (codedValues.length) {
|
|
173
|
+
const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
|
|
174
|
+
value = codeValue?.name || EMPTY_VALUE;
|
|
175
|
+
}
|
|
176
|
+
return value;
|
|
177
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.d.ts","sourceRoot":"","sources":["../src/i3s-building-scene-layer-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAA+B,MAAM,0BAA0B,CAAC;AAS7F;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBASzC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.I3SBuildingSceneLayerLoader = void 0;
|
|
4
|
+
const parse_i3s_building_scene_layer_1 = require("./lib/parsers/parse-i3s-building-scene-layer");
|
|
5
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
|
|
8
|
+
/**
|
|
9
|
+
* Loader for I3S - Building Scene Layer
|
|
10
|
+
*/
|
|
11
|
+
exports.I3SBuildingSceneLayerLoader = {
|
|
12
|
+
name: 'I3S Building Scene Layer',
|
|
13
|
+
id: 'i3s-building-scene-layer',
|
|
14
|
+
module: 'i3s',
|
|
15
|
+
version: VERSION,
|
|
16
|
+
mimeTypes: ['application/json'],
|
|
17
|
+
parse,
|
|
18
|
+
extensions: ['json'],
|
|
19
|
+
options: {}
|
|
20
|
+
};
|
|
21
|
+
async function parse(data, options, context) {
|
|
22
|
+
if (!context?.url) {
|
|
23
|
+
throw new Error('Url is not provided');
|
|
24
|
+
}
|
|
25
|
+
return (0, parse_i3s_building_scene_layer_1.parseBuildingSceneLayer)(data, context.url);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.d.ts","sourceRoot":"","sources":["../src/i3s-content-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAA+B,MAAM,0BAA0B,CAAC;AAO7F;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAY9B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.I3SContentLoader = void 0;
|
|
4
|
+
const parse_i3s_tile_content_1 = require("./lib/parsers/parse-i3s-tile-content");
|
|
5
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
|
|
8
|
+
/**
|
|
9
|
+
* Loader for I3S - Indexed 3D Scene Layer
|
|
10
|
+
*/
|
|
11
|
+
exports.I3SContentLoader = {
|
|
12
|
+
name: 'I3S Content (Indexed Scene Layers)',
|
|
13
|
+
id: 'i3s-content',
|
|
14
|
+
module: 'i3s',
|
|
15
|
+
worker: true,
|
|
16
|
+
version: VERSION,
|
|
17
|
+
mimeTypes: ['application/octet-stream'],
|
|
18
|
+
parse,
|
|
19
|
+
extensions: ['bin'],
|
|
20
|
+
options: {
|
|
21
|
+
'i3s-content': {}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
async function parse(data, options, context) {
|
|
25
|
+
const { tile, tileset } = options?.i3s || {};
|
|
26
|
+
await (0, parse_i3s_tile_content_1.parseI3STileContent)(data, tile, tileset, options, context);
|
|
27
|
+
return tile.content;
|
|
28
|
+
}
|