@maplibre/mlt 1.1.1 → 1.1.2
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/decoding/decodingUtils.js +2 -2
- package/dist/decoding/decodingUtils.js.map +1 -1
- package/dist/decoding/geometryDecoder.js +8 -8
- package/dist/decoding/geometryDecoder.js.map +1 -1
- package/dist/decoding/integerDecodingUtils.d.ts +1 -1
- package/dist/decoding/integerDecodingUtils.js.map +1 -1
- package/dist/decoding/integerStreamDecoder.d.ts +1 -1
- package/dist/decoding/integerStreamDecoder.js.map +1 -1
- package/dist/decoding/integerStreamDecoder.spec.js +22 -4
- package/dist/decoding/integerStreamDecoder.spec.js.map +1 -1
- package/dist/decoding/propertyDecoder.js +10 -10
- package/dist/decoding/propertyDecoder.js.map +1 -1
- package/dist/decoding/propertyDecoder.spec.js +27 -24
- package/dist/decoding/propertyDecoder.spec.js.map +1 -1
- package/dist/decoding/stringDecoder.d.ts +2 -10
- package/dist/decoding/stringDecoder.js +149 -157
- package/dist/decoding/stringDecoder.js.map +1 -1
- package/dist/decoding/stringDecoder.spec.js +10 -10
- package/dist/decoding/stringDecoder.spec.js.map +1 -1
- package/dist/metadata/tile/streamMetadataDecoder.d.ts +28 -4
- package/dist/metadata/tile/streamMetadataDecoder.js +81 -15
- package/dist/metadata/tile/streamMetadataDecoder.js.map +1 -1
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js +4 -4
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js.map +1 -1
- package/dist/metadata/tileset/typeMap.d.ts +21 -29
- package/dist/metadata/tileset/typeMap.js +167 -169
- package/dist/metadata/tileset/typeMap.js.map +1 -1
- package/dist/mltDecoder.js +11 -9
- package/dist/mltDecoder.js.map +1 -1
- package/dist/vector/geometry/geometryVector.js +2 -2
- package/dist/vector/geometry/geometryVector.js.map +1 -1
- package/dist/vector/geometry/geometryVectorConverter.js +4 -4
- package/dist/vector/geometry/geometryVectorConverter.js.map +1 -1
- package/dist/vector/geometry/zOrderCurve.d.ts +4 -17
- package/dist/vector/geometry/zOrderCurve.js +10 -35
- package/dist/vector/geometry/zOrderCurve.js.map +1 -1
- package/dist/vector/geometry/zOrderCurve.spec.js +15 -10
- package/dist/vector/geometry/zOrderCurve.spec.js.map +1 -1
- package/package.json +1 -1
- package/dist/metadata/tile/mortonEncodedStreamMetadata.d.ts +0 -15
- package/dist/metadata/tile/mortonEncodedStreamMetadata.js +0 -27
- package/dist/metadata/tile/mortonEncodedStreamMetadata.js.map +0 -1
- package/dist/metadata/tile/rleEncodedStreamMetadata.d.ts +0 -24
- package/dist/metadata/tile/rleEncodedStreamMetadata.js +0 -38
- package/dist/metadata/tile/rleEncodedStreamMetadata.js.map +0 -1
- package/dist/metadata/tile/streamMetadata.d.ts +0 -29
- package/dist/metadata/tile/streamMetadata.js +0 -82
- package/dist/metadata/tile/streamMetadata.js.map +0 -1
- package/dist/vector/geometry/spaceFillingCurve.d.ts +0 -22
- package/dist/vector/geometry/spaceFillingCurve.js +0 -31
- package/dist/vector/geometry/spaceFillingCurve.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryVectorConverter.js","sourceRoot":"","sources":["../../../src/vector/geometry/geometryVectorConverter.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,MAAM,kBAAkB;IACpB,WAAW,CAAC,UAAiB;QACzB,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,gBAAgB,CAAC,MAAe;QAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;I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AAC,YAAY,GAAG,CAAC,CAAC,CAAC;QAC/C,MAAM,mBAAmB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;QAC/G,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QAClB,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { type GeometryVector, type MortonSettings, type CoordinatesArray } from \"./geometryVector\";\nimport ZOrderCurve from \"./zOrderCurve\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport { VertexBufferType } from \"./vertexBufferType\";\nimport Point from \"@mapbox/point-geometry\";\n\nclass MvtGeometryFactory {\n createPoint(coordinate: Point): CoordinatesArray {\n return [[coordinate]];\n }\n\n createMultiPoint(points: Point[]): CoordinatesArray {\n return points.map((point) => [point]);\n }\n\n createLineString(vertices: Point[]): CoordinatesArray {\n return [vertices];\n }\n\n createMultiLineString(lineStrings: Array<Array<Point>>): CoordinatesArray {\n return lineStrings;\n }\n\n createPolygon(shell: Point[], rings: Array<Array<Point>>): CoordinatesArray {\n return [shell, ...rings];\n }\n\n createMultiPolygon(polygons: Array<Array<Point>>[]): CoordinatesArray {\n //TODO: check winding order of shell and holes\n return polygons.flat();\n }\n}\n\nexport function convertGeometryVector(geometryVector: GeometryVector): CoordinatesArray[] {\n const geometries: CoordinatesArray[] = new Array(geometryVector.numGeometries);\n let partOffsetCounter = 1;\n let ringOffsetsCounter = 1;\n let geometryOffsetsCounter = 1;\n let geometryCounter = 0;\n const geometryFactory = new MvtGeometryFactory();\n let vertexBufferOffset = 0;\n let vertexOffsetsOffset = 0;\n\n const mortonSettings = geometryVector.mortonSettings;\n const topologyVector = geometryVector.topologyVector;\n const geometryOffsets = topologyVector.geometryOffsets;\n const partOffsets = topologyVector.partOffsets;\n const ringOffsets = topologyVector.ringOffsets;\n const vertexOffsets = geometryVector.vertexOffsets;\n\n const containsPolygon = geometryVector.containsPolygonGeometry();\n const vertexBuffer = geometryVector.vertexBuffer;\n\n for (let i = 0; i < geometryVector.numGeometries; i++) {\n const geometryType = geometryVector.geometryType(i);\n if (geometryType === GEOMETRY_TYPE.POINT) {\n if (!vertexOffsets || vertexOffsets.length === 0) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n const coordinate = new Point(x, y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n } else if (geometryVector.vertexBufferType === VertexBufferType.VEC_2) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n const coordinate = new Point(x, y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n } else {\n const offset = vertexOffsets[vertexOffsetsOffset++];\n const mortonCode = vertexBuffer[offset];\n const vertex = ZOrderCurve.decode(mortonCode, mortonSettings.numBits, mortonSettings.coordinateShift);\n const coordinate = new Point(vertex.x, vertex.y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n }\n\n if (geometryOffsets) geometryOffsetsCounter++;\n if (partOffsets) partOffsetCounter++;\n if (ringOffsets) ringOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.MULTIPOINT) {\n const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const points: Point[] = new Array(numPoints);\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numPoints; j++) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n points[j] = new Point(x, y);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);\n } else {\n for (let j = 0; j < numPoints; j++) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n points[j] = new Point(x, y);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);\n }\n } else if (geometryType === GEOMETRY_TYPE.LINESTRING) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n let vertices: Point[];\n if (!vertexOffsets || vertexOffsets.length === 0) {\n vertices = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n } else {\n vertices =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n )\n : decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n geometries[geometryCounter++] = geometryFactory.createLineString(vertices);\n\n if (geometryOffsets) geometryOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.POLYGON) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n\n if (!vertexOffsets || vertexOffsets.length === 0) {\n const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n }\n geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);\n } else {\n const shell =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);\n }\n\n if (geometryOffsets) geometryOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.MULTILINESTRING) {\n const numLineStrings =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const lineStrings: CoordinatesArray = new Array(numLineStrings);\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n lineStrings[j] = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n }\n geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);\n } else {\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n const vertices =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n )\n : decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n lineStrings[j] = vertices;\n vertexOffsetsOffset += numVertices;\n }\n geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);\n }\n } else if (geometryType === GEOMETRY_TYPE.MULTIPOLYGON) {\n const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const polygons: CoordinatesArray[] = new Array(numPolygons);\n let numVertices = 0;\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n for (let k = 0; k < rings.length; k++) {\n const numRingVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[k] = getLinearRing(vertexBuffer, vertexBufferOffset, numRingVertices);\n vertexBufferOffset += numRingVertices * 2;\n }\n\n polygons[j] = geometryFactory.createPolygon(shell, rings);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);\n } else {\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const shell =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let k = 0; k < rings.length; k++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[k] =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n polygons[j] = geometryFactory.createPolygon(shell, rings);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);\n }\n } else {\n throw new Error(\"The specified geometry type is currently not supported.\");\n }\n }\n\n return geometries;\n}\n\nfunction getLinearRing(vertexBuffer: Int32Array, startIndex: number, numVertices: number): Point[] {\n return getLineString(vertexBuffer, startIndex, numVertices, true);\n}\n\nfunction decodeDictionaryEncodedLinearRing(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n): Point[] {\n return decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, true);\n}\n\nfunction decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n geometryFactory: MvtGeometryFactory,\n mortonSettings: MortonSettings,\n): Point[] {\n return decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffset,\n numVertices,\n true,\n mortonSettings,\n );\n}\n\nfunction getLineString(\n vertexBuffer: Int32Array,\n startIndex: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const x = vertexBuffer[startIndex + i];\n const y = vertexBuffer[startIndex + i + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const offset = vertexOffsets[vertexOffset + i / 2] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeMortonDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n mortonSettings: MortonSettings,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices; i++) {\n const offset = vertexOffsets[vertexOffset + i];\n const mortonEncodedVertex = vertexBuffer[offset];\n const vertex = ZOrderCurve.decode(mortonEncodedVertex, mortonSettings.numBits, mortonSettings.coordinateShift);\n vertices[i] = new Point(vertex.x, vertex.y);\n }\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n\n return vertices;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"geometryVectorConverter.js","sourceRoot":"","sources":["../../../src/vector/geometry/geometryVectorConverter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,MAAM,kBAAkB;IACpB,WAAW,CAAC,UAAiB;QACzB,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,gBAAgB,CAAC,MAAe;QAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,gBAAgB,CAAC,QAAiB;QAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;IAED,qBAAqB,CAAC,WAAgC;QAClD,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,aAAa,CAAC,KAAc,EAAE,KAA0B;QACpD,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,kBAAkB,CAAC,QAA+B;QAC9C,8CAA8C;QAC9C,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACJ;AAED,MAAM,UAAU,qBAAqB,CAAC,cAA8B;IAChE,MAAM,UAAU,GAAuB,IAAI,KAAK,CAAC,cAAc,CAA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D,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { type GeometryVector, type MortonSettings, type CoordinatesArray } from \"./geometryVector\";\nimport { decodeZOrderCurve } from \"./zOrderCurve\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport { VertexBufferType } from \"./vertexBufferType\";\nimport Point from \"@mapbox/point-geometry\";\n\nclass MvtGeometryFactory {\n createPoint(coordinate: Point): CoordinatesArray {\n return [[coordinate]];\n }\n\n createMultiPoint(points: Point[]): CoordinatesArray {\n return points.map((point) => [point]);\n }\n\n createLineString(vertices: Point[]): CoordinatesArray {\n return [vertices];\n }\n\n createMultiLineString(lineStrings: Array<Array<Point>>): CoordinatesArray {\n return lineStrings;\n }\n\n createPolygon(shell: Point[], rings: Array<Array<Point>>): CoordinatesArray {\n return [shell].concat(rings);\n }\n\n createMultiPolygon(polygons: Array<Array<Point>>[]): CoordinatesArray {\n //TODO: check winding order of shell and holes\n return polygons.flat();\n }\n}\n\nexport function convertGeometryVector(geometryVector: GeometryVector): CoordinatesArray[] {\n const geometries: CoordinatesArray[] = new Array(geometryVector.numGeometries);\n let partOffsetCounter = 1;\n let ringOffsetsCounter = 1;\n let geometryOffsetsCounter = 1;\n let geometryCounter = 0;\n const geometryFactory = new MvtGeometryFactory();\n let vertexBufferOffset = 0;\n let vertexOffsetsOffset = 0;\n\n const mortonSettings = geometryVector.mortonSettings;\n const topologyVector = geometryVector.topologyVector;\n const geometryOffsets = topologyVector.geometryOffsets;\n const partOffsets = topologyVector.partOffsets;\n const ringOffsets = topologyVector.ringOffsets;\n const vertexOffsets = geometryVector.vertexOffsets;\n\n const containsPolygon = geometryVector.containsPolygonGeometry();\n const vertexBuffer = geometryVector.vertexBuffer;\n\n for (let i = 0; i < geometryVector.numGeometries; i++) {\n const geometryType = geometryVector.geometryType(i);\n if (geometryType === GEOMETRY_TYPE.POINT) {\n if (!vertexOffsets || vertexOffsets.length === 0) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n const coordinate = new Point(x, y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n } else if (geometryVector.vertexBufferType === VertexBufferType.VEC_2) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n const coordinate = new Point(x, y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n } else {\n const offset = vertexOffsets[vertexOffsetsOffset++];\n const mortonCode = vertexBuffer[offset];\n const vertex = decodeZOrderCurve(mortonCode, mortonSettings.numBits, mortonSettings.coordinateShift);\n const coordinate = new Point(vertex.x, vertex.y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n }\n\n if (geometryOffsets) geometryOffsetsCounter++;\n if (partOffsets) partOffsetCounter++;\n if (ringOffsets) ringOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.MULTIPOINT) {\n const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const points: Point[] = new Array(numPoints);\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numPoints; j++) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n points[j] = new Point(x, y);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);\n } else {\n for (let j = 0; j < numPoints; j++) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n points[j] = new Point(x, y);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);\n }\n } else if (geometryType === GEOMETRY_TYPE.LINESTRING) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n let vertices: Point[];\n if (!vertexOffsets || vertexOffsets.length === 0) {\n vertices = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n } else {\n vertices =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n )\n : decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n geometries[geometryCounter++] = geometryFactory.createLineString(vertices);\n\n if (geometryOffsets) geometryOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.POLYGON) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n\n if (!vertexOffsets || vertexOffsets.length === 0) {\n const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n }\n geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);\n } else {\n const shell =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);\n }\n\n if (geometryOffsets) geometryOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.MULTILINESTRING) {\n const numLineStrings =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const lineStrings: CoordinatesArray = new Array(numLineStrings);\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n lineStrings[j] = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n }\n geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);\n } else {\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n const vertices =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n )\n : decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n lineStrings[j] = vertices;\n vertexOffsetsOffset += numVertices;\n }\n geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);\n }\n } else if (geometryType === GEOMETRY_TYPE.MULTIPOLYGON) {\n const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const polygons: CoordinatesArray[] = new Array(numPolygons);\n let numVertices = 0;\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n for (let k = 0; k < rings.length; k++) {\n const numRingVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[k] = getLinearRing(vertexBuffer, vertexBufferOffset, numRingVertices);\n vertexBufferOffset += numRingVertices * 2;\n }\n\n polygons[j] = geometryFactory.createPolygon(shell, rings);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);\n } else {\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const shell =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let k = 0; k < rings.length; k++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[k] =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n polygons[j] = geometryFactory.createPolygon(shell, rings);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);\n }\n } else {\n throw new Error(\"The specified geometry type is currently not supported.\");\n }\n }\n\n return geometries;\n}\n\nfunction getLinearRing(vertexBuffer: Int32Array, startIndex: number, numVertices: number): Point[] {\n return getLineString(vertexBuffer, startIndex, numVertices, true);\n}\n\nfunction decodeDictionaryEncodedLinearRing(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n): Point[] {\n return decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, true);\n}\n\nfunction decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n geometryFactory: MvtGeometryFactory,\n mortonSettings: MortonSettings,\n): Point[] {\n return decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffset,\n numVertices,\n true,\n mortonSettings,\n );\n}\n\nfunction getLineString(\n vertexBuffer: Int32Array,\n startIndex: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const x = vertexBuffer[startIndex + i];\n const y = vertexBuffer[startIndex + i + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const offset = vertexOffsets[vertexOffset + i / 2] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeMortonDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n mortonSettings: MortonSettings,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices; i++) {\n const offset = vertexOffsets[vertexOffset + i];\n const mortonEncodedVertex = vertexBuffer[offset];\n const vertex = decodeZOrderCurve(mortonEncodedVertex, mortonSettings.numBits, mortonSettings.coordinateShift);\n vertices[i] = new Point(vertex.x, vertex.y);\n }\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n\n return vertices;\n}\n"]}
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
y: number;
|
|
6
|
-
}): number;
|
|
7
|
-
decode(mortonCode: number): {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
};
|
|
11
|
-
private decodeMorton;
|
|
12
|
-
static decode(mortonCode: number, numBits: number, coordinateShift: number): {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
};
|
|
16
|
-
private static decodeMorton;
|
|
17
|
-
}
|
|
1
|
+
export declare function decodeZOrderCurve(mortonCode: number, numBits: number, coordinateShift: number): {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return mortonCode;
|
|
12
|
-
}
|
|
13
|
-
decode(mortonCode) {
|
|
14
|
-
const x = this.decodeMorton(mortonCode) - this._coordinateShift;
|
|
15
|
-
const y = this.decodeMorton(mortonCode >> 1) - this._coordinateShift;
|
|
16
|
-
return { x, y };
|
|
17
|
-
}
|
|
18
|
-
decodeMorton(code) {
|
|
19
|
-
let coordinate = 0;
|
|
20
|
-
for (let i = 0; i < this._numBits; i++) {
|
|
21
|
-
coordinate |= (code & (1 << (2 * i))) >> i;
|
|
22
|
-
}
|
|
23
|
-
return coordinate;
|
|
24
|
-
}
|
|
25
|
-
static decode(mortonCode, numBits, coordinateShift) {
|
|
26
|
-
const x = ZOrderCurve.decodeMorton(mortonCode, numBits) - coordinateShift;
|
|
27
|
-
const y = ZOrderCurve.decodeMorton(mortonCode >> 1, numBits) - coordinateShift;
|
|
28
|
-
return { x, y };
|
|
29
|
-
}
|
|
30
|
-
static decodeMorton(code, numBits) {
|
|
31
|
-
let coordinate = 0;
|
|
32
|
-
for (let i = 0; i < numBits; i++) {
|
|
33
|
-
coordinate |= (code & (1 << (2 * i))) >> i;
|
|
34
|
-
}
|
|
35
|
-
return coordinate;
|
|
1
|
+
export function decodeZOrderCurve(mortonCode, numBits, coordinateShift) {
|
|
2
|
+
const x = decodeMorton(mortonCode, numBits) - coordinateShift;
|
|
3
|
+
const y = decodeMorton(mortonCode >> 1, numBits) - coordinateShift;
|
|
4
|
+
return { x, y };
|
|
5
|
+
}
|
|
6
|
+
function decodeMorton(code, numBits) {
|
|
7
|
+
let coordinate = 0;
|
|
8
|
+
for (let i = 0; i < numBits; i++) {
|
|
9
|
+
coordinate |= (code & (1 << (2 * i))) >> i;
|
|
36
10
|
}
|
|
11
|
+
return coordinate;
|
|
37
12
|
}
|
|
38
13
|
//# sourceMappingURL=zOrderCurve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zOrderCurve.js","sourceRoot":"","sources":["../../../src/vector/geometry/zOrderCurve.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"zOrderCurve.js","sourceRoot":"","sources":["../../../src/vector/geometry/zOrderCurve.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAC7B,UAAkB,EAClB,OAAe,EACf,eAAuB;IAEvB,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC;IAC9D,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC;IACnE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,OAAe;IAC/C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,UAAU,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["export function decodeZOrderCurve(\n mortonCode: number,\n numBits: number,\n coordinateShift: number,\n): { x: number; y: number } {\n const x = decodeMorton(mortonCode, numBits) - coordinateShift;\n const y = decodeMorton(mortonCode >> 1, numBits) - coordinateShift;\n return { x, y };\n}\n\nfunction decodeMorton(code: number, numBits: number): number {\n let coordinate = 0;\n for (let i = 0; i < numBits; i++) {\n coordinate |= (code & (1 << (2 * i))) >> i;\n }\n return coordinate;\n}\n"]}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
-
import
|
|
3
|
-
describe("
|
|
4
|
-
it("decode", () => {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { decodeZOrderCurve } from "./zOrderCurve";
|
|
3
|
+
describe("decodeZOrderCurve", () => {
|
|
4
|
+
it("should decode z-order curve", () => {
|
|
5
|
+
const encodedValue = 38865244;
|
|
6
|
+
const numBits = 13;
|
|
7
|
+
const coordinateShift = 0;
|
|
8
|
+
const expectedDecodedValue = { x: 3358, y: 4130 };
|
|
9
|
+
expect(expectedDecodedValue).toEqual(decodeZOrderCurve(encodedValue, numBits, coordinateShift));
|
|
10
|
+
});
|
|
11
|
+
it("should decode the example value of wikipedia", () => {
|
|
12
|
+
const encodedValue = 2479;
|
|
13
|
+
const numBits = 6;
|
|
14
|
+
const coordinateShift = 0;
|
|
15
|
+
const expectedDecodedValue = { x: 19, y: 47 };
|
|
16
|
+
expect(expectedDecodedValue).toEqual(decodeZOrderCurve(encodedValue, numBits, coordinateShift));
|
|
12
17
|
});
|
|
13
18
|
});
|
|
14
19
|
//# sourceMappingURL=zOrderCurve.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zOrderCurve.spec.js","sourceRoot":"","sources":["../../../src/vector/geometry/zOrderCurve.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"zOrderCurve.spec.js","sourceRoot":"","sources":["../../../src/vector/geometry/zOrderCurve.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACnC,MAAM,YAAY,GAAG,QAAQ,CAAC;QAC9B,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,MAAM,eAAe,GAAG,CAAC,CAAC;QAC1B,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;QAElD,MAAM,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IACpG,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACpD,MAAM,YAAY,GAAG,IAAI,CAAC;QAC1B,MAAM,OAAO,GAAG,CAAC,CAAC;QAClB,MAAM,eAAe,GAAG,CAAC,CAAC;QAC1B,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAE9C,MAAM,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IACpG,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { decodeZOrderCurve } from \"./zOrderCurve\";\n\ndescribe(\"decodeZOrderCurve\", () => {\n it(\"should decode z-order curve\", () => {\n const encodedValue = 38865244;\n const numBits = 13;\n const coordinateShift = 0;\n const expectedDecodedValue = { x: 3358, y: 4130 };\n\n expect(expectedDecodedValue).toEqual(decodeZOrderCurve(encodedValue, numBits, coordinateShift));\n });\n\n it(\"should decode the example value of wikipedia\", () => {\n const encodedValue = 2479;\n const numBits = 6;\n const coordinateShift = 0;\n const expectedDecodedValue = { x: 19, y: 47 };\n\n expect(expectedDecodedValue).toEqual(decodeZOrderCurve(encodedValue, numBits, coordinateShift));\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StreamMetadata } from "./streamMetadata";
|
|
2
|
-
import { type PhysicalStreamType } from "./physicalStreamType";
|
|
3
|
-
import { type LogicalStreamType } from "./logicalStreamType";
|
|
4
|
-
import { type LogicalLevelTechnique } from "./logicalLevelTechnique";
|
|
5
|
-
import { type PhysicalLevelTechnique } from "./physicalLevelTechnique";
|
|
6
|
-
import type IntWrapper from "../../decoding/intWrapper";
|
|
7
|
-
export declare class MortonEncodedStreamMetadata extends StreamMetadata {
|
|
8
|
-
private readonly num_bits;
|
|
9
|
-
private readonly coordinate_shift;
|
|
10
|
-
constructor(physicalStreamType: PhysicalStreamType, logicalStreamType: LogicalStreamType, logicalLevelTechnique1: LogicalLevelTechnique, logicalLevelTechnique2: LogicalLevelTechnique, physicalLevelTechnique: PhysicalLevelTechnique, numValues: number, byteLength: number, numBits: number, coordinateShift: number);
|
|
11
|
-
static decode(tile: Uint8Array, offset: IntWrapper): MortonEncodedStreamMetadata;
|
|
12
|
-
static decodePartial(streamMetadata: StreamMetadata, tile: Uint8Array, offset: IntWrapper): MortonEncodedStreamMetadata;
|
|
13
|
-
numBits(): number;
|
|
14
|
-
coordinateShift(): number;
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { StreamMetadata } from "./streamMetadata";
|
|
2
|
-
import { decodeVarintInt32 } from "../../decoding/integerDecodingUtils";
|
|
3
|
-
export class MortonEncodedStreamMetadata extends StreamMetadata {
|
|
4
|
-
num_bits;
|
|
5
|
-
coordinate_shift;
|
|
6
|
-
constructor(physicalStreamType, logicalStreamType, logicalLevelTechnique1, logicalLevelTechnique2, physicalLevelTechnique, numValues, byteLength, numBits, coordinateShift) {
|
|
7
|
-
super(physicalStreamType, logicalStreamType, logicalLevelTechnique1, logicalLevelTechnique2, physicalLevelTechnique, numValues, byteLength);
|
|
8
|
-
this.num_bits = numBits;
|
|
9
|
-
this.coordinate_shift = coordinateShift;
|
|
10
|
-
}
|
|
11
|
-
static decode(tile, offset) {
|
|
12
|
-
const streamMetadata = StreamMetadata.decode(tile, offset);
|
|
13
|
-
const mortonInfo = decodeVarintInt32(tile, offset, 2);
|
|
14
|
-
return new MortonEncodedStreamMetadata(streamMetadata.physicalStreamType, streamMetadata.logicalStreamType, streamMetadata.logicalLevelTechnique1, streamMetadata.logicalLevelTechnique2, streamMetadata.physicalLevelTechnique, streamMetadata.numValues, streamMetadata.byteLength, mortonInfo[0], mortonInfo[1]);
|
|
15
|
-
}
|
|
16
|
-
static decodePartial(streamMetadata, tile, offset) {
|
|
17
|
-
const mortonInfo = decodeVarintInt32(tile, offset, 2);
|
|
18
|
-
return new MortonEncodedStreamMetadata(streamMetadata.physicalStreamType, streamMetadata.logicalStreamType, streamMetadata.logicalLevelTechnique1, streamMetadata.logicalLevelTechnique2, streamMetadata.physicalLevelTechnique, streamMetadata.numValues, streamMetadata.byteLength, mortonInfo[0], mortonInfo[1]);
|
|
19
|
-
}
|
|
20
|
-
numBits() {
|
|
21
|
-
return this.num_bits;
|
|
22
|
-
}
|
|
23
|
-
coordinateShift() {
|
|
24
|
-
return this.coordinate_shift;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=mortonEncodedStreamMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mortonEncodedStreamMetadata.js","sourceRoot":"","sources":["../../../src/metadata/tile/mortonEncodedStreamMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,M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C,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,UAAU,EACzB,UAAU,CAAC,CAAC,CAAC,EACb,UAAU,CAAC,CAAC,CAAC,CAChB,CAAC;IACN,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEM,eAAe;QAClB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;CACJ","sourcesContent":["import { StreamMetadata } from \"./streamMetadata\";\nimport { type PhysicalStreamType } from \"./physicalStreamType\";\nimport { type LogicalStreamType } from \"./logicalStreamType\";\nimport { type LogicalLevelTechnique } from \"./logicalLevelTechnique\";\nimport { type PhysicalLevelTechnique } from \"./physicalLevelTechnique\";\nimport type IntWrapper from \"../../decoding/intWrapper\";\nimport { decodeVarintInt32 } from \"../../decoding/integerDecodingUtils\";\n\nexport class MortonEncodedStreamMetadata extends StreamMetadata {\n private readonly num_bits: number;\n private readonly coordinate_shift: number;\n\n constructor(\n physicalStreamType: PhysicalStreamType,\n logicalStreamType: LogicalStreamType,\n logicalLevelTechnique1: LogicalLevelTechnique,\n logicalLevelTechnique2: LogicalLevelTechnique,\n physicalLevelTechnique: PhysicalLevelTechnique,\n numValues: number,\n byteLength: number,\n numBits: number,\n coordinateShift: number,\n ) {\n super(\n physicalStreamType,\n logicalStreamType,\n logicalLevelTechnique1,\n logicalLevelTechnique2,\n physicalLevelTechnique,\n numValues,\n byteLength,\n );\n this.num_bits = numBits;\n this.coordinate_shift = coordinateShift;\n }\n\n public static decode(tile: Uint8Array, offset: IntWrapper): MortonEncodedStreamMetadata {\n const streamMetadata = StreamMetadata.decode(tile, offset);\n const mortonInfo = decodeVarintInt32(tile, offset, 2);\n return new MortonEncodedStreamMetadata(\n streamMetadata.physicalStreamType,\n streamMetadata.logicalStreamType,\n streamMetadata.logicalLevelTechnique1,\n streamMetadata.logicalLevelTechnique2,\n streamMetadata.physicalLevelTechnique,\n streamMetadata.numValues,\n streamMetadata.byteLength,\n mortonInfo[0],\n mortonInfo[1],\n );\n }\n\n public static decodePartial(\n streamMetadata: StreamMetadata,\n tile: Uint8Array,\n offset: IntWrapper,\n ): MortonEncodedStreamMetadata {\n const mortonInfo = decodeVarintInt32(tile, offset, 2);\n return new MortonEncodedStreamMetadata(\n streamMetadata.physicalStreamType,\n streamMetadata.logicalStreamType,\n streamMetadata.logicalLevelTechnique1,\n streamMetadata.logicalLevelTechnique2,\n streamMetadata.physicalLevelTechnique,\n streamMetadata.numValues,\n streamMetadata.byteLength,\n mortonInfo[0],\n mortonInfo[1],\n );\n }\n\n public numBits(): number {\n return this.num_bits;\n }\n\n public coordinateShift(): number {\n return this.coordinate_shift;\n }\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { StreamMetadata } from "./streamMetadata";
|
|
2
|
-
import { type PhysicalStreamType } from "./physicalStreamType";
|
|
3
|
-
import { type LogicalStreamType } from "./logicalStreamType";
|
|
4
|
-
import { type LogicalLevelTechnique } from "./logicalLevelTechnique";
|
|
5
|
-
import { type PhysicalLevelTechnique } from "./physicalLevelTechnique";
|
|
6
|
-
import type IntWrapper from "../../decoding/intWrapper";
|
|
7
|
-
export declare class RleEncodedStreamMetadata extends StreamMetadata {
|
|
8
|
-
private readonly _runs;
|
|
9
|
-
private readonly _numRleValues;
|
|
10
|
-
/**
|
|
11
|
-
* @param numValues After LogicalLevelTechnique was applied -> numRuns + numValues
|
|
12
|
-
* @param _runs Length of the runs array
|
|
13
|
-
* @param _numRleValues Used for pre-allocating the arrays on the client for faster decoding
|
|
14
|
-
*/
|
|
15
|
-
constructor(physicalStreamType: PhysicalStreamType, logicalStreamType: LogicalStreamType, logicalLevelTechnique1: LogicalLevelTechnique, logicalLevelTechnique2: LogicalLevelTechnique, physicalLevelTechnique: PhysicalLevelTechnique, numValues: number, byteLength: number, _runs: number, _numRleValues: number);
|
|
16
|
-
static decode(tile: Uint8Array, offset: IntWrapper): RleEncodedStreamMetadata;
|
|
17
|
-
static decodePartial(streamMetadata: StreamMetadata, tile: Uint8Array, offset: IntWrapper): RleEncodedStreamMetadata;
|
|
18
|
-
get runs(): number;
|
|
19
|
-
get numRleValues(): number;
|
|
20
|
-
/**
|
|
21
|
-
* Override to return the decompressed count for RLE streams.
|
|
22
|
-
*/
|
|
23
|
-
getDecompressedCount(): number;
|
|
24
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { StreamMetadata } from "./streamMetadata";
|
|
2
|
-
import { decodeVarintInt32 } from "../../decoding/integerDecodingUtils";
|
|
3
|
-
export class RleEncodedStreamMetadata extends StreamMetadata {
|
|
4
|
-
_runs;
|
|
5
|
-
_numRleValues;
|
|
6
|
-
/**
|
|
7
|
-
* @param numValues After LogicalLevelTechnique was applied -> numRuns + numValues
|
|
8
|
-
* @param _runs Length of the runs array
|
|
9
|
-
* @param _numRleValues Used for pre-allocating the arrays on the client for faster decoding
|
|
10
|
-
*/
|
|
11
|
-
constructor(physicalStreamType, logicalStreamType, logicalLevelTechnique1, logicalLevelTechnique2, physicalLevelTechnique, numValues, byteLength, _runs, _numRleValues) {
|
|
12
|
-
super(physicalStreamType, logicalStreamType, logicalLevelTechnique1, logicalLevelTechnique2, physicalLevelTechnique, numValues, byteLength);
|
|
13
|
-
this._runs = _runs;
|
|
14
|
-
this._numRleValues = _numRleValues;
|
|
15
|
-
}
|
|
16
|
-
static decode(tile, offset) {
|
|
17
|
-
const streamMetadata = StreamMetadata.decode(tile, offset);
|
|
18
|
-
const rleInfo = decodeVarintInt32(tile, offset, 2);
|
|
19
|
-
return new RleEncodedStreamMetadata(streamMetadata.physicalStreamType, streamMetadata.logicalStreamType, streamMetadata.logicalLevelTechnique1, streamMetadata.logicalLevelTechnique2, streamMetadata.physicalLevelTechnique, streamMetadata.numValues, streamMetadata.byteLength, rleInfo[0], rleInfo[1]);
|
|
20
|
-
}
|
|
21
|
-
static decodePartial(streamMetadata, tile, offset) {
|
|
22
|
-
const rleInfo = decodeVarintInt32(tile, offset, 2);
|
|
23
|
-
return new RleEncodedStreamMetadata(streamMetadata.physicalStreamType, streamMetadata.logicalStreamType, streamMetadata.logicalLevelTechnique1, streamMetadata.logicalLevelTechnique2, streamMetadata.physicalLevelTechnique, streamMetadata.numValues, streamMetadata.byteLength, rleInfo[0], rleInfo[1]);
|
|
24
|
-
}
|
|
25
|
-
get runs() {
|
|
26
|
-
return this._runs;
|
|
27
|
-
}
|
|
28
|
-
get numRleValues() {
|
|
29
|
-
return this._numRleValues;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Override to return the decompressed count for RLE streams.
|
|
33
|
-
*/
|
|
34
|
-
getDecompressedCount() {
|
|
35
|
-
return this._numRleValues;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=rleEncodedStreamMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rleEncodedStreamMetadata.js","sourceRoot":"","sources":["../../../src/metadata/tile/rleEncodedStreamMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAcnC;IACA;IAdrB;;;;OAIG;IACH,YACI,kBAAsC,EACtC,iBAAoC,EACpC,sBAA6C,EAC7C,sBAA6C,EAC7C,sBAA8C,EAC9C,SAAiB,EACjB,UAAkB,EACD,KAAa,EACb,aAAqB;QAEtC,KAAK,CACD,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,SAAS,EACT,UAAU,CACb,CAAC;QAXe,UAAK,GAAL,KAAK,CAAQ;QACb,kBAAa,GAAb,aAAa,CAAQ;IAW1C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,IAAgB,EAAE,MAAkB;QAC9C,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACnD,OAAO,IAAI,wBAAwB,CAC/B,cAAc,CAAC,kBAAkB,EACjC,cAAc,CAAC,iBAAiB,EAChC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,UAAU,EACzB,OAAO,CAAC,CAAC,CAAC,EACV,OAAO,CAAC,CAAC,CAAC,CACb,CAAC;IACN,CAAC;IAED,MAAM,CAAC,aAAa,CAChB,cAA8B,EAC9B,IAAgB,EAChB,MAAkB;QAElB,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACnD,OAAO,IAAI,wBAAwB,CAC/B,cAAc,CAAC,kBAAkB,EACjC,cAAc,CAAC,iBAAiB,EAChC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,sBAAsB,EACrC,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,UAAU,EACzB,OAAO,CAAC,CAAC,CAAC,EACV,OAAO,CAAC,CAAC,CAAC,CACb,CAAC;IACN,CAAC;IAED,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACM,oBAAoB;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import { StreamMetadata } from \"./streamMetadata\";\nimport { type PhysicalStreamType } from \"./physicalStreamType\";\nimport { type LogicalStreamType } from \"./logicalStreamType\";\nimport { type LogicalLevelTechnique } from \"./logicalLevelTechnique\";\nimport { type PhysicalLevelTechnique } from \"./physicalLevelTechnique\";\nimport type IntWrapper from \"../../decoding/intWrapper\";\nimport { decodeVarintInt32 } from \"../../decoding/integerDecodingUtils\";\n\nexport class RleEncodedStreamMetadata extends StreamMetadata {\n /**\n * @param numValues After LogicalLevelTechnique was applied -> numRuns + numValues\n * @param _runs Length of the runs array\n * @param _numRleValues Used for pre-allocating the arrays on the client for faster decoding\n */\n constructor(\n physicalStreamType: PhysicalStreamType,\n logicalStreamType: LogicalStreamType,\n logicalLevelTechnique1: LogicalLevelTechnique,\n logicalLevelTechnique2: LogicalLevelTechnique,\n physicalLevelTechnique: PhysicalLevelTechnique,\n numValues: number,\n byteLength: number,\n private readonly _runs: number,\n private readonly _numRleValues: number,\n ) {\n super(\n physicalStreamType,\n logicalStreamType,\n logicalLevelTechnique1,\n logicalLevelTechnique2,\n physicalLevelTechnique,\n numValues,\n byteLength,\n );\n }\n\n static decode(tile: Uint8Array, offset: IntWrapper): RleEncodedStreamMetadata {\n const streamMetadata = StreamMetadata.decode(tile, offset);\n const rleInfo = decodeVarintInt32(tile, offset, 2);\n return new RleEncodedStreamMetadata(\n streamMetadata.physicalStreamType,\n streamMetadata.logicalStreamType,\n streamMetadata.logicalLevelTechnique1,\n streamMetadata.logicalLevelTechnique2,\n streamMetadata.physicalLevelTechnique,\n streamMetadata.numValues,\n streamMetadata.byteLength,\n rleInfo[0],\n rleInfo[1],\n );\n }\n\n static decodePartial(\n streamMetadata: StreamMetadata,\n tile: Uint8Array,\n offset: IntWrapper,\n ): RleEncodedStreamMetadata {\n const rleInfo = decodeVarintInt32(tile, offset, 2);\n return new RleEncodedStreamMetadata(\n streamMetadata.physicalStreamType,\n streamMetadata.logicalStreamType,\n streamMetadata.logicalLevelTechnique1,\n streamMetadata.logicalLevelTechnique2,\n streamMetadata.physicalLevelTechnique,\n streamMetadata.numValues,\n streamMetadata.byteLength,\n rleInfo[0],\n rleInfo[1],\n );\n }\n\n public get runs(): number {\n return this._runs;\n }\n\n get numRleValues(): number {\n return this._numRleValues;\n }\n\n /**\n * Override to return the decompressed count for RLE streams.\n */\n override getDecompressedCount(): number {\n return this._numRleValues;\n }\n}\n"]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PhysicalStreamType } from "./physicalStreamType";
|
|
2
|
-
import { LogicalStreamType } from "./logicalStreamType";
|
|
3
|
-
import { LogicalLevelTechnique } from "./logicalLevelTechnique";
|
|
4
|
-
import { PhysicalLevelTechnique } from "./physicalLevelTechnique";
|
|
5
|
-
import type IntWrapper from "../../decoding/intWrapper";
|
|
6
|
-
export declare class StreamMetadata {
|
|
7
|
-
private readonly _physicalStreamType;
|
|
8
|
-
private readonly _logicalStreamType;
|
|
9
|
-
private readonly _logicalLevelTechnique1;
|
|
10
|
-
private readonly _logicalLevelTechnique2;
|
|
11
|
-
private readonly _physicalLevelTechnique;
|
|
12
|
-
private readonly _numValues;
|
|
13
|
-
private readonly _byteLength;
|
|
14
|
-
constructor(_physicalStreamType: PhysicalStreamType, _logicalStreamType: LogicalStreamType, _logicalLevelTechnique1: LogicalLevelTechnique, _logicalLevelTechnique2: LogicalLevelTechnique, _physicalLevelTechnique: PhysicalLevelTechnique, _numValues: number, _byteLength: number);
|
|
15
|
-
static decode(tile: Uint8Array, offset: IntWrapper): StreamMetadata;
|
|
16
|
-
get physicalStreamType(): PhysicalStreamType;
|
|
17
|
-
get logicalStreamType(): LogicalStreamType;
|
|
18
|
-
get logicalLevelTechnique1(): LogicalLevelTechnique;
|
|
19
|
-
get logicalLevelTechnique2(): LogicalLevelTechnique;
|
|
20
|
-
get physicalLevelTechnique(): PhysicalLevelTechnique;
|
|
21
|
-
get numValues(): number;
|
|
22
|
-
get byteLength(): number;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the number of decompressed values.
|
|
25
|
-
* For non-RLE streams, this is the same as numValues.
|
|
26
|
-
* For RLE streams, this is overridden to return numRleValues.
|
|
27
|
-
*/
|
|
28
|
-
getDecompressedCount(): number;
|
|
29
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { PhysicalStreamType } from "./physicalStreamType";
|
|
2
|
-
import { LogicalStreamType } from "./logicalStreamType";
|
|
3
|
-
import { LogicalLevelTechnique } from "./logicalLevelTechnique";
|
|
4
|
-
import { PhysicalLevelTechnique } from "./physicalLevelTechnique";
|
|
5
|
-
import { DictionaryType } from "./dictionaryType";
|
|
6
|
-
import { OffsetType } from "./offsetType";
|
|
7
|
-
import { LengthType } from "./lengthType";
|
|
8
|
-
import { decodeVarintInt32 } from "../../decoding/integerDecodingUtils";
|
|
9
|
-
export class StreamMetadata {
|
|
10
|
-
_physicalStreamType;
|
|
11
|
-
_logicalStreamType;
|
|
12
|
-
_logicalLevelTechnique1;
|
|
13
|
-
_logicalLevelTechnique2;
|
|
14
|
-
_physicalLevelTechnique;
|
|
15
|
-
_numValues;
|
|
16
|
-
_byteLength;
|
|
17
|
-
constructor(_physicalStreamType, _logicalStreamType, _logicalLevelTechnique1, _logicalLevelTechnique2, _physicalLevelTechnique, _numValues, _byteLength) {
|
|
18
|
-
this._physicalStreamType = _physicalStreamType;
|
|
19
|
-
this._logicalStreamType = _logicalStreamType;
|
|
20
|
-
this._logicalLevelTechnique1 = _logicalLevelTechnique1;
|
|
21
|
-
this._logicalLevelTechnique2 = _logicalLevelTechnique2;
|
|
22
|
-
this._physicalLevelTechnique = _physicalLevelTechnique;
|
|
23
|
-
this._numValues = _numValues;
|
|
24
|
-
this._byteLength = _byteLength;
|
|
25
|
-
}
|
|
26
|
-
static decode(tile, offset) {
|
|
27
|
-
const stream_type = tile[offset.get()];
|
|
28
|
-
const physicalStreamType = Object.values(PhysicalStreamType)[stream_type >> 4];
|
|
29
|
-
let logicalStreamType = null;
|
|
30
|
-
switch (physicalStreamType) {
|
|
31
|
-
case PhysicalStreamType.DATA:
|
|
32
|
-
logicalStreamType = new LogicalStreamType(Object.values(DictionaryType)[stream_type & 0xf]);
|
|
33
|
-
break;
|
|
34
|
-
case PhysicalStreamType.OFFSET:
|
|
35
|
-
logicalStreamType = new LogicalStreamType(null, Object.values(OffsetType)[stream_type & 0xf]);
|
|
36
|
-
break;
|
|
37
|
-
case PhysicalStreamType.LENGTH:
|
|
38
|
-
logicalStreamType = new LogicalStreamType(null, null, Object.values(LengthType)[stream_type & 0xf]);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
offset.increment();
|
|
42
|
-
const encodings_header = tile[offset.get()];
|
|
43
|
-
const llt1 = Object.values(LogicalLevelTechnique)[encodings_header >> 5];
|
|
44
|
-
const llt2 = Object.values(LogicalLevelTechnique)[(encodings_header >> 2) & 0x7];
|
|
45
|
-
const plt = Object.values(PhysicalLevelTechnique)[encodings_header & 0x3];
|
|
46
|
-
offset.increment();
|
|
47
|
-
const sizeInfo = decodeVarintInt32(tile, offset, 2);
|
|
48
|
-
const numValues = sizeInfo[0];
|
|
49
|
-
const byteLength = sizeInfo[1];
|
|
50
|
-
return new StreamMetadata(physicalStreamType, logicalStreamType, llt1, llt2, plt, numValues, byteLength);
|
|
51
|
-
}
|
|
52
|
-
get physicalStreamType() {
|
|
53
|
-
return this._physicalStreamType;
|
|
54
|
-
}
|
|
55
|
-
get logicalStreamType() {
|
|
56
|
-
return this._logicalStreamType;
|
|
57
|
-
}
|
|
58
|
-
get logicalLevelTechnique1() {
|
|
59
|
-
return this._logicalLevelTechnique1;
|
|
60
|
-
}
|
|
61
|
-
get logicalLevelTechnique2() {
|
|
62
|
-
return this._logicalLevelTechnique2;
|
|
63
|
-
}
|
|
64
|
-
get physicalLevelTechnique() {
|
|
65
|
-
return this._physicalLevelTechnique;
|
|
66
|
-
}
|
|
67
|
-
get numValues() {
|
|
68
|
-
return this._numValues;
|
|
69
|
-
}
|
|
70
|
-
get byteLength() {
|
|
71
|
-
return this._byteLength;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Returns the number of decompressed values.
|
|
75
|
-
* For non-RLE streams, this is the same as numValues.
|
|
76
|
-
* For RLE streams, this is overridden to return numRleValues.
|
|
77
|
-
*/
|
|
78
|
-
getDecompressedCount() {
|
|
79
|
-
return this._numValues;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=streamMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streamMetadata.js","sourceRoot":"","sources":["../../../src/metadata/tile/streamMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,MAAM,OAAO,cAAc;IAEF;IACA;IACA;IACA;IACA;IACA;IACA;IAPrB,YACqB,mBAAuC,EACvC,kBAAqC,EACrC,uBAA8C,EAC9C,uBAA8C,EAC9C,uBAA+C,EAC/C,UAAkB,EAClB,WAAmB;QANnB,wBAAmB,GAAnB,mBAAmB,CAAoB;QACvC,uBAAkB,GAAlB,kBAAkB,CAAmB;QACrC,4BAAuB,GAAvB,uBAAuB,CAAuB;QAC9C,4BAAuB,GAAvB,uBAAuB,CAAuB;QAC9C,4BAAuB,GAAvB,uBAAuB,CAAwB;QAC/C,eAAU,GAAV,UAAU,CAAQ;QAClB,gBAAW,GAAX,WAAW,CAAQ;IACrC,CAAC;IAEG,MAAM,CAAC,MAAM,CAAC,IAAgB,EAAE,MAAkB;QACrD,MAAM,WAAW,GAAG,IAAI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,EAAE,CAAC;QAEnB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACpD,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE/B,OAAO,IAAI,cAAc,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC7G,CAAC;IAED,IAAI,kBAAkB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IAED,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,IAAI,sBAAsB;QACtB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAED,IAAI,sBAAsB;QACtB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAED,IAAI,sBAAsB;QACtB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,oBAAoB;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { PhysicalStreamType } from \"./physicalStreamType\";\nimport { LogicalStreamType } from \"./logicalStreamType\";\nimport { LogicalLevelTechnique } from \"./logicalLevelTechnique\";\nimport { PhysicalLevelTechnique } from \"./physicalLevelTechnique\";\nimport { DictionaryType } from \"./dictionaryType\";\nimport { OffsetType } from \"./offsetType\";\nimport { LengthType } from \"./lengthType\";\nimport type IntWrapper from \"../../decoding/intWrapper\";\nimport { decodeVarintInt32 } from \"../../decoding/integerDecodingUtils\";\n\nexport class StreamMetadata {\n constructor(\n private readonly _physicalStreamType: PhysicalStreamType,\n private readonly _logicalStreamType: LogicalStreamType,\n private readonly _logicalLevelTechnique1: LogicalLevelTechnique,\n private readonly _logicalLevelTechnique2: LogicalLevelTechnique,\n private readonly _physicalLevelTechnique: PhysicalLevelTechnique,\n private readonly _numValues: number,\n private readonly _byteLength: number,\n ) {}\n\n public static decode(tile: Uint8Array, offset: IntWrapper): StreamMetadata {\n const stream_type = tile[offset.get()];\n const physicalStreamType = Object.values(PhysicalStreamType)[stream_type >> 4] as PhysicalStreamType;\n let logicalStreamType: LogicalStreamType | null = null;\n\n switch (physicalStreamType) {\n case PhysicalStreamType.DATA:\n logicalStreamType = new LogicalStreamType(\n Object.values(DictionaryType)[stream_type & 0xf] as DictionaryType,\n );\n break;\n case PhysicalStreamType.OFFSET:\n logicalStreamType = new LogicalStreamType(\n null,\n Object.values(OffsetType)[stream_type & 0xf] as OffsetType,\n );\n break;\n case PhysicalStreamType.LENGTH:\n logicalStreamType = new LogicalStreamType(\n null,\n null,\n Object.values(LengthType)[stream_type & 0xf] as LengthType,\n );\n break;\n }\n offset.increment();\n\n const encodings_header = tile[offset.get()];\n const llt1 = Object.values(LogicalLevelTechnique)[encodings_header >> 5] as LogicalLevelTechnique;\n const llt2 = Object.values(LogicalLevelTechnique)[(encodings_header >> 2) & 0x7] as LogicalLevelTechnique;\n const plt = Object.values(PhysicalLevelTechnique)[encodings_header & 0x3] as PhysicalLevelTechnique;\n offset.increment();\n\n const sizeInfo = decodeVarintInt32(tile, offset, 2);\n const numValues = sizeInfo[0];\n const byteLength = sizeInfo[1];\n\n return new StreamMetadata(physicalStreamType, logicalStreamType, llt1, llt2, plt, numValues, byteLength);\n }\n\n get physicalStreamType(): PhysicalStreamType {\n return this._physicalStreamType;\n }\n\n get logicalStreamType(): LogicalStreamType {\n return this._logicalStreamType;\n }\n\n get logicalLevelTechnique1(): LogicalLevelTechnique {\n return this._logicalLevelTechnique1;\n }\n\n get logicalLevelTechnique2(): LogicalLevelTechnique {\n return this._logicalLevelTechnique2;\n }\n\n get physicalLevelTechnique(): PhysicalLevelTechnique {\n return this._physicalLevelTechnique;\n }\n\n get numValues(): number {\n return this._numValues;\n }\n\n get byteLength(): number {\n return this._byteLength;\n }\n\n /**\n * Returns the number of decompressed values.\n * For non-RLE streams, this is the same as numValues.\n * For RLE streams, this is overridden to return numRleValues.\n */\n getDecompressedCount(): number {\n return this._numValues;\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export default abstract class SpaceFillingCurve {
|
|
2
|
-
protected tileExtent: number;
|
|
3
|
-
protected _numBits: number;
|
|
4
|
-
protected _coordinateShift: number;
|
|
5
|
-
private readonly minBound;
|
|
6
|
-
private readonly maxBound;
|
|
7
|
-
constructor(minVertexValue: number, maxVertexValue: number);
|
|
8
|
-
protected validateCoordinates(vertex: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}): void;
|
|
12
|
-
abstract encode(vertex: {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
}): number;
|
|
16
|
-
abstract decode(mortonCode: number): {
|
|
17
|
-
x: number;
|
|
18
|
-
y: number;
|
|
19
|
-
};
|
|
20
|
-
numBits(): number;
|
|
21
|
-
coordinateShift(): number;
|
|
22
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export default class SpaceFillingCurve {
|
|
2
|
-
tileExtent;
|
|
3
|
-
_numBits;
|
|
4
|
-
_coordinateShift;
|
|
5
|
-
minBound;
|
|
6
|
-
maxBound;
|
|
7
|
-
constructor(minVertexValue, maxVertexValue) {
|
|
8
|
-
// TODO: fix tile buffer problem
|
|
9
|
-
this._coordinateShift = minVertexValue < 0 ? Math.abs(minVertexValue) : 0;
|
|
10
|
-
this.tileExtent = maxVertexValue + this._coordinateShift;
|
|
11
|
-
this._numBits = Math.ceil(Math.log2(this.tileExtent));
|
|
12
|
-
this.minBound = minVertexValue;
|
|
13
|
-
this.maxBound = maxVertexValue;
|
|
14
|
-
}
|
|
15
|
-
validateCoordinates(vertex) {
|
|
16
|
-
// TODO: also check for int overflow as we are limiting the sfc ids to max int size
|
|
17
|
-
if (vertex.x < this.minBound ||
|
|
18
|
-
vertex.y < this.minBound ||
|
|
19
|
-
vertex.x > this.maxBound ||
|
|
20
|
-
vertex.y > this.maxBound) {
|
|
21
|
-
throw new Error("The specified tile buffer size is currently not supported.");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
numBits() {
|
|
25
|
-
return this._numBits;
|
|
26
|
-
}
|
|
27
|
-
coordinateShift() {
|
|
28
|
-
return this._coordinateShift;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=spaceFillingCurve.js.map
|