Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start implementation of point cloud layer #96

Merged
merged 11 commits into from
Feb 2, 2024
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ docs_build/
*.zip
*.feather
*.parquet
*.code-workspace

*.yarn

Expand Down
96 changes: 96 additions & 0 deletions src/point-cloud-layer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import {
CompositeLayer,
CompositeLayerProps,
DefaultProps,
GetPickingInfoParams,
Layer,
LayersList,
assert,
} from "@deck.gl/core/typed";
import { PointCloudLayer } from "@deck.gl/layers/typed";
import type { PointCloudLayerProps } from "@deck.gl/layers/typed";
import * as arrow from "apache-arrow"
import * as ga from "@geoarrow/geoarrow-js"
import {
assignAccessor,
extractAccessorsFromProps,
getGeometryVector,
invertOffsets,
} from "./utils.js"
// TODO which accessors are actually needed for a pointcloud layer
naomatheus marked this conversation as resolved.
Show resolved Hide resolved
import {
GeoArrowExtraPickingProps,
computeChunkOffsets,
getPickingInfo,
} from "./picking.js"
import { ColorAccessor, FloatAccessor, GeoArrowPickingInfo } from "./types.js";
import { EXTENSION_NAME } from "./constants.js";
import { validateAccessors } from "./validate.js";
import { defaultPoolSize } from "threads/dist/master/implementation.browser.js";
import { defaultProps } from "./path-layer.js";

/* All properties supported by GeoArrowPointCloudLayer */
export type GeoArrowPointCloudLayerProps = Omit<
PointCloudLayerProps<arrow.Table>, // TODO is this still an Arrow Table or is it another datatype? An arrow table is a vector/array like value so is it the same?
| "omitted properties here"
> &
_GeoArrowPointCloudLayerProps &
CompositeLayerProps;

// TODO # see line of getSizeUnits
export type Unit = 'meters' | 'common' | 'pixels';

/* All properties added by GeoArrowPointCloudLayer */
type _GeoArrowPointCloudLayerProps = {
// data
data: arrow.Table,

/**
* If `true`, validate the arrays provided (e.g. chunk lengths)
* @default true
*/
_validate?: boolean;
/**
*
* The units of the point size, one of `'meters'`, `'common'`, and `'pixels'`.
* @default 'pixels'
*/
getSizeUnits?: Unit; // TODO do we need a unit type here?
naomatheus marked this conversation as resolved.
Show resolved Hide resolved
/**
* Center position accessor.
* If not provided, will be inferred by finding a column with extension type
* `"geoarrow.point"` or `"geoarrow.multipoint"`.
*/
getPosition?: ga.vector.PointVector | ga.vector.MultiPointVector;
naomatheus marked this conversation as resolved.
Show resolved Hide resolved


//getProperties here
}

export class GeoArrowPointCloudLayer<
ExtraProps extends {} = {},
> extends CompositeLayer<Required<GeoArrowPointCloudLayerProps> & ExtraProps>{
naomatheus marked this conversation as resolved.
Show resolved Hide resolved
static defaultProps = defaultProps
static layerName = "GeoArrowPointCloudLayer"

// picking info method


// render layers methods, determine geometry types

// renderlayerpoints method, determine point types

// accessors logic


/// props

/// assign accessor(s)


// render multipoint layers

// final logic

// return
}
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export type TimestampAccessor = arrow.Vector<arrow.List<arrow.Float>>;
export type ColorAccessor =
| arrow.Vector<arrow.FixedSizeList<arrow.Uint8>>
| Accessor<arrow.Table, Color | Color[]>;
export type NormalAccessor = arrow.Vector<arrow.FixedSizeList<arrow.Float32>>
Loading