Skip to content

Commit

Permalink
Merge pull request #269 from lixinghua123/3.4-pointCloud-lxhFix
Browse files Browse the repository at this point in the history
fix: Point cloud configuration display / feat: Point cloud view page flip performance optimization
  • Loading branch information
Kerwin-L authored Aug 15, 2023
2 parents 977e4ed + 7a3df22 commit 1e0d6fa
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const LimitPopover = ({
const sizeRange = limit?.sizeLimit?.sizeRange;
const positionLimit = limit?.positionLimit;

const { heightDefault, depthDefault, widthDefault } = defaultSize;
const { heightMax, heightMin, depthMax, depthMin, widthMax, widthMin } = sizeRange;
const { XMin, XMax, YMin, YMax, ZMin, ZMax } = positionLimit;
const { heightDefault, depthDefault, widthDefault } = defaultSize || {};
const { heightMax, heightMin, depthMax, depthMin, widthMax, widthMin } = sizeRange || {};
const { XMin, XMax, YMin, YMax, ZMin, ZMax } = positionLimit || {};

return (
<Tooltip
Expand All @@ -27,21 +27,19 @@ const LimitPopover = ({
<div style={{ padding: '8px' }}>
{defaultSize && (
<div style={{ marginBottom: '24px' }}>
<div>
{t('DefaultSize')}
</div>
<span>{`${t('Length')}: ${depthDefault}m、`}</span>
<span>{`${t('Width')}: ${widthDefault}m、`}</span>
<span>{`${t('Height')}: ${heightDefault}m`}</span>
<div>{t('DefaultSize')}</div>
<span>{`${t('Length')}: ${widthDefault}m、`}</span>
<span>{`${t('Width')}: ${heightDefault}m、`}</span>
<span>{`${t('Height')}: ${depthDefault}m`}</span>
</div>
)}

{sizeRange && (
<div style={{ marginBottom: '24px' }}>
<div>*{t('NormalSizeRange')}</div>
<span>{`${t('Length')}:: ${depthMin}~${depthMax}m、`}</span>
<span>{`${t('Width')}: ${widthMin}~${widthMax}m、`}</span>
<span>{`${t('Height')}: ${heightMin}~${heightMax}m`}</span>
<span>{`${t('Length')}: ${widthMin}~${widthMax}m、`}</span>
<span>{`${t('Width')}: ${heightMin}~${heightMax}m、`}</span>
<span>{`${t('Height')}: ${depthMin}~${depthMax}m`}</span>
</div>
)}
{positionLimit && (
Expand All @@ -60,9 +58,9 @@ const LimitPopover = ({
src={defaultSizeSvg}
style={{ margin: '0px 8px' }}
onClick={(e) => {
e.preventDefault()
e.preventDefault();
if (defaultSize) {
updateSize?.(defaultSize)
updateSize?.(defaultSize);
}
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ import { useDispatch, useSelector } from '@/store/ctx';
import { AppState } from '@/store';
import StepUtils from '@/utils/StepUtils';
import { jsonParser } from '@/utils';
import { PreDataProcess, SetPointCloudLoading } from '@/store/annotation/actionCreators';
import {
PreDataProcess,
SetPointCloudLoading,
SetLoadPcdFileProgress,
} from '@/store/annotation/actionCreators';
import { message } from 'antd';
import { useTranslation } from 'react-i18next';
import { useHistory } from './useHistory';
Expand Down Expand Up @@ -1194,6 +1198,7 @@ export const usePointCloudViews = () => {
setHighlight2DDataList([]);

SetPointCloudLoading(dispatch, true);
SetLoadPcdFileProgress(dispatch, true);
await mainViewInstance.loadPCDFile(newData.url, config?.radius ?? DEFAULT_RADIUS);

mainViewInstance?.clearAllBox();
Expand Down Expand Up @@ -1249,6 +1254,7 @@ export const usePointCloudViews = () => {
});

SetPointCloudLoading(dispatch, false);
SetLoadPcdFileProgress(dispatch, false);
};

return {
Expand Down
11 changes: 7 additions & 4 deletions packages/lb-components/src/components/pointCloudView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const PointCloudView: React.FC<IProps> = ({
checkMode,
intelligentFit,
imgIndex,
loadPCDFileProgress,
}) => {
const ptCtx = useContext(PointCloudContext);
const { globalPattern, setGlobalPattern, selectedIDs } = ptCtx;
Expand Down Expand Up @@ -181,10 +182,12 @@ const PointCloudView: React.FC<IProps> = ({
isEnlargeTopView,
})}
>
<PointCloud2DView
isEnlargeTopView={isEnlargeTopView}
thumbnailWidth={isEnlargeTopView ? 300 : 455}
/>
{!loadPCDFileProgress && (
<PointCloud2DView
isEnlargeTopView={isEnlargeTopView}
thumbnailWidth={isEnlargeTopView ? 300 : 455}
/>
)}
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/lb-components/src/store/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const ANNOTATION_ACTIONS = {
SKIP_BEFORE_PAGE_TURNING: '@@SKIP_BEFORE_PAGE_TURNING',
UPDATE_BEFORE_ROTATE: '@@UPDATE_BEFORE_ROTATE',
SET_LOADING: '@@SET_LOADING',
SET_LOADPCDFILE_PROGRESS: '@@SET_LOADPCDFILE_PROGRESS',
SET_POINT_CLOUD_LOADING: '@@SET_POINT_CLOUD_LOADING',
SET_CHECK_MODE: '@@SET_CHECK_MODE',

Expand Down
9 changes: 9 additions & 0 deletions packages/lb-components/src/store/annotation/actionCreators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,15 @@ export const SetPointCloudLoading = (dispatch: Function, loading: boolean) => {
});
};

export const SetLoadPcdFileProgress = (dispatch: Function, loadPCDFileProgress: boolean) => {
dispatch({
type: ANNOTATION_ACTIONS.SET_LOADPCDFILE_PROGRESS,
payload: {
loadPCDFileProgress,
},
});
};

export const InitAnnotationState = (dispatch: Function) => {
dispatch({
type: ANNOTATION_ACTIONS.INIT_ALL_STATE,
Expand Down
4 changes: 3 additions & 1 deletion packages/lb-components/src/store/annotation/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ export interface IA2MapStateProps extends IAnnotationStateProps {
imgIndex: number;
configString: string; // Easy for users to listener.
highlightAttribute: string;
loadPCDFileProgress: boolean;
}

export const a2MapStateToProps = (state: AppState) => {
const {
annotation: { imgList, imgIndex, highlightAttribute },
annotation: { imgList, imgIndex, highlightAttribute, loadPCDFileProgress },
} = state;
const currentData = imgList[imgIndex] ?? {};
const stepInfo = StepUtils.getCurrentStepInfo(state.annotation?.step, state.annotation?.stepList);
Expand All @@ -48,5 +49,6 @@ export const a2MapStateToProps = (state: AppState) => {
config: jsonParser(stepInfo?.config),
configString: stepInfo?.config,
highlightAttribute,
loadPCDFileProgress,
};
};
10 changes: 10 additions & 0 deletions packages/lb-components/src/store/annotation/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const initialState: AnnotationState = {
resultList: [],
stepProgress: 0,
loading: false,
loadPCDFileProgress: true,
triggerEventAfterIndexChanged: false,

pointCloudLoading: false,
Expand Down Expand Up @@ -760,6 +761,15 @@ export const annotationReducer = (
}

case ANNOTATION_ACTIONS.SET_LOADING: {
const { loadPCDFileProgress } = action.payload;

return {
...state,
loadPCDFileProgress: !!loadPCDFileProgress,
};
}

case ANNOTATION_ACTIONS.SET_LOADPCDFILE_PROGRESS: {
const { loading } = action.payload;

return {
Expand Down
1 change: 1 addition & 0 deletions packages/lb-components/src/store/annotation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface AnnotationState {
resultList: any[];
stepProgress: number;
loading: boolean; // 用于图片加载
loadPCDFileProgress: boolean; // loadPCDFile
/** 阻止文件切换后的事件 */
triggerEventAfterIndexChanged: boolean;

Expand Down
2 changes: 1 addition & 1 deletion packages/lb-utils/src/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface IPositionLimit {
export interface ILimit {
sizeLimit: {
sizeRange: ISizeRange;
defaultSize: IDefaultSize;
defaultSize?: IDefaultSize;
logicalCondition: ILogicalCondition[];
};
positionLimit: IPositionLimit;
Expand Down

0 comments on commit 1e0d6fa

Please sign in to comment.