@labelbee/lb-components 1.10.0-alpha.1 → 1.10.0-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/PointCloudContext.js +1 -1
- package/dist/components/pointCloudView/PointCloudListener.js +1 -1
- package/dist/components/pointCloudView/PointCloudTopView.js +1 -1
- package/dist/components/pointCloudView/hooks/useHistory.js +1 -1
- package/dist/components/pointCloudView/hooks/useLine.js +1 -0
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/types/components/pointCloudView/PointCloudContext.d.ts +4 -2
- package/dist/types/components/pointCloudView/PointCloudLayout.d.ts +1 -1
- package/dist/types/components/pointCloudView/hooks/useHistory.d.ts +5 -2
- package/dist/types/components/pointCloudView/hooks/useLine.d.ts +12 -0
- package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +3 -1
- package/dist/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/es/components/pointCloudView/PointCloudContext.js +1 -1
- package/es/components/pointCloudView/PointCloudListener.js +1 -1
- package/es/components/pointCloudView/PointCloudTopView.js +1 -1
- package/es/components/pointCloudView/hooks/useHistory.js +1 -1
- package/es/components/pointCloudView/hooks/useLine.js +1 -0
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/views/MainView/toolFooter/AnnotatedAttributes/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],polygonList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),PointCloudProvider=({children:u})=>{const[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation");function _interopDefaultLegacy(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var React__default=_interopDefaultLegacy(React);const PointCloudContext=React__default.default.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new lbAnnotation.ActionsHistory,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:lbAnnotation.EToolName.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),PointCloudProvider=({children:u})=>{const[l,y]=React.useState([]),[c,h]=React.useState([]),[C,j]=React.useState([]),[S,N]=React.useState([]),[r,L]=React.useState([]),[m,T]=React.useState(!0),[w,_]=React.useState(1),[n,k]=React.useState(),[I,q]=React.useState(),[V,z]=React.useState(),[o,F]=React.useState(),[g,Z]=React.useState(""),[x,G]=React.useState(lbAnnotation.EToolName.Rect),J=React.useRef(new lbAnnotation.ActionsHistory).current,[i,v]=React.useState([]),[B,K]=React.useState(""),R=React.useMemo(()=>r.length===1?r[0]:"",[r]),D=React.useMemo(()=>{const d=l.find(t=>t.id===R),A=t=>{const e=l.concat(t);return y(e),e},b=t=>{const e=c.concat(t);return h(e),e},f=t=>{T(t!==!1)},s=t=>{t===void 0&&L([]),typeof t=="string"&&L([t]),Array.isArray(t)&&L(Array.from(new Set(t)))},U=t=>{r.includes(t)?s(r.filter(e=>e!==t)):s([...r,t])},W=()=>{s(l.map(t=>t.id))},X=t=>{s(l.filter(e=>e.attribute===t).map(e=>e.id))},E=l.filter(t=>!i.includes(t.attribute)),H=c.filter(t=>!i.includes(t.attribute)),Y=t=>{if(i.includes(t))v(i.filter(e=>e!==t));else{const e=i.concat(t);v(e)}},$=(t=E,e=C,P=H,p=S)=>{l.forEach(a=>{o==null||o.removeObjectByName(a.id)}),c.forEach(a=>{o==null||o.removeObjectByName(a.id)}),n==null||n.updatePolygonList(t,e),n==null||n.updatePointList(P),n==null||n.updateLineList(p),o==null||o.generateBoxes(t),o==null||o.generateSpheres(P),M(t)},M=t=>{const e=o==null?void 0:o.highlightOriginPointCloud(t);return new Promise(P=>{e==null||e.then(p=>{[n].forEach(a=>{var O;p&&((O=a==null?void 0:a.pointCloudInstance)==null||O.updateColor(p),P({color:p}))})})})};return{selectedID:R,pointCloudBoxList:l,pointCloudSphereList:c,displayPointCloudList:E,displaySphereList:H,selectedIDs:r,setPointCloudResult:y,setSelectedIDs:s,addPointCloudBox:A,addPointCloudSphere:b,setPointCloudSphereList:h,valid:m,selectedPointCloudBox:d,setPointCloudValid:f,addSelectedID:U,selectedAllBoxes:W,topViewInstance:n,setTopViewInstance:k,sideViewInstance:I,setSideViewInstance:q,backViewInstance:V,setBackViewInstance:z,mainViewInstance:o,setMainViewInstance:F,polygonList:C,setPolygonList:j,lineList:S,setLineList:N,zoom:w,setZoom:_,history:J,toggleAttributesVisible:Y,hideAttributes:i,setHideAttributes:v,reRender:$,attrPanelLayout:B,setAttrPanelLayout:K,syncAllViewPointCloudColor:M,defaultAttribute:g,setDefaultAttribute:Z,pointCloudPattern:x,setPointCloudPattern:G,selectSpecAttr:X}},[m,r,l,c,C,S,n,I,V,o,w,i,B,g,x]),Q=()=>{const d=l.filter(s=>i.includes(s.attribute)),{setSelectedIDs:A,reRender:b}=D,f=d.map(s=>s.id);f.length>0&&A(r.filter(s=>!f.includes(s))),b()};return React.useEffect(()=>{var d;Q(),(d=n==null?void 0:n.pointCloud2dOperation)==null||d.setHiddenAttributes(i)},[i]),React__default.default.createElement(PointCloudContext.Provider,{value:D},u)};exports.PointCloudContext=PointCloudContext,exports.PointCloudProvider=PointCloudProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),reactI18next=require("react-i18next"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,r,i)=>r in u?__defProp(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i,__spreadValues=(u,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(u,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(u,i,r[i]);return u},__spreadProps=(u,r)=>__defProps(u,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:u,config:r,checkMode:i,configString:_,imgIndex:w})=>{const
|
|
1
|
+
"use strict";var PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useBoxes=require("./hooks/useBoxes.js"),useSingleBox=require("./hooks/useSingleBox.js"),useSphere=require("./hooks/useSphere.js"),React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),antd=require("antd"),reactRedux=require("react-redux"),map=require("../../store/annotation/map.js"),annotation=require("../../hooks/annotation.js"),useStatus=require("./hooks/useStatus.js"),index=require("../../utils/index.js"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),ctx=require("../../store/ctx.js"),useHistory=require("./hooks/useHistory.js"),useAttribute=require("./hooks/useAttribute.js"),useConfig=require("./hooks/useConfig.js"),usePolygon=require("./hooks/usePolygon.js"),reactI18next=require("react-i18next"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(u,r,i)=>r in u?__defProp(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i,__spreadValues=(u,r)=>{for(var i in r||(r={}))__hasOwnProp.call(r,i)&&__defNormalProp(u,i,r[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(r))__propIsEnum.call(r,i)&&__defNormalProp(u,i,r[i]);return u},__spreadProps=(u,r)=>__defProps(u,__getOwnPropDescs(r));const{EPolygonPattern}=lbAnnotation.cTool,PointCloudListener=({currentData:u,config:r,checkMode:i,configString:_,imgIndex:w})=>{const t=React.useContext(PointCloudContext.PointCloudContext),{changeSelectedBoxValid:B,selectNextBox:I,selectPrevBox:L,updateSelectedBox:C,deleteSelectedPointCloudBoxAndPolygon:V}=useSingleBox.useSingleBox(),{selectedSphere:f,updatePointCloudSphere:E}=useSphere.useSphere(),{clearAllResult:b,updatePointCloudPattern:q}=useStatus.useStatus(),A=index.jsonParser(u.result),{copySelectedBoxes:O,pasteSelectedBoxes:j,copiedBoxes:T}=useBoxes.useBoxes({config:r}),{toolInstanceRef:a}=annotation.useCustomToolInstance({basicInfo:A}),{updateRotate:P}=useRotate.useRotate({currentData:u}),{updatePointCloudData:p,topViewSelectedChanged:x}=usePointCloudViews.usePointCloudViews(),{redo:h,undo:g,pushHistoryWithList:R,pushHistoryUnderUpdatePolygon:D}=useHistory.useHistory(),{syncThreeViewsAttribute:S}=useAttribute.useAttribute(),{syncAllViewsConfig:N,reRenderTopViewRange:H}=useConfig.useConfig(),{selectedPolygon:m}=usePolygon.usePolygon(),{t:y}=reactI18next.useTranslation(),v=e=>{var o;const{topViewInstance:s}=t;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},K=(e,o)=>{var s;const{topViewInstance:n,mainViewInstance:l}=t;if(!n)return;const{pointCloud2dOperation:c}=n;switch(e){case"q":{P(2);break}case"e":P(-2);break;case"g":P(180);break;case"u":{const d=c.pattern===EPolygonPattern.Normal?lbAnnotation.EToolName.Rect:lbAnnotation.EToolName.Polygon;q(d);const z={[lbAnnotation.EToolName.Polygon]:y("PolygonPattern"),[lbAnnotation.EToolName.Rect]:y("RectPattern")};antd.message.success(y("ChangePatternMsg",{pattern:z[d]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize(!0);break;case"-":l==null||l.updatePointSize(!1);break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){L();break}I(),o.preventDefault();break;case"f":B();break;case"arrowup":v({y:-1});break;case"arrowdown":v({y:1});break;case"arrowleft":v({x:-1});break;case"arrowright":v({x:1});break;case"delete":V();break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const d=lbAnnotation.AttributeUtils.getAttributeByKeycode(o.keyCode,r.attributeList);d!==void 0&&a.current.setDefaultAttribute(d)}return}}},U=(e,o)=>{switch(e){case"c":O();break;case"v":j();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?h():g();break}}},k=e=>{if(!lbAnnotation.CommonToolUtils.hotkeyFilter(e)||i===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){U(o,e);return}K(o,e)};return React.useEffect(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}},[t,T,r,t.pointCloudBoxList,t.polygonList]),React.useEffect(()=>{N(r)},[_]),React.useEffect(()=>{(r==null?void 0:r.radius)&&H(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),React.useEffect(()=>{p==null||p()},[w,t.mainViewInstance]),React.useEffect(()=>{t.setHideAttributes([])},[w]),React.useEffect(()=>{a.current.exportData=()=>[t.pointCloudBoxList,{valid:t.valid}],a.current.exportCustomData=()=>{var e,o,s;return{resultPolygon:(e=t.polygonList)!=null?e:[],resultLine:(o=t.lineList)!=null?o:[],resultPoint:(s=t.pointCloudSphereList)!=null?s:[]}},a.current.setDefaultAttribute=e=>{var o;S(e);const s=t.selectedPointCloudBox;if(s){s.attribute=e;const n=C(s);t.mainViewInstance&&x({newSelectedBox:s,newPointCloudList:n})}if(m&&D(__spreadProps(__spreadValues({},m),{attribute:e})),f){const n=E(__spreadProps(__spreadValues({},f),{attribute:e}));t.mainViewInstance&&((o=t.mainViewInstance)==null||o.generateSpheres(n),x({newSelectedSphere:f,newSphereList:n}))}},a.current.setSubAttribute=(e,o)=>{var s;const n=t.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=__spreadProps(__spreadValues({},l),{[e]:o}),C(n)}},a.current.clearResult=()=>{b==null||b()},a.current.redo=()=>{h()},a.current.undo=()=>{g()},a.current.setValid=e=>{a.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&b()})},a.current.setForbidOperation=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},a.current.setShowDefaultCursor=e=>{var o,s;(s=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(e)},a.current.asyncData=e=>{setTimeout(()=>{p==null||p(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance]),React.useEffect(()=>{a.current.history={pushHistory:e=>{R({pointCloudBoxList:e})},initRecord:()=>{}}},[]),React.useEffect(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||i)return;const s=c=>{S(c)},n=c=>{antd.message.error(c)},l=c=>{antd.message.info(c)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[t.topViewInstance]),null};var PointCloudListener$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudListener);module.exports=PointCloudListener$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),index$1=require("../../views/MainView/toolFooter/index.js"),index$2=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),ToolUtils=require("../../utils/ToolUtils.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),index$1=require("../../views/MainView/toolFooter/index.js"),index$2=require("../../views/MainView/toolFooter/ZoomController/index.js"),icons=require("@ant-design/icons"),lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("./PointCloudContext.js"),useRotate=require("./hooks/useRotate.js"),useSingleBox=require("./hooks/useSingleBox.js"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudInfos=require("./PointCloudInfos.js"),usePolygon=require("./hooks/usePolygon.js"),useLine=require("./hooks/useLine.js"),useSphere=require("./hooks/useSphere.js"),useZoom=require("./hooks/useZoom.js"),antd=require("antd"),map=require("../../store/annotation/map.js"),reactRedux=require("react-redux"),usePointCloudViews=require("./hooks/usePointCloudViews.js"),useSize=require("../../hooks/useSize.js"),reactI18next=require("react-i18next"),ctx=require("../../store/ctx.js"),index=require("../../utils/index.js"),ToolUtils=require("../../utils/ToolUtils.js");function _interopDefaultLegacy(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,l,s)=>l in o?__defProp(o,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[l]=s,__spreadValues=(o,l)=>{for(var s in l||(l={}))__hasOwnProp.call(l,s)&&__defNormalProp(o,s,l[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(l))__propIsEnum.call(l,s)&&__defNormalProp(o,s,l[s]);return o},__spreadProps=(o,l)=>__defProps(o,__getOwnPropDescs(l));const{EPolygonPattern}=lbAnnotation.cTool,TransferCanvas2WorldOffset=(o,l,s=1)=>{const{width:p,height:C}=l,m={x:o.x+p*s/2,y:o.y+C*s/2},g={x:l.width/2,y:l.height/2};return{offsetX:(g.x-m.x)/s,offsetY:-(g.y-m.y)/s}},TopViewToolbar=({currentData:o})=>{const{zoom:l,zoomIn:s,zoomOut:p,initialPosition:C}=useZoom.useZoom(),{selectNextBox:m,selectPrevBox:g}=useSingleBox.useSingleBox(),{updateRotate:P}=useRotate.useRotate({currentData:o}),x=2,I=()=>{P(-x)},f=()=>{P(x)},t=()=>{P(180)};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("span",{onClick:f,className:dom.getClassName("point-cloud","rotate-reserve")}),React__default.default.createElement("span",{onClick:I,className:dom.getClassName("point-cloud","rotate")}),React__default.default.createElement("span",{onClick:t,className:dom.getClassName("point-cloud","rotate-180")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(icons.UpSquareOutlined,{onClick:()=>{g()},className:dom.getClassName("point-cloud","prev")}),React__default.default.createElement(icons.DownSquareOutlined,{onClick:()=>{m()},className:dom.getClassName("point-cloud","next")}),React__default.default.createElement(index$1.FooterDivider,null),React__default.default.createElement(index$2.ZoomController,{initialPosition:C,zoomIn:s,zoomOut:p,zoom:l}))},ZAxisSlider=({setZAxisLimit:o,zAxisLimit:l,checkMode:s})=>s?null:React__default.default.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},React__default.default.createElement(antd.Slider,{vertical:!0,step:.5,max:10,min:.5,defaultValue:l,onAfterChange:p=>{o(p)}})),PointCloudTopView=({currentData:o,imgList:l,stepInfo:s,drawLayerSlot:p,checkMode:C,intelligentFit:m})=>{var g,P;const[x,I]=React.useState({zoom:1,currentPos:{x:0,y:0}}),f=React.useRef(null),t=React__default.default.useContext(PointCloudContext.PointCloudContext),a=useSize(f),w=index.jsonParser(s.config),{setZoom:q,syncTopviewToolZoom:j}=useZoom.useZoom(),{hideAttributes:_}=t,{addPolygon:E,deletePolygon:A}=usePolygon.usePolygon(),{addLine:N,deleteLine:T}=useLine.useLine(),{deletePointCloudSphere:k}=useSphere.useSphere(),{deletePointCloudBox:L,changeValidByID:B}=useSingleBox.useSingleBox(),[y,D]=React.useState(10),{t:R}=reactI18next.useTranslation(),d=usePointCloudViews.usePointCloudViews();return React.useLayoutEffect(()=>{if(!t.topViewInstance&&f.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const n={width:f.current.clientWidth,height:f.current.clientHeight},c=new lbAnnotation.PointCloudAnnotation({container:f.current,size:n,pcdPath:o.url,config:__spreadProps(__spreadValues({},w),{pointCloudPattern:t.pointCloudPattern}),checkMode:C,toolName:ToolUtils.getPointCloudToolList()});t.setTopViewInstance(c)}},[o]),React.useEffect(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:n}=t.topViewInstance;n.singleOn("lineCreated",(e,i)=>{const u=__spreadProps(__spreadValues({},e),{pointList:e.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,a))});N(u),t.setSelectedIDs(_.includes(e.attribute)?"":e.id)}),n.singleOn("lineDeleted",e=>{L(e),T(e)}),n.singleOn("lineSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updateLineByDrag",e=>{var i;(i=d.topViewUpdateLine)==null||i.call(d,e,a)}),n.singleOn("pointCreated",(e,i)=>{d.topViewAddSphere({newPoint:e,size:a,trackConfigurable:w.trackConfigurable,zoom:i})}),n.singleOn("pointDeleted",e=>{k(e)}),n.singleOn("pointSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updatePointByDrag",(e,i)=>{var u;(u=d.topViewUpdatePoint)==null||u.call(d,e,a)}),n.singleOn("polygonCreated",(e,i)=>{if(n.pattern===EPolygonPattern.Normal||!(o==null?void 0:o.url)){const u=__spreadProps(__spreadValues({},e),{pointList:e.pointList.map(r=>lbUtils.PointCloudUtils.transferCanvas2World(r,a))});E(u),t.setSelectedIDs(_.includes(e.attribute)?"":e.id);return}d.topViewAddBox({polygon:e,size:a,imgList:l,trackConfigurable:w.trackConfigurable,zoom:i,intelligentFit:m})}),n.singleOn("deletedObject",({id:e})=>{L(e),A(e)}),n.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),n.singleOn("addSelectedIDs",e=>{t.addSelectedID(e)}),n.singleOn("setSelectedIDs",e=>{t.setSelectedIDs(e)}),n.singleOn("updatePolygonByDrag",e=>{var i;(i=d.topViewUpdateBox)==null||i.call(d,e,a)});const c=e=>{var i;const u=B(e);u&&t.syncAllViewPointCloudColor(u),t.polygonList.find(r=>r.id===e)&&((i=t.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(e,!0))};return n.on("validUpdate",c),()=>{n.unbind("validUpdate",c)}},[t,a,o,d,t.polygonList,t.lineList,(g=t.topViewInstance)==null?void 0:g.toolInstance]),React.useEffect(()=>{var n,c;if(!(a==null?void 0:a.width)||!t.topViewInstance)return;const e=(c=(n=w==null?void 0:w.attributeList)==null?void 0:n[0])==null?void 0:c.value;e&&t.topViewInstance.toolInstance.setDefaultAttribute(e),t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList);const{topViewInstance:{pointCloudInstance:i,toolInstance:u}}=t;u.singleOn("renderZoom",(r,v)=>{const{offsetX:V,offsetY:h}=TransferCanvas2WorldOffset(v,a,r);if(i.camera.zoom=r,v){const{x:O,y:S,z:b}=i.initCameraPosition;i.camera.position.set(O+h,S-V,b)}i.camera.updateProjectionMatrix(),i.render(),q(r),j(v,r,a),I({zoom:r,currentPos:v})}),u.singleOn("dragMove",({currentPos:r,zoom:v})=>{const{offsetX:V,offsetY:h}=TransferCanvas2WorldOffset(r,a,v);i.camera.zoom=v;const{x:O,y:S,z:b}=i.initCameraPosition;i.camera.position.set(O+h,S-V,b),i.render(),I({zoom:v,currentPos:r})})},[a,t.topViewInstance,(P=t.topViewInstance)==null?void 0:P.toolInstance]),React.useEffect(()=>{var n,c;(c=(n=t.topViewInstance)==null?void 0:n.pointCloudInstance)==null||c.applyZAxisPoints(y)},[y]),React.useEffect(()=>{d.topViewSelectedChanged({})},[t.selectedIDs]),React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:dom.getClassName("point-cloud-container","top-view"),title:R("TopView"),toolbar:React__default.default.createElement(TopViewToolbar,{currentData:o})},React__default.default.createElement("div",{style:{position:"relative",flex:1}},React__default.default.createElement("div",{style:{width:"100%",height:"100%"},ref:f},p==null?void 0:p(x)),React__default.default.createElement(PointCloudInfos.BoxInfos,{checkMode:C,config:w}),React__default.default.createElement(ZAxisSlider,{checkMode:C,zAxisLimit:y,setZAxisLimit:D}),React__default.default.createElement(PointCloudInfos.PointCloudValidity,null)))};var PointCloudTopView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloudTopView);module.exports=PointCloudTopView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,s,r)=>s in e?__defProp(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r,__spreadValues=(e,s)=>{for(var r in s||(s={}))__hasOwnProp.call(s,r)&&__defNormalProp(e,r,s[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(s))__propIsEnum.call(s,r)&&__defNormalProp(e,r,s[r]);return e};const useHistory=()=>{const{history:e,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:l,pointCloudSphereList:P,mainViewInstance:p,topViewInstance:L,polygonList:u,setPolygonList:f,lineList:c,setLineList:a,syncAllViewPointCloudColor:h}=React.useContext(PointCloudContext.PointCloudContext),g=({newBoxParams:t,newPolygon:o,newLine:i})=>{const n={pointCloudBoxList:l,polygonList:u,lineList:c};t&&(n.pointCloudBoxList=l.concat(t)),o&&(n.polygonList=u.concat(o)),i&&(n.lineList=c.concat(i)),e.pushHistory(n)},v=t=>{const o={pointCloudBoxList:l,polygonList:u,lineList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),e.pushHistory(o)},x=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(n=>n.id===t.id?t:__spreadValues({},n));e.pushHistory({lineList:i}),a(i)}},_=t=>{t&&e.pushHistory({pointCloudSphereList:P})},H=t=>{if(u.find(i=>i.id===t.id)){const i=u.map(n=>n.id===t.id?t:__spreadValues({},n));e.pushHistory({pointCloudBoxList:l,polygonList:i}),f(i)}},w=({pointCloudBoxList:t,polygonList:o})=>{e.initRecord({pointCloudBoxList:t,polygonList:o},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:n=[]}=t;if(o){l.length!==o.length&&r();const B=l.filter(d=>o.every(y=>y.id!==d.id)),O=o.filter(d=>l.every(y=>y.id!==d.id));B.forEach(d=>{p==null||p.removeObjectByName(d.id)}),O.forEach(d=>{p==null||p.generateBox(d)}),s(o),h(o)}i&&f(i),n&&a(n),L==null||L.updatePolygonList(o!=null?o:[],i!=null?i:[]),L==null||L.updateLineList(n!=null?n:[])};return{addHistory:g,pushHistoryWithList:v,initHistory:w,pushHistoryUnderUpdatePoint:_,pushHistoryUnderUpdatePolygon:H,pushHistoryUnderUpdateLine:x,redo:()=>{C(e.redo())},undo:()=>{C(e.undo())}}};exports.useHistory=useHistory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useHistory=require("./useHistory.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e));const useLine=()=>{const{lineList:t,setLineList:e,selectedID:r}=React.useContext(PointCloudContext.PointCloudContext),{addHistory:a,pushHistoryWithList:d}=useHistory.useHistory(),s=t.find(i=>i.id===r);return{addLine:i=>{e(t.concat(i)),a({newLine:i})},deleteLine:i=>{const o=t.filter(n=>n.id!==i).map(n=>__spreadValues({},n));e(o),d({lineList:o})},selectedLine:s,updateSelectedLine:i=>{s&&e(t.map(o=>o.id===r?i:o))},updateLineValidByID:i=>{t.find(n=>n.id===i)&&e(t.map(n=>n.id===i?__spreadProps(__spreadValues({},n),{valid:!n.valid}):n))}}};exports.useLine=useLine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,n)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,__spreadValues=(t,o)=>{for(var n in o||(o={}))__hasOwnProp.call(o,n)&&__defNormalProp(t,n,o[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(o))__propIsEnum.call(o,n)&&__defNormalProp(t,n,o[n]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,n)=>new Promise((r,e)=>{var c=l=>{try{s(n.next(l))}catch(h){e(h)}},p=l=>{try{s(n.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((n=n.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,n,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,n,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(n){const y=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,L,A]=p,U=lbAnnotation.MathUtils.getLineCenterPoint([g,A]),I=lbAnnotation.MathUtils.getLineLength(g,L),D=lbAnnotation.MathUtils.getLineLength(L,A),_=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const V={center:{x:U.x,y:U.y,z:s},width:D,height:I,depth:l,rotation:_,id:t.id},w=__spreadValues(r?__spreadValues(__spreadValues({},r),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);e&&Object.assign(w,e);const O=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:w,newPointList:O}},sideViewPoint2PointCloud=(t,o,n)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,n,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),U={x:{x:g.x-L.x,y:g.y-L.y}.x,y:0,z:g.y-L.y},I=lbAnnotation.MathUtils.getLineLength(e,c),D=lbAnnotation.MathUtils.getLineLength(s,l),_=I-D,V=lbAnnotation.MathUtils.getLineLength(c,p),w=lbAnnotation.MathUtils.getLineLength(l,h),O=V-w,{newBoxParams:y}=r.getNewBoxBySideUpdate(U,O,_,n);return y},backViewPoint2PointCloud=(t,o,n)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,n,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),L=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),U={x:{x:g.x-L.x,y:g.y-L.y}.x,y:0,z:g.y-L.y},I=lbAnnotation.MathUtils.getLineLength(e,c),D=lbAnnotation.MathUtils.getLineLength(s,l),_=I-D,V=lbAnnotation.MathUtils.getLineLength(c,p),w=lbAnnotation.MathUtils.getLineLength(l,h),O=V-w;let{newBoxParams:y}=r.getNewBoxByBackUpdate(U,O,_,n);return y},syncSideViewByPoint=(t,o,n,r,e)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,n,r)=>{if(!n)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,n,r,e)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,n,r)=>{if(!n)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,n,r)=>{var e;if(!n||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:n,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:L}=t,{addHistory:A,initHistory:U,pushHistoryUnderUpdatePolygon:I,pushHistoryUnderUpdatePoint:D}=useHistory.useHistory(),{selectedPolygon:_}=usePolygon.usePolygon(),{updateSelectedBox:V,updateSelectedBoxes:w,getPointCloudByID:O}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:y,updatePointCloudSphere:q,selectedSphere:T}=useSphere.useSphere(),{currentData:S,config:B}=ctx.useSelector(i=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=i.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),H=ctx.useDispatch(),{selectedBox:j}=useSingleBox.useSingleBox(),{t:Z}=reactI18next.useTranslation(),N=j==null?void 0:j.info;if(!o||!n||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,G=i=>{e==null||e.generateBox(i),e==null||e.controls.update(),e==null||e.render()},X=i=>{e==null||e.generateSphere(i),e==null||e.controls.update(),e==null||e.render()},Y=({newPoint:i,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(i,a,E,void 0,C);s(i.id);const x=p(f);z(PointCloudView.Top,i,f,P,x,B)},Q=({polygon:i,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const x={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(x,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const v=__spreadValues({},i),{boxParams:m,newPointList:k}=topViewPolygon2PointCloud(v,a,E,void 0,x,C),R=o==null?void 0:o.toolInstance;if((B==null?void 0:B.lowerLimitPointsNumInBox)&&typeof m.count=="number"&&m.count<B.lowerLimitPointsNumInBox){antd.message.info(Z("LowerLimitPointsNumInBox",{num:B.lowerLimitPointsNumInBox})),R.deletePolygon(m.id);return}C&&(k==null?void 0:k.length)&&(v.pointList=k);const b=L.includes(v.attribute),it=c(m);b?s([]):(s(m.id),R.setSelectedIDs([v.id]),M(PointCloudView.Top,v,m,d,it),C&&synchronizeTopView(m,v,o,e)),A({newBoxParams:m})},J=({newSelectedBox:i,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(i||(j==null?void 0:j.info)){const C=i!=null?i:j==null?void 0:j.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){M(PointCloudView.Top,f,C,void 0,a);return}}if((P||T)&&l.length===1){const C=P!=null?P:T;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&z(PointCloudView.Top,f,C,void 0,u,B)}}},F=(i,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(i,a,N,n.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=V(d);return M(P,i,d,void 0,C),C}},W=(i,a,P)=>{if(T){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(i,a,T);const C=q(d);return z(P,i,d,void 0,C,B),C}},K=(i,a)=>{W(i,a,PointCloudView.Side)},$=(i,a)=>{W(i,a,PointCloudView.Back)},tt=(i,a)=>{F(i,a,PointCloudView.Side)},et=(i,a)=>{F(i,a,PointCloudView.Back)},ot=(i,a)=>{const{x:P,y:u}=lbUtils.PointCloudUtils.transferCanvas2World(i,a);D(__spreadProps(__spreadValues({},i),{x:P,y:u}));const d=y(i.id),C=topViewPoint2PointCloud(i,a,E,d),f=q(C);z(PointCloudView.Top,i,C,void 0,f,B)},nt=(i,a)=>{if(_){const u=i[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),I(i[0].newPolygon);return}const P=i.map(({newPolygon:u})=>{const d=O(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=i[0],d=w(P);M(PointCloudView.Top,u,P[0],void 0,d)}else{const u=w(P);u&&t.syncAllViewPointCloudColor(u)}},z=(i,a,P,u,d,C)=>__async(void 0,null,function*(){const f=S==null?void 0:S.url,x={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,n,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(x).forEach(v=>{v!==i&&x[v]()}),u&&(e==null||e.updateCameraZoom(u)),X(P)}),M=(i,a,P,u,d)=>__async(void 0,null,function*(){const C=S==null?void 0:S.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,n,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(x=>{x!==i&&f[x]()}),u&&(e==null||e.updateCameraZoom(u)),G(P)});return{topViewAddSphere:Y,topViewAddBox:Q,topViewSelectedChanged:J,topViewUpdatePoint:ot,sideViewUpdatePoint:K,backViewUpdatePoint:$,topViewUpdateBox:nt,sideViewUpdateBox:tt,backViewUpdateBox:et,pointCloudBoxListUpdated:i=>{o.updatePolygonList(i),e==null||e.generateBoxes(i)},initPointCloud3d:i=>{if(!e)return;const a={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...i)=>__async(void 0,[...i],function*(a=S){var P,u,d,C,f,x;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(H,!0),yield e.loadPCDFile(a.url,(P=B==null?void 0:B.radius)!=null?P:DEFAULT_RADIUS),h.forEach(b=>{e==null||e.removeObjectByName(b.id)}),g.forEach(b=>{e==null||e.removeObjectByName(b.id)});let v=[],m=[],k=[];S.result?(v=lbUtils.PointCloudUtils.getBoxParamsFromResultList(S.result),m=lbUtils.PointCloudUtils.getPolygonListFromResultList(S.result),k=lbUtils.PointCloudUtils.getSphereParamsFromResultList(S.result),v.forEach(b=>{e==null||e.generateBox(b)}),k.forEach(b=>{e==null||e.generateSphere(b)}),t.syncAllViewPointCloudColor(v),t.setPointCloudResult(v),t.setPolygonList(m),t.setPointCloudSphereList(k)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([])),U({pointCloudBoxList:v,polygonList:m}),e.updateTopCamera();const R=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(R),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.result,{radius:(x=B==null?void 0:B.radius)!=null?x:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(H,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,o,i)=>o in t?__defProp(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i,__spreadValues=(t,o)=>{for(var i in o||(o={}))__hasOwnProp.call(o,i)&&__defNormalProp(t,i,o[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(o))__propIsEnum.call(o,i)&&__defNormalProp(t,i,o[i]);return t},__spreadProps=(t,o)=>__defProps(t,__getOwnPropDescs(o)),__async=(t,o,i)=>new Promise((r,e)=>{var c=l=>{try{s(i.next(l))}catch(h){e(h)}},p=l=>{try{s(i.throw(l))}catch(h){e(h)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(c,p);s((i=i.apply(t,o)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(t,o,i,r,e)=>{const{x:c,y:p}=lbUtils.PointCloudUtils.transferCanvas2World(t,o),{defaultZ:s}=lbUtils.DEFAULT_SPHERE_PARAMS,l={center:{x:c,y:p,z:s},id:t.id},h=r?__spreadValues(__spreadValues({},r),l):__spreadProps(__spreadValues({},l),{attribute:"",valid:!0});return e&&Object.assign(h,e),h},topViewPolygon2PointCloud=(t,o,i,r,e,c)=>{let p=t.pointList.map(y=>lbUtils.PointCloudUtils.transferCanvas2World(y,o)),s=0,l=1,h={};if(i){const y=i.getSensesPointZAxisInPolygon(p,void 0,c);c&&y.fittedCoordinates.length>0&&(p=y.fittedCoordinates),s=(y.maxZ+y.minZ)/2,l=y.maxZ-y.minZ,h={count:y.zCount}}const[g,x,j]=p,b=lbAnnotation.MathUtils.getLineCenterPoint([g,j]),_=lbAnnotation.MathUtils.getLineLength(g,x),O=lbAnnotation.MathUtils.getLineLength(x,j),k=lbAnnotation.MathUtils.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,l=r.depth);const V={center:{x:b.x,y:b.y,z:s},width:O,height:_,depth:l,rotation:k,id:t.id},I=__spreadValues(r?__spreadValues(__spreadValues({},r),V):__spreadProps(__spreadValues({},V),{attribute:"",valid:!0}),h);e&&Object.assign(I,e);const D=p.map(y=>lbUtils.PointCloudUtils.transferWorld2Canvas(y,o));return{boxParams:I,newPointList:D}},sideViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-r.x,y:i.center.y,z:i.center.z-r.y}})},sideViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),b={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},_=lbAnnotation.MathUtils.getLineLength(e,c),O=lbAnnotation.MathUtils.getLineLength(s,l),k=_-O,V=lbAnnotation.MathUtils.getLineLength(c,p),I=lbAnnotation.MathUtils.getLineLength(l,h),D=V-I,{newBoxParams:y}=r.getNewBoxBySideUpdate(b,D,k,i);return y},backViewPoint2PointCloud=(t,o,i)=>{const r={x:t.x-o.x,y:t.y-o.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-r.x,z:i.center.z-r.y}})},backViewPolygon2PointCloud=(t,o,i,r)=>{const[e,c,p]=t.pointList,[s,l,h]=o.pointList,g=lbAnnotation.MathUtils.getLineCenterPoint([e,p]),x=lbAnnotation.MathUtils.getLineCenterPoint([s,h]),b={x:{x:g.x-x.x,y:g.y-x.y}.x,y:0,z:g.y-x.y},_=lbAnnotation.MathUtils.getLineLength(e,c),O=lbAnnotation.MathUtils.getLineLength(s,l),k=_-O,V=lbAnnotation.MathUtils.getLineLength(c,p),I=lbAnnotation.MathUtils.getLineLength(l,h),D=V-I;let{newBoxParams:y}=r.getNewBoxByBackUpdate(b,D,k,i);return y},syncSideViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Left);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeSideView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncBackViewByPoint=(t,o,i,r,e)=>{var c;if(!i)return;const{toolInstance:p,pointCloudInstance:s}=i;s.loadPCDFile(r,(c=e==null?void 0:e.radius)!=null?c:DEFAULT_RADIUS);const{cameraPositionVector:l}=s.updateOrthoCameraBySphere(t,lbUtils.EPerspectiveView.Back);s.setInitCameraPosition(l);const{point2d:h,zoom:g}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=g,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([__spreadProps(__spreadValues(__spreadValues({},o),h),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(o.id)},synchronizeBackView=(t,o,i,r)=>{if(!i)return;const{pointCloud2dOperation:e,pointCloudInstance:c}=i;c.loadPCDFileByBox(r,t,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:p}=c.updateOrthoCamera(t,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:l}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=l,c.camera.updateProjectionMatrix(),c.render(),e.initPosition(),e.zoomChangeOnCenter(l),e.setResultAndSelectedID([{id:o.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],o.id)},syncTopViewByPoint=(t,o,i,r)=>{if(!i||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,lbUtils.EPerspectiveView.Top),r.render();const{toolInstance:e,pointCloudInstance:c}=i,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...e.pointList].map(l=>l.id===o.id?__spreadProps(__spreadValues(__spreadValues({},o),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):l);e.setResult(s),e.setSelectedID(o.id)},synchronizeTopView=(t,o,i,r)=>{var e;if(!i||!r)return;r.generateBox(t,o.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=i,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),l=[...c.polygonList],h=l.find(g=>g.id===o.id);h?h.pointList=s:l.push({id:o.id,pointList:s,textAttribute:"",isRect:!0,valid:(e=t.valid)!=null?e:!0}),c.setResultAndSelectedID(l,o.id)},usePointCloudViews=()=>{const t=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:o,sideViewInstance:i,backViewInstance:r,mainViewInstance:e,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:l,pointCloudBoxList:h,pointCloudSphereList:g,hideAttributes:x}=t,{addHistory:j,initHistory:b,pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdatePoint:O,pushHistoryUnderUpdateLine:k}=useHistory.useHistory(),{selectedPolygon:V}=usePolygon.usePolygon(),{updateSelectedBox:I,updateSelectedBoxes:D,getPointCloudByID:y}=useSingleBox.useSingleBox(),{getPointCloudSphereByID:G,updatePointCloudSphere:H,selectedSphere:z}=useSphere.useSphere(),{currentData:w,config:L}=ctx.useSelector(n=>{const{stepList:a,step:P,imgList:u,imgIndex:d}=n.annotation;return{currentData:u[d],config:index.jsonParser(StepUtils.getCurrentStepInfo(P,a).config)}}),F=ctx.useDispatch(),{selectedBox:T}=useSingleBox.useSingleBox(),{t:X}=reactI18next.useTranslation(),N=T==null?void 0:T.info;if(!o||!i||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:E}=o,Y=n=>{e==null||e.generateBox(n),e==null||e.controls.update(),e==null||e.render()},Q=n=>{e==null||e.generateSphere(n),e==null||e.controls.update(),e==null||e.render()},J=({newPoint:n,size:a,zoom:P,trackConfigurable:u})=>{var d;const C={attribute:(d=o.toolInstance.defaultAttribute)!=null?d:""};u===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const f=topViewPoint2PointCloud(n,a,E,void 0,C);s(n.id);const v=p(f);M(PointCloudView.Top,n,f,P,v,L)},K=({polygon:n,size:a,imgList:P,trackConfigurable:u,zoom:d,intelligentFit:C})=>{var f;const v={attribute:(f=o.toolInstance.defaultAttribute)!=null?f:""};u===!0&&Object.assign(v,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:g})});const m=o==null?void 0:o.toolInstance,S=__spreadValues({},n),{boxParams:B,newPointList:A}=topViewPolygon2PointCloud(S,a,E,void 0,v,C);if((L==null?void 0:L.lowerLimitPointsNumInBox)&&typeof B.count=="number"&&B.count<L.lowerLimitPointsNumInBox){antd.message.info(X("LowerLimitPointsNumInBox",{num:L.lowerLimitPointsNumInBox})),m.deletePolygon(B.id);return}C&&(A==null?void 0:A.length)&&(S.pointList=A);const q=x.includes(S.attribute),U=c(B);q?s([]):(s(B.id),m.setSelectedIDs([S.id]),R(PointCloudView.Top,S,B,d,U),C&&synchronizeTopView(B,S,o,e)),j({newBoxParams:B})},$=({newSelectedBox:n,newPointCloudList:a,newSelectedSphere:P,newSphereList:u})=>{const d=o==null?void 0:o.toolInstance;if(!(l.length===0||!d)){if(n||(T==null?void 0:T.info)){const C=n!=null?n:T==null?void 0:T.info;d.setSelectedIDs(l);const f=d.selectedPolygon;if(l.length===1&&C){R(PointCloudView.Top,f,C,void 0,a);return}}if((P||z)&&l.length===1){const C=P!=null?P:z;d.setSelectedID(l[0]);const f=d.selectedPoint;C&&M(PointCloudView.Top,f,C,void 0,u,L)}}},W=(n,a,P)=>{if(N){let u,d;switch(P){case PointCloudView.Back:u=backViewPolygon2PointCloud;break;case PointCloudView.Side:u=sideViewPolygon2PointCloud;break;default:u=sideViewPolygon2PointCloud;break}if(d=u(n,a,N,i.pointCloudInstance),e){const{count:f}=e.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(d).polygonPointList,[d.center.z-d.depth/2,d.center.z+d.depth/2]);d=__spreadProps(__spreadValues({},d),{count:f})}const C=I(d);return R(P,n,d,void 0,C),C}},Z=(n,a,P)=>{if(z){let u,d;switch(P){case PointCloudView.Back:u=backViewPoint2PointCloud;break;case PointCloudView.Side:u=sideViewPoint2PointCloud;break;default:u=sideViewPoint2PointCloud;break}d=u(n,a,z);const C=H(d);return M(P,n,d,void 0,C,L),C}},tt=(n,a)=>{Z(n,a,PointCloudView.Side)},et=(n,a)=>{Z(n,a,PointCloudView.Back)},ot=(n,a)=>{W(n,a,PointCloudView.Side)},it=(n,a)=>{W(n,a,PointCloudView.Back)},nt=(n,a)=>{k(n)},st=(n,a)=>{const{x:P,y:u}=lbUtils.PointCloudUtils.transferCanvas2World(n,a);O(__spreadProps(__spreadValues({},n),{x:P,y:u}));const d=G(n.id),C=topViewPoint2PointCloud(n,a,E,d),f=H(C);M(PointCloudView.Top,n,C,void 0,f,L)},rt=(n,a)=>{if(V){const u=n[0].newPolygon;u.pointList=u.pointList.map(d=>lbUtils.PointCloudUtils.transferCanvas2World(d,a)),_(n[0].newPolygon);return}const P=n.map(({newPolygon:u})=>{const d=y(u.id),{boxParams:C}=topViewPolygon2PointCloud(u,a,o.pointCloudInstance,d);return C});if(P.length===1){const{newPolygon:u}=n[0],d=D(P);R(PointCloudView.Top,u,P[0],void 0,d)}else{const u=D(P);u&&t.syncAllViewPointCloudColor(u)}},M=(n,a,P,u,d,C)=>__async(void 0,null,function*(){const f=w==null?void 0:w.url,v={[PointCloudView.Side]:()=>{syncSideViewByPoint(P,a,i,f,C)},[PointCloudView.Back]:()=>{r&&syncBackViewByPoint(P,a,r,f,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(P,a,o,e)}};Object.keys(v).forEach(m=>{m!==n&&v[m]()}),u&&(e==null||e.updateCameraZoom(u)),Q(P)}),R=(n,a,P,u,d)=>__async(void 0,null,function*(){const C=w==null?void 0:w.url;d&&(yield t.syncAllViewPointCloudColor(d));const f={[PointCloudView.Side]:()=>{synchronizeSideView(P,a,i,C)},[PointCloudView.Back]:()=>{r&&synchronizeBackView(P,a,r,C)},[PointCloudView.Top]:()=>{synchronizeTopView(P,a,o,e)}};Object.keys(f).forEach(v=>{v!==n&&f[v]()}),u&&(e==null||e.updateCameraZoom(u)),Y(P)});return{topViewAddSphere:J,topViewAddBox:K,topViewSelectedChanged:$,topViewUpdatePoint:st,sideViewUpdatePoint:tt,backViewUpdatePoint:et,topViewUpdateBox:rt,topViewUpdateLine:nt,sideViewUpdateBox:ot,backViewUpdateBox:it,pointCloudBoxListUpdated:n=>{o.updatePolygonList(n),e==null||e.generateBoxes(n)},initPointCloud3d:n=>{if(!e)return;const a={left:-n.width/2,right:n.width/2,top:n.height/2,bottom:-n.height/2,near:100,far:-100};e.initOrthographicCamera(a),e.initRenderer(),e.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(a=w){var P,u,d,C,f,v;if(!(a==null?void 0:a.url)||!e)return;actionCreators.SetPointCloudLoading(F,!0),yield e.loadPCDFile(a.url,(P=L==null?void 0:L.radius)!=null?P:DEFAULT_RADIUS),h.forEach(U=>{e==null||e.removeObjectByName(U.id)}),g.forEach(U=>{e==null||e.removeObjectByName(U.id)});let m=[],S=[],B=[],A=[];w.result?(m=lbUtils.PointCloudUtils.getBoxParamsFromResultList(w.result),B=lbUtils.PointCloudUtils.getPolygonListFromResultList(w.result),S=lbUtils.PointCloudUtils.getLineListFromResultList(w.result),A=lbUtils.PointCloudUtils.getSphereParamsFromResultList(w.result),m.forEach(U=>{e==null||e.generateBox(U)}),A.forEach(U=>{e==null||e.generateSphere(U)}),t.syncAllViewPointCloudColor(m),t.setPointCloudResult(m),t.setPolygonList(B),t.setLineList(S),t.setPointCloudSphereList(A)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),b({pointCloudBoxList:m,polygonList:B}),e.updateTopCamera();const q=(d=(u=index.jsonParser(a.result))==null?void 0:u.valid)!=null?d:!0;t.setPointCloudValid(q),(C=t.sideViewInstance)==null||C.clearAllData(),(f=t.backViewInstance)==null||f.clearAllData(),o.updateData(a.url,a.result,{radius:(v=L==null?void 0:L.radius)!=null?v:DEFAULT_RADIUS}),actionCreators.SetPointCloudLoading(F,!1)})}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere } from '@labelbee/lb-utils';
|
|
1
|
+
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointCloudSphereList, IPointCloudSphere, ILine } from '@labelbee/lb-utils';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { PointCloud, PointCloudAnnotation, ActionsHistory, EToolName } from '@labelbee/lb-annotation';
|
|
4
4
|
interface IPointCloudContextInstances {
|
|
@@ -31,13 +31,15 @@ export interface IPointCloudContext extends IPointCloudContextInstances {
|
|
|
31
31
|
addPointCloudSphere: (sphereParams: IPointCloudSphere) => IPointCloudSphere[];
|
|
32
32
|
polygonList: IPolygonData[];
|
|
33
33
|
setPolygonList: (polygonList: IPolygonData[]) => void;
|
|
34
|
+
lineList: ILine[];
|
|
35
|
+
setLineList: (lineList: ILine[]) => void;
|
|
34
36
|
zoom: number;
|
|
35
37
|
setZoom: (zoom: number) => void;
|
|
36
38
|
history: ActionsHistory;
|
|
37
39
|
hideAttributes: string[];
|
|
38
40
|
setHideAttributes: (hideAttrs: string[]) => void;
|
|
39
41
|
toggleAttributesVisible: (attribute: string) => void;
|
|
40
|
-
reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[], _displaySphereList: IPointCloudSphereList) => void;
|
|
42
|
+
reRender: (_displayPointCloudList: IPointCloudBoxList, _polygonList: IPolygonData[], _displaySphereList: IPointCloudSphereList, _lineList: ILine[]) => void;
|
|
41
43
|
attrPanelLayout: AttrPanelLayout;
|
|
42
44
|
setAttrPanelLayout: (layout: AttrPanelLayout) => void;
|
|
43
45
|
syncAllViewPointCloudColor: (newPointCloudList?: IPointCloudBox[]) => void;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointUnit } from '@labelbee/lb-utils';
|
|
1
|
+
import { IPointCloudBox, IPointCloudBoxList, IPolygonData, IPointUnit, ILine } from '@labelbee/lb-utils';
|
|
2
2
|
export declare const useHistory: () => {
|
|
3
|
-
addHistory: ({ newBoxParams, newPolygon, }: {
|
|
3
|
+
addHistory: ({ newBoxParams, newPolygon, newLine, }: {
|
|
4
4
|
newBoxParams?: IPointCloudBox | undefined;
|
|
5
5
|
newPolygon?: IPolygonData | undefined;
|
|
6
|
+
newLine?: ILine | undefined;
|
|
6
7
|
}) => void;
|
|
7
8
|
pushHistoryWithList: (params: Partial<{
|
|
8
9
|
pointCloudBoxList: IPointCloudBoxList;
|
|
9
10
|
polygonList: IPolygonData[];
|
|
11
|
+
lineList: ILine[];
|
|
10
12
|
}>) => void;
|
|
11
13
|
initHistory: ({ pointCloudBoxList, polygonList, }: {
|
|
12
14
|
pointCloudBoxList: IPointCloudBoxList;
|
|
@@ -14,6 +16,7 @@ export declare const useHistory: () => {
|
|
|
14
16
|
}) => void;
|
|
15
17
|
pushHistoryUnderUpdatePoint: (point: IPointUnit) => void;
|
|
16
18
|
pushHistoryUnderUpdatePolygon: (polygon: IPolygonData) => void;
|
|
19
|
+
pushHistoryUnderUpdateLine: (line: ILine) => void;
|
|
17
20
|
redo: () => void;
|
|
18
21
|
undo: () => void;
|
|
19
22
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILine } from '@labelbee/lb-utils';
|
|
2
|
+
/**
|
|
3
|
+
* PointCloud line Hook
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare const useLine: () => {
|
|
7
|
+
addLine: (line: ILine) => void;
|
|
8
|
+
deleteLine: (id: string) => void;
|
|
9
|
+
selectedLine: ILine | undefined;
|
|
10
|
+
updateSelectedLine: (line: ILine) => void;
|
|
11
|
+
updateLineValidByID: (id: string) => void;
|
|
12
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @createdate 2022-08-17
|
|
5
5
|
*/
|
|
6
6
|
import { PointCloudAnnotation, PointCloud } from '@labelbee/lb-annotation';
|
|
7
|
-
import { IPointCloudBox, IPointCloudSphere, IPointUnit, UpdatePolygonByDragList } from '@labelbee/lb-utils';
|
|
7
|
+
import { IPointCloudBox, IPointCloudSphere, IPointUnit, UpdatePolygonByDragList, ILine } from '@labelbee/lb-utils';
|
|
8
8
|
import { ISize } from '@/types/main';
|
|
9
9
|
import { IFileItem } from '@/types/data';
|
|
10
10
|
export declare const topViewPoint2PointCloud: (newPoint: any, size: ISize, pointCloud: PointCloud, selectedPointCloudSphere?: IPointCloudSphere, defaultValue?: {
|
|
@@ -63,6 +63,7 @@ export declare const usePointCloudViews: () => {
|
|
|
63
63
|
sideViewUpdatePoint?: undefined;
|
|
64
64
|
backViewUpdatePoint?: undefined;
|
|
65
65
|
topViewUpdateBox?: undefined;
|
|
66
|
+
topViewUpdateLine?: undefined;
|
|
66
67
|
pointCloudBoxListUpdated?: undefined;
|
|
67
68
|
initPointCloud3d?: undefined;
|
|
68
69
|
updatePointCloudData?: undefined;
|
|
@@ -91,6 +92,7 @@ export declare const usePointCloudViews: () => {
|
|
|
91
92
|
sideViewUpdatePoint: (newPoint: IPointUnit, originPoint: IPointUnit) => void;
|
|
92
93
|
backViewUpdatePoint: (newPoint: IPointUnit, originPoint: IPointUnit) => void;
|
|
93
94
|
topViewUpdateBox: (updateList: UpdatePolygonByDragList, size: ISize) => void;
|
|
95
|
+
topViewUpdateLine: (updateList: ILine, size: ISize) => void;
|
|
94
96
|
sideViewUpdateBox: (newPolygon: any, originPolygon: any) => void;
|
|
95
97
|
backViewUpdateBox: (newPolygon: any, originPolygon: any) => void;
|
|
96
98
|
pointCloudBoxListUpdated: (newBoxes: IPointCloudBox[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const AnnotatedAttributesItem=({attribute:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:t,pointCloudSphereList:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PointCloudContext=require("../../../../components/pointCloudView/PointCloudContext.js"),antd=require("antd"),React=require("react"),selectors=require("../../../../store/annotation/selectors.js"),ctx=require("../../../../store/ctx.js"),lbUtils=require("@labelbee/lb-utils"),icons=require("@ant-design/icons"),useHistory=require("../../../../components/pointCloudView/hooks/useHistory.js"),dom=require("../../../../utils/dom.js"),StepUtils=require("../../../../utils/StepUtils.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),FooterPopover=require("../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__spreadProps=(e,n)=>__defProps(e,__getOwnPropDescs(n));const AnnotatedAttributesItem=({attribute:e})=>{const n=React.useContext(PointCloudContext.PointCloudContext),{pointCloudBoxList:t,pointCloudSphereList:a,hideAttributes:s,toggleAttributesVisible:u,polygonList:o,setPolygonList:p,lineList:c,setLineList:i,setPointCloudResult:x,setPointCloudSphereList:y,reRender:b,selectSpecAttr:L}=n,[f,E]=React.useState(!0),{pushHistoryWithList:A}=useHistory.useHistory(),v=[...t,...o,...a,...c].filter(l=>l.attribute===e.value),g=()=>{u(e.value)},h=s.includes(e.value),_=({trackID:l,order:r})=>l||r,N=({trackID:l,order:r})=>l?`trackID_${l}`:`order_${r}`,O=l=>{if(v.length===0)return;const r=o.filter(d=>l!==d.attribute),m=t.filter(d=>l!==d.attribute),C=c.filter(d=>l!==d.attribute),P=a.filter(d=>l!==d.attribute);b(m,r,P,C),p(r),x(m),y(P),i(C),A({pointCloudBoxList:m,polygonList:r,lineList:C})},F=l=>{antd.Modal.confirm({content:lbUtils.i18n.t("onDeleteGraphByAttr",{attribute:l.key}),onOk:()=>{O(l.value)},okText:lbUtils.i18n.t("Confirm"),cancelText:lbUtils.i18n.t("Cancel")})};return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","item")},h?React__default.default.createElement(icons.EyeInvisibleFilled,{onClick:g}):React__default.default.createElement(icons.EyeFilled,{onClick:g}),React__default.default.createElement(icons.CaretDownFilled,{rotate:f?0:270,onClick:()=>{E(!f)}}),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","item","text"),onClick:()=>{L(e.value)}},e.key),React__default.default.createElement(icons.DeleteOutlined,{onClick:()=>F(e)})),f&&v.map((l,r)=>React__default.default.createElement("div",{key:N(__spreadProps(__spreadValues({},l),{order:r})),style:{paddingLeft:54}},`${_(__spreadProps(__spreadValues({},l),{order:r}))}.${e.key}`)))},AnnotatedAttributesPanel=()=>{const e=ctx.useSelector(selectors.stepConfigSelector),{attrPanelLayout:n,setAttrPanelLayout:t,pointCloudBoxList:a,polygonList:s,lineList:u}=React.useContext(PointCloudContext.PointCloudContext),{t:o}=reactI18next.useTranslation(),p=React.useMemo(()=>[...a,...s,...u].map(i=>i.attribute),[a,s,u]),c=React.useMemo(()=>e.attributeList.filter(i=>p.includes(i.value)),[p]);return React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute")},n?React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",null,o("AnnotatedResult")),React__default.default.createElement("span",{className:dom.getClassName("annotated-attribute","pin"),onClick:()=>{t("")}},React__default.default.createElement(icons.PushpinFilled,null),o("CancelFixed"))):React__default.default.createElement("div",{className:dom.getClassName("annotated-attribute","text")},React__default.default.createElement("span",{onClick:()=>{t("left")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),o("FixedOnLeft")),React__default.default.createElement("span",{onClick:()=>{t("right")},className:dom.getClassName("annotated-attribute","pin")},React__default.default.createElement(icons.PushpinFilled,null),o("FixedOnRight"))),React__default.default.createElement("div",null,c.length>0?c.map(i=>React__default.default.createElement(AnnotatedAttributesItem,{attribute:i,key:i.value})):React__default.default.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},o("NoData"))))},AnnotatedAttributesPanelFixedLeft=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="left"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesPanelFixedRight=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext);return e==="right"?React__default.default.createElement(AnnotatedAttributesPanel,null):null},AnnotatedAttributesIcon=()=>{const{attrPanelLayout:e}=React.useContext(PointCloudContext.PointCloudContext),{t:n}=reactI18next.useTranslation(),t=ctx.useSelector(a=>{var s,u;return StepUtils.getCurrentStepInfo((s=a==null?void 0:a.annotation)==null?void 0:s.step,(u=a.annotation)==null?void 0:u.stepList)});return(t==null?void 0:t.tool)!==lbAnnotation.EPointCloudName.PointCloud||e?null:React__default.default.createElement(FooterPopover,{hoverIcon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),icon:React__default.default.createElement(icons.UnorderedListOutlined,{style:{marginRight:4}}),title:n("AnnotatedList"),content:React__default.default.createElement(AnnotatedAttributesPanel,null)})};exports.AnnotatedAttributesIcon=AnnotatedAttributesIcon,exports.AnnotatedAttributesPanel=AnnotatedAttributesPanel,exports.AnnotatedAttributesPanelFixedLeft=AnnotatedAttributesPanelFixedLeft,exports.AnnotatedAttributesPanelFixedRight=AnnotatedAttributesPanelFixedRight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icon_kj1=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj1.svg.js"),icon_kj_h=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj_h.svg.js"),ToolType=require("../../../../../data/enums/ToolType.js"),index=require("./rectToolShortCutTable/index.js"),index$2=require("./point/index.js"),index$3=require("./polygon/index.js"),index$4=require("./line/index.js"),index$1=require("./tag/index.js"),index$5=require("./text/index.js"),index$6=require("./videoTag/index.js"),index$7=require("./pointCloud/index.js"),index$8=require("./scribble/index.js"),index$9=require("./cuboid/index.js"),index$a=require("../../index.js"),reactI18next=require("react-i18next"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../../components/pointCloudView/PointCloudContext.js"),FooterPopover=require("../../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,shortCutTable={[ToolType.EToolName.Rect]:index.default,[ToolType.EToolName.Tag]:index$1.default,[ToolType.EToolName.Point]:index$2.default,[ToolType.EToolName.Polygon]:index$3.default,[ToolType.EToolName.Line]:index$4.default,[ToolType.EToolName.Text]:index$5,[EVideoToolName.VideoTagTool]:index$6,[EPointCloudName.PointCloud]:index$7.default,[EPointCloudName.PointCloud+"_POLYGON"]:index$7.pointCloudShortCutTable_POLYGON,[ToolType.EToolName.ScribbleTool]:index$8,[ToolType.EToolName.Cuboid]:index$9},ToolHotKeyIcon=({icon:e})=>typeof e=="string"?React__default.default.createElement("img",{width:16,height:16,src:e}):e||null,ToolHotKeyCom=({title:e,style:r,shortCutList:t})=>{const{t:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),icon_kj1=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj1.svg.js"),icon_kj_h=require("../../../../../assets/annotation/toolHotKeyIcon/icon_kj_h.svg.js"),ToolType=require("../../../../../data/enums/ToolType.js"),index=require("./rectToolShortCutTable/index.js"),index$2=require("./point/index.js"),index$3=require("./polygon/index.js"),index$4=require("./line/index.js"),index$1=require("./tag/index.js"),index$5=require("./text/index.js"),index$6=require("./videoTag/index.js"),index$7=require("./pointCloud/index.js"),index$8=require("./scribble/index.js"),index$9=require("./cuboid/index.js"),index$a=require("../../index.js"),reactI18next=require("react-i18next"),lbAnnotation=require("@labelbee/lb-annotation"),PointCloudContext=require("../../../../../components/pointCloudView/PointCloudContext.js"),FooterPopover=require("../../FooterPopover.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))__hasOwnProp.call(r,t)&&__defNormalProp(e,t,r[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(r))__propIsEnum.call(r,t)&&__defNormalProp(e,t,r[t]);return e};const{EVideoToolName,EPointCloudName}=lbAnnotation.cTool,shortCutTable={[ToolType.EToolName.Rect]:index.default,[ToolType.EToolName.Tag]:index$1.default,[ToolType.EToolName.Point]:index$2.default,[ToolType.EToolName.Polygon]:index$3.default,[ToolType.EToolName.Line]:index$4.default,[ToolType.EToolName.Text]:index$5,[EVideoToolName.VideoTagTool]:index$6,[EPointCloudName.PointCloud]:index$7.default,[EPointCloudName.PointCloud+"_POLYGON"]:index$7.pointCloudShortCutTable_POLYGON,[ToolType.EToolName.ScribbleTool]:index$8,[ToolType.EToolName.Cuboid]:index$9},ToolHotKeyIcon=({icon:e})=>typeof e=="string"?React__default.default.createElement("img",{width:16,height:16,src:e}):e||null,ToolHotKeyCom=({title:e,style:r,shortCutList:t})=>{const{t:o}=reactI18next.useTranslation(),s={width:320,display:"flex",justifyContent:"space-between",margin:16},i={display:"block",padding:"0 3px",minWidth:"20px",marginRight:"3px",border:"1px solid rgba(204,204,204,1)",verticalAlign:"middle",fontSize:"12px",textAlign:"center"},f=(a,u)=>React__default.default.createElement("div",{style:s,key:u},React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(ToolHotKeyIcon,{icon:a.icon}),React__default.default.createElement("span",{style:{marginLeft:a.icon?16:0}},o(a.name))),React__default.default.createElement("span",{style:{display:"flex",alignItems:"center"}},a.noticeInfo&&React__default.default.createElement("span",{style:{marginRight:"5px",color:"#CCCCCC"}},o(a.noticeInfo)),m(a.shortCut,a.shortCutUseHtml,a.linkSymbol))),m=(a,u=!1,E="+")=>{if(!a)return null;const v=a.map((n,l)=>{var c,p;const d={display:"flex",alignItems:"center"};return u?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:i,dangerouslySetInnerHTML:{__html:n}})):l<a.length-1?typeof n=="number"?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:i},n),React__default.default.createElement("span",{style:{marginRight:"3px"}},"~")):((c=n==null?void 0:n.startsWith)==null?void 0:c.call(n,"data"))?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{className:"shortCutButton",style:{marginRight:"3px"}},React__default.default.createElement("img",{width:16,height:23,src:n})),React__default.default.createElement("span",{style:{marginRight:"3px"}},"+")):React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:i},n),React__default.default.createElement("span",{style:{marginRight:"3px"}},E)):typeof n=="number"?React__default.default.createElement("span",{key:l,style:d},React__default.default.createElement("span",{style:i},n)):((p=n==null?void 0:n.startsWith)==null?void 0:p.call(n,"data"))?React__default.default.createElement("span",{className:"shortCutButton",key:l,style:{marginRight:"3px"}},React__default.default.createElement("img",{width:16,height:23,src:n})):React__default.default.createElement("span",{style:i,key:l},n)});return React__default.default.createElement("div",{style:{display:"flex",justifyContent:"space-around",alignItems:"center"}},v)},y=React__default.default.createElement("div",{className:`${index$a.footerCls}__hotkey-content`},t==null?void 0:t.map((a,u)=>f(a,u))),g=r||{};return React__default.default.createElement(FooterPopover,{hoverIcon:icon_kj_h,icon:icon_kj1,title:o("Hotkeys"),content:y,containerStyle:g})},ToolHotKey=({style:e,title:r,toolName:t})=>{const{pointCloudPattern:o}=React.useContext(PointCloudContext.PointCloudContext);if(!t||!shortCutTable[t])return null;let s=t;s===`${EPointCloudName.PointCloud}`&&o===ToolType.EToolName.Polygon?s+="_POLYGON":o===ToolType.EToolName.Line?s=ToolType.EToolName.Line:o===ToolType.EToolName.Point&&(s=ToolType.EToolName.Point);const i={style:e,title:r,shortCutList:shortCutTable[s]};return React__default.default.createElement(ToolHotKeyCom,__spreadValues({},i))};exports.ToolHotKeyCom=ToolHotKeyCom,exports.default=ToolHotKey,exports.shortCutTable=shortCutTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import M,{useState as o,useRef as lt,useMemo as N,useEffect as dt}from"react";import{ActionsHistory as T,EToolName as j}from"@labelbee/lb-annotation";const z=M.createContext({pointCloudBoxList:[],pointCloudSphereList:[],displayPointCloudList:[],displaySphereList:[],polygonList:[],lineList:[],selectedID:"",selectedIDs:[],valid:!0,setSelectedIDs:()=>{},setPointCloudResult:()=>{},setPointCloudSphereList:()=>{},setPointCloudValid:()=>{},setTopViewInstance:()=>{},setSideViewInstance:()=>{},setBackViewInstance:()=>{},setMainViewInstance:()=>{},addSelectedID:()=>{},selectedAllBoxes:()=>{},addPointCloudBox:()=>[],addPointCloudSphere:()=>[],setPolygonList:()=>{},setLineList:()=>{},zoom:1,setZoom:()=>{},history:new T,hideAttributes:[],setHideAttributes:()=>{},toggleAttributesVisible:()=>{},reRender:()=>{},setAttrPanelLayout:()=>{},attrPanelLayout:"",syncAllViewPointCloudColor:()=>{},defaultAttribute:"",setDefaultAttribute:()=>{},pointCloudPattern:j.Rect,setPointCloudPattern:()=>{},selectSpecAttr:()=>{}}),rt=({children:F})=>{const[d,h]=o([]),[a,m]=o([]),[f,Z]=o([]),[L,q]=o([]),[r,A]=o([]),[y,G]=o(!0),[w,J]=o(1),[i,K]=o(),[I,Q]=o(),[V,U]=o(),[n,W]=o(),[g,X]=o(""),[x,Y]=o(j.Rect),$=lt(new T).current,[l,v]=o([]),[B,_]=o(""),R=N(()=>r.length===1?r[0]:"",[r]),D=N(()=>{const c=d.find(t=>t.id===R),S=t=>{const e=d.concat(t);return h(e),e},b=t=>{const e=a.concat(t);return m(e),e},P=t=>{G(t!==!1)},s=t=>{t===void 0&&A([]),typeof t=="string"&&A([t]),Array.isArray(t)&&A(Array.from(new Set(t)))},et=t=>{r.includes(t)?s(r.filter(e=>e!==t)):s([...r,t])},ot=()=>{s(d.map(t=>t.id))},nt=t=>{s(d.filter(e=>e.attribute===t).map(e=>e.id))},E=d.filter(t=>!l.includes(t.attribute)),H=a.filter(t=>!l.includes(t.attribute)),it=t=>{if(l.includes(t))v(l.filter(e=>e!==t));else{const e=l.concat(t);v(e)}},st=(t=E,e=f,C=H,p=L)=>{d.forEach(u=>{n==null||n.removeObjectByName(u.id)}),a.forEach(u=>{n==null||n.removeObjectByName(u.id)}),i==null||i.updatePolygonList(t,e),i==null||i.updatePointList(C),i==null||i.updateLineList(p),n==null||n.generateBoxes(t),n==null||n.generateSpheres(C),O(t)},O=t=>{const e=n==null?void 0:n.highlightOriginPointCloud(t);return new Promise(C=>{e==null||e.then(p=>{[i].forEach(u=>{var k;p&&((k=u==null?void 0:u.pointCloudInstance)==null||k.updateColor(p),C({color:p}))})})})};return{selectedID:R,pointCloudBoxList:d,pointCloudSphereList:a,displayPointCloudList:E,displaySphereList:H,selectedIDs:r,setPointCloudResult:h,setSelectedIDs:s,addPointCloudBox:S,addPointCloudSphere:b,setPointCloudSphereList:m,valid:y,selectedPointCloudBox:c,setPointCloudValid:P,addSelectedID:et,selectedAllBoxes:ot,topViewInstance:i,setTopViewInstance:K,sideViewInstance:I,setSideViewInstance:Q,backViewInstance:V,setBackViewInstance:U,mainViewInstance:n,setMainViewInstance:W,polygonList:f,setPolygonList:Z,lineList:L,setLineList:q,zoom:w,setZoom:J,history:$,toggleAttributesVisible:it,hideAttributes:l,setHideAttributes:v,reRender:st,attrPanelLayout:B,setAttrPanelLayout:_,syncAllViewPointCloudColor:O,defaultAttribute:g,setDefaultAttribute:X,pointCloudPattern:x,setPointCloudPattern:Y,selectSpecAttr:nt}},[y,r,d,a,f,L,i,I,V,n,w,l,B,g,x]),tt=()=>{const c=d.filter(s=>l.includes(s.attribute)),{setSelectedIDs:S,reRender:b}=D,P=c.map(s=>s.id);P.length>0&&S(r.filter(s=>!P.includes(s))),b()};return dt(()=>{var c;tt(),(c=i==null?void 0:i.pointCloud2dOperation)==null||c.setHiddenAttributes(l)},[l]),M.createElement(z.Provider,{value:D},F)};export{z as PointCloudContext,rt as PointCloudProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudContext as Q}from"./PointCloudContext.js";import{useRotate as X}from"./hooks/useRotate.js";import{useBoxes as Z}from"./hooks/useBoxes.js";import{useSingleBox as ee}from"./hooks/useSingleBox.js";import{useSphere as te}from"./hooks/useSphere.js";import{useContext as oe,useEffect as d}from"react";import{CommonToolUtils as re,AttributeUtils as ne,EToolName as b,cTool as se}from"@labelbee/lb-annotation";import{message as C}from"antd";import{connect as ie}from"react-redux";import{a2MapStateToProps as ae}from"../../store/annotation/map.js";import{useCustomToolInstance as le}from"../../hooks/annotation.js";import{useStatus as ue}from"./hooks/useStatus.js";import{jsonParser as ce}from"../../utils/index.js";import{usePointCloudViews as de}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as pe}from"../../store/ctx.js";import{useHistory as me}from"./hooks/useHistory.js";import{useAttribute as fe}from"./hooks/useAttribute.js";import{useConfig as be}from"./hooks/useConfig.js";import{usePolygon as Pe}from"./hooks/usePolygon.js";import{useTranslation as ye}from"react-i18next";var ve=Object.defineProperty,we=Object.defineProperties,Ce=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,j=(l,r,a)=>r in l?ve(l,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[r]=a,h=(l,r)=>{for(var a in r||(r={}))he.call(r,a)&&j(l,a,r[a]);if(O)for(var a of O(r))xe.call(r,a)&&j(l,a,r[a]);return l},x=(l,r)=>we(l,Ce(r));const{EPolygonPattern:ge}=se,ke=({currentData:l,config:r,checkMode:a,configString:A,imgIndex:g})=>{const
|
|
1
|
+
import{PointCloudContext as Q}from"./PointCloudContext.js";import{useRotate as X}from"./hooks/useRotate.js";import{useBoxes as Z}from"./hooks/useBoxes.js";import{useSingleBox as ee}from"./hooks/useSingleBox.js";import{useSphere as te}from"./hooks/useSphere.js";import{useContext as oe,useEffect as d}from"react";import{CommonToolUtils as re,AttributeUtils as ne,EToolName as b,cTool as se}from"@labelbee/lb-annotation";import{message as C}from"antd";import{connect as ie}from"react-redux";import{a2MapStateToProps as ae}from"../../store/annotation/map.js";import{useCustomToolInstance as le}from"../../hooks/annotation.js";import{useStatus as ue}from"./hooks/useStatus.js";import{jsonParser as ce}from"../../utils/index.js";import{usePointCloudViews as de}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as pe}from"../../store/ctx.js";import{useHistory as me}from"./hooks/useHistory.js";import{useAttribute as fe}from"./hooks/useAttribute.js";import{useConfig as be}from"./hooks/useConfig.js";import{usePolygon as Pe}from"./hooks/usePolygon.js";import{useTranslation as ye}from"react-i18next";var ve=Object.defineProperty,we=Object.defineProperties,Ce=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,j=(l,r,a)=>r in l?ve(l,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[r]=a,h=(l,r)=>{for(var a in r||(r={}))he.call(r,a)&&j(l,a,r[a]);if(O)for(var a of O(r))xe.call(r,a)&&j(l,a,r[a]);return l},x=(l,r)=>we(l,Ce(r));const{EPolygonPattern:ge}=se,ke=({currentData:l,config:r,checkMode:a,configString:A,imgIndex:g})=>{const t=oe(Q),{changeSelectedBoxValid:D,selectNextBox:T,selectPrevBox:E,updateSelectedBox:k,deleteSelectedPointCloudBoxAndPolygon:R}=ee(),{selectedSphere:P,updatePointCloudSphere:K}=te(),{clearAllResult:y,updatePointCloudPattern:N}=ue(),H=ce(l.result),{copySelectedBoxes:U,pasteSelectedBoxes:z,copiedBoxes:F}=Z({config:r}),{toolInstanceRef:i}=le({basicInfo:H}),{updateRotate:v}=X({currentData:l}),{updatePointCloudData:m,topViewSelectedChanged:S}=de(),{redo:_,undo:L,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G}=me(),{syncThreeViewsAttribute:B}=fe(),{syncAllViewsConfig:M,reRenderTopViewRange:W}=be(),{selectedPolygon:I}=Pe(),{t:w}=ye(),f=e=>{var o;const{topViewInstance:n}=t;!n||(o=n.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(e)},Y=(e,o)=>{var n;const{topViewInstance:s,mainViewInstance:u}=t;if(!s)return;const{pointCloud2dOperation:c}=s;switch(e){case"q":{v(2);break}case"e":v(-2);break;case"g":v(180);break;case"u":{const p=c.pattern===ge.Normal?b.Rect:b.Polygon;N(p);const J={[b.Polygon]:w("PolygonPattern"),[b.Rect]:w("RectPattern")};C.success(w("ChangePatternMsg",{pattern:J[p]})),c.clearActiveStatus(),c.clearDrawingStatus()}break;case"+":u==null||u.updatePointSize(!0);break;case"-":u==null||u.updatePointSize(!1);break;case"v":t.setPointCloudValid(!t.valid);break;case"tab":if(o.shiftKey){E();break}T(),o.preventDefault();break;case"f":D();break;case"arrowup":f({y:-1});break;case"arrowdown":f({y:1});break;case"arrowleft":f({x:-1});break;case"arrowright":f({x:1});break;case"delete":R();break;default:{if(((n=r.attributeList)==null?void 0:n.length)>0){const p=ne.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&i.current.setDefaultAttribute(p)}return}}},$=(e,o)=>{switch(e){case"c":U();break;case"v":z();break;case"a":o.preventDefault(),t.selectedAllBoxes();break;case"z":{o.shiftKey?_():L();break}}},V=e=>{if(!re.hotkeyFilter(e)||a===!0)return;const o=e.key.toLocaleLowerCase();if(e.ctrlKey){$(o,e);return}Y(o,e)};return d(()=>{const{topViewInstance:e}=t;if(!!e)return window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}},[t,F,r,t.pointCloudBoxList,t.polygonList]),d(()=>{M(r)},[A]),d(()=>{(r==null?void 0:r.radius)&&W(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{m==null||m()},[g,t.mainViewInstance]),d(()=>{t.setHideAttributes([])},[g]),d(()=>{i.current.exportData=()=>[t.pointCloudBoxList,{valid:t.valid}],i.current.exportCustomData=()=>{var e,o,n;return{resultPolygon:(e=t.polygonList)!=null?e:[],resultLine:(o=t.lineList)!=null?o:[],resultPoint:(n=t.pointCloudSphereList)!=null?n:[]}},i.current.setDefaultAttribute=e=>{var o;B(e);const n=t.selectedPointCloudBox;if(n){n.attribute=e;const s=k(n);t.mainViewInstance&&S({newSelectedBox:n,newPointCloudList:s})}if(I&&G(x(h({},I),{attribute:e})),P){const s=K(x(h({},P),{attribute:e}));t.mainViewInstance&&((o=t.mainViewInstance)==null||o.generateSpheres(s),S({newSelectedSphere:P,newSphereList:s}))}},i.current.setSubAttribute=(e,o)=>{var n;const s=t.selectedPointCloudBox;if(s){const u=(n=s==null?void 0:s.subAttribute)!=null?n:{};s.subAttribute=x(h({},u),{[e]:o}),k(s)}},i.current.clearResult=()=>{y==null||y()},i.current.redo=()=>{_()},i.current.undo=()=>{L()},i.current.setValid=e=>{i.current.valid=e,setTimeout(()=>{t.setPointCloudValid(e),e===!1&&y()})},i.current.setForbidOperation=e=>{var o,n;(n=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||n.setForbidOperation(e),e===!0&&t.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=e=>{var o,n;(n=(o=t.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||n.setShowDefaultCursor(e)},i.current.asyncData=e=>{setTimeout(()=>{m==null||m(e)})}},[t.pointCloudBoxList,t.pointCloudSphereList,t.selectedID,t.valid,t.polygonList,t.lineList,t.mainViewInstance]),d(()=>{i.current.history={pushHistory:e=>{q({pointCloudBoxList:e})},initRecord:()=>{}}},[]),d(()=>{var e;const o=(e=t.topViewInstance)==null?void 0:e.toolInstance;if(!o||a)return;const n=c=>{B(c)},s=c=>{C.error(c)},u=c=>{C.info(c)};return o.on("syncAttribute",n),o.on("messageError",s),o.on("messageInfo",u),()=>{o.unbind("syncAttribute",n),o.unbind("messageError",s),o.unbind("messageInfo",u)}},[t.topViewInstance]),null};var Se=ie(ae,null,null,{context:pe})(ke);export{Se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as x}from"../../utils/dom.js";import{FooterDivider as
|
|
1
|
+
import{getClassName as x}from"../../utils/dom.js";import{FooterDivider as B}from"../../views/MainView/toolFooter/index.js";import{ZoomController as Q}from"../../views/MainView/toolFooter/ZoomController/index.js";import{UpSquareOutlined as ee,DownSquareOutlined as te}from"@ant-design/icons";import{PointCloudAnnotation as oe,cTool as ne}from"@labelbee/lb-annotation";import{PointCloudUtils as D}from"@labelbee/lb-utils";import r,{useState as N,useRef as ie,useLayoutEffect as se,useEffect as h}from"react";import{PointCloudContext as le}from"./PointCloudContext.js";import{useRotate as re}from"./hooks/useRotate.js";import{useSingleBox as U}from"./hooks/useSingleBox.js";import{PointCloudContainer as ae}from"./PointCloudLayout.js";import{BoxInfos as ce,PointCloudValidity as de}from"./PointCloudInfos.js";import{usePolygon as pe}from"./hooks/usePolygon.js";import{useLine as ue}from"./hooks/useLine.js";import{useSphere as me}from"./hooks/useSphere.js";import{useZoom as Z}from"./hooks/useZoom.js";import{Slider as fe}from"antd";import{a2MapStateToProps as we}from"../../store/annotation/map.js";import{connect as ge}from"react-redux";import{usePointCloudViews as ve}from"./hooks/usePointCloudViews.js";import Ce from"../../hooks/useSize.js";import{useTranslation as Pe}from"react-i18next";import{LabelBeeContext as Ie}from"../../store/ctx.js";import{jsonParser as xe}from"../../utils/index.js";import ye from"../../utils/ToolUtils.js";var Ve=Object.defineProperty,he=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,z=(o,s,l)=>s in o?Ve(o,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[s]=l,E=(o,s)=>{for(var l in s||(s={}))Se.call(s,l)&&z(o,l,s[l]);if(R)for(var l of R(s))be.call(s,l)&&z(o,l,s[l]);return o},T=(o,s)=>he(o,Oe(s));const{EPolygonPattern:_e}=ne,F=(o,s,l=1)=>{const{width:m,height:g}=s,C={x:o.x+m*l/2,y:o.y+g*l/2},v={x:s.width/2,y:s.height/2};return{offsetX:(v.x-C.x)/l,offsetY:-(v.y-C.y)/l}},Le=({currentData:o})=>{const{zoom:s,zoomIn:l,zoomOut:m,initialPosition:g}=Z(),{selectNextBox:C,selectPrevBox:v}=U(),{updateRotate:P}=re({currentData:o}),y=2,V=()=>{P(-y)},f=()=>{P(y)},t=()=>{P(180)};return r.createElement(r.Fragment,null,r.createElement("span",{onClick:f,className:x("point-cloud","rotate-reserve")}),r.createElement("span",{onClick:V,className:x("point-cloud","rotate")}),r.createElement("span",{onClick:t,className:x("point-cloud","rotate-180")}),r.createElement(B,null),r.createElement(ee,{onClick:()=>{v()},className:x("point-cloud","prev")}),r.createElement(te,{onClick:()=>{C()},className:x("point-cloud","next")}),r.createElement(B,null),r.createElement(Q,{initialPosition:g,zoomIn:l,zoomOut:m,zoom:s}))},je=({setZAxisLimit:o,zAxisLimit:s,checkMode:l})=>l?null:r.createElement("div",{style:{position:"absolute",top:128,right:8,height:"50%",zIndex:20}},r.createElement(fe,{vertical:!0,step:.5,max:10,min:.5,defaultValue:s,onAfterChange:m=>{o(m)}})),Ee=({currentData:o,imgList:s,stepInfo:l,drawLayerSlot:m,checkMode:g,intelligentFit:C})=>{var v,P;const[y,V]=N({zoom:1,currentPos:{x:0,y:0}}),f=ie(null),t=r.useContext(le),a=Ce(f),I=xe(l.config),{setZoom:W,syncTopviewToolZoom:M}=Z(),{hideAttributes:k}=t,{addPolygon:X,deletePolygon:Y}=pe(),{addLine:q,deleteLine:H}=ue(),{deletePointCloudSphere:$}=me(),{deletePointCloudBox:A,changeValidByID:G}=U(),[O,J]=N(10),{t:K}=Pe(),p=ve();return se(()=>{if(!t.topViewInstance&&f.current&&(o==null?void 0:o.url)&&(o==null?void 0:o.result)){const n={width:f.current.clientWidth,height:f.current.clientHeight},u=new oe({container:f.current,size:n,pcdPath:o.url,config:T(E({},I),{pointCloudPattern:t.pointCloudPattern}),checkMode:g,toolName:ye.getPointCloudToolList()});t.setTopViewInstance(u)}},[o]),h(()=>{if(!a||!t.topViewInstance||!t.sideViewInstance)return;const{toolInstance:n}=t.topViewInstance;n.singleOn("lineCreated",(e,i)=>{const d=T(E({},e),{pointList:e.pointList.map(c=>D.transferCanvas2World(c,a))});q(d),t.setSelectedIDs(k.includes(e.attribute)?"":e.id)}),n.singleOn("lineDeleted",e=>{A(e),H(e)}),n.singleOn("lineSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updateLineByDrag",e=>{var i;(i=p.topViewUpdateLine)==null||i.call(p,e,a)}),n.singleOn("pointCreated",(e,i)=>{p.topViewAddSphere({newPoint:e,size:a,trackConfigurable:I.trackConfigurable,zoom:i})}),n.singleOn("pointDeleted",e=>{$(e)}),n.singleOn("pointSelected",e=>{t.setSelectedIDs([e])}),n.singleOn("updatePointByDrag",(e,i)=>{var d;(d=p.topViewUpdatePoint)==null||d.call(p,e,a)}),n.singleOn("polygonCreated",(e,i)=>{if(n.pattern===_e.Normal||!(o==null?void 0:o.url)){const d=T(E({},e),{pointList:e.pointList.map(c=>D.transferCanvas2World(c,a))});X(d),t.setSelectedIDs(k.includes(e.attribute)?"":e.id);return}p.topViewAddBox({polygon:e,size:a,imgList:s,trackConfigurable:I.trackConfigurable,zoom:i,intelligentFit:C})}),n.singleOn("deletedObject",({id:e})=>{A(e),Y(e)}),n.singleOn("deleteSelectedIDs",()=>{t.setSelectedIDs([])}),n.singleOn("addSelectedIDs",e=>{t.addSelectedID(e)}),n.singleOn("setSelectedIDs",e=>{t.setSelectedIDs(e)}),n.singleOn("updatePolygonByDrag",e=>{var i;(i=p.topViewUpdateBox)==null||i.call(p,e,a)});const u=e=>{var i;const d=G(e);d&&t.syncAllViewPointCloudColor(d),t.polygonList.find(c=>c.id===e)&&((i=t.topViewInstance)==null||i.toolInstance.setPolygonValidAndRender(e,!0))};return n.on("validUpdate",u),()=>{n.unbind("validUpdate",u)}},[t,a,o,p,t.polygonList,t.lineList,(v=t.topViewInstance)==null?void 0:v.toolInstance]),h(()=>{var n,u;if(!(a==null?void 0:a.width)||!t.topViewInstance)return;const e=(u=(n=I==null?void 0:I.attributeList)==null?void 0:n[0])==null?void 0:u.value;e&&t.topViewInstance.toolInstance.setDefaultAttribute(e),t.topViewInstance.initSize(a),t.topViewInstance.updatePolygonList(t.displayPointCloudList,t.polygonList),t.topViewInstance.updatePointList(t.displaySphereList);const{topViewInstance:{pointCloudInstance:i,toolInstance:d}}=t;d.singleOn("renderZoom",(c,w)=>{const{offsetX:S,offsetY:b}=F(w,a,c);if(i.camera.zoom=c,w){const{x:_,y:L,z:j}=i.initCameraPosition;i.camera.position.set(_+b,L-S,j)}i.camera.updateProjectionMatrix(),i.render(),W(c),M(w,c,a),V({zoom:c,currentPos:w})}),d.singleOn("dragMove",({currentPos:c,zoom:w})=>{const{offsetX:S,offsetY:b}=F(c,a,w);i.camera.zoom=w;const{x:_,y:L,z:j}=i.initCameraPosition;i.camera.position.set(_+b,L-S,j),i.render(),V({zoom:w,currentPos:c})})},[a,t.topViewInstance,(P=t.topViewInstance)==null?void 0:P.toolInstance]),h(()=>{var n,u;(u=(n=t.topViewInstance)==null?void 0:n.pointCloudInstance)==null||u.applyZAxisPoints(O)},[O]),h(()=>{p.topViewSelectedChanged({})},[t.selectedIDs]),r.createElement(ae,{className:x("point-cloud-container","top-view"),title:K("TopView"),toolbar:r.createElement(Le,{currentData:o})},r.createElement("div",{style:{position:"relative",flex:1}},r.createElement("div",{style:{width:"100%",height:"100%"},ref:f},m==null?void 0:m(y)),r.createElement(ce,{checkMode:g,config:I}),r.createElement(je,{checkMode:g,zAxisLimit:O,setZAxisLimit:J}),r.createElement(de,null)))};var Te=ge(we,null,null,{context:Ie})(Ee);export{Te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as
|
|
1
|
+
import{useContext as j}from"react";import{PointCloudContext as E}from"../PointCloudContext.js";var R=Object.defineProperty,P=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,h=(n,s,r)=>s in n?R(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r,g=(n,s)=>{for(var r in s||(s={}))S.call(s,r)&&h(n,r,s[r]);if(P)for(var r of P(s))V.call(s,r)&&h(n,r,s[r]);return n};const b=()=>{const{history:n,setPointCloudResult:s,setSelectedIDs:r,pointCloudBoxList:l,pointCloudSphereList:x,mainViewInstance:p,topViewInstance:L,polygonList:u,setPolygonList:f,lineList:c,setLineList:a,syncAllViewPointCloudColor:v}=j(E),H=({newBoxParams:t,newPolygon:o,newLine:i})=>{const e={pointCloudBoxList:l,polygonList:u,lineList:c};t&&(e.pointCloudBoxList=l.concat(t)),o&&(e.polygonList=u.concat(o)),i&&(e.lineList=c.concat(i)),n.pushHistory(e)},_=t=>{const o={pointCloudBoxList:l,polygonList:u,lineList:c};t.pointCloudBoxList&&(o.pointCloudBoxList=t.pointCloudBoxList),t.polygonList&&(o.polygonList=t.polygonList),t.lineList&&(o.lineList=t.lineList),n.pushHistory(o)},w=t=>{if(c.find(i=>i.id===t.id)){const i=c.map(e=>e.id===t.id?t:g({},e));n.pushHistory({lineList:i}),a(i)}},B=t=>{t&&n.pushHistory({pointCloudSphereList:x})},O=t=>{if(u.find(i=>i.id===t.id)){const i=u.map(e=>e.id===t.id?t:g({},e));n.pushHistory({pointCloudBoxList:l,polygonList:i}),f(i)}},m=({pointCloudBoxList:t,polygonList:o})=>{n.initRecord({pointCloudBoxList:t,polygonList:o},!0)},C=t=>{if(!t)return;const{pointCloudBoxList:o=[],polygonList:i=[],lineList:e=[]}=t;if(o){l.length!==o.length&&r();const U=l.filter(d=>o.every(y=>y.id!==d.id)),I=o.filter(d=>l.every(y=>y.id!==d.id));U.forEach(d=>{p==null||p.removeObjectByName(d.id)}),I.forEach(d=>{p==null||p.generateBox(d)}),s(o),v(o)}i&&f(i),e&&a(e),L==null||L.updatePolygonList(o!=null?o:[],i!=null?i:[]),L==null||L.updateLineList(e!=null?e:[])};return{addHistory:H,pushHistoryWithList:_,initHistory:m,pushHistoryUnderUpdatePoint:B,pushHistoryUnderUpdatePolygon:O,pushHistoryUnderUpdateLine:w,redo:()=>{C(n.redo())},undo:()=>{C(n.undo())}}};export{b as useHistory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as u}from"react";import{PointCloudContext as f}from"../PointCloudContext.js";import{useHistory as L}from"./useHistory.js";var _=Object.defineProperty,m=Object.defineProperties,P=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,d=(t,e,r)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p=(t,e)=>{for(var r in e||(e={}))y.call(e,r)&&d(t,r,e[r]);if(a)for(var r of a(e))O.call(e,r)&&d(t,r,e[r]);return t},w=(t,e)=>m(t,P(e));const v=()=>{const{lineList:t,setLineList:e,selectedID:r}=u(f),{addHistory:c,pushHistoryWithList:l}=L(),s=t.find(i=>i.id===r);return{addLine:i=>{e(t.concat(i)),c({newLine:i})},deleteLine:i=>{const o=t.filter(n=>n.id!==i).map(n=>p({},n));e(o),l({lineList:o})},selectedLine:s,updateSelectedLine:i=>{s&&e(t.map(o=>o.id===r?i:o))},updateLineValidByID:i=>{t.find(n=>n.id===i)&&e(t.map(n=>n.id===i?w(p({},n),{valid:!n.valid}):n))}}};export{v as useLine};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MathUtils as v,getCuboidFromPointCloudBox as Ot}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as _t}from"@labelbee/lb-utils";import{useContext as Vt}from"react";import{PointCloudContext as kt}from"../PointCloudContext.js";import{useSingleBox as it}from"./useSingleBox.js";import{useSphere as Ut}from"./useSphere.js";import{useSelector as At,useDispatch as jt}from"../../../store/ctx.js";import Tt from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as st}from"../../../store/annotation/actionCreators.js";import{message as zt}from"antd";import{useTranslation as Rt}from"react-i18next";import{useHistory as Et}from"./useHistory.js";import{usePolygon as Ht}from"./usePolygon.js";var Nt=Object.defineProperty,Ft=Object.defineProperties,Wt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable,lt=(t,e,n)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e)=>{for(var n in e||(e={}))Zt.call(e,n)&<(t,n,e[n]);if(dt)for(var n of dt(e))Mt.call(e,n)&<(t,n,e[n]);return t},V=(t,e)=>Ft(t,Wt(e)),Q=(t,e,n)=>new Promise((s,o)=>{var c=d=>{try{r(n.next(d))}catch(P){o(P)}},p=d=>{try{r(n.throw(d))}catch(P){o(P)}},r=d=>d.done?s(d.value):Promise.resolve(d.value).then(c,p);r((n=n.apply(t,e)).next())});const G=5,X=90,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},q=(t,e,n,s,o)=>{const{x:c,y:p}=I.transferCanvas2World(t,e),{defaultZ:r}=_t,d={center:{x:c,y:p,z:r},id:t.id},P=s?m(m({},s),d):V(m({},d),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},J=(t,e,n,s,o,c)=>{let p=t.pointList.map(x=>I.transferCanvas2World(x,e)),r=0,d=1,P={};if(n){const x=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&x.fittedCoordinates.length>0&&(p=x.fittedCoordinates),r=(x.maxZ+x.minZ)/2,d=x.maxZ-x.minZ,P={count:x.zCount}}const[g,S,E]=p,k=v.getLineCenterPoint([g,E]),A=v.getLineLength(g,S),j=v.getLineLength(S,E),T=v.getRadiusFromQuadrangle(t.pointList);s&&(r=s.center.z,d=s.depth);const U={center:{x:k.x,y:k.y,z:r},width:j,height:A,depth:d,rotation:T,id:t.id},D=m(s?m(m({},s),U):V(m({},U),{attribute:"",valid:!0}),P);o&&Object.assign(D,o);const z=p.map(x=>I.transferWorld2Canvas(x,e));return{boxParams:D,newPointList:z}},at=(t,e,n)=>{const s={x:t.x-e.x,y:t.y-e.y};return V(m({},n),{center:{x:n.center.x-s.x,y:n.center.y,z:n.center.z-s.y}})},ct=(t,e,n,s)=>{const[o,c,p]=t.pointList,[r,d,P]=e.pointList,g=v.getLineCenterPoint([o,p]),S=v.getLineCenterPoint([r,P]),k={x:{x:g.x-S.x,y:g.y-S.y}.x,y:0,z:g.y-S.y},A=v.getLineLength(o,c),j=v.getLineLength(r,d),T=A-j,U=v.getLineLength(c,p),D=v.getLineLength(d,P),z=U-D,{newBoxParams:x}=s.getNewBoxBySideUpdate(k,z,T,n);return x},Gt=(t,e,n)=>{const s={x:t.x-e.x,y:t.y-e.y};return V(m({},n),{center:{x:n.center.x,y:n.center.y-s.x,z:n.center.z-s.y}})},Xt=(t,e,n,s)=>{const[o,c,p]=t.pointList,[r,d,P]=e.pointList,g=v.getLineCenterPoint([o,p]),S=v.getLineCenterPoint([r,P]),k={x:{x:g.x-S.x,y:g.y-S.y}.x,y:0,z:g.y-S.y},A=v.getLineLength(o,c),j=v.getLineLength(r,d),T=A-j,U=v.getLineLength(c,p),D=v.getLineLength(d,P),z=U-D;let{newBoxParams:x}=s.getNewBoxByBackUpdate(k,z,T,n);return x},ut=(t,e,n,s,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(s,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,N.Left);r.setInitCameraPosition(d);const{point2d:P,zoom:g}=r.getSphereSidePoint2DCoordinate(t);r.camera.zoom=g,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([V(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},pt=(t,e,n,s)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(s,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},ft=(t,e,n,s,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:r}=n;r.loadPCDFile(s,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=r.updateOrthoCameraBySphere(t,N.Back);r.setInitCameraPosition(d);const{point2d:P,zoom:g}=r.getSphereBackPoint2DCoordinate(t);r.camera.zoom=g,r.camera.updateProjectionMatrix(),r.render(),p.initPosition(),p.zoomChangeOnCenter(g),p.setResult([V(m(m({},e),P),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},Ct=(t,e,n,s)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(s,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:r,zoom:d}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:r,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Pt=(t,e,n,s)=>{if(!n||!s)return;s.generateSphere(t),s.updateCameraBySphere(t,N.Top),s.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),r=[...o.pointList].map(d=>d.id===e.id?V(m(m({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(r),o.setSelectedID(e.id)},K=(t,e,n,s)=>{var o;if(!n||!s)return;s.generateBox(t,e.id),s.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:r}=p.getBoxTopPolygon2DCoordinate(t),d=[...c.polygonList],P=d.find(g=>g.id===e.id);P?P.pointList=r:d.push({id:e.id,pointList:r,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(d,e.id)},Yt=()=>{const t=Vt(kt),{topViewInstance:e,sideViewInstance:n,backViewInstance:s,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:r,selectedIDs:d,pointCloudBoxList:P,pointCloudSphereList:g,hideAttributes:S}=t,{addHistory:E,initHistory:k,pushHistoryUnderUpdatePolygon:A,pushHistoryUnderUpdatePoint:j}=Et(),{selectedPolygon:T}=Ht(),{updateSelectedBox:U,updateSelectedBoxes:D,getPointCloudByID:z}=it(),{getPointCloudSphereByID:x,updatePointCloudSphere:$,selectedSphere:F}=Ut(),{currentData:O,config:b}=At(i=>{const{stepList:l,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(Tt.getCurrentStepInfo(f,l).config)}}),tt=jt(),{selectedBox:H}=it(),{t:gt}=Rt(),ot=H==null?void 0:H.info;if(!e||!n||!s)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,ht=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},yt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},mt=({newPoint:i,size:l,zoom:f,trackConfigurable:u})=>{var a;const C={attribute:(a=e.toolInstance.defaultAttribute)!=null?a:""};u===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:g})});const h=q(i,l,Y,void 0,C);r(i.id);const B=p(h);W(y.Top,i,h,f,B,b)},xt=({polygon:i,size:l,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const B={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(B,{trackID:I.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:g})});const L=m({},i),{boxParams:w,newPointList:R}=J(L,l,Y,void 0,B,C),M=e==null?void 0:e.toolInstance;if((b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof w.count=="number"&&w.count<b.lowerLimitPointsNumInBox){zt.info(gt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),M.deletePolygon(w.id);return}C&&(R==null?void 0:R.length)&&(L.pointList=R);const _=S.includes(L.attribute),Dt=c(w);_?r([]):(r(w.id),M.setSelectedIDs([L.id]),Z(y.Top,L,w,a,Dt),C&&K(w,L,e,o)),E({newBoxParams:w})},vt=({newSelectedBox:i,newPointCloudList:l,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(d.length===0||!a)){if(i||(H==null?void 0:H.info)){const C=i!=null?i:H==null?void 0:H.info;a.setSelectedIDs(d);const h=a.selectedPolygon;if(d.length===1&&C){Z(y.Top,h,C,void 0,l);return}}if((f||F)&&d.length===1){const C=f!=null?f:F;a.setSelectedID(d[0]);const h=a.selectedPoint;C&&W(y.Top,h,C,void 0,u,b)}}},et=(i,l,f)=>{if(ot){let u,a;switch(f){case y.Back:u=Xt;break;case y.Side:u=ct;break;default:u=ct;break}if(a=u(i,l,ot,n.pointCloudInstance),o){const{count:h}=o.getSensesPointZAxisInPolygon(Ot(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=V(m({},a),{count:h})}const C=U(a);return Z(f,i,a,void 0,C),C}},nt=(i,l,f)=>{if(F){let u,a;switch(f){case y.Back:u=Gt;break;case y.Side:u=at;break;default:u=at;break}a=u(i,l,F);const C=$(a);return W(f,i,a,void 0,C,b),C}},Lt=(i,l)=>{nt(i,l,y.Side)},Bt=(i,l)=>{nt(i,l,y.Back)},St=(i,l)=>{et(i,l,y.Side)},bt=(i,l)=>{et(i,l,y.Back)},wt=(i,l)=>{const{x:f,y:u}=I.transferCanvas2World(i,l);j(V(m({},i),{x:f,y:u}));const a=x(i.id),C=q(i,l,Y,a),h=$(C);W(y.Top,i,C,void 0,h,b)},It=(i,l)=>{if(T){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>I.transferCanvas2World(a,l)),A(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=z(u.id),{boxParams:C}=J(u,l,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=D(f);Z(y.Top,u,f[0],void 0,a)}else{const u=D(f);u&&t.syncAllViewPointCloudColor(u)}},W=(i,l,f,u,a,C)=>Q(void 0,null,function*(){const h=O==null?void 0:O.url,B={[y.Side]:()=>{ut(f,l,n,h,C)},[y.Back]:()=>{s&&ft(f,l,s,h,C)},[y.Top]:()=>{Pt(f,l,e,o)}};Object.keys(B).forEach(L=>{L!==i&&B[L]()}),u&&(o==null||o.updateCameraZoom(u)),yt(f)}),Z=(i,l,f,u,a)=>Q(void 0,null,function*(){const C=O==null?void 0:O.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[y.Side]:()=>{pt(f,l,n,C)},[y.Back]:()=>{s&&Ct(f,l,s,C)},[y.Top]:()=>{K(f,l,e,o)}};Object.keys(h).forEach(B=>{B!==i&&h[B]()}),u&&(o==null||o.updateCameraZoom(u)),ht(f)});return{topViewAddSphere:mt,topViewAddBox:xt,topViewSelectedChanged:vt,topViewUpdatePoint:wt,sideViewUpdatePoint:Lt,backViewUpdatePoint:Bt,topViewUpdateBox:It,sideViewUpdateBox:St,backViewUpdateBox:bt,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(l),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>Q(void 0,[...i],function*(l=O){var f,u,a,C,h,B;if(!(l==null?void 0:l.url)||!o)return;st(tt,!0),yield o.loadPCDFile(l.url,(f=b==null?void 0:b.radius)!=null?f:X),P.forEach(_=>{o==null||o.removeObjectByName(_.id)}),g.forEach(_=>{o==null||o.removeObjectByName(_.id)});let L=[],w=[],R=[];O.result?(L=I.getBoxParamsFromResultList(O.result),w=I.getPolygonListFromResultList(O.result),R=I.getSphereParamsFromResultList(O.result),L.forEach(_=>{o==null||o.generateBox(_)}),R.forEach(_=>{o==null||o.generateSphere(_)}),t.syncAllViewPointCloudColor(L),t.setPointCloudResult(L),t.setPolygonList(w),t.setPointCloudSphereList(R)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([])),k({pointCloudBoxList:L,polygonList:w}),o.updateTopCamera();const M=(a=(u=rt(l.result))==null?void 0:u.valid)!=null?a:!0;t.setPointCloudValid(M),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),e.updateData(l.url,l.result,{radius:(B=b==null?void 0:b.radius)!=null?B:X}),st(tt,!1)})}};export{ft as syncBackViewByPoint,ut as syncSideViewByPoint,Pt as syncTopViewByPoint,Ct as synchronizeBackView,pt as synchronizeSideView,K as synchronizeTopView,q as topViewPoint2PointCloud,J as topViewPolygon2PointCloud,Yt as usePointCloudViews};
|
|
1
|
+
import{MathUtils as x,getCuboidFromPointCloudBox as Vt}from"@labelbee/lb-annotation";import{EPerspectiveView as N,PointCloudUtils as I,DEFAULT_SPHERE_PARAMS as Ut}from"@labelbee/lb-utils";import{useContext as kt}from"react";import{PointCloudContext as At}from"../PointCloudContext.js";import{useSingleBox as st}from"./useSingleBox.js";import{useSphere as jt}from"./useSphere.js";import{useSelector as Tt,useDispatch as zt}from"../../../store/ctx.js";import Rt from"../../../utils/StepUtils.js";import{jsonParser as rt}from"../../../utils/index.js";import{SetPointCloudLoading as dt}from"../../../store/annotation/actionCreators.js";import{message as Et}from"antd";import{useTranslation as Ht}from"react-i18next";import{useHistory as Ft}from"./useHistory.js";import{usePolygon as Nt}from"./usePolygon.js";var Wt=Object.defineProperty,Zt=Object.defineProperties,Mt=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,at=(t,e,n)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e)=>{for(var n in e||(e={}))Gt.call(e,n)&&at(t,n,e[n]);if(lt)for(var n of lt(e))Xt.call(e,n)&&at(t,n,e[n]);return t},V=(t,e)=>Zt(t,Mt(e)),q=(t,e,n)=>new Promise((r,o)=>{var c=d=>{try{s(n.next(d))}catch(g){o(g)}},p=d=>{try{s(n.throw(d))}catch(g){o(g)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(c,p);s((n=n.apply(t,e)).next())});const G=5,X=90,y={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},J=(t,e,n,r,o)=>{const{x:c,y:p}=I.transferCanvas2World(t,e),{defaultZ:s}=Ut,d={center:{x:c,y:p,z:s},id:t.id},g=r?L(L({},r),d):V(L({},d),{attribute:"",valid:!0});return o&&Object.assign(g,o),g},K=(t,e,n,r,o,c)=>{let p=t.pointList.map(m=>I.transferCanvas2World(m,e)),s=0,d=1,g={};if(n){const m=n.getSensesPointZAxisInPolygon(p,void 0,c);c&&m.fittedCoordinates.length>0&&(p=m.fittedCoordinates),s=(m.maxZ+m.minZ)/2,d=m.maxZ-m.minZ,g={count:m.zCount}}const[P,B,H]=p,U=x.getLineCenterPoint([P,H]),T=x.getLineLength(P,B),z=x.getLineLength(B,H),R=x.getRadiusFromQuadrangle(t.pointList);r&&(s=r.center.z,d=r.depth);const k={center:{x:U.x,y:U.y,z:s},width:z,height:T,depth:d,rotation:R,id:t.id},A=L(r?L(L({},r),k):V(L({},k),{attribute:"",valid:!0}),g);o&&Object.assign(A,o);const j=p.map(m=>I.transferWorld2Canvas(m,e));return{boxParams:A,newPointList:j}},ct=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return V(L({},n),{center:{x:n.center.x-r.x,y:n.center.y,z:n.center.z-r.y}})},ut=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,g]=e.pointList,P=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,g]),U={x:{x:P.x-B.x,y:P.y-B.y}.x,y:0,z:P.y-B.y},T=x.getLineLength(o,c),z=x.getLineLength(s,d),R=T-z,k=x.getLineLength(c,p),A=x.getLineLength(d,g),j=k-A,{newBoxParams:m}=r.getNewBoxBySideUpdate(U,j,R,n);return m},Yt=(t,e,n)=>{const r={x:t.x-e.x,y:t.y-e.y};return V(L({},n),{center:{x:n.center.x,y:n.center.y-r.x,z:n.center.z-r.y}})},Qt=(t,e,n,r)=>{const[o,c,p]=t.pointList,[s,d,g]=e.pointList,P=x.getLineCenterPoint([o,p]),B=x.getLineCenterPoint([s,g]),U={x:{x:P.x-B.x,y:P.y-B.y}.x,y:0,z:P.y-B.y},T=x.getLineLength(o,c),z=x.getLineLength(s,d),R=T-z,k=x.getLineLength(c,p),A=x.getLineLength(d,g),j=k-A;let{newBoxParams:m}=r.getNewBoxByBackUpdate(U,j,R,n);return m},pt=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Left);s.setInitCameraPosition(d);const{point2d:g,zoom:P}=s.getSphereSidePoint2DCoordinate(t);s.camera.zoom=P,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(P),p.setResult([V(L(L({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},ft=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{width:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Left);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxSidePolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Ct=(t,e,n,r,o)=>{var c;if(!n)return;const{toolInstance:p,pointCloudInstance:s}=n;s.loadPCDFile(r,(c=o==null?void 0:o.radius)!=null?c:X);const{cameraPositionVector:d}=s.updateOrthoCameraBySphere(t,N.Back);s.setInitCameraPosition(d);const{point2d:g,zoom:P}=s.getSphereBackPoint2DCoordinate(t);s.camera.zoom=P,s.camera.updateProjectionMatrix(),s.render(),p.initPosition(),p.zoomChangeOnCenter(P),p.setResult([V(L(L({},e),g),{valid:t.valid,textAttribute:"",attribute:t.attribute})]),p.setSelectedID(e.id)},gt=(t,e,n,r)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:c}=n;c.loadPCDFileByBox(r,t,{height:G,depth:G});const{cameraPositionVector:p}=c.updateOrthoCamera(t,N.Back);c.setInitCameraPosition(p);const{polygon2d:s,zoom:d}=c.getBoxBackPolygon2DCoordinate(t);c.camera.zoom=d,c.camera.updateProjectionMatrix(),c.render(),o.initPosition(),o.zoomChangeOnCenter(d),o.setResultAndSelectedID([{id:e.id,valid:t.valid,pointList:s,textAttribute:"",isRect:!0,attribute:t.attribute}],e.id)},Pt=(t,e,n,r)=>{if(!n||!r)return;r.generateSphere(t),r.updateCameraBySphere(t,N.Top),r.render();const{toolInstance:o,pointCloudInstance:c}=n,{point2d:p}=c.getSphereTopPoint2DCoordinate(t),s=[...o.pointList].map(d=>d.id===e.id?V(L(L({},e),p),{valid:t.valid,textAttribute:"",attribute:t.attribute}):d);o.setResult(s),o.setSelectedID(e.id)},$=(t,e,n,r)=>{var o;if(!n||!r)return;r.generateBox(t,e.id),r.render();const{pointCloud2dOperation:c,pointCloudInstance:p}=n,{polygon2d:s}=p.getBoxTopPolygon2DCoordinate(t),d=[...c.polygonList],g=d.find(P=>P.id===e.id);g?g.pointList=s:d.push({id:e.id,pointList:s,textAttribute:"",isRect:!0,valid:(o=t.valid)!=null?o:!0}),c.setResultAndSelectedID(d,e.id)},qt=()=>{const t=kt(At),{topViewInstance:e,sideViewInstance:n,backViewInstance:r,mainViewInstance:o,addPointCloudBox:c,addPointCloudSphere:p,setSelectedIDs:s,selectedIDs:d,pointCloudBoxList:g,pointCloudSphereList:P,hideAttributes:B}=t,{addHistory:H,initHistory:U,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdatePoint:z,pushHistoryUnderUpdateLine:R}=Ft(),{selectedPolygon:k}=Nt(),{updateSelectedBox:A,updateSelectedBoxes:j,getPointCloudByID:m}=st(),{getPointCloudSphereByID:ht,updatePointCloudSphere:tt,selectedSphere:W}=jt(),{currentData:D,config:S}=Tt(i=>{const{stepList:l,step:f,imgList:u,imgIndex:a}=i.annotation;return{currentData:u[a],config:rt(Rt.getCurrentStepInfo(f,l).config)}}),ot=zt(),{selectedBox:F}=st(),{t:yt}=Ht(),et=F==null?void 0:F.info;if(!e||!n||!r)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:Y}=e,Lt=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},mt=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},xt=({newPoint:i,size:l,zoom:f,trackConfigurable:u})=>{var a;const C={attribute:(a=e.toolInstance.defaultAttribute)!=null?a:""};u===!0&&Object.assign(C,{trackID:I.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:P})});const h=J(i,l,Y,void 0,C);s(i.id);const v=p(h);Z(y.Top,i,h,f,v,S)},vt=({polygon:i,size:l,imgList:f,trackConfigurable:u,zoom:a,intelligentFit:C})=>{var h;const v={attribute:(h=e.toolInstance.defaultAttribute)!=null?h:""};u===!0&&Object.assign(v,{trackID:I.getNextTrackID({imgList:[],extraBoxList:g,extraSphereList:P})});const w=e==null?void 0:e.toolInstance,O=L({},i),{boxParams:b,newPointList:E}=K(O,l,Y,void 0,v,C);if((S==null?void 0:S.lowerLimitPointsNumInBox)&&typeof b.count=="number"&&b.count<S.lowerLimitPointsNumInBox){Et.info(yt("LowerLimitPointsNumInBox",{num:S.lowerLimitPointsNumInBox})),w.deletePolygon(b.id);return}C&&(E==null?void 0:E.length)&&(O.pointList=E);const Q=B.includes(O.attribute),_=c(b);Q?s([]):(s(b.id),w.setSelectedIDs([O.id]),M(y.Top,O,b,a,_),C&&$(b,O,e,o)),H({newBoxParams:b})},Bt=({newSelectedBox:i,newPointCloudList:l,newSelectedSphere:f,newSphereList:u})=>{const a=e==null?void 0:e.toolInstance;if(!(d.length===0||!a)){if(i||(F==null?void 0:F.info)){const C=i!=null?i:F==null?void 0:F.info;a.setSelectedIDs(d);const h=a.selectedPolygon;if(d.length===1&&C){M(y.Top,h,C,void 0,l);return}}if((f||W)&&d.length===1){const C=f!=null?f:W;a.setSelectedID(d[0]);const h=a.selectedPoint;C&&Z(y.Top,h,C,void 0,u,S)}}},nt=(i,l,f)=>{if(et){let u,a;switch(f){case y.Back:u=Qt;break;case y.Side:u=ut;break;default:u=ut;break}if(a=u(i,l,et,n.pointCloudInstance),o){const{count:h}=o.getSensesPointZAxisInPolygon(Vt(a).polygonPointList,[a.center.z-a.depth/2,a.center.z+a.depth/2]);a=V(L({},a),{count:h})}const C=A(a);return M(f,i,a,void 0,C),C}},it=(i,l,f)=>{if(W){let u,a;switch(f){case y.Back:u=Yt;break;case y.Side:u=ct;break;default:u=ct;break}a=u(i,l,W);const C=tt(a);return Z(f,i,a,void 0,C,S),C}},St=(i,l)=>{it(i,l,y.Side)},bt=(i,l)=>{it(i,l,y.Back)},wt=(i,l)=>{nt(i,l,y.Side)},It=(i,l)=>{nt(i,l,y.Back)},Dt=(i,l)=>{R(i)},Ot=(i,l)=>{const{x:f,y:u}=I.transferCanvas2World(i,l);z(V(L({},i),{x:f,y:u}));const a=ht(i.id),C=J(i,l,Y,a),h=tt(C);Z(y.Top,i,C,void 0,h,S)},_t=(i,l)=>{if(k){const u=i[0].newPolygon;u.pointList=u.pointList.map(a=>I.transferCanvas2World(a,l)),T(i[0].newPolygon);return}const f=i.map(({newPolygon:u})=>{const a=m(u.id),{boxParams:C}=K(u,l,e.pointCloudInstance,a);return C});if(f.length===1){const{newPolygon:u}=i[0],a=j(f);M(y.Top,u,f[0],void 0,a)}else{const u=j(f);u&&t.syncAllViewPointCloudColor(u)}},Z=(i,l,f,u,a,C)=>q(void 0,null,function*(){const h=D==null?void 0:D.url,v={[y.Side]:()=>{pt(f,l,n,h,C)},[y.Back]:()=>{r&&Ct(f,l,r,h,C)},[y.Top]:()=>{Pt(f,l,e,o)}};Object.keys(v).forEach(w=>{w!==i&&v[w]()}),u&&(o==null||o.updateCameraZoom(u)),mt(f)}),M=(i,l,f,u,a)=>q(void 0,null,function*(){const C=D==null?void 0:D.url;a&&(yield t.syncAllViewPointCloudColor(a));const h={[y.Side]:()=>{ft(f,l,n,C)},[y.Back]:()=>{r&>(f,l,r,C)},[y.Top]:()=>{$(f,l,e,o)}};Object.keys(h).forEach(v=>{v!==i&&h[v]()}),u&&(o==null||o.updateCameraZoom(u)),Lt(f)});return{topViewAddSphere:xt,topViewAddBox:vt,topViewSelectedChanged:Bt,topViewUpdatePoint:Ot,sideViewUpdatePoint:St,backViewUpdatePoint:bt,topViewUpdateBox:_t,topViewUpdateLine:Dt,sideViewUpdateBox:wt,backViewUpdateBox:It,pointCloudBoxListUpdated:i=>{e.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const l={left:-i.width/2,right:i.width/2,top:i.height/2,bottom:-i.height/2,near:100,far:-100};o.initOrthographicCamera(l),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>q(void 0,[...i],function*(l=D){var f,u,a,C,h,v;if(!(l==null?void 0:l.url)||!o)return;dt(ot,!0),yield o.loadPCDFile(l.url,(f=S==null?void 0:S.radius)!=null?f:X),g.forEach(_=>{o==null||o.removeObjectByName(_.id)}),P.forEach(_=>{o==null||o.removeObjectByName(_.id)});let w=[],O=[],b=[],E=[];D.result?(w=I.getBoxParamsFromResultList(D.result),b=I.getPolygonListFromResultList(D.result),O=I.getLineListFromResultList(D.result),E=I.getSphereParamsFromResultList(D.result),w.forEach(_=>{o==null||o.generateBox(_)}),E.forEach(_=>{o==null||o.generateSphere(_)}),t.syncAllViewPointCloudColor(w),t.setPointCloudResult(w),t.setPolygonList(b),t.setLineList(O),t.setPointCloudSphereList(E)):(t.setPointCloudResult([]),t.setPolygonList([]),t.setPointCloudSphereList([]),t.setLineList([])),U({pointCloudBoxList:w,polygonList:b}),o.updateTopCamera();const Q=(a=(u=rt(l.result))==null?void 0:u.valid)!=null?a:!0;t.setPointCloudValid(Q),(C=t.sideViewInstance)==null||C.clearAllData(),(h=t.backViewInstance)==null||h.clearAllData(),e.updateData(l.url,l.result,{radius:(v=S==null?void 0:S.radius)!=null?v:X}),dt(ot,!1)})}};export{Ct as syncBackViewByPoint,pt as syncSideViewByPoint,Pt as syncTopViewByPoint,gt as synchronizeBackView,ft as synchronizeSideView,$ as synchronizeTopView,J as topViewPoint2PointCloud,K as topViewPolygon2PointCloud,qt as usePointCloudViews};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloudContext as
|
|
1
|
+
import{PointCloudContext as f}from"../../../../components/pointCloudView/PointCloudContext.js";import{Modal as K}from"antd";import t,{useContext as y,useMemo as _,useState as W}from"react";import{stepConfigSelector as q}from"../../../../store/annotation/selectors.js";import{useSelector as O}from"../../../../store/ctx.js";import{i18n as P}from"@labelbee/lb-utils";import{UnorderedListOutlined as w,PushpinFilled as b,EyeInvisibleFilled as z,EyeFilled as J,CaretDownFilled as Q,DeleteOutlined as X}from"@ant-design/icons";import{useHistory as Y}from"../../../../components/pointCloudView/hooks/useHistory.js";import{getClassName as c}from"../../../../utils/dom.js";import Z from"../../../../utils/StepUtils.js";import{EPointCloudName as tt}from"@labelbee/lb-annotation";import{useTranslation as k}from"react-i18next";import et from"../FooterPopover.js";var nt=Object.defineProperty,ot=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,S=(e,o,n)=>o in e?nt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,N=(e,o)=>{for(var n in o||(o={}))lt.call(o,n)&&S(e,n,o[n]);if(F)for(var n of F(o))it.call(o,n)&&S(e,n,o[n]);return e},j=(e,o)=>ot(e,rt(o));const at=({attribute:e})=>{const o=y(f),{pointCloudBoxList:n,pointCloudSphereList:i,hideAttributes:u,toggleAttributesVisible:m,polygonList:a,setPolygonList:C,lineList:d,setLineList:s,setPointCloudResult:I,setPointCloudSphereList:R,reRender:D,selectSpecAttr:B}=o,[L,H]=W(!0),{pushHistoryWithList:V}=Y(),h=[...n,...a,...i,...d].filter(r=>r.attribute===e.value),x=()=>{m(e.value)},$=u.includes(e.value),G=({trackID:r,order:l})=>r||l,T=({trackID:r,order:l})=>r?`trackID_${r}`:`order_${l}`,U=r=>{if(h.length===0)return;const l=a.filter(p=>r!==p.attribute),v=n.filter(p=>r!==p.attribute),E=d.filter(p=>r!==p.attribute),A=i.filter(p=>r!==p.attribute);D(v,l,A,E),C(l),I(v),R(A),s(E),V({pointCloudBoxList:v,polygonList:l,lineList:E})},M=r=>{K.confirm({content:P.t("onDeleteGraphByAttr",{attribute:r.key}),onOk:()=>{U(r.value)},okText:P.t("Confirm"),cancelText:P.t("Cancel")})};return t.createElement(t.Fragment,null,t.createElement("div",{className:c("annotated-attribute","item")},$?t.createElement(z,{onClick:x}):t.createElement(J,{onClick:x}),t.createElement(Q,{rotate:L?0:270,onClick:()=>{H(!L)}}),t.createElement("span",{className:c("annotated-attribute","item","text"),onClick:()=>{B(e.value)}},e.key),t.createElement(X,{onClick:()=>M(e)})),L&&h.map((r,l)=>t.createElement("div",{key:T(j(N({},r),{order:l})),style:{paddingLeft:54}},`${G(j(N({},r),{order:l}))}.${e.key}`)))},g=()=>{const e=O(q),{attrPanelLayout:o,setAttrPanelLayout:n,pointCloudBoxList:i,polygonList:u,lineList:m}=y(f),{t:a}=k(),C=_(()=>[...i,...u,...m].map(s=>s.attribute),[i,u,m]),d=_(()=>e.attributeList.filter(s=>C.includes(s.value)),[C]);return t.createElement("div",{className:c("annotated-attribute")},o?t.createElement("div",{className:c("annotated-attribute","text")},t.createElement("span",null,a("AnnotatedResult")),t.createElement("span",{className:c("annotated-attribute","pin"),onClick:()=>{n("")}},t.createElement(b,null),a("CancelFixed"))):t.createElement("div",{className:c("annotated-attribute","text")},t.createElement("span",{onClick:()=>{n("left")},className:c("annotated-attribute","pin")},t.createElement(b,null),a("FixedOnLeft")),t.createElement("span",{onClick:()=>{n("right")},className:c("annotated-attribute","pin")},t.createElement(b,null),a("FixedOnRight"))),t.createElement("div",null,d.length>0?d.map(s=>t.createElement(at,{attribute:s,key:s.value})):t.createElement("div",{style:{textAlign:"center",height:200,lineHeight:"200px"}},a("NoData"))))},st=()=>{const{attrPanelLayout:e}=y(f);return e==="left"?t.createElement(g,null):null},ct=()=>{const{attrPanelLayout:e}=y(f);return e==="right"?t.createElement(g,null):null},ut=()=>{const{attrPanelLayout:e}=y(f),{t:o}=k(),n=O(i=>{var u,m;return Z.getCurrentStepInfo((u=i==null?void 0:i.annotation)==null?void 0:u.step,(m=i.annotation)==null?void 0:m.stepList)});return(n==null?void 0:n.tool)!==tt.PointCloud||e?null:t.createElement(et,{hoverIcon:t.createElement(w,{style:{marginRight:4}}),icon:t.createElement(w,{style:{marginRight:4}}),title:o("AnnotatedList"),content:t.createElement(g,null)})};export{ut as AnnotatedAttributesIcon,g as AnnotatedAttributesPanel,st as AnnotatedAttributesPanelFixedLeft,ct as AnnotatedAttributesPanelFixedRight};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as
|
|
1
|
+
import e,{useContext as _}from"react";import j from"../../../../../assets/annotation/toolHotKeyIcon/icon_kj1.svg.js";import O from"../../../../../assets/annotation/toolHotKeyIcon/icon_kj_h.svg.js";import{EToolName as a}from"../../../../../data/enums/ToolType.js";import w from"./rectToolShortCutTable/index.js";import I from"./point/index.js";import k from"./polygon/index.js";import N from"./line/index.js";import H from"./tag/index.js";import R from"./text/index.js";import L from"./videoTag/index.js";import K,{pointCloudShortCutTable_POLYGON as V}from"./pointCloud/index.js";import G from"./scribble/index.js";import $ from"./cuboid/index.js";import{footerCls as W}from"../../index.js";import{useTranslation as Y}from"react-i18next";import{cTool as A}from"@labelbee/lb-annotation";import{PointCloudContext as B}from"../../../../../components/pointCloudView/PointCloudContext.js";import F from"../../FooterPopover.js";var z=Object.defineProperty,h=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,C=(o,r,t)=>r in o?z(o,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[r]=t,U=(o,r)=>{for(var t in r||(r={}))D.call(r,t)&&C(o,t,r[t]);if(h)for(var t of h(r))M.call(r,t)&&C(o,t,r[t]);return o};const{EVideoToolName:q,EPointCloudName:y}=A,d={[a.Rect]:w,[a.Tag]:H,[a.Point]:I,[a.Polygon]:k,[a.Line]:N,[a.Text]:R,[q.VideoTagTool]:L,[y.PointCloud]:K,[y.PointCloud+"_POLYGON"]:V,[a.ScribbleTool]:G,[a.Cuboid]:$},J=({icon:o})=>typeof o=="string"?e.createElement("img",{width:16,height:16,src:o}):o||null,T=({title:o,style:r,shortCutList:t})=>{const{t:i}=Y(),m={width:320,display:"flex",justifyContent:"space-between",margin:16},c={display:"block",padding:"0 3px",minWidth:"20px",marginRight:"3px",border:"1px solid rgba(204,204,204,1)",verticalAlign:"middle",fontSize:"12px",textAlign:"center"},b=(l,p)=>e.createElement("div",{style:m,key:p},e.createElement("span",{style:{display:"flex",alignItems:"center"}},e.createElement(J,{icon:l.icon}),e.createElement("span",{style:{marginLeft:l.icon?16:0}},i(l.name))),e.createElement("span",{style:{display:"flex",alignItems:"center"}},l.noticeInfo&&e.createElement("span",{style:{marginRight:"5px",color:"#CCCCCC"}},i(l.noticeInfo)),E(l.shortCut,l.shortCutUseHtml,l.linkSymbol))),E=(l,p=!1,P="+")=>{if(!l)return null;const S=l.map((n,s)=>{var f,g;const u={display:"flex",alignItems:"center"};return p?e.createElement("span",{key:s,style:u},e.createElement("span",{style:c,dangerouslySetInnerHTML:{__html:n}})):s<l.length-1?typeof n=="number"?e.createElement("span",{key:s,style:u},e.createElement("span",{style:c},n),e.createElement("span",{style:{marginRight:"3px"}},"~")):((f=n==null?void 0:n.startsWith)==null?void 0:f.call(n,"data"))?e.createElement("span",{key:s,style:u},e.createElement("span",{className:"shortCutButton",style:{marginRight:"3px"}},e.createElement("img",{width:16,height:23,src:n})),e.createElement("span",{style:{marginRight:"3px"}},"+")):e.createElement("span",{key:s,style:u},e.createElement("span",{style:c},n),e.createElement("span",{style:{marginRight:"3px"}},P)):typeof n=="number"?e.createElement("span",{key:s,style:u},e.createElement("span",{style:c},n)):((g=n==null?void 0:n.startsWith)==null?void 0:g.call(n,"data"))?e.createElement("span",{className:"shortCutButton",key:s,style:{marginRight:"3px"}},e.createElement("img",{width:16,height:23,src:n})):e.createElement("span",{style:c,key:s},n)});return e.createElement("div",{style:{display:"flex",justifyContent:"space-around",alignItems:"center"}},S)},x=e.createElement("div",{className:`${W}__hotkey-content`},t==null?void 0:t.map((l,p)=>b(l,p))),v=r||{};return e.createElement(F,{hoverIcon:O,icon:j,title:i("Hotkeys"),content:x,containerStyle:v})},Q=({style:o,title:r,toolName:t})=>{const{pointCloudPattern:i}=_(B);if(!t||!d[t])return null;let m=t;m===`${y.PointCloud}`&&i===a.Polygon?m+="_POLYGON":i===a.Line?m=a.Line:i===a.Point&&(m=a.Point);const c={style:o,title:r,shortCutList:d[m]};return e.createElement(T,U({},c))};export{T as ToolHotKeyCom,Q as default,d as shortCutTable};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.10.0-alpha.
|
|
3
|
+
"version": "1.10.0-alpha.2",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@ant-design/icons": "^4.6.2",
|
|
44
|
-
"@labelbee/lb-annotation": "^1.14.0-alpha.
|
|
45
|
-
"@labelbee/lb-utils": "^1.7.0-alpha.
|
|
44
|
+
"@labelbee/lb-annotation": "^1.14.0-alpha.2",
|
|
45
|
+
"@labelbee/lb-utils": "^1.7.0-alpha.2",
|
|
46
46
|
"ahooks": "^3.4.0",
|
|
47
47
|
"classnames": "^2.3.0",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"path": "node_modules/cz-conventional-changelog"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "a7db5e1d7448a47848f6a338d1ecd5646ade27ff"
|
|
101
101
|
}
|