Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/model/base-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
PickingInfo,
} from "@deck.gl/core";
import type { WidgetModel } from "@jupyter-widgets/base";
import { Vector } from "apache-arrow";

import { BaseModel } from "./base.js";
import { initializeExtension } from "./extension.js";
Expand Down Expand Up @@ -53,11 +54,16 @@ export abstract class BaseLayerModel extends BaseModel {
.filter((extensionInstance) => extensionInstance !== null);
}

extensionProps() {
extensionProps(batchIndex?: number): Record<string, unknown> {
const props: Record<string, unknown> = {};
for (const layerPropertyName of this.extensionLayerPropertyNames) {
if (isDefined(this[layerPropertyName as keyof this])) {
props[layerPropertyName] = this[layerPropertyName as keyof this];
const value = this[layerPropertyName as keyof this];
if (isDefined(value)) {
if (value instanceof Vector) {
props[layerPropertyName] = value.data[batchIndex ?? 0];
} else {
props[layerPropertyName] = value;
}
}
}
// console.log("extension props", props);
Expand All @@ -71,10 +77,10 @@ export abstract class BaseLayerModel extends BaseModel {
this.model.save_changes();
}

baseLayerProps(): Omit<LayerProps, "id"> {
baseLayerProps(batchIndex?: number): Omit<LayerProps, "id"> {
return {
extensions: this.extensionInstances(),
...this.extensionProps(),
...this.extensionProps(batchIndex),
pickable: this.pickable,
visible: this.visible,
opacity: this.opacity,
Expand Down
20 changes: 10 additions & 10 deletions src/model/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class ArcModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowArcLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -417,7 +417,7 @@ export class ColumnModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowColumnLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -491,7 +491,7 @@ export class HeatmapModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowHeatmapLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -561,7 +561,7 @@ export class PathModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowPathLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -610,7 +610,7 @@ export class PointCloudModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowPointCloudLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -715,7 +715,7 @@ export class PolygonModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowPolygonLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -827,7 +827,7 @@ export class ScatterplotModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowScatterplotLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -890,7 +890,7 @@ export class SolidPolygonModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowSolidPolygonLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -1159,7 +1159,7 @@ export class TextModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowTextLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down Expand Up @@ -1242,7 +1242,7 @@ export class TripsModel extends BaseArrowLayerModel {
for (let batchIdx = 0; batchIdx < this.table.batches.length; batchIdx++) {
layers.push(
new GeoArrowTripsLayer({
...this.baseLayerProps(),
...this.baseLayerProps(batchIdx),
...this.layerProps(batchIdx),
}),
);
Expand Down
Loading