Skip to content

Commit

Permalink
feat(pointcloud): Temporarily hide the trackID
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin-L committed Sep 19, 2022
1 parent 618f6ba commit e13d1e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
10 changes: 8 additions & 2 deletions packages/lb-annotation/src/core/pointCloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,13 @@ export class PointCloud {
const cube = new THREE.Mesh(geometry, material);
const box = new THREE.BoxHelper(cube, color);
const arrow = this.generateBoxArrow(boxParams);
const boxID = this.generateBoxTrackID(boxParams);

// Temporarily hide
// const boxID = this.generateBoxTrackID(boxParams);
// group.add(boxID);

group.add(box);
group.add(arrow);
group.add(boxID);
group.position.set(center.x, center.y, center.z);

group.rotation.set(0, 0, rotation);
Expand Down Expand Up @@ -789,6 +791,10 @@ export class PointCloud {
};

public generateBoxTrackID = (boxParams: IPointCloudBox) => {
if (!boxParams.trackID) {
return;
}

const texture = new THREE.Texture(this.getTextCanvas(boxParams.trackID.toString()));
texture.needsUpdate = true;
const sprite = new THREE.SpriteMaterial({ map: texture, depthWrite: false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,15 @@ export const usePointCloudViews = () => {

const { pointCloudInstance: topViewPointCloud } = topViewInstance;

const getNextTrackID = () => {
if (pointCloudBoxList.length > 0) {
const sortedPcList = pointCloudBoxList.sort((a, b) => a.trackID - b.trackID);
return sortedPcList.slice(-1)[0]?.trackID + 1;
}
// Temporarily hide
// const getNextTrackID = () => {
// if (pointCloudBoxList.length > 0) {
// const sortedPcList = pointCloudBoxList.sort((a, b) => a.trackID - b.trackID);
// return sortedPcList.slice(-1)[0]?.trackID + 1;
// }

return 1;
};
// return 1;
// };

const mainViewGenBox = (boxParams: IPointCloudBox) => {
mainViewInstance?.generateBox(boxParams);
Expand All @@ -346,9 +347,11 @@ export const usePointCloudViews = () => {
});
const polygonOperation = topViewInstance?.pointCloud2dOperation;

const boxParams: IPointCloudBox = Object.assign(newParams, {
trackID: getNextTrackID(),
});
// Temporarily hide
// const boxParams: IPointCloudBox = Object.assign(newParams, {
// trackID: getNextTrackID(),
// });
const boxParams: IPointCloudBox = newParams;

polygonOperation.setSelectedIDs([newPolygon.id]);
setSelectedIDs(boxParams.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const toolList = [
},
];

const getToolNameVersion = (lang: 'en' | 'cn') => {
const getToolNameVersion = (lang: string) => {
if (lang === 'en') {
return TOOL_NAME_EN;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lb-utils/src/types/pointCloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export interface IPointCloudBox extends IVolume {
center: I3DSpaceCoord;
id: string;
rotation: number;
trackID: number;
valid: boolean;
trackID?: number; // It can be deleted.
subAttribute?: {
[k: string]: string;
};
Expand Down

0 comments on commit e13d1e3

Please sign in to comment.