Skip to content

Commit e9cc12d

Browse files
committed
remove extraneous tixrixqid code
1 parent e426586 commit e9cc12d

File tree

1 file changed

+4
-37
lines changed

1 file changed

+4
-37
lines changed

src/tixrixqid.ts

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ type Tix = number;
2121
// An Rix is a row index, which is an integer identifier for a row in a tile.
2222
type Rix = number;
2323

24-
// A Rixen is a list of row indices. It must be non-empty.
25-
type Rixen = [Rix, ...Rix[]];
2624

2725
// A Qid is a pair of a Tix and a Rixen. It identifies a set of rows in a tile.
28-
export type Qid = [Tix, Rixen];
26+
export type Qid = [Tix, Rix];
2927
export type QidArray = Qid[];
3028

3129
export function zxyToTix(z: number, x: number, y: number) {
@@ -99,7 +97,7 @@ export async function tixToTile(tix: Tix, dataset: Deeptable): Promise<Tile> {
9997
export async function qidToRowProxy(qid: Qid, dataset: Deeptable) {
10098
const tile = await tixToTile(qid[0], dataset);
10199
await tile.get_column('x');
102-
return tile.record_batch.get(qid[1][0]);
100+
return tile.record_batch.get(qid[1]);
103101
}
104102

105103
export function tileKey_to_tix(key: string) {
@@ -132,10 +130,10 @@ export function tixToZxy(tix: Tix): [number, number, number] {
132130
export function getQidFromRow(
133131
row: StructRowProxy,
134132
dataset: Deeptable,
135-
): [number, number] {
133+
): Qid {
136134
const tile = getTileFromRow(row, dataset);
137135
const rix = row[Symbol.for('rowIndex')] as number;
138-
return [tileKey_to_tix(tile.key), rix] as [number, number];
136+
return [tile.tix, rix] satisfies [number, number];
139137
}
140138

141139
export function getTileFromRow(row: StructRowProxy, dataset: Deeptable): Tile {
@@ -178,37 +176,6 @@ export function getTileFromRow(row: StructRowProxy, dataset: Deeptable): Tile {
178176
return best_match[0];
179177
}
180178

181-
export function getQidArrayFromRows(
182-
rows: StructRowProxy[],
183-
dataset: Deeptable,
184-
): QidArray {
185-
// TODO: this is really inefficient. We should be able to do this in one pass.
186-
const qids = rows.map((row) => getQidFromRow(row, dataset));
187-
const mapped = new Map<number, [number, ...number[]]>();
188-
for (const qid of qids) {
189-
if (mapped.has(qid[0])) {
190-
mapped.get(qid[0]).push(qid[1]);
191-
} else {
192-
mapped.set(qid[0], [qid[1]]);
193-
}
194-
}
195-
return Array.from(mapped.entries());
196-
}
197-
198-
export function selectQixOnTile(tile: Tile, qidList: QidArray) {
199-
const mask = new Bitmask(tile.record_batch.numRows);
200-
const [z, x, y] = tile.key.split('/').map((d) => parseInt(d));
201-
const tix = zxyToTix(z, x, y);
202-
const rixes = qidList
203-
.filter((d) => d[0] === tix)
204-
.map((d) => d[1])
205-
.flat();
206-
for (const rix of rixes) {
207-
mask.set(rix);
208-
}
209-
return mask.to_arrow();
210-
}
211-
212179
/**
213180
*
214181
* @param hoverDatum A struct row.

0 commit comments

Comments
 (0)