diff --git a/packages/lb-annotation/src/core/toolOperation/polygonOperation.ts b/packages/lb-annotation/src/core/toolOperation/polygonOperation.ts index 72b32d29b..c0e71e46b 100644 --- a/packages/lb-annotation/src/core/toolOperation/polygonOperation.ts +++ b/packages/lb-annotation/src/core/toolOperation/polygonOperation.ts @@ -930,8 +930,8 @@ class PolygonOperation extends BasicToolOperation { /** * Judgment of drag information during mousedown - * @param e - * @returns + * @param e + * @returns */ public dragMouseDown(e: MouseEvent) { const firstPolygon = this.selectedPolygon; diff --git a/packages/lb-components/src/components/pointCloudView/PointCloudInfos.tsx b/packages/lb-components/src/components/pointCloudView/PointCloudInfos.tsx index f1a5a68de..2166c4a5f 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloudInfos.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloudInfos.tsx @@ -4,7 +4,7 @@ * @createdate 2022-07-13 */ -import { EPerspectiveView, PointCloudUtils } from '@labelbee/lb-utils'; +import { EPerspectiveView, IPointCloudConfig, PointCloudUtils } from '@labelbee/lb-utils'; import React, { useEffect, useState } from 'react'; import { PointCloudContext } from './PointCloudContext'; import { UnitUtils } from '@labelbee/lb-annotation'; @@ -65,7 +65,13 @@ export const SizeInfoForView = ({ perspectiveView }: { perspectiveView: EPerspec /** * Display selected box's infos */ -export const BoxInfos = () => { +export const BoxInfos = ({ + checkMode, + config, +}: { + checkMode?: boolean; + config: IPointCloudConfig; +}) => { const ptCtx = React.useContext(PointCloudContext); const { selectedBox } = useSingleBox(); const [infos, setInfos] = useState>([]); @@ -111,6 +117,16 @@ export const BoxInfos = () => { label: t('PointCount'), value: `${data.num}`, }); + + // SubAttribute is shown in checkMode + if (checkMode === true && selectedBox.info.subAttribute && config) { + const subAttributeNameList = PointCloudUtils.getSubAttributeName( + selectedBox.info.subAttribute, + config, + ); + subAttributeNameList.forEach((data) => infos.push(data)); + } + setInfos(infos); }); }, [selectedBox, i18n.language]); diff --git a/packages/lb-components/src/components/pointCloudView/PointCloudTopView.tsx b/packages/lb-components/src/components/pointCloudView/PointCloudTopView.tsx index b845f070f..31d4c02d7 100644 --- a/packages/lb-components/src/components/pointCloudView/PointCloudTopView.tsx +++ b/packages/lb-components/src/components/pointCloudView/PointCloudTopView.tsx @@ -115,10 +115,16 @@ const TopViewToolbar = ({ currentData }: IAnnotationStateProps) => { const ZAxisSlider = ({ setZAxisLimit, zAxisLimit, + checkMode, }: { setZAxisLimit: (value: number) => void; zAxisLimit: number; + checkMode?: boolean; }) => { + if (checkMode) { + return null; + } + return (
= ({ currentData, imgList, stepInfo, drawLayerSlot, checkMode }) => { +const PointCloudTopView: React.FC = ({ + currentData, + imgList, + stepInfo, + drawLayerSlot, + checkMode, +}) => { const [annotationPos, setAnnotationPos] = useState({ zoom: 1, currentPos: { x: 0, y: 0 } }); const ref = useRef(null); const ptCtx = React.useContext(PointCloudContext); @@ -170,9 +182,9 @@ const PointCloudTopView: React.FC = ({ currentData, imgList, stepInfo, d size, pcdPath: currentData.url, config, - checkMode + checkMode, }); - + ptCtx.setTopViewInstance(pointCloudAnnotation); } }, [currentData]); @@ -294,8 +306,8 @@ const PointCloudTopView: React.FC = ({ currentData, imgList, stepInfo, d {drawLayerSlot?.(annotationPos)}
- - + + diff --git a/packages/lb-utils/src/PointCloudUtils.ts b/packages/lb-utils/src/PointCloudUtils.ts index 37df2875c..5d869e465 100644 --- a/packages/lb-utils/src/PointCloudUtils.ts +++ b/packages/lb-utils/src/PointCloudUtils.ts @@ -4,7 +4,7 @@ * @author Ron */ -import { IPointCloudBox } from './types/pointCloud'; +import { IPointCloudBox, IPointCloudConfig } from './types/pointCloud'; class PointCloudUtils { public static genColorByCoord(x: number, y: number, z: number) { @@ -465,6 +465,30 @@ class PointCloudUtils { return basicSize; } + + public static getSubAttributeName( + subAttribute: { [key: string]: string }, + config: IPointCloudConfig, + ) { + const subAttributeList = config.inputList; + return Object.entries(subAttribute).map(([label, value]) => { + const data = subAttributeList.find((v) => v.value === label); + if (data) { + const subValue = data?.subSelected?.find((v) => v.value === value); + + if (subValue) { + return { + label: data.key, + value: subValue.key, + }; + } + } + return { + label, + value, + }; + }); + } } export default PointCloudUtils;