Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:open-mmlab/labelbee into feat/fu/poi…
Browse files Browse the repository at this point in the history
…ntCloud
  • Loading branch information
Henry-Diasa committed Mar 28, 2023
2 parents d941102 + 025e828 commit fae6ad8
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 54 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.12.1](https://github.com/open-mmlab/labelbee/compare/v1.12.0...v1.12.1) (2023-03-23)


### Bug Fixes

* **view-operation:** Update the range of direction judgement ([943c2b0](https://github.com/open-mmlab/labelbee/commit/943c2b0dbb025c983352f12d16793b508b4c15ce))

## [1.12.0](https://github.com/open-mmlab/labelbee/compare/v1.11.0...v1.12.0) (2023-03-09)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "labelbee",
"private": true,
"version": "1.12.0",
"version": "1.12.1",
"scripts": {
"start": "lerna run build:type && lerna run --parallel --stream start",
"start:quick": "lerna run --parallel --stream start",
Expand Down
5 changes: 3 additions & 2 deletions packages/lb-annotation/src/core/pointCloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ export class PointCloud {
}

if (camera) {
const cameraTar = this.getOrthographicCameraTarget(camera as OrthographicCamera);
this.updateCamera(camera.position, cameraTar);
const cameraTarget = this.getOrthographicCameraTarget(camera as OrthographicCamera);
this.camera.zoom = camera.zoom;
this.updateCamera(camera.position, cameraTarget);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export default class ViewOperation extends BasicToolOperation {
newPointList = DrawUtils.drawPolygon(this.canvas, renderLineWithZoom, lineRenderOptions);
}

const isShowDirection = line?.showDirection === true && line?.pointList?.length > 2;
const isShowDirection = line?.showDirection === true && line?.pointList?.length >= 2;

// 是否展示方向
if (isShowDirection) {
Expand Down Expand Up @@ -460,7 +460,7 @@ export default class ViewOperation extends BasicToolOperation {
newPointList = DrawUtils.drawPolygon(this.canvas, renderPolygon, polygonRenderOptions);
}

const isShowDirection = polygon?.showDirection === true && polygon?.pointList?.length > 2;
const isShowDirection = polygon?.showDirection === true && polygon?.pointList?.length >= 2;

// 是否展示方向
if (isShowDirection) {
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const PointCloud3D: React.FC<IA2MapStateProps> = ({ currentData, config }) => {

const ptCloud3DCtx = useMemo(() => {
return { reset3DView, setTarget3DView, isActive: !!selectedBox, followTopView };
}, [selectedBox]);
}, [selectedBox, ptCtx.mainViewInstance]);

const PointCloud3DTitle = (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface IPointCloudContext extends IPointCloudContextInstances {

history: ActionsHistory; // Operation History
hideAttributes: string[];
setHideAttributes: (hideAttrs: string[]) => void;
toggleAttributesVisible: (attribute: string) => void;
reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[]) => void;
attrPanelLayout: AttrPanelLayout;
Expand Down Expand Up @@ -81,6 +82,7 @@ export const PointCloudContext = React.createContext<IPointCloudContext>({
setZoom: () => {},
history: new ActionsHistory(),
hideAttributes: [],
setHideAttributes: () => {},
toggleAttributesVisible: () => {},
reRender: () => {},
setAttrPanelLayout: () => {},
Expand Down Expand Up @@ -177,7 +179,7 @@ export const PointCloudProvider: React.FC<{}> = ({ children }) => {
_displayPointCloudList: IPointCloudBoxList = displayPointCloudList,
_polygonList: IPolygonData[] = polygonList,
) => {
_displayPointCloudList.forEach((v) => {
pointCloudBoxList.forEach((v) => {
mainViewInstance?.removeObjectByName(v.id);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ const PointCloudListener: React.FC<IProps> = ({
updatePointCloudData?.();
}, [imgIndex, ptCtx.mainViewInstance]);

useEffect(() => {
ptCtx.setHideAttributes([]);
}, [imgIndex]);

// Update the listener of toolInstance.
useEffect(() => {
toolInstanceRef.current.exportData = () => {
Expand Down
8 changes: 5 additions & 3 deletions packages/lb-components/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ $hotkey-container-padding: 7px;
.svg {
width: 80px;
height: 100%;
color: #cccccc;
color: white;
display: flex;
justify-content: center;
align-items: center;
Expand Down Expand Up @@ -1283,7 +1283,8 @@ $hotkey-container-padding: 7px;
cursor: pointer;
}
.anticon-eye,
.anticon-caret-down {
.anticon-caret-down,
.anticon-eye-invisible {
margin-right: 8px;
}

Expand Down Expand Up @@ -1590,7 +1591,8 @@ $headerHeight: 40px;

&__followTop {
margin: 16px 0 0 0;
background-image: url('./assets/annotation/pointCloudTool/followTop.svg');
background-size: 36px;
background-image: url('./assets/annotation/pointCloudTool/followTopView.png');
}

&__top,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import FooterPopover from '../FooterPopover';

const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {
const pointCloudCtx = useContext(PointCloudContext);
const { t } = useTranslation();
const {
pointCloudBoxList,
hideAttributes,
Expand Down Expand Up @@ -50,18 +51,23 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {
return trackID ? trackID : order;
};

const getBoxKey = ({ trackID, order }: { trackID?: number; order?: number }) => {
return trackID ? `trackID_${trackID}` : `order_${order}`;
};

const deleteGraphByAttr = (attribute: string) => {
if (pointCloudListForSpecAttribute.length === 0) {
return;
}

const newPolygonList = polygonList.filter((i) => attribute !== i.attribute);
const newPointCloudList = pointCloudBoxList.filter((i) => attribute !== i.attribute);
setPolygonList(newPolygonList);
setPointCloudResult(newPointCloudList);

reRender(newPointCloudList, newPolygonList);

setPolygonList(newPolygonList);
setPointCloudResult(newPointCloudList);

pushHistoryWithList({ pointCloudBoxList: newPointCloudList, polygonList: newPolygonList });
};

Expand All @@ -85,7 +91,7 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {
<EyeFilled onClick={onVisibleChange} />
)}
<CaretDownFilled
rotate={expanded ? 270 : 0}
rotate={expanded ? 0 : 270}
onClick={() => {
setExpanded(!expanded);
}}
Expand All @@ -94,13 +100,19 @@ const AnnotatedAttributesItem = ({ attribute }: { attribute: IInputList }) => {

<DeleteOutlined onClick={() => onDeleteGraphByAttr(attribute)} />
</div>
{pointCloudListForSpecAttribute.map((box) => {
return (
<div key={getBoxID(box)} style={{ paddingLeft: 54 }}>
{`${getBoxID(box)}.${attribute.key}`}
</div>
);
})}

{expanded &&
(pointCloudListForSpecAttribute.length > 0 ? (
pointCloudListForSpecAttribute.map((box) => {
return (
<div key={getBoxKey(box)} style={{ paddingLeft: 54 }}>
{`${getBoxID(box)}.${attribute.key}`}
</div>
);
})
) : (
<div style={{ textAlign: 'center' }}>{t('NoData')}</div>
))}
</>
);
};
Expand All @@ -114,7 +126,7 @@ export const AnnotatedAttributesPanel = () => {
<div className={getClassName('annotated-attribute')}>
{attrPanelLayout ? (
<div className={getClassName('annotated-attribute', 'text')}>
<span>标注结果</span>
<span>{t('AnnotatedResult')}</span>
<span
className={getClassName('annotated-attribute', 'pin')}
onClick={() => {
Expand Down
40 changes: 20 additions & 20 deletions packages/lb-demo/src/components/Annotation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,26 @@ const Annotation = (props) => {
};
};

const loadFileList = (page, pageSize) => {
return new Promise((resolve) => {
const fileList = [];
const total = 105;
for (let i = 0; i < pageSize; i++) {
if (page * pageSize + i >= total) {
break;
}
fileList.push({
id: Number(`${page}${i}`),
result: '',
url: urlList[i % urlList.length],
});
}
console.log('loadFileList', fileList);
setTimeout(() => {
resolve({ fileList, total });
}, 500);
});
};
// const loadFileList = (page, pageSize) => {
// return new Promise((resolve) => {
// const fileList = [];
// const total = 105;
// for (let i = 0; i < pageSize; i++) {
// if (page * pageSize + i >= total) {
// break;
// }
// fileList.push({
// id: Number(`${page}${i}`),
// result: '',
// url: urlList[i % urlList.length],
// });
// }
// console.log('loadFileList', fileList);
// setTimeout(() => {
// resolve({ fileList, total });
// }, 500);
// });
// };

// const renderEnhance = {
// staticRender: (canvas, rect, style) => {
Expand Down
6 changes: 4 additions & 2 deletions packages/lb-utils/src/i18n/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@
"onDeleteGraphByAttr": "Are you sure to delete the data with attribute {{attribute}}?",
"CancelFixed": "Cancel Fixed",
"FixedOnLeft": "Fixed On Left",
"FixedOnRight": "Fixed On Right"
"FixedOnRight": "Fixed On Right",
"AnnotatedResult": "Annotated Result"
},
"cn": {
"TextInput": "文本输入",
Expand Down Expand Up @@ -395,6 +396,7 @@
"onDeleteGraphByAttr": "确定要删除属性为 {{attribute}} 的标注数据吗?",
"CancelFixed": "取消固定",
"FixedOnLeft": "固定在左侧",
"FixedOnRight": "固定在右侧"
"FixedOnRight": "固定在右侧",
"AnnotatedResult": "标注结果"
}
}

0 comments on commit fae6ad8

Please sign in to comment.