@labelbee/lb-components 1.9.1-alpha.0 → 1.9.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
- package/dist/components/pointCloudView/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/components/PointCloudSizeSlider/index.js +1 -0
- package/dist/components/pointCloudView/hooks/useRotate.js +1 -1
- package/dist/index.css +17 -0
- package/dist/types/components/pointCloudView/components/PointCloudSizeSlider/index.d.ts +5 -0
- package/dist/types/components/pointCloudView/hooks/useRotate.d.ts +1 -1
- package/es/assets/predictTracking/icon.svg.js +4 -1
- package/es/components/pointCloudView/PointCloud3DView.js +1 -1
- package/es/components/pointCloudView/PointCloud3DView.js.map +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js.map +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js.map +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js.map +1 -1
- package/es/components/pointCloudView/components/PointCloudSizeSlider/index.js +1 -0
- package/es/components/pointCloudView/components/PointCloudSizeSlider/index.js.map +1 -0
- package/es/components/pointCloudView/hooks/useRotate.js +1 -1
- package/es/components/pointCloudView/hooks/useRotate.js.map +1 -1
- package/es/components/pointCloudView/hooks/useSphere.js +43 -0
- package/es/components/pointCloudView/hooks/useSphere.js.map +1 -0
- package/es/components/predictTracking/index.js +3 -1
- package/es/components/predictTracking/predictTrackingIcon/index.js +91 -1
- package/es/components/predictTracking/previewResult/index.js +189 -1
- package/es/components/predictTracking/previewResult/util.js +135 -1
- package/es/index.css +17 -0
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/cuboid/index.js +24 -0
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/cuboid/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as g}from"../../utils/dom.js";import{FooterDivider as
|
|
1
|
+
import{getClassName as g}from"../../utils/dom.js";import{FooterDivider as L}from"../../views/MainView/toolFooter/index.js";import{ZoomController as W}from"../../views/MainView/toolFooter/ZoomController/index.js";import{UpSquareOutlined as X,DownSquareOutlined as Y}from"@ant-design/icons";import{PointCloudAnnotation as q,cTool as H}from"@labelbee/lb-annotation";import{PointCloudUtils as $}from"@labelbee/lb-utils";import s,{useState as k,useRef as G,useLayoutEffect as J,useEffect as V,useContext as K}from"react";import{PointCloudContext as B}from"./PointCloudContext.js";import{useRotate as Q}from"./hooks/useRotate.js";import{useSingleBox as T}from"./hooks/useSingleBox.js";import{PointCloudContainer as ee}from"./PointCloudLayout.js";import{BoxInfos as te,PointCloudValidity as oe}from"./PointCloudInfos.js";import{usePolygon as ne}from"./hooks/usePolygon.js";import{useZoom as z}from"./hooks/useZoom.js";import{Slider as ie}from"antd";import{a2MapStateToProps as se}from"../../store/annotation/map.js";import{connect as le}from"react-redux";import{usePointCloudViews as re}from"./hooks/usePointCloudViews.js";import ae from"../../hooks/useSize.js";import{useTranslation as ce}from"react-i18next";import{LabelBeeContext as de}from"../../store/ctx.js";import{jsonParser as ue}from"../../utils/index.js";import pe from"./components/PointCloudSizeSlider/index.js";var me=Object.defineProperty,fe=Object.defineProperties,Ce=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,R=(t,o,n)=>o in t?me(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,we=(t,o)=>{for(var n in o||(o={}))Pe.call(o,n)&&R(t,n,o[n]);if(N)for(var n of N(o))ve.call(o,n)&&R(t,n,o[n]);return t},ge=(t,o)=>fe(t,Ce(o));const{EPolygonPattern:xe}=H,Z=(t,o,n=1)=>{const{width:p,height:m}=o,w={x:t.x+p*n/2,y:t.y+m*n/2},f={x:o.width/2,y:o.height/2};return{offsetX:(f.x-w.x)/n,offsetY:-(f.y-w.y)/n}},ye=({currentData:t})=>{const{zoom:o,zoomIn:n,zoomOut:p,initialPosition:m}=z(),{selectNextBox:w,selectPrevBox:f}=T(),{updateRotate:d}=Q({currentData:t}),{topViewInstance:e}=K(B),a=2,C=()=>{d(-a)},I=()=>{d(a)},h=()=>{d(180)};return s.createElement(s.Fragment,null,s.createElement(pe,{onChange:O=>{var y;(y=e==null?void 0:e.pointCloudInstance)==null||y.updatePointSize({customSize:O})}}),s.createElement("span",{onClick:I,className:g("point-cloud","rotate-reserve")}),s.createElement("span",{onClick:C,className:g("point-cloud","rotate")}),s.createElement("span",{onClick:h,className:g("point-cloud","rotate-180")}),s.createElement(L,null),s.createElement(X,{onClick:()=>{f()},className:g("point-cloud","prev")}),s.createElement(Y,{onClick:()=>{w()},className:g("point-cloud","next")}),s.createElement(L,null),s.createElement(W,{initialPosition:m,zoomIn:n,zoomOut:p,zoom:o}))},Ve=({setZAxisLimit:t,zAxisLimit:o,checkMode:n})=>n?null:s.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},s.createElement(ie,{vertical:!0,step:.5,max:10,min:.5,defaultValue:o,onAfterChange:p=>{t(p)}})),Ie=({currentData:t,imgList:o,stepInfo:n,drawLayerSlot:p,checkMode:m})=>{const[w,f]=k({zoom:1,currentPos:{x:0,y:0}}),d=G(null),e=s.useContext(B),a=ae(d),C=ue(n.config),{setZoom:I}=z(),{hideAttributes:h}=e,{addPolygon:O,deletePolygon:y}=ne(),{deletePointCloudBox:D,changeValidByID:U}=T(),[S,F]=k(10),{t:M}=ce(),x=re();return J(()=>{if(!e.topViewInstance&&d.current&&(t==null?void 0:t.url)&&(t==null?void 0:t.result)){const l={width:d.current.clientWidth,height:d.current.clientHeight},u=new q({container:d.current,size:l,pcdPath:t.url,config:C,checkMode:m});e.setTopViewInstance(u)}},[t]),V(()=>{if(!a||!e.topViewInstance||!e.sideViewInstance)return;const{pointCloud2dOperation:l}=e.topViewInstance;l.singleOn("polygonCreated",(i,r)=>{if(l.pattern===xe.Normal||!(t==null?void 0:t.url)){const P=ge(we({},i),{pointList:i.pointList.map(c=>$.transferCanvas2World(c,a))});O(P),e.setSelectedIDs(h.includes(i.attribute)?"":i.id);return}x.topViewAddBox({newPolygon:i,size:a,imgList:o,trackConfigurable:C.trackConfigurable,zoom:r})}),l.singleOn("deletedObject",({id:i})=>{D(i),y(i)}),l.singleOn("deleteSelectedIDs",()=>{e.setSelectedIDs([])}),l.singleOn("addSelectedIDs",i=>{e.addSelectedID(i)}),l.singleOn("setSelectedIDs",i=>{e.setSelectedIDs(i)}),l.singleOn("updatePolygonByDrag",i=>{var r;(r=x.topViewUpdateBox)==null||r.call(x,i,a)});const u=i=>{var r;const P=U(i);P&&e.syncAllViewPointCloudColor(P),e.polygonList.find(c=>c.id===i)&&((r=e.topViewInstance)==null||r.pointCloud2dOperation.setPolygonValidAndRender(i,!0))};return l.on("validUpdate",u),()=>{l.unbind("validUpdate",u)}},[e,a,t,x,e.polygonList]),V(()=>{var l,u;if(!(a==null?void 0:a.width)||!e.topViewInstance)return;const i=(u=(l=C==null?void 0:C.attributeList)==null?void 0:l[0])==null?void 0:u.value;i&&e.topViewInstance.pointCloud2dOperation.setDefaultAttribute(i),e.topViewInstance.initSize(a),e.topViewInstance.updatePolygonList(e.displayPointCloudList,e.polygonList);const{topViewInstance:{pointCloudInstance:r,pointCloud2dOperation:P}}=e;P.singleOn("renderZoom",(c,v)=>{const{offsetX:b,offsetY:_}=Z(v,a,c);if(r.camera.zoom=c,v){const{x:E,y:j,z:A}=r.initCameraPosition;r.camera.position.set(E+_,j-b,A)}r.camera.updateProjectionMatrix(),r.render(),I(c),f({zoom:c,currentPos:v})}),P.singleOn("dragMove",({currentPos:c,zoom:v})=>{const{offsetX:b,offsetY:_}=Z(c,a,v);r.camera.zoom=v;const{x:E,y:j,z:A}=r.initCameraPosition;r.camera.position.set(E+_,j-b,A),r.render(),f({zoom:v,currentPos:c})})},[a,e.topViewInstance]),V(()=>{var l,u;(u=(l=e.topViewInstance)==null?void 0:l.pointCloudInstance)==null||u.applyZAxisPoints(S)},[S]),V(()=>{x.topViewSelectedChanged()},[e.selectedIDs]),s.createElement(ee,{className:g("point-cloud-container","top-view"),title:M("TopView"),toolbar:s.createElement(ye,{currentData:t})},s.createElement("div",{style:{position:"relative",flex:1}},s.createElement("div",{style:{width:"100%",height:"100%"},ref:d},p==null?void 0:p(w)),s.createElement(te,{checkMode:m,config:C}),s.createElement(Ve,{checkMode:m,zAxisLimit:S,setZAxisLimit:F}),s.createElement(oe,null)))};var he=le(se,null,null,{context:de})(Ie);export{he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointCloudTopView.js","sources":["../../../src/components/pointCloudView/PointCloudTopView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-22 11:08:31\n * @LastEditors: Laoluo luozefeng@sensetime.com\n */\nimport { getClassName } from '@/utils/dom';\nimport { FooterDivider } from '@/views/MainView/toolFooter';\nimport { ZoomController } from '@/views/MainView/toolFooter/ZoomController';\nimport { DownSquareOutlined, UpSquareOutlined } from '@ant-design/icons';\nimport { cTool, PointCloudAnnotation } from '@labelbee/lb-annotation';\nimport { IPolygonData, PointCloudUtils, UpdatePolygonByDragList } from '@labelbee/lb-utils';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport { useRotate } from './hooks/useRotate';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport { BoxInfos, PointCloudValidity } from './PointCloudInfos';\nimport { usePolygon } from './hooks/usePolygon';\nimport { useZoom } from './hooks/useZoom';\nimport { Slider } from 'antd';\nimport { a2MapStateToProps, IA2MapStateProps, IAnnotationStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport useSize from '@/hooks/useSize';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { jsonParser } from '@/utils';\nimport { TDrawLayerSlot } from '@/types/main';\n\nconst { EPolygonPattern } = cTool;\n\n/**\n * Get the offset from canvas2d-coordinate to world coordinate (Top View)\n * @param currentPos\n * @param size\n * @param zoom\n * @returns\n */\nconst TransferCanvas2WorldOffset = (\n currentPos: { x: number; y: number },\n size: { width: number; height: number },\n zoom = 1,\n) => {\n const { width: w, height: h } = size;\n\n const canvasCenterPoint = {\n x: currentPos.x + (w * zoom) / 2,\n y: currentPos.y + (h * zoom) / 2,\n };\n\n const worldCenterPoint = {\n x: size.width / 2,\n y: size.height / 2,\n };\n\n return {\n offsetX: (worldCenterPoint.x - canvasCenterPoint.x) / zoom,\n offsetY: -(worldCenterPoint.y - canvasCenterPoint.y) / zoom,\n };\n};\n\nconst TopViewToolbar = ({ currentData }: IAnnotationStateProps) => {\n const { zoom, zoomIn, zoomOut, initialPosition } = useZoom();\n const { selectNextBox, selectPrevBox } = useSingleBox();\n const { updateRotate } = useRotate({ currentData });\n\n const ratio = 2;\n\n const clockwiseRotate = () => {\n updateRotate(-ratio);\n };\n const anticlockwiseRotate = () => {\n updateRotate(ratio);\n };\n\n const reverseRotate = () => {\n updateRotate(180);\n };\n\n return (\n <>\n <span\n onClick={anticlockwiseRotate}\n className={getClassName('point-cloud', 'rotate-reserve')}\n />\n <span onClick={clockwiseRotate} className={getClassName('point-cloud', 'rotate')} />\n <span onClick={reverseRotate} className={getClassName('point-cloud', 'rotate-180')} />\n <FooterDivider />\n <UpSquareOutlined\n onClick={() => {\n selectPrevBox();\n }}\n className={getClassName('point-cloud', 'prev')}\n />\n <DownSquareOutlined\n onClick={() => {\n selectNextBox();\n }}\n className={getClassName('point-cloud', 'next')}\n />\n <FooterDivider />\n <ZoomController\n initialPosition={initialPosition}\n zoomIn={zoomIn}\n zoomOut={zoomOut}\n zoom={zoom}\n />\n </>\n );\n};\n\n/**\n * Slider for filtering Z-axis points\n */\nconst ZAxisSlider = ({\n setZAxisLimit,\n zAxisLimit,\n checkMode,\n}: {\n setZAxisLimit: (value: number) => void;\n zAxisLimit: number;\n checkMode?: boolean;\n}) => {\n if (checkMode) {\n return null;\n }\n\n return (\n <div style={{ position: 'absolute', top: 128, right: 8, height: '50%', zIndex: 20 }}>\n <Slider\n vertical\n step={0.5}\n max={10}\n min={0.5}\n defaultValue={zAxisLimit}\n onAfterChange={(v: number) => {\n setZAxisLimit(v);\n }}\n />\n </div>\n );\n};\n\ninterface IProps extends IA2MapStateProps {\n drawLayerSlot?: TDrawLayerSlot;\n checkMode?: boolean;\n}\n\nconst PointCloudTopView: React.FC<IProps> = ({\n currentData,\n imgList,\n stepInfo,\n drawLayerSlot,\n checkMode,\n}) => {\n const [annotationPos, setAnnotationPos] = useState({ zoom: 1, currentPos: { x: 0, y: 0 } });\n const ref = useRef<HTMLDivElement>(null);\n const ptCtx = React.useContext(PointCloudContext);\n const size = useSize(ref);\n const config = jsonParser(stepInfo.config);\n const { setZoom } = useZoom();\n const { hideAttributes } = ptCtx;\n\n const { addPolygon, deletePolygon } = usePolygon();\n const { deletePointCloudBox, changeValidByID } = useSingleBox();\n const [zAxisLimit, setZAxisLimit] = useState<number>(10);\n const { t } = useTranslation();\n const pointCloudViews = usePointCloudViews();\n\n useLayoutEffect(() => {\n if (ptCtx.topViewInstance) {\n return;\n }\n\n if (ref.current && currentData?.url && currentData?.result) {\n const size = {\n width: ref.current.clientWidth,\n height: ref.current.clientHeight,\n };\n\n const pointCloudAnnotation = new PointCloudAnnotation({\n container: ref.current,\n size,\n pcdPath: currentData.url,\n config,\n checkMode,\n });\n\n ptCtx.setTopViewInstance(pointCloudAnnotation);\n }\n }, [currentData]);\n\n useEffect(() => {\n if (!size || !ptCtx.topViewInstance || !ptCtx.sideViewInstance) {\n return;\n }\n\n const { pointCloud2dOperation: TopView2dOperation } = ptCtx.topViewInstance;\n\n TopView2dOperation.singleOn('polygonCreated', (polygon: IPolygonData, zoom: number) => {\n if (TopView2dOperation.pattern === EPolygonPattern.Normal || !currentData?.url) {\n /**\n * Notice. The Polygon need to be converted to pointCloud coordinate system for storage.\n */\n const newPolygon = {\n ...polygon,\n pointList: polygon.pointList.map((v) => PointCloudUtils.transferCanvas2World(v, size)),\n };\n\n addPolygon(newPolygon);\n ptCtx.setSelectedIDs(hideAttributes.includes(polygon.attribute) ? '' : polygon.id);\n return;\n }\n\n pointCloudViews.topViewAddBox({\n newPolygon: polygon,\n size,\n imgList,\n trackConfigurable: config.trackConfigurable,\n zoom,\n });\n });\n\n TopView2dOperation.singleOn('deletedObject', ({ id }) => {\n deletePointCloudBox(id);\n deletePolygon(id);\n });\n\n TopView2dOperation.singleOn('deleteSelectedIDs', () => {\n ptCtx.setSelectedIDs([]);\n });\n\n TopView2dOperation.singleOn('addSelectedIDs', (selectedID: string) => {\n ptCtx.addSelectedID(selectedID);\n });\n\n TopView2dOperation.singleOn('setSelectedIDs', (selectedIDs: string[]) => {\n ptCtx.setSelectedIDs(selectedIDs);\n });\n\n TopView2dOperation.singleOn('updatePolygonByDrag', (updateList: UpdatePolygonByDragList) => {\n pointCloudViews.topViewUpdateBox?.(updateList, size);\n });\n\n const validUpdate = (id: string) => {\n // UpdateData.\n const newPointCloudList = changeValidByID(id);\n\n // HighLight\n if (newPointCloudList) {\n ptCtx.syncAllViewPointCloudColor(newPointCloudList);\n }\n if (ptCtx.polygonList.find((v) => v.id === id)) {\n ptCtx.topViewInstance?.pointCloud2dOperation.setPolygonValidAndRender(id, true);\n }\n };\n\n TopView2dOperation.on('validUpdate', validUpdate);\n\n return () => {\n TopView2dOperation.unbind('validUpdate', validUpdate);\n };\n }, [ptCtx, size, currentData, pointCloudViews, ptCtx.polygonList]);\n\n useEffect(() => {\n if (!size?.width || !ptCtx.topViewInstance) {\n return;\n }\n /**\n * Init Config\n *\n * 1. Update defaultAttribute by first attribute;\n * */\n const defaultAttribute = config?.attributeList?.[0]?.value;\n if (defaultAttribute) {\n ptCtx.topViewInstance.pointCloud2dOperation.setDefaultAttribute(defaultAttribute);\n }\n\n // 1. Update Size\n ptCtx.topViewInstance.initSize(size);\n ptCtx.topViewInstance.updatePolygonList(ptCtx.displayPointCloudList, ptCtx.polygonList);\n\n const {\n topViewInstance: { pointCloudInstance: pointCloud, pointCloud2dOperation: polygonOperation },\n } = ptCtx;\n\n /**\n * Synchronized 3d point cloud view displacement operations\n *\n * Change Orthographic Camera size\n */\n polygonOperation.singleOn('renderZoom', (zoom: number, currentPos: any) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n pointCloud.camera.zoom = zoom;\n if (currentPos) {\n const { x, y, z } = pointCloud.initCameraPosition;\n pointCloud.camera.position.set(x + offsetY, y - offsetX, z);\n }\n\n pointCloud.camera.updateProjectionMatrix();\n pointCloud.render();\n\n setZoom(zoom);\n setAnnotationPos({ zoom, currentPos });\n });\n\n // Synchronized 3d point cloud view displacement operations\n polygonOperation.singleOn('dragMove', ({ currentPos, zoom }) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n pointCloud.camera.zoom = zoom;\n const { x, y, z } = pointCloud.initCameraPosition;\n pointCloud.camera.position.set(x + offsetY, y - offsetX, z);\n pointCloud.render();\n setAnnotationPos({ zoom, currentPos });\n });\n }, [size, ptCtx.topViewInstance]);\n\n useEffect(() => {\n ptCtx.topViewInstance?.pointCloudInstance?.applyZAxisPoints(zAxisLimit);\n }, [zAxisLimit]);\n\n useEffect(() => {\n pointCloudViews.topViewSelectedChanged();\n }, [ptCtx.selectedIDs]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-container', 'top-view')}\n title={t('TopView')}\n toolbar={<TopViewToolbar currentData={currentData} />}\n >\n <div style={{ position: 'relative', flex: 1 }}>\n <div style={{ width: '100%', height: '100%' }} ref={ref}>\n {drawLayerSlot?.(annotationPos)}\n </div>\n\n <BoxInfos checkMode={checkMode} config={config} />\n <ZAxisSlider checkMode={checkMode} zAxisLimit={zAxisLimit} setZAxisLimit={setZAxisLimit} />\n <PointCloudValidity />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudTopView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,CAAE,eAAoB,CAAA,GAAA,KAAA,CAAA;AAS5B,MAAM,0BAA6B,GAAA,CACjC,UACA,EAAA,IAAA,EACA,OAAO,CACJ,KAAA;AACH,EAAA,MAAM,CAAE,KAAA,EAAO,CAAG,EAAA,MAAA,EAAQ,CAAM,CAAA,GAAA,IAAA,CAAA;AAEhC,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,IAC/B,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,GAAA,CAAA;AAGjC,EAAA,MAAM,gBAAmB,GAAA;AAAA,IACvB,CAAA,EAAG,KAAK,KAAQ,GAAA,CAAA;AAAA,IAChB,CAAA,EAAG,KAAK,MAAS,GAAA,CAAA;AAAA,GAAA,CAAA;AAGnB,EAAO,OAAA;AAAA,IACL,OAAU,EAAA,CAAA,gBAAA,CAAiB,CAAI,GAAA,iBAAA,CAAkB,CAAK,IAAA,IAAA;AAAA,IACtD,OAAS,EAAA,EAAmB,gBAAA,CAAA,CAAA,GAAI,kBAAkB,CAAK,CAAA,GAAA,IAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAI3D,MAAM,cAAA,GAAiB,CAAC,CAAE,WAAyC,CAAA,KAAA;AACjE,EAAA,MAAM,CAAE,IAAA,EAAM,MAAQ,EAAA,O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AAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,aAAA,CAAgB,aAGnB,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAD,EAAA;AAAA,IAAU,SAAA;AAAA,IAAsB,MAAA;AAAA,GAAA,CAAA,sCAC/B,WAAD,EAAA;AAAA,IAAa,SAAA;AAAA,IAAsB,UAAA;AAAA,IAAwB,aAAA;AAAA,GAAA,CAAA,sCAC1D,kBAAD,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAMR,0BAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,iBAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"PointCloudTopView.js","sources":["../../../src/components/pointCloudView/PointCloudTopView.tsx"],"sourcesContent":["/*\n * @Author: Laoluo luozefeng@sensetime.com\n * @Date: 2022-06-22 11:08:31\n * @LastEditors: Laoluo luozefeng@sensetime.com\n */\nimport { getClassName } from '@/utils/dom';\nimport { FooterDivider } from '@/views/MainView/toolFooter';\nimport { ZoomController } from '@/views/MainView/toolFooter/ZoomController';\nimport { DownSquareOutlined, UpSquareOutlined } from '@ant-design/icons';\nimport { cTool, PointCloudAnnotation } from '@labelbee/lb-annotation';\nimport { IPolygonData, PointCloudUtils, UpdatePolygonByDragList } from '@labelbee/lb-utils';\nimport React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { PointCloudContext } from './PointCloudContext';\nimport { useRotate } from './hooks/useRotate';\nimport { useSingleBox } from './hooks/useSingleBox';\nimport { PointCloudContainer } from './PointCloudLayout';\nimport { BoxInfos, PointCloudValidity } from './PointCloudInfos';\nimport { usePolygon } from './hooks/usePolygon';\nimport { useZoom } from './hooks/useZoom';\nimport { Slider } from 'antd';\nimport { a2MapStateToProps, IA2MapStateProps, IAnnotationStateProps } from '@/store/annotation/map';\nimport { connect } from 'react-redux';\nimport { usePointCloudViews } from './hooks/usePointCloudViews';\nimport useSize from '@/hooks/useSize';\nimport { useTranslation } from 'react-i18next';\nimport { LabelBeeContext } from '@/store/ctx';\nimport { jsonParser } from '@/utils';\nimport { TDrawLayerSlot } from '@/types/main';\nimport PointCloudSizeSlider from './components/PointCloudSizeSlider';\n\nconst { EPolygonPattern } = cTool;\n\n/**\n * Get the offset from canvas2d-coordinate to world coordinate (Top View)\n * @param currentPos\n * @param size\n * @param zoom\n * @returns\n */\nconst TransferCanvas2WorldOffset = (\n currentPos: { x: number; y: number },\n size: { width: number; height: number },\n zoom = 1,\n) => {\n const { width: w, height: h } = size;\n\n const canvasCenterPoint = {\n x: currentPos.x + (w * zoom) / 2,\n y: currentPos.y + (h * zoom) / 2,\n };\n\n const worldCenterPoint = {\n x: size.width / 2,\n y: size.height / 2,\n };\n\n return {\n offsetX: (worldCenterPoint.x - canvasCenterPoint.x) / zoom,\n offsetY: -(worldCenterPoint.y - canvasCenterPoint.y) / zoom,\n };\n};\n\nconst TopViewToolbar = ({ currentData }: IAnnotationStateProps) => {\n const { zoom, zoomIn, zoomOut, initialPosition } = useZoom();\n const { selectNextBox, selectPrevBox } = useSingleBox();\n const { updateRotate } = useRotate({ currentData });\n const { topViewInstance } = useContext(PointCloudContext);\n\n const ratio = 2;\n\n const clockwiseRotate = () => {\n updateRotate(-ratio);\n };\n const anticlockwiseRotate = () => {\n updateRotate(ratio);\n };\n\n const reverseRotate = () => {\n updateRotate(180);\n };\n\n return (\n <>\n <PointCloudSizeSlider\n onChange={(v: number) => {\n topViewInstance?.pointCloudInstance?.updatePointSize({ customSize: v });\n }}\n />\n <span\n onClick={anticlockwiseRotate}\n className={getClassName('point-cloud', 'rotate-reserve')}\n />\n <span onClick={clockwiseRotate} className={getClassName('point-cloud', 'rotate')} />\n <span onClick={reverseRotate} className={getClassName('point-cloud', 'rotate-180')} />\n <FooterDivider />\n <UpSquareOutlined\n onClick={() => {\n selectPrevBox();\n }}\n className={getClassName('point-cloud', 'prev')}\n />\n <DownSquareOutlined\n onClick={() => {\n selectNextBox();\n }}\n className={getClassName('point-cloud', 'next')}\n />\n <FooterDivider />\n <ZoomController\n initialPosition={initialPosition}\n zoomIn={zoomIn}\n zoomOut={zoomOut}\n zoom={zoom}\n />\n </>\n );\n};\n\n/**\n * Slider for filtering Z-axis points\n */\nconst ZAxisSlider = ({\n setZAxisLimit,\n zAxisLimit,\n checkMode,\n}: {\n setZAxisLimit: (value: number) => void;\n zAxisLimit: number;\n checkMode?: boolean;\n}) => {\n if (checkMode) {\n return null;\n }\n\n return (\n <div style={{ position: 'absolute', top: 128, right: 8, height: '50%', zIndex: 20 }}>\n <Slider\n vertical\n step={0.5}\n max={10}\n min={0.5}\n defaultValue={zAxisLimit}\n onAfterChange={(v: number) => {\n setZAxisLimit(v);\n }}\n />\n </div>\n );\n};\n\ninterface IProps extends IA2MapStateProps {\n drawLayerSlot?: TDrawLayerSlot;\n checkMode?: boolean;\n}\n\nconst PointCloudTopView: React.FC<IProps> = ({\n currentData,\n imgList,\n stepInfo,\n drawLayerSlot,\n checkMode,\n}) => {\n const [annotationPos, setAnnotationPos] = useState({ zoom: 1, currentPos: { x: 0, y: 0 } });\n const ref = useRef<HTMLDivElement>(null);\n const ptCtx = React.useContext(PointCloudContext);\n const size = useSize(ref);\n const config = jsonParser(stepInfo.config);\n const { setZoom } = useZoom();\n const { hideAttributes } = ptCtx;\n\n const { addPolygon, deletePolygon } = usePolygon();\n const { deletePointCloudBox, changeValidByID } = useSingleBox();\n const [zAxisLimit, setZAxisLimit] = useState<number>(10);\n const { t } = useTranslation();\n const pointCloudViews = usePointCloudViews();\n\n useLayoutEffect(() => {\n if (ptCtx.topViewInstance) {\n return;\n }\n\n if (ref.current && currentData?.url && currentData?.result) {\n const size = {\n width: ref.current.clientWidth,\n height: ref.current.clientHeight,\n };\n\n const pointCloudAnnotation = new PointCloudAnnotation({\n container: ref.current,\n size,\n pcdPath: currentData.url,\n config,\n checkMode,\n });\n\n ptCtx.setTopViewInstance(pointCloudAnnotation);\n }\n }, [currentData]);\n\n useEffect(() => {\n if (!size || !ptCtx.topViewInstance || !ptCtx.sideViewInstance) {\n return;\n }\n\n const { pointCloud2dOperation: TopView2dOperation } = ptCtx.topViewInstance;\n\n TopView2dOperation.singleOn('polygonCreated', (polygon: IPolygonData, zoom: number) => {\n if (TopView2dOperation.pattern === EPolygonPattern.Normal || !currentData?.url) {\n /**\n * Notice. The Polygon need to be converted to pointCloud coordinate system for storage.\n */\n const newPolygon = {\n ...polygon,\n pointList: polygon.pointList.map((v) => PointCloudUtils.transferCanvas2World(v, size)),\n };\n\n addPolygon(newPolygon);\n ptCtx.setSelectedIDs(hideAttributes.includes(polygon.attribute) ? '' : polygon.id);\n return;\n }\n\n pointCloudViews.topViewAddBox({\n newPolygon: polygon,\n size,\n imgList,\n trackConfigurable: config.trackConfigurable,\n zoom,\n });\n });\n\n TopView2dOperation.singleOn('deletedObject', ({ id }) => {\n deletePointCloudBox(id);\n deletePolygon(id);\n });\n\n TopView2dOperation.singleOn('deleteSelectedIDs', () => {\n ptCtx.setSelectedIDs([]);\n });\n\n TopView2dOperation.singleOn('addSelectedIDs', (selectedID: string) => {\n ptCtx.addSelectedID(selectedID);\n });\n\n TopView2dOperation.singleOn('setSelectedIDs', (selectedIDs: string[]) => {\n ptCtx.setSelectedIDs(selectedIDs);\n });\n\n TopView2dOperation.singleOn('updatePolygonByDrag', (updateList: UpdatePolygonByDragList) => {\n pointCloudViews.topViewUpdateBox?.(updateList, size);\n });\n\n const validUpdate = (id: string) => {\n // UpdateData.\n const newPointCloudList = changeValidByID(id);\n\n // HighLight\n if (newPointCloudList) {\n ptCtx.syncAllViewPointCloudColor(newPointCloudList);\n }\n if (ptCtx.polygonList.find((v) => v.id === id)) {\n ptCtx.topViewInstance?.pointCloud2dOperation.setPolygonValidAndRender(id, true);\n }\n };\n\n TopView2dOperation.on('validUpdate', validUpdate);\n\n return () => {\n TopView2dOperation.unbind('validUpdate', validUpdate);\n };\n }, [ptCtx, size, currentData, pointCloudViews, ptCtx.polygonList]);\n\n useEffect(() => {\n if (!size?.width || !ptCtx.topViewInstance) {\n return;\n }\n /**\n * Init Config\n *\n * 1. Update defaultAttribute by first attribute;\n * */\n const defaultAttribute = config?.attributeList?.[0]?.value;\n if (defaultAttribute) {\n ptCtx.topViewInstance.pointCloud2dOperation.setDefaultAttribute(defaultAttribute);\n }\n\n // 1. Update Size\n ptCtx.topViewInstance.initSize(size);\n ptCtx.topViewInstance.updatePolygonList(ptCtx.displayPointCloudList, ptCtx.polygonList);\n\n const {\n topViewInstance: { pointCloudInstance: pointCloud, pointCloud2dOperation: polygonOperation },\n } = ptCtx;\n\n /**\n * Synchronized 3d point cloud view displacement operations\n *\n * Change Orthographic Camera size\n */\n polygonOperation.singleOn('renderZoom', (zoom: number, currentPos: any) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n pointCloud.camera.zoom = zoom;\n if (currentPos) {\n const { x, y, z } = pointCloud.initCameraPosition;\n pointCloud.camera.position.set(x + offsetY, y - offsetX, z);\n }\n\n pointCloud.camera.updateProjectionMatrix();\n pointCloud.render();\n\n setZoom(zoom);\n setAnnotationPos({ zoom, currentPos });\n });\n\n // Synchronized 3d point cloud view displacement operations\n polygonOperation.singleOn('dragMove', ({ currentPos, zoom }) => {\n const { offsetX, offsetY } = TransferCanvas2WorldOffset(currentPos, size, zoom);\n pointCloud.camera.zoom = zoom;\n const { x, y, z } = pointCloud.initCameraPosition;\n pointCloud.camera.position.set(x + offsetY, y - offsetX, z);\n pointCloud.render();\n setAnnotationPos({ zoom, currentPos });\n });\n }, [size, ptCtx.topViewInstance]);\n\n useEffect(() => {\n ptCtx.topViewInstance?.pointCloudInstance?.applyZAxisPoints(zAxisLimit);\n }, [zAxisLimit]);\n\n useEffect(() => {\n pointCloudViews.topViewSelectedChanged();\n }, [ptCtx.selectedIDs]);\n\n return (\n <PointCloudContainer\n className={getClassName('point-cloud-container', 'top-view')}\n title={t('TopView')}\n toolbar={<TopViewToolbar currentData={currentData} />}\n >\n <div style={{ position: 'relative', flex: 1 }}>\n <div style={{ width: '100%', height: '100%' }} ref={ref}>\n {drawLayerSlot?.(annotationPos)}\n </div>\n\n <BoxInfos checkMode={checkMode} config={config} />\n <ZAxisSlider checkMode={checkMode} zAxisLimit={zAxisLimit} setZAxisLimit={setZAxisLimit} />\n <PointCloudValidity />\n </div>\n </PointCloudContainer>\n );\n};\n\nexport default connect(a2MapStateToProps, null, null, { context: LabelBeeContext })(\n PointCloudTopView,\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,CAAE,eAAoB,CAAA,GAAA,KAAA,CAAA;AAS5B,MAAM,0BAA6B,GAAA,CACjC,UACA,EAAA,IAAA,EACA,OAAO,CACJ,KAAA;AACH,EAAA,MAAM,CAAE,KAAA,EAAO,CAAG,EAAA,MAAA,EAAQ,CAAM,CAAA,GAAA,IAAA,CAAA;AAEhC,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,IAC/B,CAAG,EAAA,UAAA,CAAW,CAAK,GAAA,CAAA,GAAI,IAAQ,GAAA,CAAA;AAAA,GAAA,CAAA;AAGjC,EAAA,MAAM,gBAAmB,GAAA;AAAA,IACvB,CAAA,EAAG,KAAK,KAAQ,GAAA,CAAA;AAAA,IAChB,CAAA,EAAG,KAAK,MAAS,GAAA,CAAA;AAAA,GAAA,CAAA;AAGnB,EAAO,OAAA;AAAA,IACL,OAAU,EAAA,CAAA,gBAAA,CAAiB,CAAI,GAAA,iBAAA,CAAkB,CAAK,IAAA,IAAA;AAAA,IACtD,OAAS,EAAA,EAAmB,gBAAA,CAAA,CAAA,GAAI,kBAAkB,CAAK,CAAA,GAAA,IAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAI3D,MAAM,cAAA,G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A,CAAA,CAAA;AAEV,EAAA,2CACG,mBAAD,EAAA;AAAA,IACE,SAAA,EAAW,aAAa,uBAAyB,EAAA,UAAA,CAAA;AAAA,IACjD,OAAO,CAAE,CAAA,SAAA,CAAA;AAAA,IACT,OAAA,sCAAU,cAAD,EAAA;AAAA,MAAgB,WAAA;AAAA,KAAA,CAAA;AAAA,GAAA,sCAExB,KAAD,EAAA;AAAA,IAAK,KAAO,EAAA,CAAE,QAAU,EAAA,UAAA,EAAY,IAAM,EAAA,CAAA,CAAA;AAAA,GAAA,sCACvC,KAAD,EAAA;AAAA,IAAK,KAAO,EAAA,CAAE,KAAO,EAAA,MAAA,EAAQ,MAAQ,EAAA,MAAA,CAAA;AAAA,IAAU,GAAA;AAAA,GAC5C,EAAA,aAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,aAAA,CAAgB,aAGnB,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAD,EAAA;AAAA,IAAU,SAAA;AAAA,IAAsB,MAAA;AAAA,GAAA,CAAA,sCAC/B,WAAD,EAAA;AAAA,IAAa,SAAA;AAAA,IAAsB,UAAA;AAAA,IAAwB,aAAA;AAAA,GAAA,CAAA,sCAC1D,kBAAD,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA;AAMR,0BAAe,QAAQ,iBAAmB,EAAA,IAAA,EAAM,IAAM,EAAA,CAAE,SAAS,eAC/D,CAAA,CAAA,CAAA,iBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{getClassName as t}from"../../../../utils/dom.js";import{Slider as a}from"antd";const r=({onChange:n})=>e.createElement("span",{className:t("point-cloud-container","slider-container")},e.createElement("span",{className:t("point-cloud-container","slider-container","circle")}),e.createElement("span",{className:t("point-cloud-container","slider-container","slider")},e.createElement(a,{onChange:n,min:1,max:8})),e.createElement("span",{className:t("point-cloud-container","slider-container","circle"),style:{width:"10px",height:"10px"}}));export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/pointCloudView/components/PointCloudSizeSlider/index.tsx"],"sourcesContent":["import React from 'react';\nimport { getClassName } from '@/utils/dom';\nimport { Slider } from 'antd';\n\ninterface IProps {\n onChange: (size: number) => void;\n}\n\nconst PointCloudSizeSlider = ({ onChange }: IProps) => {\n return (\n <span className={getClassName('point-cloud-container', 'slider-container')}>\n <span className={getClassName('point-cloud-container', 'slider-container', 'circle')} />\n <span className={getClassName('point-cloud-container', 'slider-container', 'slider')}>\n <Slider onChange={onChange} min={1} max={8} />\n </span>\n <span\n className={getClassName('point-cloud-container', 'slider-container', 'circle')}\n style={{ width: '10px', height: '10px' }}\n />\n </span>\n );\n};\n\nexport default PointCloudSizeSlider;\n"],"names":[],"mappings":";;;;AAQM,MAAA,oBAAA,GAAuB,CAAC,CAAE,QAAuB,CAAA,KAAA;AACrD,EAAA,2CACG,MAAD,EAAA;AAAA,IAAM,SAAA,EAAW,aAAa,uBAAyB,EAAA,kBAAA,CAAA;AAAA,GAAA,sCACpD,MAAD,EAAA;AAAA,IAAM,SAAA,EAAW,YAAa,CAAA,uBAAA,EAAyB,kBAAoB,EAAA,QAAA,CAAA;AAAA,GAAA,CAAA,sCAC1E,MAAD,EAAA;AAAA,IAAM,SAAA,EAAW,YAAa,CAAA,uBAAA,EAAyB,kBAAoB,EAAA,QAAA,CAAA;AAAA,GAAA,sCACxE,MAAD,EAAA;AAAA,IAAQ,QAAA;AAAA,IAAoB,GAAK,EAAA,CAAA;AAAA,IAAG,GAAK,EAAA,CAAA;AAAA,GAAA,CAAA,CAAA,sCAE1C,MAAD,EAAA;AAAA,IACE,SAAA,EAAW,YAAa,CAAA,uBAAA,EAAyB,kBAAoB,EAAA,QAAA,CAAA;AAAA,IACrE,KAAO,EAAA,CAAE,KAAO,EAAA,MAAA,EAAQ,MAAQ,EAAA,MAAA,CAAA;AAAA,GAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as p
|
|
1
|
+
import{useContext as p}from"react";import{synchronizeSideView as C,synchronizeBackView as P}from"./usePointCloudViews.js";import{useSingleBox as w}from"./useSingleBox.js";import{PointCloudContext as x}from"../PointCloudContext.js";import{cAnnotation as f}from"@labelbee/lb-annotation";import{PointCloudUtils as b}from"@labelbee/lb-utils";import{useThrottleFn as V}from"ahooks";const{ERotateDirection:g}=f,y=({currentData:t})=>{const e=p(x),{selectedBox:i,updateSelectedBox:u}=w(),{run:a}=V(l=>{const{topViewInstance:s,mainViewInstance:n,syncAllViewPointCloudColor:d}=e;if(!s||!n)return;const{pointCloud2dOperation:r}=s,o=i==null?void 0:i.info;if(!o||!(t==null?void 0:t.url)||!e.backViewInstance)return;const m=u({rotation:b.restrictAngleRange(o.rotation+Number(Math.PI*l)/180)});r.rotatePolygon(l,g.Anticlockwise);const c=r.selectedPolygon;n.generateBox(o),d(m),C(o,c,e.sideViewInstance,t.url),P(o,c,e.backViewInstance,t.url),n.render()},{wait:800});return{updateRotate:a}};export{y as useRotate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRotate.js","sources":["../../../../src/components/pointCloudView/hooks/useRotate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useRotate.js","sources":["../../../../src/components/pointCloudView/hooks/useRotate.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { IAnnotationStateProps } from '@/store/annotation/map';\nimport { synchronizeBackView, synchronizeSideView } from './usePointCloudViews';\nimport { useSingleBox } from './useSingleBox';\nimport { PointCloudContext } from '../PointCloudContext';\nimport { cAnnotation } from '@labelbee/lb-annotation';\nimport { PointCloudUtils } from '@labelbee/lb-utils';\nimport { useThrottleFn } from 'ahooks';\n\nconst { ERotateDirection } = cAnnotation;\n\n/**\n * PointCloud Rotate Hook\n * @returns\n */\nexport const useRotate = ({ currentData }: IAnnotationStateProps) => {\n const ptCtx = useContext(PointCloudContext);\n const { selectedBox, updateSelectedBox } = useSingleBox();\n const { run: updateRotate } = useThrottleFn(\n (angle: number) => {\n const { topViewInstance, mainViewInstance, syncAllViewPointCloudColor } = ptCtx;\n if (!topViewInstance || !mainViewInstance) {\n return;\n }\n\n const { pointCloud2dOperation: TopPointCloudPolygonOperation } = topViewInstance;\n\n const selectedPointCloudBox = selectedBox?.info;\n\n if (!selectedPointCloudBox || !currentData?.url || !ptCtx.backViewInstance) {\n return;\n }\n\n const newPointCloudList = updateSelectedBox({\n rotation: PointCloudUtils.restrictAngleRange(\n selectedPointCloudBox.rotation + Number(Math.PI * angle) / 180,\n ),\n });\n\n TopPointCloudPolygonOperation.rotatePolygon(angle, ERotateDirection.Anticlockwise);\n const selectedPolygon = TopPointCloudPolygonOperation.selectedPolygon;\n\n mainViewInstance.generateBox(selectedPointCloudBox);\n syncAllViewPointCloudColor(newPointCloudList);\n synchronizeSideView(\n selectedPointCloudBox,\n selectedPolygon,\n ptCtx.sideViewInstance,\n currentData.url,\n );\n synchronizeBackView(\n selectedPointCloudBox,\n selectedPolygon,\n ptCtx.backViewInstance,\n currentData.url,\n );\n mainViewInstance.render();\n },\n {\n wait: 800,\n }\n );\n\n return { \n updateRotate,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AASA,MAAM,CAAE,gBAAqB,CAAA,GAAA,WAAA,CAAA;AAMhB,MAAA,SAAA,GAAY,CAAC,CAAE,WAAyC,CAAA,KAAA;AACnE,EAAA,MAAM,QAAQ,UAAW,CAAA,iBAAA,CAAA,CAAA;AACzB,EAAM,MAAA,CAAE,aAAa,iBAAsB,CAAA,GAAA,YAAA,EAAA,CAAA;AAC3C,EAAA,MAAM,CAAE,GAAA,EAAK,YAAiB,CAAA,GAAA,aAAA,CAC5B,CAAC,KAAkB,KAAA;AACjB,IAAM,MAAA,CAAE,eAAiB,EAAA,gBAAA,EAAkB,0BAA+B,CAAA,GAAA,KAAA,CAAA;AAC1E,IAAI,IAAA,CAAC,eAAmB,IAAA,CAAC,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'../PointCloudContext.js';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
|
|
5
|
+
const useSphere = () => {
|
|
6
|
+
const {
|
|
7
|
+
pointCloudSphereList,
|
|
8
|
+
setPointCloudSphereList,
|
|
9
|
+
selectedID,
|
|
10
|
+
mainViewInstance
|
|
11
|
+
} = useContext(PointCloudContext);
|
|
12
|
+
const selectedSphere = useMemo(() => {
|
|
13
|
+
return pointCloudSphereList.find((v) => v.id === selectedID);
|
|
14
|
+
}, [selectedID, pointCloudSphereList]);
|
|
15
|
+
const getPointCloudSphereByID = useCallback((id) => {
|
|
16
|
+
return pointCloudSphereList.find((i) => i.id === id);
|
|
17
|
+
}, [pointCloudSphereList]);
|
|
18
|
+
const updatePointCloudSphere = useCallback((sphereParams) => {
|
|
19
|
+
const sphereIndex = pointCloudSphereList.findIndex((v) => v.id === sphereParams.id);
|
|
20
|
+
if (sphereIndex > -1) {
|
|
21
|
+
pointCloudSphereList.splice(sphereIndex, 1, _.merge(pointCloudSphereList[sphereIndex], sphereParams));
|
|
22
|
+
const newPointCloudSphereList = _.cloneDeep(pointCloudSphereList);
|
|
23
|
+
setPointCloudSphereList(newPointCloudSphereList);
|
|
24
|
+
return newPointCloudSphereList;
|
|
25
|
+
}
|
|
26
|
+
return pointCloudSphereList;
|
|
27
|
+
}, [pointCloudSphereList]);
|
|
28
|
+
const deletePointCloudSphere = useCallback((id) => {
|
|
29
|
+
const newPointCloudSphereList = pointCloudSphereList.filter((v) => v.id !== id);
|
|
30
|
+
setPointCloudSphereList(newPointCloudSphereList);
|
|
31
|
+
mainViewInstance == null ? void 0 : mainViewInstance.removeObjectByName(id);
|
|
32
|
+
mainViewInstance == null ? void 0 : mainViewInstance.render();
|
|
33
|
+
}, [pointCloudSphereList]);
|
|
34
|
+
return {
|
|
35
|
+
selectedSphere,
|
|
36
|
+
getPointCloudSphereByID,
|
|
37
|
+
updatePointCloudSphere,
|
|
38
|
+
deletePointCloudSphere
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { useSphere };
|
|
43
|
+
//# sourceMappingURL=useSphere.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSphere.js","sources":["../../../../src/components/pointCloudView/hooks/useSphere.ts"],"sourcesContent":["import { useCallback, useContext, useMemo } from 'react';\nimport { PointCloudContext } from '@/components/pointCloudView/PointCloudContext';\nimport _ from 'lodash';\n\nexport const useSphere = () => {\n const {\n pointCloudSphereList,\n setPointCloudSphereList,\n selectedID,\n mainViewInstance,\n } = useContext(PointCloudContext);\n\n const selectedSphere = useMemo(() => {\n return pointCloudSphereList.find((v) => v.id === selectedID)\n }, [selectedID, pointCloudSphereList])\n\n const getPointCloudSphereByID = useCallback(\n (id: string) => {\n return pointCloudSphereList.find((i) => i.id === id);\n },\n [pointCloudSphereList],\n );\n\n const updatePointCloudSphere = useCallback(\n (sphereParams) => {\n const sphereIndex = pointCloudSphereList.findIndex((v) => v.id === sphereParams.id)\n if (sphereIndex > -1) {\n pointCloudSphereList.splice(sphereIndex, 1, _.merge(pointCloudSphereList[sphereIndex], sphereParams));\n const newPointCloudSphereList = _.cloneDeep(pointCloudSphereList);\n setPointCloudSphereList(newPointCloudSphereList);\n return newPointCloudSphereList;\n }\n return pointCloudSphereList\n }, [pointCloudSphereList]\n )\n\n const deletePointCloudSphere = useCallback(\n (id: string) => {\n const newPointCloudSphereList = pointCloudSphereList.filter((v) => v.id !== id);\n setPointCloudSphereList(newPointCloudSphereList);\n mainViewInstance?.removeObjectByName(id);\n mainViewInstance?.render();\n }, [pointCloudSphereList]\n )\n\n return {\n selectedSphere,\n getPointCloudSphereByID,\n updatePointCloudSphere,\n deletePointCloudSphere,\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,YAAY,MAAM;AAC7B,EAAM,MAAA;AAAA,IACJ,oBAAA;AAAA,IACA,uBAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,GAAA,GACE,UAAW,CAAA,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A,CAAA,CAAA;AACxB,IAAA,gBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,gBAAA,CAAkB,kBAAmB,CAAA,EAAA,CAAA,CAAA;AACrC,IAAkB,gBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,gBAAA,CAAA,MAAA,EAAA,CAAA;AAAA,GAAA,EACjB,CAAC,oBAAA,CAAA,CAAA,CAAA;AAGN,EAAO,OAAA;AAAA,IACL,cAAA;AAAA,IACA,uBAAA;AAAA,IACA,sBAAA;AAAA,IACA,sBAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
|
|
@@ -1 +1,91 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button, message } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import img from '../../../assets/predictTracking/icon.svg.js';
|
|
6
|
+
import { useSingleBox } from '../../pointCloudView/hooks/useSingleBox.js';
|
|
7
|
+
import { ChangeSave, GetBoxesByID, SetPointCloudLoading, SetPredictResult, SetPredictResultVisible } from '../../../store/annotation/actionCreators.js';
|
|
8
|
+
import { LabelBeeContext, useDispatch } from '../../../store/ctx.js';
|
|
9
|
+
import { predict } from '../previewResult/util.js';
|
|
10
|
+
|
|
11
|
+
var __async = (__this, __arguments, generator) => {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
var fulfilled = (value) => {
|
|
14
|
+
try {
|
|
15
|
+
step(generator.next(value));
|
|
16
|
+
} catch (e) {
|
|
17
|
+
reject(e);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var rejected = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.throw(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
28
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const PredictTrackingIcon = (props) => {
|
|
32
|
+
const dispatch = useDispatch();
|
|
33
|
+
const {t} = useTranslation();
|
|
34
|
+
const {loading} = props;
|
|
35
|
+
const {selectedBox} = useSingleBox();
|
|
36
|
+
const handler = () => __async(undefined, null, function* () {
|
|
37
|
+
if (loading) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const selectedBoxTrackID = selectedBox == null ? void 0 : selectedBox.info.trackID;
|
|
41
|
+
if (!selectedBoxTrackID) {
|
|
42
|
+
message.error(t("BeforePredictStarting"));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
yield dispatch(ChangeSave);
|
|
46
|
+
const boxes = yield dispatch(GetBoxesByID(selectedBoxTrackID));
|
|
47
|
+
if (boxes.length < 2) {
|
|
48
|
+
message.error(t("BeforePredictStarting"));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const start = boxes[boxes.length - 2];
|
|
52
|
+
const end = boxes[boxes.length - 1];
|
|
53
|
+
const difference = end.index - start.index;
|
|
54
|
+
if (difference < 2) {
|
|
55
|
+
message.error(t("BeforePredictStarting"));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (difference > 8) {
|
|
59
|
+
message.error(t("ThePredictedPointCloud"));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
SetPointCloudLoading(dispatch, true);
|
|
63
|
+
const result = predict(start, end);
|
|
64
|
+
SetPredictResult(dispatch, result);
|
|
65
|
+
SetPredictResultVisible(dispatch, true);
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
68
|
+
type: "link",
|
|
69
|
+
onClick: handler,
|
|
70
|
+
style: {
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
height: "auto",
|
|
74
|
+
alignItems: "center"
|
|
75
|
+
}
|
|
76
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
77
|
+
src: img,
|
|
78
|
+
style: {alignSelf: "center"}
|
|
79
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
80
|
+
style: {color: "#797979"}
|
|
81
|
+
}, t("ComplementaryTracking")));
|
|
82
|
+
};
|
|
83
|
+
const mapStateToProps = (state) => {
|
|
84
|
+
return {
|
|
85
|
+
loading: state.annotation.loading
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
var PredictTrackingIcon$1 = connect(mapStateToProps, null, null, {context: LabelBeeContext})(PredictTrackingIcon);
|
|
89
|
+
|
|
90
|
+
export { PredictTrackingIcon$1 as default };
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,189 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import { PointCloudContext } from '../../pointCloudView/PointCloudContext.js';
|
|
6
|
+
import { SetPredictResultVisible, SetPredictResult, SetPointCloudLoading, BatchUpdateImgListResultByPredictResult } from '../../../store/annotation/actionCreators.js';
|
|
7
|
+
import { LabelBeeContext, useDispatch } from '../../../store/ctx.js';
|
|
8
|
+
import { getClassName } from '../../../utils/dom.js';
|
|
9
|
+
import { PointCloud } from '@labelbee/lb-annotation';
|
|
10
|
+
import { toolStyleConverter } from '@labelbee/lb-utils';
|
|
11
|
+
import { views, sleep, getViewsDataUrl } from './util.js';
|
|
12
|
+
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __defProps = Object.defineProperties;
|
|
15
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
16
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
20
|
+
var __spreadValues = (a, b) => {
|
|
21
|
+
for (var prop in b || (b = {}))
|
|
22
|
+
if (__hasOwnProp.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols)
|
|
25
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
+
if (__propIsEnum.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
}
|
|
29
|
+
return a;
|
|
30
|
+
};
|
|
31
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const PreviewResult = (props) => {
|
|
53
|
+
const {predictionResult, predictionResultVisible, imgList} = props;
|
|
54
|
+
const [list, setList] = useState([]);
|
|
55
|
+
const dispatch = useDispatch();
|
|
56
|
+
const {t} = useTranslation();
|
|
57
|
+
const close = () => {
|
|
58
|
+
SetPredictResultVisible(dispatch, false);
|
|
59
|
+
SetPredictResult(dispatch, []);
|
|
60
|
+
setList([]);
|
|
61
|
+
};
|
|
62
|
+
const apply = () => __async(undefined, null, function* () {
|
|
63
|
+
SetPointCloudLoading(dispatch, true);
|
|
64
|
+
yield dispatch(BatchUpdateImgListResultByPredictResult());
|
|
65
|
+
SetPointCloudLoading(dispatch, false);
|
|
66
|
+
close();
|
|
67
|
+
});
|
|
68
|
+
return predictionResultVisible ? /* @__PURE__ */ React.createElement(React.Fragment, null, list.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
69
|
+
className: getClassName("point-cloud-predict-tracking-container")
|
|
70
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
71
|
+
className: getClassName("point-cloud-predict-tracking-container", "bar")
|
|
72
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
73
|
+
className: getClassName("point-cloud-predict-tracking-container", "title")
|
|
74
|
+
}, /* @__PURE__ */ React.createElement("div", null, t("ComplementaryTrackingPrediction"), list.length > 0 ? `\uFF08${list.length}\uFF09` : ""), /* @__PURE__ */ React.createElement("div", {
|
|
75
|
+
className: getClassName("point-cloud-predict-tracking-container", "option")
|
|
76
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
77
|
+
className: classNames([
|
|
78
|
+
getClassName("point-cloud-predict-tracking-container", "cancelOption"),
|
|
79
|
+
getClassName("point-cloud-predict-tracking-container", "button")
|
|
80
|
+
]),
|
|
81
|
+
onClick: close
|
|
82
|
+
}, t("Cancel")), /* @__PURE__ */ React.createElement("div", {
|
|
83
|
+
className: classNames([
|
|
84
|
+
getClassName("point-cloud-predict-tracking-container", "okOption"),
|
|
85
|
+
getClassName("point-cloud-predict-tracking-container", "button")
|
|
86
|
+
]),
|
|
87
|
+
onClick: apply
|
|
88
|
+
}, t("Apply")))), /* @__PURE__ */ React.createElement("div", {
|
|
89
|
+
className: getClassName("point-cloud-predict-tracking-container", "content")
|
|
90
|
+
}, /* @__PURE__ */ React.createElement(Result, {
|
|
91
|
+
list
|
|
92
|
+
})))), predictionResult.length > 0 && /* @__PURE__ */ React.createElement(GenerateViewsDataUrl, {
|
|
93
|
+
result: predictionResult,
|
|
94
|
+
imgList,
|
|
95
|
+
setList
|
|
96
|
+
})) : null;
|
|
97
|
+
};
|
|
98
|
+
const Result = (props) => {
|
|
99
|
+
const {list} = props;
|
|
100
|
+
const {t} = useTranslation();
|
|
101
|
+
const viewsTitle = [t("TopView"), t("SideView"), t("BackView")];
|
|
102
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
103
|
+
className: getClassName("point-cloud-predict-tracking-container", "left")
|
|
104
|
+
}, viewsTitle.map((i) => /* @__PURE__ */ React.createElement("div", {
|
|
105
|
+
className: getClassName("point-cloud-predict-tracking-container", "title"),
|
|
106
|
+
key: i
|
|
107
|
+
}, i))), /* @__PURE__ */ React.createElement("div", {
|
|
108
|
+
className: getClassName("point-cloud-predict-tracking-container", "right")
|
|
109
|
+
}, list.map((i) => {
|
|
110
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
111
|
+
className: getClassName("point-cloud-predict-tracking-container", "item"),
|
|
112
|
+
key: i.id
|
|
113
|
+
}, views.map((view) => {
|
|
114
|
+
const url = i[view];
|
|
115
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
116
|
+
className: getClassName("point-cloud-predict-tracking-container", "view"),
|
|
117
|
+
key: `${i.id}-${view}`
|
|
118
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
119
|
+
src: url
|
|
120
|
+
}));
|
|
121
|
+
}));
|
|
122
|
+
})));
|
|
123
|
+
};
|
|
124
|
+
const GenerateViewsDataUrl = (props) => {
|
|
125
|
+
const ptCtx = React.useContext(PointCloudContext);
|
|
126
|
+
const dispatch = useDispatch();
|
|
127
|
+
const {result, imgList, setList} = props;
|
|
128
|
+
const ref = useRef(null);
|
|
129
|
+
const size = {
|
|
130
|
+
width: 600,
|
|
131
|
+
height: 600
|
|
132
|
+
};
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
const generate = () => __async(undefined, null, function* () {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f;
|
|
136
|
+
const config = (_a = ptCtx.mainViewInstance) == null ? void 0 : _a.config;
|
|
137
|
+
if (config && ref.current) {
|
|
138
|
+
const orthographicParams = {
|
|
139
|
+
left: -size.width / 2,
|
|
140
|
+
right: size.width / 2,
|
|
141
|
+
top: size.height / 2,
|
|
142
|
+
bottom: -size.height / 2,
|
|
143
|
+
near: 200,
|
|
144
|
+
far: -200
|
|
145
|
+
};
|
|
146
|
+
const pointCloud = new PointCloud({
|
|
147
|
+
container: ref.current,
|
|
148
|
+
isOrthographicCamera: true,
|
|
149
|
+
orthographicParams,
|
|
150
|
+
config
|
|
151
|
+
});
|
|
152
|
+
pointCloud.setShowDirection(false);
|
|
153
|
+
for (const item of result) {
|
|
154
|
+
const {index} = item;
|
|
155
|
+
const url = imgList[index].url ? imgList[index].url : (_e = (_d = (_c = (_b = imgList[index]) == null ? void 0 : _b.webPointCloudFile) == null ? void 0 : _c.lidar) == null ? void 0 : _d.url) != null ? _e : "";
|
|
156
|
+
yield pointCloud.loadPCDFileByBox(url, item, {
|
|
157
|
+
width: 2,
|
|
158
|
+
height: 2,
|
|
159
|
+
depth: 2
|
|
160
|
+
});
|
|
161
|
+
yield pointCloud.updateCameraZoom(ptCtx.zoom);
|
|
162
|
+
const hex = (_f = toolStyleConverter.getColorFromConfig({attribute: item.attribute}, __spreadProps(__spreadValues({}, config), {attributeConfigurable: true}), {})) == null ? void 0 : _f.hex;
|
|
163
|
+
pointCloud.generateBox(item, hex);
|
|
164
|
+
yield sleep(500);
|
|
165
|
+
yield getViewsDataUrl(pointCloud, item, ptCtx.zoom);
|
|
166
|
+
yield pointCloud.removeObjectByName(item.id);
|
|
167
|
+
yield pointCloud.clearPointCloudAndRender();
|
|
168
|
+
}
|
|
169
|
+
setList(result);
|
|
170
|
+
SetPointCloudLoading(dispatch, false);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
generate();
|
|
174
|
+
}, []);
|
|
175
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
176
|
+
style: size,
|
|
177
|
+
ref,
|
|
178
|
+
className: "generate-view"
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const mapStateToProps = (state) => ({
|
|
182
|
+
predictionResult: state.annotation.predictionResult,
|
|
183
|
+
predictionResultVisible: state.annotation.predictionResultVisible,
|
|
184
|
+
imgList: state.annotation.imgList
|
|
185
|
+
});
|
|
186
|
+
var PreviewResult$1 = connect(mapStateToProps, null, null, {context: LabelBeeContext})(PreviewResult);
|
|
187
|
+
|
|
188
|
+
export { PreviewResult$1 as default };
|
|
189
|
+
//# sourceMappingURL=index.js.map
|