Skip to content

Commit 198b87f

Browse files
authored
feat: Add vectorized props from polygon layer to h3 hexagon layer (#157)
1 parent 6c93b05 commit 198b87f

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

packages/deck.gl-layers/src/layers/h3-hexagon-layer.ts

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { H3HexagonLayerProps } from "@deck.gl/geo-layers";
1414
import { H3HexagonLayer } from "@deck.gl/geo-layers";
1515
import * as arrow from "apache-arrow";
1616

17-
import { GeoArrowPickingInfo } from "../types";
17+
import { ColorAccessor, FloatAccessor, GeoArrowPickingInfo } from "../types";
1818
import { assignAccessor, extractAccessorsFromProps } from "../utils/utils";
1919
import { GeoArrowExtraPickingProps, getPickingInfo } from "../utils/picking";
2020
import { validateAccessors } from "../utils/validate";
@@ -25,6 +25,7 @@ export type GeoArrowH3HexagonLayerProps = Omit<
2525
"data" | "getHexagon"
2626
> &
2727
_GeoArrowH3HexagonLayerProps &
28+
// Omit<GeoArrowPolygonLayerProps, "getPolygon"> &
2829
CompositeLayerProps;
2930

3031
/** Props added by the GeoArrowH3HexagonLayer */
@@ -36,6 +37,31 @@ type _GeoArrowH3HexagonLayerProps = {
3637
*/
3738
getHexagon: arrow.Data<arrow.Utf8>;
3839

40+
/** Fill color accessor.
41+
* @default [0, 0, 0, 255]
42+
*/
43+
getFillColor?: ColorAccessor;
44+
45+
/** Stroke color accessor.
46+
* @default [0, 0, 0, 255]
47+
*/
48+
getLineColor?: ColorAccessor;
49+
50+
/**
51+
* Line width value of accessor.
52+
* @default 1
53+
*/
54+
getLineWidth?: FloatAccessor;
55+
56+
/**
57+
* Elevation value of accessor.
58+
*
59+
* Only used if `extruded: true`.
60+
*
61+
* @default 1000
62+
*/
63+
getElevation?: FloatAccessor;
64+
3965
/**
4066
* If `true`, validate the arrays provided (e.g. chunk lengths)
4167
* @default true
@@ -55,7 +81,9 @@ const ourDefaultProps = {
5581
_validate: true,
5682
};
5783

84+
// @ts-expect-error getFillColor
5885
const defaultProps: DefaultProps<GeoArrowH3HexagonLayerProps> = {
86+
// ..._polygonDefaultProps,
5987
..._defaultProps,
6088
...ourDefaultProps,
6189
};
@@ -90,8 +118,6 @@ export class GeoArrowH3HexagonLayer<
90118
"getHexagon",
91119
]);
92120

93-
const hexValues = hexData.values;
94-
95121
const props: H3HexagonLayerProps = {
96122
// Note: because this is a composite layer and not doing the rendering
97123
// itself, we still have to pass in our defaultProps
@@ -106,8 +132,8 @@ export class GeoArrowH3HexagonLayer<
106132
length: hexData.length,
107133
attributes: {
108134
getHexagon: {
109-
value: hexValues,
110-
// h3 cells should always be 15 characters...?
135+
value: hexData.values,
136+
// h3 cells should always be 15 characters
111137
size: 15,
112138
},
113139
},

0 commit comments

Comments
 (0)