@@ -21,9 +21,11 @@ import {
2121 assignAccessor ,
2222 extractAccessorsFromProps ,
2323 getGeometryVector ,
24+ getInterleavedPolygon ,
2425 getMultiPolygonResolvedOffsets ,
2526 getPolygonResolvedOffsets ,
2627 invertOffsets ,
28+ isGeomSeparate ,
2729} from "../utils/utils" ;
2830import {
2931 GeoArrowExtraPickingProps ,
@@ -249,7 +251,12 @@ export class GeoArrowSolidPolygonLayer<
249251 recordBatchIdx < geometryColumn . data . length ;
250252 recordBatchIdx ++
251253 ) {
252- const polygonData = geometryColumn . data [ recordBatchIdx ] ;
254+ let polygonData = geometryColumn . data [ recordBatchIdx ] ;
255+ // TODO: Note here that [when applicable] we do this conversion twice -
256+ // one for triangulation (earcut) here and the other for rendering later.
257+ if ( isGeomSeparate ( polygonData ) ) {
258+ polygonData = getInterleavedPolygon ( polygonData ) ;
259+ }
253260 const [ preparedPolygonData , arrayBuffers ] = ga . worker . preparePostMessage (
254261 polygonData ,
255262 true ,
@@ -278,7 +285,12 @@ export class GeoArrowSolidPolygonLayer<
278285 recordBatchIdx < geometryColumn . data . length ;
279286 recordBatchIdx ++
280287 ) {
281- const polygonData = geometryColumn . data [ recordBatchIdx ] ;
288+ let polygonData = geometryColumn . data [ recordBatchIdx ] ;
289+ // TODO: Note here that [when applicable] we do this conversion twice -
290+ // one for triangulation (earcut) here and the other for rendering later.
291+ if ( isGeomSeparate ( polygonData ) ) {
292+ polygonData = getInterleavedPolygon ( polygonData ) ;
293+ }
282294 result [ recordBatchIdx ] = ga . algorithm . earcut ( polygonData ) ;
283295 }
284296
@@ -303,7 +315,12 @@ export class GeoArrowSolidPolygonLayer<
303315 recordBatchIdx ++
304316 ) {
305317 const multiPolygonData = geometryColumn . data [ recordBatchIdx ] ;
306- const polygonData = ga . child . getMultiPolygonChild ( multiPolygonData ) ;
318+ let polygonData = ga . child . getMultiPolygonChild ( multiPolygonData ) ;
319+ // TODO: Note here that [when applicable] we do this conversion twice -
320+ // one for triangulation (earcut) here and the other for rendering later.
321+ if ( isGeomSeparate ( polygonData ) ) {
322+ polygonData = getInterleavedPolygon ( polygonData ) ;
323+ }
307324 const [ preparedPolygonData , arrayBuffers ] = ga . worker . preparePostMessage (
308325 polygonData ,
309326 true ,
@@ -333,7 +350,12 @@ export class GeoArrowSolidPolygonLayer<
333350 recordBatchIdx ++
334351 ) {
335352 const multiPolygonData = geometryColumn . data [ recordBatchIdx ] ;
336- const polygonData = ga . child . getMultiPolygonChild ( multiPolygonData ) ;
353+ let polygonData = ga . child . getMultiPolygonChild ( multiPolygonData ) ;
354+ // TODO: Note here that [when applicable] we do this conversion twice -
355+ // one for triangulation (earcut) here and the other for rendering later.
356+ if ( isGeomSeparate ( polygonData ) ) {
357+ polygonData = getInterleavedPolygon ( polygonData ) ;
358+ }
337359 result [ recordBatchIdx ] = ga . algorithm . earcut ( polygonData ) ;
338360 }
339361
@@ -417,7 +439,10 @@ export class GeoArrowSolidPolygonLayer<
417439 recordBatchIdx < table . batches . length ;
418440 recordBatchIdx ++
419441 ) {
420- const polygonData = geometryColumn . data [ recordBatchIdx ] ;
442+ let polygonData = geometryColumn . data [ recordBatchIdx ] ;
443+ if ( isGeomSeparate ( polygonData ) ) {
444+ polygonData = getInterleavedPolygon ( polygonData ) ;
445+ }
421446 const ringData = ga . child . getPolygonChild ( polygonData ) ;
422447 const pointData = ga . child . getLineStringChild ( ringData ) ;
423448 const coordData = ga . child . getPointChild ( pointData ) ;
@@ -499,7 +524,10 @@ export class GeoArrowSolidPolygonLayer<
499524 recordBatchIdx ++
500525 ) {
501526 const multiPolygonData = geometryColumn . data [ recordBatchIdx ] ;
502- const polygonData = ga . child . getMultiPolygonChild ( multiPolygonData ) ;
527+ let polygonData = ga . child . getMultiPolygonChild ( multiPolygonData ) ;
528+ if ( isGeomSeparate ( polygonData ) ) {
529+ polygonData = getInterleavedPolygon ( polygonData ) ;
530+ }
503531 const ringData = ga . child . getPolygonChild ( polygonData ) ;
504532 const pointData = ga . child . getLineStringChild ( ringData ) ;
505533 const coordData = ga . child . getPointChild ( pointData ) ;
0 commit comments