feat: Integrate aisle data into polygon generation logic and enhance logging
This commit is contained in:
parent
3970479930
commit
f0e6242edd
|
@ -3,6 +3,7 @@ import { useEffect } from "react";
|
|||
import * as turf from "@turf/turf";
|
||||
import * as Types from "../../../../types/world/worldTypes";
|
||||
import arrayLinesToObject from "../../../builder/geomentries/lines/lineConvertions/arrayLinesToObject";
|
||||
import { useAisleStore } from "../../../../store/builder/useAisleStore";
|
||||
|
||||
interface PolygonGeneratorProps {
|
||||
groupRef: React.MutableRefObject<THREE.Group | null>;
|
||||
|
@ -13,22 +14,30 @@ export default function PolygonGenerator({
|
|||
groupRef,
|
||||
lines,
|
||||
}: PolygonGeneratorProps) {
|
||||
|
||||
const { aisles } = useAisleStore();
|
||||
useEffect(() => {
|
||||
let allLines = arrayLinesToObject(lines.current);
|
||||
const wallLines = allLines?.filter((line) => line?.type === "WallLine");
|
||||
const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
||||
|
||||
// const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
||||
console.log('aisles: ', aisles.map((aisle) => aisle.points.map((point) => point.position)));
|
||||
const result = aisles.map((aisle) =>
|
||||
aisle.points.map((point) => ({
|
||||
position: [point.position[0], point.position[2]],
|
||||
uuid: point.pointUuid,
|
||||
}))
|
||||
);
|
||||
const wallPoints = wallLines
|
||||
.map((pair) => pair?.line.map((vals) => vals.position))
|
||||
.filter((wall): wall is THREE.Vector3[] => !!wall);
|
||||
|
||||
const result = aisleLines.map((pair) =>
|
||||
pair?.line.map((point) => ({
|
||||
position: [point.position.x, point.position.z],
|
||||
uuid: point.uuid,
|
||||
}))
|
||||
);
|
||||
// const result = aisleLines.map((pair) =>
|
||||
// pair?.line.map((point) => ({
|
||||
// position: [point.position.x, point.position.z],
|
||||
// uuid: point.uuid,
|
||||
// }))
|
||||
// );
|
||||
|
||||
|
||||
if (!result || result.some((line) => !line)) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue