@labelbee/lb-annotation 1.13.1-alpha.0 → 1.14.0-alpha.1
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/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -0
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -0
- package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -0
- package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -0
- package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -0
- package/dist/constant/annotation.js +1 -1
- package/dist/constant/tool.js +1 -1
- package/dist/core/pointCloud/annotation.js +1 -1
- package/dist/core/pointCloud/index.js +2 -2
- package/dist/core/scheduler.js +1 -1
- package/dist/core/toolOperation/ViewOperation.js +1 -1
- package/dist/core/toolOperation/basicToolOperation.js +1 -1
- package/dist/core/toolOperation/cuboidOperation.js +1 -0
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +31 -0
- package/dist/core/toolOperation/pointOperation.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/constant/annotation.d.ts +45 -1
- package/dist/types/constant/tool.d.ts +6 -1
- package/dist/types/core/index.d.ts +1 -2
- package/dist/types/core/pointCloud/annotation.d.ts +16 -3
- package/dist/types/core/pointCloud/index.d.ts +45 -10
- package/dist/types/core/pointCloud/matrix.d.ts +1 -0
- package/dist/types/core/scheduler.d.ts +18 -2
- package/dist/types/core/toolOperation/ViewOperation.d.ts +3 -2
- package/dist/types/core/toolOperation/basicToolOperation.d.ts +11 -1
- package/dist/types/core/toolOperation/cuboidOperation.d.ts +174 -0
- package/dist/types/core/toolOperation/cuboidToggleButtonClass.d.ts +38 -0
- package/dist/types/core/toolOperation/pointOperation.d.ts +6 -1
- package/dist/types/core/toolOperation/textAttributeClass.d.ts +9 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/utils/MathUtils.d.ts +1 -1
- package/dist/types/utils/tool/AttributeUtils.d.ts +7 -0
- package/dist/types/utils/tool/AxisUtils.d.ts +50 -1
- package/dist/types/utils/tool/CuboidUtils.d.ts +267 -0
- package/dist/types/utils/tool/DrawUtils.d.ts +32 -0
- package/dist/types/utils/tool/EnhanceCommonToolUtils.d.ts +4 -2
- package/dist/types/utils/tool/PolygonUtils.d.ts +5 -2
- package/dist/utils/MathUtils.js +2 -2
- package/dist/utils/tool/AttributeUtils.js +1 -1
- package/dist/utils/tool/AxisUtils.js +1 -1
- package/dist/utils/tool/CuboidUtils.js +1 -0
- package/dist/utils/tool/DrawUtils.js +3 -3
- package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -1
- package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
- package/es/constant/annotation.js +1 -1
- package/es/constant/tool.js +1 -1
- package/es/core/pointCloud/annotation.js +1 -1
- package/es/core/pointCloud/index.js +2 -2
- package/es/core/scheduler.js +1 -1
- package/es/core/toolOperation/ViewOperation.js +1 -1
- package/es/core/toolOperation/basicToolOperation.js +1 -1
- package/es/core/toolOperation/cuboidOperation.js +1 -736
- package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
- package/es/core/toolOperation/pointOperation.js +1 -1
- package/es/index.js +1 -1
- package/es/utils/MathUtils.js +2 -2
- package/es/utils/tool/AttributeUtils.js +1 -1
- package/es/utils/tool/AxisUtils.js +1 -1
- package/es/utils/tool/CuboidUtils.js +1 -663
- package/es/utils/tool/DrawUtils.js +3 -3
- package/es/utils/tool/EnhanceCommonToolUtils.js +1 -1
- package/package.json +3 -3
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
- package/es/core/pointCloud/segmentation.js +0 -50
- package/es/core/toolOperation/scribbleTool2.js +0 -249
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var tool=require("../../constant/tool.js"),RectUtils=require("../../utils/tool/RectUtils.js"),PolygonUtils=require("../../utils/tool/PolygonUtils.js"),MarkerUtils=require("../../utils/tool/MarkerUtils.js"),MathUtils=require("../../utils/MathUtils.js"),annotation=require("../../constant/annotation.js"),keyCode=require("../../constant/keyCode.js"),index=require("../../locales/index.js"),constants=require("../../locales/constants.js"),AttributeUtils=require("../../utils/tool/AttributeUtils.js"),AxisUtils=require("../../utils/tool/AxisUtils.js"),CommonToolUtils=require("../../utils/tool/CommonToolUtils.js"),DrawUtils=require("../../utils/tool/DrawUtils.js"),StyleUtils=require("../../utils/tool/StyleUtils.js"),uuid=require("../../utils/uuid.js"),basicToolOperation=require("./basicToolOperation.js"),textAttributeClass=require("./textAttributeClass.js"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__pow=Math.pow,__defNormalProp=(c,t,e)=>t in c?__defProp(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e,__spreadValues=(c,t)=>{for(var e in t||(t={}))__hasOwnProp.call(t,e)&&__defNormalProp(c,e,t[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(t))__propIsEnum.call(t,e)&&__defNormalProp(c,e,t[e]);return c},__spreadProps=(c,t)=>__defProps(c,__getOwnPropDescs(t));const TEXTAREA_WIDTH=200;class PointOperation extends basicToolOperation.BasicToolOperation{constructor(t){super(t);this.setMarkerIndex=e=>{this.markerIndex=e},this.setMarkerIndexAndSelect=e=>{if(!this.config.markerList)return;this.markerIndex=e;const i=this.config.markerList[e].value,s=this.currentPageResult.find(r=>r.label===i);s&&(this.setSelectedID(s.id),this.config.attributeConfigurable===!0&&this.setDefaultAttribute(s.attribute)),this.emit("markIndexChange")},this.textChange=e=>{this.config.textConfigurable!==!0||!this.selectedID||(this.setPointList(AttributeUtils.default.textChange(e,this.selectedID,this.pointList)),this.emit("selectedChange"),this.render())},this.isMinDistance=e=>{const i=AxisUtils.default.changePointByZoom(e,this.zoom);return this.pointList.some(s=>{const r=AxisUtils.default.changePointByZoom(s,this.zoom);return MathUtils.default.getLineLength(r,i)<.2})},this.config=CommonToolUtils.jsonParser(t.config),this.pointList=[],this.markerIndex=0,this.setStyle(t.style),this.createPoint=this.createPoint.bind(this),this.getCurrentSelectedData=this.getCurrentSelectedData.bind(this),this.updateSelectedTextAttribute=this.updateSelectedTextAttribute.bind(this),this.setSelectedID=this.setSelectedID.bind(this)}get dataList(){return this.pointList}get drawOutsideTarget(){var t;return(t=this.config.drawOutsideTarget)!=null?t:this.config.drawPointOut}setNextMarker(t=this.pointList){if(this.hasMarkerConfig){const e=CommonToolUtils.getNextMarker(this.getCurrentPageResult(t),this.config.markerList);e&&this.setMarkerIndexAndSelect(e.index)}}setResult(t){this.clearActiveStatus(),this.setPointList(t),this.setNextMarker(t),this.recoverOperationMode(),this.render()}setPointList(t,e=!1){const i=this.pointList.length;this.pointList=t,i!==t.length&&this.emit("updatePageNumber"),e&&this.emit("updateResult")}setConfig(t,e=!1){this.config=CommonToolUtils.jsonParser(t),e===!0&&this.clearResult()}clearResult(){this.setPointList([]),this.setSelectedID(void 0),this.history.pushHistory([]),this.hoverID="",this.render()}setDefaultAttribute(t=""){const e=this.defaultAttribute;if(this.defaultAttribute=t,e!==t){this.changeStyle(t),this.emit("changeAttributeSidebar");const{selectedID:i}=this;if(i&&(this.pointList.forEach(s=>{s.id===i&&(s.attribute=t)}),this.history.pushHistory(this.pointList),this.render()),this._textAttributInstance){if(this.attributeLockList.length>0&&!this.attributeLockList.includes(t)){this._textAttributInstance.clearTextAttribute();return}this._textAttributInstance.updateIcon(this.getTextIconSvg(t))}}}get selectedText(){var t;return(t=this.pointList.find(e=>e.id===this.selectedID))==null?void 0:t.textAttribute}setStyle(t){var e;super.setStyle(t),this._textAttributInstance&&this.config.attributeConfigurable===!1&&((e=this._textAttributInstance)==null||e.updateIcon(this.getTextIconSvg()))}setSelectedID(t){var e,i;const s=this.selectedID;t!==s&&s&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute(),this.selectedID=t,this.render(),this.emit("selectedChange")}getTextIconSvg(t=""){return AttributeUtils.default.getTextIconSvg(t,this.config.attributeList,this.config.attributeConfigurable,this.baseIcon)}clearActiveStatus(){this.hoverID=void 0,this.dragStatus=annotation.EDragStatus.Wait,this.setSelectedID(void 0)}setBasicResult(t){super.setBasicResult(t),this.setNextMarker(),this.clearActiveStatus()}onDragMoveAll(t){var e,i;!((i=(e=this.dragInfo)==null?void 0:e.originPointList)==null?void 0:i.length)||(this.setPointList(this.dragInfo.originPointList.map(s=>__spreadProps(__spreadValues({},s),{x:s.x+t.x/this.zoom,y:s.y+t.y/this.zoom}))),this.render())}onMouseDown(t){if(!(super.onMouseDown(t)||this.forbidMouseOperation)){if(t.button===0&&!this.hoverID){this.recoverOperationMode(),this.createPoint(t),this.render();return}if((this.hoverID===this.selectedID||this.isMultiMoveMode&&this.hoverID)&&t.button===0){this.dragStatus=annotation.EDragStatus.Start,this.isMultiMoveMode&&(this.dragInfo={dragStartCoord:this.getCoordinateUnderZoom(t),originPointList:this.pointList});return}return this.render(),!0}}onMouseMove(t){super.onMouseMove(t)||this.forbidMouseOperation||!this.imgInfo||(this.hoverID=this.getHoverId(),(this.dragStatus===annotation.EDragStatus.Start||this.dragStatus===annotation.EDragStatus.Move)&&this.onDragMove(t),this.hoverID&&this.render())}onMouseUp(t){if(super.onMouseUp(t)||this.forbidMouseOperation||!this.imgInfo)return!0;t.button===2&&this.rightMouseUp(),this.dragStatus===annotation.EDragStatus.Move&&(this.history.pushHistory(this.pointList),this.dragInfo=void 0),this.dragStatus=annotation.EDragStatus.Wait,this.render()}onDragMove(t){var e,i;if(!this.imgInfo)return;this.dragStatus=annotation.EDragStatus.Move;const s=this.getCoordinateUnderZoom(t);if(this.isMultiMoveMode&&this.dragInfo){const n={x:s.x-this.dragInfo.dragStartCoord.x,y:s.y-this.dragInfo.dragStartCoord.y};this.onDragMoveAll(n);return}const r=AxisUtils.default.changeDrawOutsideTarget(s,{x:0,y:0},this.imgInfo,this.drawOutsideTarget,this.basicResult,this.zoom),h=this.drawOutsideTarget?AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos):AxisUtils.default.changePointByZoom(r,1/this.zoom);this.drawOutsideTarget===!1&&this.dependToolName===tool.EToolName.Polygon&&((i=(e=this.basicResult)==null?void 0:e.pointList)==null?void 0:i.length)>0&&!PolygonUtils.isInPolygon(h,this.basicResult.pointList)||(this.pointList.forEach(n=>{n.id===this.selectedID&&(n.x=h.x,n.y=h.y)}),this.render())}onKeyDown(t){if(!CommonToolUtils.hotkeyFilter(t)||super.onKeyDown(t)===!1)return;const{keyCode:e}=t;switch(e){case keyCode.Delete:this.deletePoint();break;case keyCode.Tab:{this.onTabKeyDown(t);break}case keyCode.Z:this.setIsHidden(!this.isHidden),this.render();break;default:{if(this.config.attributeConfigurable){const i=AttributeUtils.default.getAttributeByKeycode(e,this.config.attributeList);i!==void 0&&this.setDefaultAttribute(i)}break}}}createPoint(t){var e,i,s,r;if(!this.imgInfo)return;const{upperLimit:h}=this.config;if(h&&this.currentPageResult.length>=h){this.emit("messageInfo",`${index.getMessagesByLocale(constants.EMessage.LowerLimitPoint,this.lang)}`);return}const n=CommonToolUtils.getSourceID(this.basicResult),d=this.getCoordinateUnderZoom(t);let l=AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos);if(this.config.edgeAdsorption&&this.referenceData&&[tool.EToolName.Polygon,tool.EToolName.Line].includes((e=this.referenceData)==null?void 0:e.toolName)){const g=((i=this.referenceData)==null?void 0:i.toolName)===tool.EToolName.Polygon,{dropFoot:f,hasClosed:v}=PolygonUtils.getClosestPoint(l,this.referenceData.result,(r=(s=this.referenceData.config)==null?void 0:s.lineType)!=null?r:tool.ELineTypes.Line,tool.edgeAdsorptionScope/this.zoom,{isClose:g});f&&(l=f),v&&this.emit("messageSuccess",`${index.getMessagesByLocale(constants.EMessage.SuccessfulEdgeAdsorption,this.lang)}`)}if(this.drawOutsideTarget===!1){if(this.dependToolName&&this.basicCanvas){let a=!1;switch(this.dependToolName){case tool.EToolName.Rect:{a=!RectUtils.isInRect(l,this.basicResult);break}case tool.EToolName.Polygon:{a=!PolygonUtils.isInPolygon(l,this.basicResult.pointList);break}}if(a)return}if(d.x<0||d.y<0||d.x>this.imgInfo.width||d.y>this.imgInfo.height)return}if(this.isMinDistance(l))return;let o=__spreadProps(__spreadValues({},l),{attribute:this.defaultAttribute,valid:!t.ctrlKey,id:uuid(8,62),sourceID:n,textAttribute:"",order:CommonToolUtils.getMaxOrder(this.pointList.filter(a=>CommonToolUtils.isSameSourceID(a.sourceID,n)))+1});if(this.config.textConfigurable){let a="";a=AttributeUtils.default.getTextAttribute(this.pointList.filter(g=>CommonToolUtils.isSameSourceID(g.sourceID,n)),this.config.textCheckType),o=__spreadProps(__spreadValues({},o),{textAttribute:a})}if(this.hasMarkerConfig){const a=CommonToolUtils.getNextMarker(this.currentPageResult,this.config.markerList,this.markerIndex);if(a)o=__spreadProps(__spreadValues({},o),{label:a.label}),this.markerIndex=a.index,this.emit("markIndexChange");else{this.emit("messageInfo",index.getMessagesByLocale(constants.EMessage.MarkerFinish,this.lang));return}}this.hoverID=o.id;const u=[...this.pointList,o];this.setPointList(u),this.history.pushHistory(u),this.setSelectedID(o.id)}isInPoint(t,e,i=this.zoom){return(this.style.width+2)/i>=Math.sqrt(__pow(t.x-e.x,2)+__pow(t.y-e.y,2))}getHoverId(){var t;const e=AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos),i=(t=this.pointList)==null?void 0:t.find(s=>this.isInPoint(e,s));return i==null?void 0:i.id}rightMouseUp(){if(this.recoverOperationMode(),this.selectedID===this.hoverID){const e=this.pointList.filter(i=>i.id!==this.selectedID);this.setPointList(e),this.history.pushHistory(e),this.setSelectedID(""),this.hoverID="";return}const t=this.pointList.find(e=>e.id===this.hoverID);if(this.setSelectedID(this.hoverID),this.setDefaultAttribute(t==null?void 0:t.attribute),(t==null?void 0:t.label)&&this.hasMarkerConfig){const e=CommonToolUtils.getCurrentMarkerIndex(t.label,this.config.markerList);e>=0&&(this.setMarkerIndex(e),this.emit("markIndexChange"))}}onTabKeyDown(t){if(t.preventDefault(),this.dragStatus===annotation.EDragStatus.Move||this.dragStatus===annotation.EDragStatus.Start)return;let e=annotation.ESortDirection.ascend;t.shiftKey&&(e=annotation.ESortDirection.descend);const[i,s]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),this.attributeLockList,this.selectedID);let r=[...i];s&&(r=[...r,s]);const h=CommonToolUtils.getNextSelectedRectID(r,e,this.selectedID);h&&this.setSelectedID(h.id)}get currentPageResult(){const[t]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),[]);return t}getCurrentPageResult(t){const[e]=CommonToolUtils.getRenderResultList(t,CommonToolUtils.getSourceID(this.basicResult),[]);return e}exportData(){const{pointList:t}=this;return[t,this.basicImgInfo]}deletePoint(){var t;this.selectedID&&(this.setPointList(this.pointList.filter(e=>e.id!==this.selectedID)),this.history.pushHistory(this.pointList),(t=this._textAttributInstance)==null||t.clearTextAttribute(),this.emit("selectedChange"),this.render())}undoAndRedo(t){var e,i;if(this.dragStatus===annotation.EDragStatus.Move||this.dragStatus===annotation.EDragStatus.Start)return;const s=(i=(e=this.history)[t])==null?void 0:i.call(e);(s==null?void 0:s.some(r=>r.id===this.selectedID))||this.setSelectedID(""),s&&(this.setPointList(s,!0),this.render())}undo(){this.undoAndRedo("undo")}redo(){this.undoAndRedo("redo")}getCurrentSelectedData(){var t;if(!this.selectedID)return;const e=(t=this.pointList)==null?void 0:t.find(r=>r.id===this.selectedID),i=this.getColor(e==null?void 0:e.attribute),s=(e==null?void 0:e.valid)?i==null?void 0:i.valid.stroke:i==null?void 0:i.invalid.stroke;return this.dragStatus=annotation.EDragStatus.Wait,{width:TEXTAREA_WIDTH*this.zoom*.6,textAttribute:(e==null?void 0:e.textAttribute)||"",color:s}}updateSelectedTextAttribute(t){if(this._textAttributInstance&&t&&this.selectedID){let e=t;AttributeUtils.default.textAttributeValidate(this.config.textCheckType,"",e)===!1&&(this.emit("messageError",AttributeUtils.default.getErrorNotice(this.config.textCheckType,this.lang)),e=""),this.setPointList(AttributeUtils.default.textChange(e,this.selectedID,this.pointList)),this.emit("updateTextAttribute"),this.render()}}renderTextAttribute(){var t,e;const i=(t=this.pointList)==null?void 0:t.find(g=>g.id===this.selectedID);if(!this.ctx||this.config.textConfigurable!==!0||!i)return;const{x:s,y:r,attribute:h,valid:n}=i,d=TEXTAREA_WIDTH*this.zoom*.6,l=AxisUtils.default.getOffsetCoordinate({x:s,y:r},this.currentPos,this.zoom),o=this.getColor(h),u=n?o==null?void 0:o.valid.stroke:o==null?void 0:o.invalid.stroke,a=4;this._textAttributInstance||(this._textAttributInstance=new textAttributeClass({width:d,container:this.container,icon:this.getTextIconSvg(h),color:u,getCurrentSelectedData:this.getCurrentSelectedData,updateSelectedTextAttribute:this.updateSelectedTextAttribute})),this._textAttributInstance&&!((e=this._textAttributInstance)==null?void 0:e.isExit)&&this._textAttributInstance.appendToContainer(),this._textAttributInstance.update(`${i.textAttribute}`,{left:l.x,top:l.y+a,color:u,width:d})}renderPoint(t,e=!1){var i,s,r;const{textAttribute:h="",attribute:n}=t,d=e||t.id===this.selectedID,l=this.getColor(n),o=AxisUtils.default.changePointByZoom(t,this.zoom,this.currentPos),{width:u=2,hiddenText:a=!1}=this.style,g=StyleUtils.getStrokeAndFill(l,t.valid,{isSelected:d||t.id===this.hoverID});DrawUtils.drawCircle(this.canvas,o,u,{startAngleDeg:0,endAngleDeg:360,thickness:1,color:g.stroke,fill:g.fill});let f="";(((i=this.config)==null?void 0:i.isShowOrder)||((s=this.config)==null?void 0:s.showOrder))&&t.order&&(t==null?void 0:t.order)>0&&(f=`${t.order}`),t.label&&this.hasMarkerConfig&&(f=`${CommonToolUtils.getCurrentMarkerIndex(t.label,this.config.markerList)+1}_${MarkerUtils.getMarkerShowText(t.label,this.config.markerList)}`),t.attribute&&(f=`${f} ${AttributeUtils.default.getAttributeShowText(t.attribute,(r=this.config)==null?void 0:r.attributeList)}`),a||DrawUtils.drawText(this.canvas,{x:o.x+u/2,y:o.y-u-4},f,{textAlign:"center",color:g.stroke}),d?this.renderTextAttribute():a||DrawUtils.drawText(this.canvas,{x:o.x+u,y:o.y+u+24},h,__spreadValues({color:g.stroke},annotation.DEFAULT_TEXT_OFFSET))}renderMultiSelectedPoint(){!this.isMultiMoveMode||this.pointList.forEach(t=>{this.renderPoint(t,!0)})}renderPointList(){switch(this.operationMode){case tool.EOperationMode.MultiMove:this.renderMultiSelectedPoint();break;default:{const[t,e]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),this.attributeLockList,this.selectedID);this.isHidden||t.forEach(i=>{this.renderPoint(i)}),e&&this.renderPoint(e)}}}renderAuxiliaryLine(){var t;if(!this.config.markerConfigurable||!((t=this.config.markerList)==null?void 0:t.length))return;const[e,i]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),this.attributeLockList,this.selectedID),s=e;if(i&&s.push(i),s.length<2)return;const r=MarkerUtils.getAuxiliaryLineByMarkerList(this.config.markerList,"value");MarkerUtils.getAuxiliaryLineCoord(r,s).forEach(n=>{const{start:d,end:l}=n,o=AxisUtils.default.changePointListByZoom([d,l],this.zoom,this.currentPos);DrawUtils.drawLine(this.canvas,o[0],o[1],{color:"#C5C5C5"})})}renderTop(){var t,e,i;const s=this.getLineColor(this.defaultAttribute);if(this.renderCursorLine(s),this.config.edgeAdsorption&&this.referenceData){let r=AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos);const h=((t=this.referenceData)==null?void 0:t.toolName)===tool.EToolName.Polygon,{dropFoot:n}=PolygonUtils.getClosestPoint(r,this.referenceData.result,(i=(e=this.referenceData.config)==null?void 0:e.lineType)!=null?i:tool.ELineTypes.Line,tool.edgeAdsorptionScope/this.zoom,{isClose:h});n&&r!==n&&r!==n&&(r=n,DrawUtils.drawCircle(this.canvas,AxisUtils.default.changePointByZoom(r,this.zoom,this.currentPos),5,{color:"white",fill:"white"}),DrawUtils.drawCircle(this.canvas,AxisUtils.default.changePointByZoom(r,this.zoom,this.currentPos),3,{fill:s,color:s}))}}render(){!this.ctx||(super.render(),this.renderAuxiliaryLine(),this.renderPointList(),this.renderTop())}}module.exports=PointOperation;
|
|
1
|
+
"use strict";var tool=require("../../constant/tool.js"),RectUtils=require("../../utils/tool/RectUtils.js"),PolygonUtils=require("../../utils/tool/PolygonUtils.js"),MarkerUtils=require("../../utils/tool/MarkerUtils.js"),MathUtils=require("../../utils/MathUtils.js"),_=require("lodash"),annotation=require("../../constant/annotation.js"),keyCode=require("../../constant/keyCode.js"),index=require("../../locales/index.js"),constants=require("../../locales/constants.js"),AttributeUtils=require("../../utils/tool/AttributeUtils.js"),AxisUtils=require("../../utils/tool/AxisUtils.js"),CommonToolUtils=require("../../utils/tool/CommonToolUtils.js"),DrawUtils=require("../../utils/tool/DrawUtils.js"),StyleUtils=require("../../utils/tool/StyleUtils.js"),uuid=require("../../utils/uuid.js"),basicToolOperation=require("./basicToolOperation.js"),textAttributeClass=require("./textAttributeClass.js");function _interopDefaultLegacy(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var ___default=_interopDefaultLegacy(_),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__pow=Math.pow,__defNormalProp=(l,t,e)=>t in l?__defProp(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e,__spreadValues=(l,t)=>{for(var e in t||(t={}))__hasOwnProp.call(t,e)&&__defNormalProp(l,e,t[e]);if(__getOwnPropSymbols)for(var e of __getOwnPropSymbols(t))__propIsEnum.call(t,e)&&__defNormalProp(l,e,t[e]);return l},__spreadProps=(l,t)=>__defProps(l,__getOwnPropDescs(t));const TEXTAREA_WIDTH=200;class PointOperation extends basicToolOperation.BasicToolOperation{constructor(t){super(t);this.setMarkerIndex=s=>{this.markerIndex=s},this.setMarkerIndexAndSelect=s=>{if(!this.config.markerList)return;this.markerIndex=s;const r=this.config.markerList[s].value,n=this.currentPageResult.find(o=>o.label===r);n&&(this.setSelectedID(n.id),this.config.attributeConfigurable===!0&&this.setDefaultAttribute(n.attribute)),this.emit("markIndexChange")},this.textChange=s=>{this.config.textConfigurable!==!0||!this.selectedID||(this.setPointList(AttributeUtils.default.textChange(s,this.selectedID,this.pointList)),this.emit("selectedChange"),this.render())},this.isMinDistance=s=>{const r=AxisUtils.default.changePointByZoom(s,this.zoom);return this.pointList.some(n=>{const o=AxisUtils.default.changePointByZoom(n,this.zoom);return MathUtils.default.getLineLength(o,r)<.2})};var e,i;this.config=CommonToolUtils.jsonParser(t.config),this.pointList=[],this.markerIndex=0,this.setStyle(t.style),this.createPoint=this.createPoint.bind(this),this.getCurrentSelectedData=this.getCurrentSelectedData.bind(this),this.updateSelectedTextAttribute=this.updateSelectedTextAttribute.bind(this),this.setSelectedID=this.setSelectedID.bind(this),this.forbidAddNew=(e=t.forbidAddNew)!=null?e:!1,this.forbidDelete=(i=t.forbidDelete)!=null?i:!1}get dataList(){return this.pointList}get drawOutsideTarget(){var t;return(t=this.config.drawOutsideTarget)!=null?t:this.config.drawPointOut}setNextMarker(t=this.pointList){if(this.hasMarkerConfig){const e=CommonToolUtils.getNextMarker(this.getCurrentPageResult(t),this.config.markerList);e&&this.setMarkerIndexAndSelect(e.index)}}setResult(t){this.clearActiveStatus(),this.setPointList(t),this.setNextMarker(t),this.recoverOperationMode(),this.render()}setPointList(t,e=!1){const i=this.pointList.length;this.pointList=t,i!==t.length&&this.emit("updatePageNumber"),e&&this.emit("updateResult")}setConfig(t,e=!1){this.config=CommonToolUtils.jsonParser(t),e===!0&&this.clearResult()}clearResult(){this.setPointList([]),this.setSelectedID(void 0),this.history.pushHistory([]),this.hoverID="",this.render()}setDefaultAttribute(t=""){const e=this.defaultAttribute;if(this.defaultAttribute=t,e!==t){this.changeStyle(t),this.emit("changeAttributeSidebar");const{selectedID:i}=this;if(i&&(this.pointList.forEach(s=>{s.id===i&&(s.attribute=t)}),this.history.pushHistory(this.pointList),this.render()),this._textAttributInstance){if(this.attributeLockList.length>0&&!this.attributeLockList.includes(t)){this._textAttributInstance.clearTextAttribute();return}this._textAttributInstance.updateIcon(this.getTextIconSvg(t))}}}get selectedText(){var t;return(t=this.pointList.find(e=>e.id===this.selectedID))==null?void 0:t.textAttribute}setStyle(t){var e;super.setStyle(t),this._textAttributInstance&&this.config.attributeConfigurable===!1&&((e=this._textAttributInstance)==null||e.updateIcon(this.getTextIconSvg()))}setSelectedID(t){var e,i;const s=this.selectedID;t!==s&&s&&((e=this._textAttributInstance)==null||e.changeSelected()),t||(i=this._textAttributInstance)==null||i.clearTextAttribute(),this.selectedID=t,this.render(),this.emit("selectedChange")}getTextIconSvg(t=""){return AttributeUtils.default.getTextIconSvg(t,this.config.attributeList,this.config.attributeConfigurable,this.baseIcon)}clearActiveStatus(){this.hoverID=void 0,this.dragStatus=annotation.EDragStatus.Wait,this.setSelectedID(void 0)}setBasicResult(t){super.setBasicResult(t),this.setNextMarker(),this.clearActiveStatus()}onDragMoveAll(t){var e,i;!((i=(e=this.dragInfo)==null?void 0:e.originPointList)==null?void 0:i.length)||(this.setPointList(this.dragInfo.originPointList.map(s=>__spreadProps(__spreadValues({},s),{x:s.x+t.x/this.zoom,y:s.y+t.y/this.zoom}))),this.render())}onMouseDown(t){if(!(super.onMouseDown(t)||this.forbidMouseOperation)){if(t.button===0&&!this.hoverID){this.recoverOperationMode(),this.createPoint(t),this.render();return}if((this.hoverID===this.selectedID||this.isMultiMoveMode&&this.hoverID)&&t.button===0){this.dragStatus=annotation.EDragStatus.Start,this.dragInfo={dragStartCoord:this.getCoordinateUnderZoom(t),originPointList:___default.default.cloneDeep(this.pointList)};return}return this.render(),!0}}onMouseMove(t){super.onMouseMove(t)||this.forbidMouseOperation||!this.imgInfo||(this.hoverID=this.getHoverId(),(this.dragStatus===annotation.EDragStatus.Start||this.dragStatus===annotation.EDragStatus.Move)&&this.onDragMove(t),this.hoverID&&this.render())}onMouseUp(t){var e;if(super.onMouseUp(t)||this.forbidMouseOperation||!this.imgInfo)return!0;t.button===2&&this.rightMouseUp(),this.dragStatus===annotation.EDragStatus.Move&&(this.history.pushHistory(this.pointList),this.emit("updatePointByDrag",this.pointList.find(i=>(i==null?void 0:i.id)===this.selectedID),(e=this.dragInfo)==null?void 0:e.originPointList),this.dragInfo=void 0),this.dragStatus=annotation.EDragStatus.Wait,this.render()}onDragMove(t){var e,i;if(!this.imgInfo)return;this.dragStatus=annotation.EDragStatus.Move;const s=this.getCoordinateUnderZoom(t);if(this.isMultiMoveMode&&this.dragInfo){const o={x:s.x-this.dragInfo.dragStartCoord.x,y:s.y-this.dragInfo.dragStartCoord.y};this.onDragMoveAll(o);return}const r=AxisUtils.default.changeDrawOutsideTarget(s,{x:0,y:0},this.imgInfo,this.drawOutsideTarget,this.basicResult,this.zoom),n=this.drawOutsideTarget?AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos):AxisUtils.default.changePointByZoom(r,1/this.zoom);this.drawOutsideTarget===!1&&this.dependToolName===tool.EToolName.Polygon&&((i=(e=this.basicResult)==null?void 0:e.pointList)==null?void 0:i.length)>0&&!PolygonUtils.isInPolygon(n,this.basicResult.pointList)||(this.pointList.forEach(o=>{o.id===this.selectedID&&(o.x=n.x,o.y=n.y)}),this.render())}onKeyDown(t){if(!CommonToolUtils.hotkeyFilter(t)||super.onKeyDown(t)===!1)return;const{keyCode:e}=t;switch(e){case keyCode.Delete:this.deletePoint();break;case keyCode.Tab:{this.onTabKeyDown(t);break}case keyCode.Z:this.setIsHidden(!this.isHidden),this.render();break;default:{if(this.config.attributeConfigurable){const i=AttributeUtils.default.getAttributeByKeycode(e,this.config.attributeList);i!==void 0&&this.setDefaultAttribute(i)}break}}}createPoint(t){var e,i,s,r;if(!this.imgInfo||this.forbidAddNew)return;const{upperLimit:n}=this.config;if(n&&this.currentPageResult.length>=n){this.emit("messageInfo",`${index.getMessagesByLocale(constants.EMessage.LowerLimitPoint,this.lang)}`);return}const o=CommonToolUtils.getSourceID(this.basicResult),u=this.getCoordinateUnderZoom(t);let d=AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos);if(this.config.edgeAdsorption&&this.referenceData&&[tool.EToolName.Polygon,tool.EToolName.Line].includes((e=this.referenceData)==null?void 0:e.toolName)){const f=((i=this.referenceData)==null?void 0:i.toolName)===tool.EToolName.Polygon,{dropFoot:g,hasClosed:v}=PolygonUtils.getClosestPoint(d,this.referenceData.result,(r=(s=this.referenceData.config)==null?void 0:s.lineType)!=null?r:tool.ELineTypes.Line,tool.edgeAdsorptionScope/this.zoom,{isClose:f});g&&(d=g),v&&this.emit("messageSuccess",`${index.getMessagesByLocale(constants.EMessage.SuccessfulEdgeAdsorption,this.lang)}`)}if(this.drawOutsideTarget===!1){if(this.dependToolName&&this.basicCanvas){let h=!1;switch(this.dependToolName){case tool.EToolName.Rect:{h=!RectUtils.isInRect(d,this.basicResult);break}case tool.EToolName.Polygon:{h=!PolygonUtils.isInPolygon(d,this.basicResult.pointList);break}}if(h)return}if(u.x<0||u.y<0||u.x>this.imgInfo.width||u.y>this.imgInfo.height)return}if(this.isMinDistance(d))return;let a=__spreadProps(__spreadValues({},d),{attribute:this.defaultAttribute,valid:!t.ctrlKey,id:uuid(8,62),sourceID:o,textAttribute:"",order:CommonToolUtils.getMaxOrder(this.pointList.filter(h=>CommonToolUtils.isSameSourceID(h.sourceID,o)))+1});if(this.config.textConfigurable){let h="";h=AttributeUtils.default.getTextAttribute(this.pointList.filter(f=>CommonToolUtils.isSameSourceID(f.sourceID,o)),this.config.textCheckType),a=__spreadProps(__spreadValues({},a),{textAttribute:h})}if(this.hasMarkerConfig){const h=CommonToolUtils.getNextMarker(this.currentPageResult,this.config.markerList,this.markerIndex);if(h)a=__spreadProps(__spreadValues({},a),{label:h.label}),this.markerIndex=h.index,this.emit("markIndexChange");else{this.emit("messageInfo",index.getMessagesByLocale(constants.EMessage.MarkerFinish,this.lang));return}}this.hoverID=a.id;const c=[...this.pointList,a];this.setPointList(c),this.emit("pointCreated",a,this.zoom),this.history.pushHistory(c),this.setSelectedID(a.id)}isInPoint(t,e,i=this.zoom){return(this.style.width+2)/i>=Math.sqrt(__pow(t.x-e.x,2)+__pow(t.y-e.y,2))}getHoverId(){var t;const e=AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos),i=(t=this.pointList)==null?void 0:t.find(s=>this.isInPoint(e,s));return i==null?void 0:i.id}get selectedPoint(){return this.pointList.find(t=>t.id===this.selectedID)}rightMouseUp(){if(this.recoverOperationMode(),this.selectedID===this.hoverID){if(this.forbidDelete)return;const e=this.pointList.filter(i=>i.id!==this.selectedID);this.setPointList(e),this.history.pushHistory(e),this.emit("pointDeleted",this.selectedID),this.setSelectedID(""),this.hoverID="";return}const t=this.pointList.find(e=>e.id===this.hoverID);if(this.setSelectedID(this.hoverID),this.emit("pointSelected",this.hoverID),this.setDefaultAttribute(t==null?void 0:t.attribute),(t==null?void 0:t.label)&&this.hasMarkerConfig){const e=CommonToolUtils.getCurrentMarkerIndex(t.label,this.config.markerList);e>=0&&(this.setMarkerIndex(e),this.emit("markIndexChange"))}}onTabKeyDown(t){if(t.preventDefault(),this.dragStatus===annotation.EDragStatus.Move||this.dragStatus===annotation.EDragStatus.Start)return;let e=annotation.ESortDirection.ascend;t.shiftKey&&(e=annotation.ESortDirection.descend);const[i,s]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),this.attributeLockList,this.selectedID);let r=[...i];s&&(r=[...r,s]);const n=CommonToolUtils.getNextSelectedRectID(r,e,this.selectedID);n&&this.setSelectedID(n.id)}get currentPageResult(){const[t]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),[]);return t}getCurrentPageResult(t){const[e]=CommonToolUtils.getRenderResultList(t,CommonToolUtils.getSourceID(this.basicResult),[]);return e}exportData(){const{pointList:t}=this;return[t,this.basicImgInfo]}deletePoint(){var t;this.selectedID&&(this.setPointList(this.pointList.filter(e=>e.id!==this.selectedID)),this.history.pushHistory(this.pointList),(t=this._textAttributInstance)==null||t.clearTextAttribute(),this.emit("selectedChange"),this.emit("pointDeleted",this.selectedID),this.render())}undoAndRedo(t){var e,i;if(this.dragStatus===annotation.EDragStatus.Move||this.dragStatus===annotation.EDragStatus.Start)return;const s=(i=(e=this.history)[t])==null?void 0:i.call(e);(s==null?void 0:s.some(r=>r.id===this.selectedID))||this.setSelectedID(""),s&&(this.setPointList(s,!0),this.render())}undo(){this.undoAndRedo("undo")}redo(){this.undoAndRedo("redo")}getCurrentSelectedData(){var t;if(!this.selectedID)return;const e=(t=this.pointList)==null?void 0:t.find(r=>r.id===this.selectedID),i=this.getColor(e==null?void 0:e.attribute),s=(e==null?void 0:e.valid)?i==null?void 0:i.valid.stroke:i==null?void 0:i.invalid.stroke;return this.dragStatus=annotation.EDragStatus.Wait,{width:TEXTAREA_WIDTH*this.zoom*.6,textAttribute:(e==null?void 0:e.textAttribute)||"",color:s}}updateSelectedTextAttribute(t){if(this._textAttributInstance&&t&&this.selectedID){let e=t;AttributeUtils.default.textAttributeValidate(this.config.textCheckType,"",e)===!1&&(this.emit("messageError",AttributeUtils.default.getErrorNotice(this.config.textCheckType,this.lang)),e=""),this.setPointList(AttributeUtils.default.textChange(e,this.selectedID,this.pointList)),this.emit("updateTextAttribute"),this.render()}}renderTextAttribute(){var t,e;const i=(t=this.pointList)==null?void 0:t.find(f=>f.id===this.selectedID);if(!this.ctx||this.config.textConfigurable!==!0||!i)return;const{x:s,y:r,attribute:n,valid:o}=i,u=TEXTAREA_WIDTH*this.zoom*.6,d=AxisUtils.default.getOffsetCoordinate({x:s,y:r},this.currentPos,this.zoom),a=this.getColor(n),c=o?a==null?void 0:a.valid.stroke:a==null?void 0:a.invalid.stroke,h=4;this._textAttributInstance||(this._textAttributInstance=new textAttributeClass({width:u,container:this.container,icon:this.getTextIconSvg(n),color:c,getCurrentSelectedData:this.getCurrentSelectedData,updateSelectedTextAttribute:this.updateSelectedTextAttribute})),this._textAttributInstance&&!((e=this._textAttributInstance)==null?void 0:e.isExit)&&this._textAttributInstance.appendToContainer(),this._textAttributInstance.update(`${i.textAttribute}`,{left:d.x,top:d.y+h,color:c,width:u})}renderPoint(t,e=!1){var i,s,r;const{textAttribute:n="",attribute:o}=t,u=e||t.id===this.selectedID,d=this.getColor(o),a=AxisUtils.default.changePointByZoom(t,this.zoom,this.currentPos),{width:c=2,hiddenText:h=!1}=this.style,f=StyleUtils.getStrokeAndFill(d,t.valid,{isSelected:u||t.id===this.hoverID});DrawUtils.drawCircle(this.canvas,a,c,{startAngleDeg:0,endAngleDeg:360,thickness:1,color:f.stroke,fill:f.fill});let g="";(((i=this.config)==null?void 0:i.isShowOrder)||((s=this.config)==null?void 0:s.showOrder))&&t.order&&(t==null?void 0:t.order)>0&&(g=`${t.order}`),t.label&&this.hasMarkerConfig&&(g=`${CommonToolUtils.getCurrentMarkerIndex(t.label,this.config.markerList)+1}_${MarkerUtils.getMarkerShowText(t.label,this.config.markerList)}`),t.attribute&&!this.config.hideAttribute&&(g=`${g} ${AttributeUtils.default.getAttributeShowText(t.attribute,(r=this.config)==null?void 0:r.attributeList)}`),h||DrawUtils.drawText(this.canvas,{x:a.x+c/2,y:a.y-c-4},g,{textAlign:"center",color:f.stroke}),u?this.renderTextAttribute():h||DrawUtils.drawText(this.canvas,{x:a.x+c,y:a.y+c+24},n,__spreadValues({color:f.stroke},annotation.DEFAULT_TEXT_OFFSET))}renderMultiSelectedPoint(){!this.isMultiMoveMode||this.pointList.forEach(t=>{this.renderPoint(t,!0)})}renderPointList(){switch(this.operationMode){case tool.EOperationMode.MultiMove:this.renderMultiSelectedPoint();break;default:{const[t,e]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),this.attributeLockList,this.selectedID);this.isHidden||t.forEach(i=>{this.renderPoint(i)}),e&&this.renderPoint(e)}}}renderAuxiliaryLine(){var t;if(!this.config.markerConfigurable||!((t=this.config.markerList)==null?void 0:t.length))return;const[e,i]=CommonToolUtils.getRenderResultList(this.pointList,CommonToolUtils.getSourceID(this.basicResult),this.attributeLockList,this.selectedID),s=e;if(i&&s.push(i),s.length<2)return;const r=MarkerUtils.getAuxiliaryLineByMarkerList(this.config.markerList,"value");MarkerUtils.getAuxiliaryLineCoord(r,s).forEach(o=>{const{start:u,end:d}=o,a=AxisUtils.default.changePointListByZoom([u,d],this.zoom,this.currentPos);DrawUtils.drawLine(this.canvas,a[0],a[1],{color:"#C5C5C5"})})}renderTop(){var t,e,i;const s=this.getLineColor(this.defaultAttribute);if(this.renderCursorLine(s),this.config.edgeAdsorption&&this.referenceData){let r=AxisUtils.default.getOriginCoordinateWithOffsetCoordinate(this.coord,this.zoom,this.currentPos);const n=((t=this.referenceData)==null?void 0:t.toolName)===tool.EToolName.Polygon,{dropFoot:o}=PolygonUtils.getClosestPoint(r,this.referenceData.result,(i=(e=this.referenceData.config)==null?void 0:e.lineType)!=null?i:tool.ELineTypes.Line,tool.edgeAdsorptionScope/this.zoom,{isClose:n});o&&r!==o&&r!==o&&(r=o,DrawUtils.drawCircle(this.canvas,AxisUtils.default.changePointByZoom(r,this.zoom,this.currentPos),5,{color:"white",fill:"white"}),DrawUtils.drawCircle(this.canvas,AxisUtils.default.changePointByZoom(r,this.zoom,this.currentPos),3,{fill:s,color:s}))}}render(){!this.ctx||(super.render(),this.renderAuxiliaryLine(),this.renderPointList(),this.renderTop())}}module.exports=PointOperation;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rectOperation=require("./core/toolOperation/rectOperation.js"),tagOperation=require("./core/toolOperation/tagOperation.js"),pointOperation=require("./core/toolOperation/pointOperation.js"),LineToolOperation=require("./core/toolOperation/LineToolOperation.js"),TextToolOperation=require("./core/toolOperation/TextToolOperation.js"),polygonOperation=require("./core/toolOperation/polygonOperation.js"),measureOperation=require("./core/toolOperation/measureOperation.js"),basicToolOperation=require("./core/toolOperation/basicToolOperation.js"),ViewOperation=require("./core/toolOperation/ViewOperation.js"),ScribbleTool=require("./core/toolOperation/ScribbleTool.js"),pointCloud2dOperation=require("./core/toolOperation/pointCloud2dOperation.js"),annotation=require("./constant/annotation.js"),annotationTask=require("./constant/annotationTask.js"),keyCode=require("./constant/keyCode.js"),style=require("./constant/style.js"),tool=require("./constant/tool.js"),TagUtils=require("./utils/tool/TagUtils.js"),uuid=require("./utils/uuid.js"),EnhanceCommonToolUtils=require("./utils/tool/EnhanceCommonToolUtils.js"),MarkerUtils=require("./utils/tool/MarkerUtils.js"),RectUtils=require("./utils/tool/RectUtils.js"),AxisUtils=require("./utils/tool/AxisUtils.js"),DrawUtils=require("./utils/tool/DrawUtils.js"),ImgUtils=require("./utils/ImgUtils.js"),MathUtils=require("./utils/MathUtils.js"),AttributeUtils=require("./utils/tool/AttributeUtils.js"),ActionsHistory=require("./utils/ActionsHistory.js"),DblClickEventListener=require("./utils/tool/DblClickEventListener.js"),index=require("./core/index.js"),UnitUtils=require("./utils/tool/UnitUtils.js"),CanvasScheduler=require("./newCore/CanvasScheduler.js"),index$1=require("./core/pointCloud/index.js"),matrix=require("./core/pointCloud/matrix.js"),annotation$1=require("./core/pointCloud/annotation.js");function _interopNamespaceDefaultOnly(e){return Object.freeze({__proto__:null,default:e})}var keyCode__namespace=_interopNamespaceDefaultOnly(keyCode);const CommonToolUtils=EnhanceCommonToolUtils.default,toolUtils=EnhanceCommonToolUtils.default;exports.RectOperation=rectOperation.RectOperation,exports.TagOperation=tagOperation,exports.PointOperation=pointOperation,exports.LineToolOperation=LineToolOperation.default,exports.TextToolOperation=TextToolOperation,exports.PolygonOperation=polygonOperation,exports.MeasureOperation=measureOperation,exports.BasicToolOperation=basicToolOperation.BasicToolOperation,exports.ViewOperation=ViewOperation,exports.ScribbleTool=ScribbleTool,exports.PointCloud2dOperation=pointCloud2dOperation,exports.cAnnotation=annotation,exports.cAnnotationTask=annotationTask,exports.cKeyCode=keyCode__namespace,exports.cStyle=style,exports.CLIENT_TOOL_HEAD_TYPE=tool.CLIENT_TOOL_HEAD_TYPE,exports.CLIENT_TOOL_NAME=tool.CLIENT_TOOL_NAME,exports.DEFAULT_FONT=tool.DEFAULT_FONT,exports.DEFAULT_TEXT_MAX_WIDTH=tool.DEFAULT_TEXT_MAX_WIDTH,Object.defineProperty(exports,"EAnnotationMode",{enumerable:!0,get:function(){return tool.EAnnotationMode}}),Object.defineProperty(exports,"EAuditStatus",{enumerable:!0,get:function(){return tool.EAuditStatus}}),Object.defineProperty(exports,"ECheckModel",{enumerable:!0,get:function(){return tool.ECheckModel}}),Object.defineProperty(exports,"EDependPattern",{enumerable:!0,get:function(){return tool.EDependPattern}}),Object.defineProperty(exports,"EDragTarget",{enumerable:!0,get:function(){return tool.EDragTarget}}),Object.defineProperty(exports,"EDrawPointPattern",{enumerable:!0,get:function(){return tool.EDrawPointPattern}}),Object.defineProperty(exports,"EFilterToolOperation",{enumerable:!0,get:function(){return tool.EFilterToolOperation}}),Object.defineProperty(exports,"ELineColor",{enumerable:!0,get:function(){return tool.ELineColor}}),Object.defineProperty(exports,"ELineTypes",{enumerable:!0,get:function(){return tool.ELineTypes}}),Object.defineProperty(exports,"EOperationMode",{enumerable:!0,get:function(){return tool.EOperationMode}}),Object.defineProperty(exports,"EPageOperator",{enumerable:!0,get:function(){return tool.EPageOperator}}),Object.defineProperty(exports,"EPointCloudName",{enumerable:!0,get:function(){return tool.EPointCloudName}}),Object.defineProperty(exports,"EPolygonPattern",{enumerable:!0,get:function(){return tool.EPolygonPattern}}),Object.defineProperty(exports,"ERectPattern",{enumerable:!0,get:function(){return tool.ERectPattern}}),Object.defineProperty(exports,"EScribblePattern",{enumerable:!0,get:function(){return tool.EScribblePattern}}),Object.defineProperty(exports,"ESelectedType",{enumerable:!0,get:function(){return tool.ESelectedType}}),Object.defineProperty(exports,"ETextType",{enumerable:!0,get:function(){return tool.ETextType}}),Object.defineProperty(exports,"EThumbnailOption",{enumerable:!0,get:function(){return tool.EThumbnailOption}}),Object.defineProperty(exports,"EToolName",{enumerable:!0,get:function(){return tool.EToolName}}),Object.defineProperty(exports,"EToolType",{enumerable:!0,get:function(){return tool.EToolType}}),Object.defineProperty(exports,"EVideoToolName",{enumerable:!0,get:function(){return tool.EVideoToolName}}),exports.OPERATION_LIST=tool.OPERATION_LIST,exports.SEGMENT_NUMBER=tool.SEGMENT_NUMBER,exports.TEXT_ATTRIBUTE_LINE_HEIGHT=tool.TEXT_ATTRIBUTE_LINE_HEIGHT,exports.TEXT_ATTRIBUTE_MAX_LENGTH=tool.TEXT_ATTRIBUTE_MAX_LENGTH,exports.TEXT_TYPE=tool.TEXT_TYPE,exports.TOOL_NAME=tool.TOOL_NAME,exports.TOOL_NAME_EN=tool.TOOL_NAME_EN,exports.cTool=tool,exports.edgeAdsorptionScope=tool.edgeAdsorptionScope,exports.editStepWidth=tool.editStepWidth,exports.TagUtils=TagUtils,exports.uuid=uuid,exports.MarkerUtils=MarkerUtils,exports.RectUtils=RectUtils,exports.AxisUtils=AxisUtils.default,exports.DrawUtils=DrawUtils,exports.ImgUtils=ImgUtils,exports.MathUtils=MathUtils.default,exports.AttributeUtils=AttributeUtils.default,exports.ActionsHistory=ActionsHistory,exports.DblClickEventListener=DblClickEventListener,exports.AnnotationEngine=index,exports.UnitUtils=UnitUtils,exports.CanvasScheduler=CanvasScheduler.CanvasScheduler,exports.PointCloud=index$1.PointCloud,exports.createThreeMatrix4=matrix.createThreeMatrix4,exports.getCuboidFromPointCloudBox=matrix.getCuboidFromPointCloudBox,exports.lidar2image=matrix.lidar2image,exports.pointCloudLidar2image=matrix.pointCloudLidar2image,exports.rotatePoint=matrix.rotatePoint,exports.transferKitti2Matrix=matrix.transferKitti2Matrix,exports.PointCloudAnnotation=annotation$1.PointCloudAnnotation,exports.CommonToolUtils=CommonToolUtils,exports.toolUtils=toolUtils;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rectOperation=require("./core/toolOperation/rectOperation.js"),tagOperation=require("./core/toolOperation/tagOperation.js"),pointOperation=require("./core/toolOperation/pointOperation.js"),LineToolOperation=require("./core/toolOperation/LineToolOperation.js"),TextToolOperation=require("./core/toolOperation/TextToolOperation.js"),polygonOperation=require("./core/toolOperation/polygonOperation.js"),measureOperation=require("./core/toolOperation/measureOperation.js"),basicToolOperation=require("./core/toolOperation/basicToolOperation.js"),ViewOperation=require("./core/toolOperation/ViewOperation.js"),ScribbleTool=require("./core/toolOperation/ScribbleTool.js"),pointCloud2dOperation=require("./core/toolOperation/pointCloud2dOperation.js"),annotation=require("./constant/annotation.js"),annotationTask=require("./constant/annotationTask.js"),keyCode=require("./constant/keyCode.js"),style=require("./constant/style.js"),tool=require("./constant/tool.js"),TagUtils=require("./utils/tool/TagUtils.js"),uuid=require("./utils/uuid.js"),EnhanceCommonToolUtils=require("./utils/tool/EnhanceCommonToolUtils.js"),MarkerUtils=require("./utils/tool/MarkerUtils.js"),RectUtils=require("./utils/tool/RectUtils.js"),AxisUtils=require("./utils/tool/AxisUtils.js"),DrawUtils=require("./utils/tool/DrawUtils.js"),ImgUtils=require("./utils/ImgUtils.js"),MathUtils=require("./utils/MathUtils.js"),AttributeUtils=require("./utils/tool/AttributeUtils.js"),ActionsHistory=require("./utils/ActionsHistory.js"),DblClickEventListener=require("./utils/tool/DblClickEventListener.js"),index=require("./core/index.js"),UnitUtils=require("./utils/tool/UnitUtils.js"),StyleUtils=require("./utils/tool/StyleUtils.js"),CanvasScheduler=require("./newCore/CanvasScheduler.js"),index$1=require("./core/pointCloud/index.js"),matrix=require("./core/pointCloud/matrix.js"),annotation$1=require("./core/pointCloud/annotation.js");function _interopNamespaceDefaultOnly(e){return Object.freeze({__proto__:null,default:e})}var keyCode__namespace=_interopNamespaceDefaultOnly(keyCode);const CommonToolUtils=EnhanceCommonToolUtils.default,toolUtils=EnhanceCommonToolUtils.default;exports.RectOperation=rectOperation.RectOperation,exports.TagOperation=tagOperation,exports.PointOperation=pointOperation,exports.LineToolOperation=LineToolOperation.default,exports.TextToolOperation=TextToolOperation,exports.PolygonOperation=polygonOperation,exports.MeasureOperation=measureOperation,exports.BasicToolOperation=basicToolOperation.BasicToolOperation,exports.ViewOperation=ViewOperation,exports.ScribbleTool=ScribbleTool,exports.PointCloud2dOperation=pointCloud2dOperation,exports.cAnnotation=annotation,exports.cAnnotationTask=annotationTask,exports.cKeyCode=keyCode__namespace,exports.cStyle=style,exports.CLIENT_TOOL_HEAD_TYPE=tool.CLIENT_TOOL_HEAD_TYPE,exports.CLIENT_TOOL_NAME=tool.CLIENT_TOOL_NAME,exports.DEFAULT_FONT=tool.DEFAULT_FONT,exports.DEFAULT_TEXT_MAX_WIDTH=tool.DEFAULT_TEXT_MAX_WIDTH,Object.defineProperty(exports,"EAnnotationMode",{enumerable:!0,get:function(){return tool.EAnnotationMode}}),Object.defineProperty(exports,"EAuditStatus",{enumerable:!0,get:function(){return tool.EAuditStatus}}),Object.defineProperty(exports,"ECheckModel",{enumerable:!0,get:function(){return tool.ECheckModel}}),Object.defineProperty(exports,"EDependPattern",{enumerable:!0,get:function(){return tool.EDependPattern}}),Object.defineProperty(exports,"EDragTarget",{enumerable:!0,get:function(){return tool.EDragTarget}}),Object.defineProperty(exports,"EDrawPointPattern",{enumerable:!0,get:function(){return tool.EDrawPointPattern}}),Object.defineProperty(exports,"EFilterToolOperation",{enumerable:!0,get:function(){return tool.EFilterToolOperation}}),Object.defineProperty(exports,"ELineColor",{enumerable:!0,get:function(){return tool.ELineColor}}),Object.defineProperty(exports,"ELineTypes",{enumerable:!0,get:function(){return tool.ELineTypes}}),Object.defineProperty(exports,"EOperationMode",{enumerable:!0,get:function(){return tool.EOperationMode}}),Object.defineProperty(exports,"EPageOperator",{enumerable:!0,get:function(){return tool.EPageOperator}}),Object.defineProperty(exports,"EPointCloudName",{enumerable:!0,get:function(){return tool.EPointCloudName}}),Object.defineProperty(exports,"EPolygonPattern",{enumerable:!0,get:function(){return tool.EPolygonPattern}}),Object.defineProperty(exports,"ERectPattern",{enumerable:!0,get:function(){return tool.ERectPattern}}),Object.defineProperty(exports,"EScribblePattern",{enumerable:!0,get:function(){return tool.EScribblePattern}}),Object.defineProperty(exports,"ESelectedType",{enumerable:!0,get:function(){return tool.ESelectedType}}),Object.defineProperty(exports,"ETextType",{enumerable:!0,get:function(){return tool.ETextType}}),Object.defineProperty(exports,"EThumbnailOption",{enumerable:!0,get:function(){return tool.EThumbnailOption}}),Object.defineProperty(exports,"EToolName",{enumerable:!0,get:function(){return tool.EToolName}}),Object.defineProperty(exports,"EToolType",{enumerable:!0,get:function(){return tool.EToolType}}),Object.defineProperty(exports,"EVideoToolName",{enumerable:!0,get:function(){return tool.EVideoToolName}}),exports.OPERATION_LIST=tool.OPERATION_LIST,exports.SEGMENT_NUMBER=tool.SEGMENT_NUMBER,exports.TEXT_ATTRIBUTE_LINE_HEIGHT=tool.TEXT_ATTRIBUTE_LINE_HEIGHT,exports.TEXT_ATTRIBUTE_MAX_LENGTH=tool.TEXT_ATTRIBUTE_MAX_LENGTH,exports.TEXT_TYPE=tool.TEXT_TYPE,exports.TOOL_NAME=tool.TOOL_NAME,exports.TOOL_NAME_EN=tool.TOOL_NAME_EN,exports.cTool=tool,exports.edgeAdsorptionScope=tool.edgeAdsorptionScope,exports.editStepWidth=tool.editStepWidth,exports.TagUtils=TagUtils,exports.uuid=uuid,exports.MarkerUtils=MarkerUtils,exports.RectUtils=RectUtils,exports.AxisUtils=AxisUtils.default,exports.DrawUtils=DrawUtils,exports.ImgUtils=ImgUtils,exports.MathUtils=MathUtils.default,exports.AttributeUtils=AttributeUtils.default,exports.ActionsHistory=ActionsHistory,exports.DblClickEventListener=DblClickEventListener,exports.AnnotationEngine=index,exports.UnitUtils=UnitUtils,exports.StyleUtils=StyleUtils,exports.CanvasScheduler=CanvasScheduler.CanvasScheduler,exports.PointCloud=index$1.PointCloud,exports.createThreeMatrix4=matrix.createThreeMatrix4,exports.getCuboidFromPointCloudBox=matrix.getCuboidFromPointCloudBox,exports.lidar2image=matrix.lidar2image,exports.pointCloudLidar2image=matrix.pointCloudLidar2image,exports.rotatePoint=matrix.rotatePoint,exports.transferKitti2Matrix=matrix.transferKitti2Matrix,exports.PointCloudAnnotation=annotation$1.PointCloudAnnotation,exports.CommonToolUtils=CommonToolUtils,exports.toolUtils=toolUtils;
|
|
@@ -29,7 +29,8 @@ export declare enum EDragStatus {
|
|
|
29
29
|
export declare enum EDragTarget {
|
|
30
30
|
Point = 0,
|
|
31
31
|
Line = 1,
|
|
32
|
-
Plane = 2
|
|
32
|
+
Plane = 2,
|
|
33
|
+
Cuboid = 3
|
|
33
34
|
}
|
|
34
35
|
/** 顺序 */
|
|
35
36
|
export declare enum ESortDirection {
|
|
@@ -72,3 +73,46 @@ export declare const TEXT_ATTRIBUTE_OFFSET: {
|
|
|
72
73
|
x: number;
|
|
73
74
|
y: number;
|
|
74
75
|
};
|
|
76
|
+
export declare enum ECuboidPlain {
|
|
77
|
+
Front = "front",
|
|
78
|
+
Back = "back",
|
|
79
|
+
Side = "side"
|
|
80
|
+
}
|
|
81
|
+
export declare enum ECuboidPosition {
|
|
82
|
+
TL = "tl",
|
|
83
|
+
TR = "tr",
|
|
84
|
+
BL = "bl",
|
|
85
|
+
BR = "br"
|
|
86
|
+
}
|
|
87
|
+
export declare enum ECuboidDirection {
|
|
88
|
+
Front = "front",
|
|
89
|
+
Back = "back",
|
|
90
|
+
Left = "left",
|
|
91
|
+
Right = "right",
|
|
92
|
+
Top = "top"
|
|
93
|
+
}
|
|
94
|
+
export declare const DIAGONAL_POINT: {
|
|
95
|
+
tl: string;
|
|
96
|
+
tr: string;
|
|
97
|
+
br: string;
|
|
98
|
+
bl: string;
|
|
99
|
+
};
|
|
100
|
+
export declare enum ECuboidLineDirection {
|
|
101
|
+
Row = "row",
|
|
102
|
+
Column = "column"
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get the Position by the point and direction(Row or Column).
|
|
106
|
+
*/
|
|
107
|
+
export declare const CUBOID_ROW: {
|
|
108
|
+
tl: ECuboidPosition;
|
|
109
|
+
tr: ECuboidPosition;
|
|
110
|
+
bl: ECuboidPosition;
|
|
111
|
+
br: ECuboidPosition;
|
|
112
|
+
};
|
|
113
|
+
export declare const CUBOID_COLUMN: {
|
|
114
|
+
tl: ECuboidPosition;
|
|
115
|
+
tr: ECuboidPosition;
|
|
116
|
+
bl: ECuboidPosition;
|
|
117
|
+
br: ECuboidPosition;
|
|
118
|
+
};
|
|
@@ -52,7 +52,11 @@ export declare enum EToolName {
|
|
|
52
52
|
/** OCR关联关系工具 */
|
|
53
53
|
OCRRelation = "OCRRelationTool",
|
|
54
54
|
/** 算法分割辅助工具 */
|
|
55
|
-
SegmentByRect = "segmentByRectTool"
|
|
55
|
+
SegmentByRect = "segmentByRectTool",
|
|
56
|
+
/** 立体框工具 */
|
|
57
|
+
Cuboid = "cuboidTool",
|
|
58
|
+
/** 点云多边形工具 */
|
|
59
|
+
PointCloudPolygon = "pointCloudPolygon"
|
|
56
60
|
}
|
|
57
61
|
export declare enum ECheckModel {
|
|
58
62
|
Check = "check"
|
|
@@ -63,6 +67,7 @@ export declare enum ERectPattern {
|
|
|
63
67
|
'showOrder' = 2
|
|
64
68
|
}
|
|
65
69
|
export type ToolName = EToolName | EVideoToolName | EPointCloudName;
|
|
70
|
+
export type THybridToolName = EToolName | Array<EToolName>;
|
|
66
71
|
export declare const TOOL_NAME: {
|
|
67
72
|
[a: string]: string;
|
|
68
73
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AnnotationEngine 标注引擎 - 各类标注工具管理
|
|
3
3
|
*/
|
|
4
|
-
import { EToolName } from '@/constant/tool';
|
|
4
|
+
import { EToolName, THybridToolName } from '@/constant/tool';
|
|
5
5
|
import { IPolygonData } from '@/types/tool/polygon';
|
|
6
|
-
import { THybridToolName } from './scheduler';
|
|
7
6
|
interface IProps {
|
|
8
7
|
container: HTMLElement;
|
|
9
8
|
size: ISize;
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
* @createDate 2022-07-18
|
|
4
4
|
* @author Ron <ron.f.luo@gmail.com>
|
|
5
5
|
*/
|
|
6
|
-
import { IPointCloudBox, IPointCloudConfig } from '@labelbee/lb-utils';
|
|
6
|
+
import { IPointCloudBox, IPointCloudSphere, IPointCloudConfig } from '@labelbee/lb-utils';
|
|
7
|
+
import { EToolName, THybridToolName } from '@/constant/tool';
|
|
7
8
|
import { CanvasScheduler } from '@/newCore';
|
|
8
9
|
import { IPolygonData } from '@/types/tool/polygon';
|
|
9
10
|
import { PointCloud } from '.';
|
|
10
11
|
import PointCloud2dOperation, { IPointCloud2dOperationProps } from '../toolOperation/pointCloud2dOperation';
|
|
12
|
+
import { IPointOperationProps } from '../toolOperation/pointOperation';
|
|
13
|
+
import { ToolScheduler } from '../scheduler';
|
|
11
14
|
interface IPointCloudAnnotationOperation {
|
|
12
15
|
updateData: (pcdPath: string, result: string) => void;
|
|
13
16
|
}
|
|
@@ -15,16 +18,19 @@ interface IPointCloudAnnotationProps {
|
|
|
15
18
|
container: HTMLElement;
|
|
16
19
|
size: ISize;
|
|
17
20
|
pcdPath?: string;
|
|
18
|
-
|
|
21
|
+
extraProps?: IPointCloud2dOperationProps | IPointOperationProps;
|
|
19
22
|
config: IPointCloudConfig;
|
|
20
23
|
checkMode?: boolean;
|
|
24
|
+
toolName: THybridToolName;
|
|
21
25
|
}
|
|
22
26
|
export declare class PointCloudAnnotation implements IPointCloudAnnotationOperation {
|
|
23
27
|
pointCloudInstance: PointCloud;
|
|
24
28
|
pointCloud2dOperation: PointCloud2dOperation;
|
|
25
29
|
canvasScheduler: CanvasScheduler;
|
|
30
|
+
toolScheduler: ToolScheduler;
|
|
31
|
+
toolInstance: any;
|
|
26
32
|
config: IPointCloudConfig;
|
|
27
|
-
constructor({ size, container, pcdPath,
|
|
33
|
+
constructor({ size, container, pcdPath, extraProps, config, checkMode, toolName }: IPointCloudAnnotationProps);
|
|
28
34
|
updateConfig(config: IPointCloudConfig): void;
|
|
29
35
|
/**
|
|
30
36
|
* Get default boundary by size.
|
|
@@ -45,7 +51,9 @@ export declare class PointCloudAnnotation implements IPointCloudAnnotationOperat
|
|
|
45
51
|
*/
|
|
46
52
|
initSize(size: ISize): void;
|
|
47
53
|
addPolygonListOnTopView(result: string): void;
|
|
54
|
+
addPointListOnTopView(result: string): void;
|
|
48
55
|
updatePolygonList: (pointCloudDataList: IPointCloudBox[], extraList?: IPolygonData[]) => void;
|
|
56
|
+
updatePointList: (sphereList: IPointCloudSphere[]) => void;
|
|
49
57
|
/**
|
|
50
58
|
* Init or Update PointCloud Data
|
|
51
59
|
* @param pcdPath
|
|
@@ -55,6 +63,11 @@ export declare class PointCloudAnnotation implements IPointCloudAnnotationOperat
|
|
|
55
63
|
updateData(pcdPath: string, result: string, config?: {
|
|
56
64
|
radius?: number;
|
|
57
65
|
}): void;
|
|
66
|
+
/**
|
|
67
|
+
* switch to chosen canvas。
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
switchToCanvas(toolName: EToolName): any;
|
|
58
71
|
/**
|
|
59
72
|
* Init All Position
|
|
60
73
|
* 1. PointCloud camera change to topView
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @author Ron <ron.f.luo@gmail.com>
|
|
5
5
|
*/
|
|
6
6
|
import * as THREE from 'three';
|
|
7
|
-
import { TMatrix4Tuple, EPerspectiveView, IVolume, IPointCloudBox, I3DSpaceCoord, IPointCloudConfig } from '@labelbee/lb-utils';
|
|
7
|
+
import { TMatrix4Tuple, EPerspectiveView, IVolume, IPointCloudBox, IPointCloudSphere, I3DSpaceCoord, IPointCloudConfig } from '@labelbee/lb-utils';
|
|
8
8
|
import { OrthographicCamera, PerspectiveCamera, Shader } from 'three';
|
|
9
9
|
import { IPolygonPoint } from '@/types/tool/polygon';
|
|
10
10
|
import { PCDLoader } from './PCDLoader';
|
|
@@ -48,7 +48,6 @@ export declare class PointCloud {
|
|
|
48
48
|
private cacheInstance;
|
|
49
49
|
private showDirection;
|
|
50
50
|
private currentPCDSrc?;
|
|
51
|
-
private pointsMaterialSize;
|
|
52
51
|
/**
|
|
53
52
|
* Record the src of Highlight PCD.
|
|
54
53
|
*
|
|
@@ -88,7 +87,14 @@ export declare class PointCloud {
|
|
|
88
87
|
getAllAttributeColor(boxes: IPointCloudBox[]): {
|
|
89
88
|
[k: string]: any;
|
|
90
89
|
};
|
|
91
|
-
|
|
90
|
+
/**
|
|
91
|
+
* add new sphere just like adding new box
|
|
92
|
+
* @param sphereParams
|
|
93
|
+
*/
|
|
94
|
+
addSphereToSense: (sphereParams: IPointCloudSphere, color?: string) => void;
|
|
95
|
+
generateSphere: (sphereParams: IPointCloudSphere) => void;
|
|
96
|
+
generateSpheres: (spheres: IPointCloudSphere[]) => void;
|
|
97
|
+
AddBoxToSense: (boxParams: IPointCloudBox, color?: number) => void;
|
|
92
98
|
generateBoxes(boxes: IPointCloudBox[]): void;
|
|
93
99
|
/**
|
|
94
100
|
* Get OrthographicCamera Params to Change
|
|
@@ -112,9 +118,13 @@ export declare class PointCloud {
|
|
|
112
118
|
* @param customCameraVector Provide a custom way.
|
|
113
119
|
*/
|
|
114
120
|
updateCameraByBox(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView, customCameraVector?: I3DSpaceCoord): THREE.Vector3;
|
|
121
|
+
updateCameraBySphere(sphereParams: IPointCloudSphere, perspectiveView: EPerspectiveView): THREE.Vector3;
|
|
115
122
|
updateOrthoCamera(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView): {
|
|
116
123
|
cameraPositionVector: THREE.Vector3;
|
|
117
124
|
};
|
|
125
|
+
updateOrthoCameraBySphere(sphereParams: IPointCloudSphere, perspectiveView: EPerspectiveView): {
|
|
126
|
+
cameraPositionVector: THREE.Vector3;
|
|
127
|
+
};
|
|
118
128
|
/**
|
|
119
129
|
* Initialize the camera to the initial position
|
|
120
130
|
*/
|
|
@@ -183,11 +193,20 @@ export declare class PointCloud {
|
|
|
183
193
|
generateBoxArrow: ({ width }: IPointCloudBox) => THREE.ArrowHelper;
|
|
184
194
|
generateBoxTrackID: (boxParams: IPointCloudBox) => THREE.Sprite | undefined;
|
|
185
195
|
getTextCanvas(text: string): HTMLCanvasElement;
|
|
186
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Filter road points and noise in all directions
|
|
198
|
+
* 1. The first 5% of the z-axis is used as the road coordinate
|
|
199
|
+
* 2. Filter out points 10cm above the road surface.
|
|
200
|
+
* 3. Filter out the first 0.5% of noise points in other directions
|
|
201
|
+
*/
|
|
202
|
+
filterNoise(innerPointList: I3DSpaceCoord[]): I3DSpaceCoord[];
|
|
203
|
+
getFittedCoordinates(polygon: IPolygonPoint[], innerPointList: ICoordinate[]): import("@labelbee/lb-utils").ICoordinate[];
|
|
204
|
+
getSensesPointZAxisInPolygon(polygon: IPolygonPoint[], zScope?: [number, number], intelligentFit?: boolean): {
|
|
187
205
|
maxZ: number;
|
|
188
206
|
minZ: number;
|
|
189
207
|
count: number;
|
|
190
208
|
zCount: number;
|
|
209
|
+
fittedCoordinates: ICoordinate[];
|
|
191
210
|
};
|
|
192
211
|
/**
|
|
193
212
|
* ViewPort - Transformation
|
|
@@ -244,6 +263,14 @@ export declare class PointCloud {
|
|
|
244
263
|
polygon2d: THREE.Vector3[];
|
|
245
264
|
zoom: number;
|
|
246
265
|
};
|
|
266
|
+
getSphereSidePoint2DCoordinate(sphereParams: IPointCloudSphere): {
|
|
267
|
+
point2d: THREE.Vector3;
|
|
268
|
+
zoom: number;
|
|
269
|
+
};
|
|
270
|
+
getSphereBackPoint2DCoordinate(sphereParams: IPointCloudSphere): {
|
|
271
|
+
point2d: THREE.Vector3;
|
|
272
|
+
zoom: number;
|
|
273
|
+
};
|
|
247
274
|
boxParams2ViewPolygon(boxParams: IPointCloudBox, perspectiveView: EPerspectiveView): {
|
|
248
275
|
x: number;
|
|
249
276
|
y: number;
|
|
@@ -267,6 +294,17 @@ export declare class PointCloud {
|
|
|
267
294
|
polygon2d: THREE.Vector3[];
|
|
268
295
|
zoom: number;
|
|
269
296
|
};
|
|
297
|
+
getSpherePoint2DCoordinate(sphereParams: IPointCloudSphere): {
|
|
298
|
+
point2d: THREE.Vector3;
|
|
299
|
+
zoom: number;
|
|
300
|
+
};
|
|
301
|
+
getSphereTopPoint2DCoordinate(sphereParams: IPointCloudSphere): {
|
|
302
|
+
point2d: {
|
|
303
|
+
x: number;
|
|
304
|
+
y: number;
|
|
305
|
+
};
|
|
306
|
+
zoom: number;
|
|
307
|
+
};
|
|
270
308
|
getBoxTopPolygon2DCoordinate(boxParams: IPointCloudBox): {
|
|
271
309
|
polygon2d: {
|
|
272
310
|
x: number;
|
|
@@ -317,6 +355,7 @@ export declare class PointCloud {
|
|
|
317
355
|
[k: string]: string;
|
|
318
356
|
} | undefined;
|
|
319
357
|
count?: number | undefined;
|
|
358
|
+
newPointList?: import("@labelbee/lb-utils").ICoordinate[] | undefined;
|
|
320
359
|
};
|
|
321
360
|
} | undefined;
|
|
322
361
|
/**
|
|
@@ -326,13 +365,9 @@ export declare class PointCloud {
|
|
|
326
365
|
applyZAxisPoints: (zAxisLimit: number) => void;
|
|
327
366
|
/**
|
|
328
367
|
* Update point size
|
|
329
|
-
* @param
|
|
330
|
-
* @returns
|
|
368
|
+
* @param zoomIn
|
|
331
369
|
*/
|
|
332
|
-
updatePointSize: (
|
|
333
|
-
zoomIn?: boolean | undefined;
|
|
334
|
-
customSize?: number | undefined;
|
|
335
|
-
}) => void;
|
|
370
|
+
updatePointSize: (zoomIn: boolean) => void;
|
|
336
371
|
render(): void;
|
|
337
372
|
}
|
|
338
373
|
export * from './matrix';
|
|
@@ -44,6 +44,7 @@ export declare function getCuboidFromPointCloudBox(boxParams: IPointCloudBox): {
|
|
|
44
44
|
[k: string]: string;
|
|
45
45
|
} | undefined;
|
|
46
46
|
count?: number | undefined;
|
|
47
|
+
newPointList?: import("@labelbee/lb-utils").ICoordinate[] | undefined;
|
|
47
48
|
width: number;
|
|
48
49
|
height: number;
|
|
49
50
|
depth: number;
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* @createDate 2022-07-27
|
|
4
4
|
* @author Ron <ron.f.luo@gmail.com>
|
|
5
5
|
*/
|
|
6
|
-
import { EToolName } from '@/constant/tool';
|
|
6
|
+
import { EToolName, THybridToolName } from '@/constant/tool';
|
|
7
7
|
import { RectOperation } from './toolOperation/rectOperation';
|
|
8
8
|
import PolygonOperation from './toolOperation/polygonOperation';
|
|
9
9
|
import SegmentByRect from './toolOperation/segmentByRect';
|
|
10
|
-
export type THybridToolName = EToolName | Array<EToolName>;
|
|
11
10
|
interface IToolSchedulerOperation {
|
|
12
11
|
}
|
|
13
12
|
interface IToolSchedulerProps {
|
|
@@ -27,6 +26,7 @@ export declare class ToolScheduler implements IToolSchedulerOperation {
|
|
|
27
26
|
private container;
|
|
28
27
|
private toolOperationList;
|
|
29
28
|
private toolOperationDom;
|
|
29
|
+
private toolOperationNameList;
|
|
30
30
|
private size;
|
|
31
31
|
private config;
|
|
32
32
|
private style;
|
|
@@ -66,6 +66,22 @@ export declare class ToolScheduler implements IToolSchedulerOperation {
|
|
|
66
66
|
* @returns
|
|
67
67
|
*/
|
|
68
68
|
getFirstToolOperation(): RectOperation | PolygonOperation | SegmentByRect;
|
|
69
|
+
/**
|
|
70
|
+
* Switch to canvas by given toolName
|
|
71
|
+
* TODO: change operationList to operationMap
|
|
72
|
+
*/
|
|
73
|
+
switchToCanvas(toolName: EToolName): RectOperation | PolygonOperation | undefined;
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param toolName
|
|
77
|
+
* @param result
|
|
78
|
+
* Update result by give toolName
|
|
79
|
+
* All the operation instances are maintained in toolOperationList,
|
|
80
|
+
* there is no more specific instance like pointCloud2dOperation you can reach,
|
|
81
|
+
* so if you need to update result in specific operation instance, you can try this.
|
|
82
|
+
*/
|
|
83
|
+
updateDataByToolName(toolName: EToolName, result: any): void;
|
|
84
|
+
clearStatusAndResult(): void;
|
|
69
85
|
destroyAllLayer(): void;
|
|
70
86
|
init(): void;
|
|
71
87
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 查看模式 - 支持简单数据注入查看
|
|
3
3
|
*/
|
|
4
|
-
import { TAnnotationViewData, TAnnotationViewLine, TAnnotationViewPolygon, TAnnotationViewBox3d, IBasicStyle } from '@labelbee/lb-utils';
|
|
4
|
+
import { TAnnotationViewData, TAnnotationViewLine, TAnnotationViewPolygon, TAnnotationViewBox3d, IBasicStyle, TAnnotationViewCuboid } from '@labelbee/lb-utils';
|
|
5
5
|
import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
|
|
6
6
|
type IViewOperationProps = {
|
|
7
7
|
style: IBasicStyle;
|
|
@@ -80,8 +80,8 @@ export default class ViewOperation extends BasicToolOperation {
|
|
|
80
80
|
getRenderStyle(annotation: TAnnotationViewData): {
|
|
81
81
|
style: {
|
|
82
82
|
radius: any;
|
|
83
|
-
thickness: any;
|
|
84
83
|
fill: any;
|
|
84
|
+
thickness: any;
|
|
85
85
|
stroke: any;
|
|
86
86
|
};
|
|
87
87
|
fontStyle: {
|
|
@@ -95,6 +95,7 @@ export default class ViewOperation extends BasicToolOperation {
|
|
|
95
95
|
};
|
|
96
96
|
renderLine(annotation: TAnnotationViewLine): void;
|
|
97
97
|
renderPolygon(annotation: TAnnotationViewPolygon): void;
|
|
98
|
+
renderSingleCuboid(annotation: TAnnotationViewCuboid): void;
|
|
98
99
|
renderBox3d(annotation: TAnnotationViewBox3d): void;
|
|
99
100
|
render(): void;
|
|
100
101
|
}
|
|
@@ -143,6 +143,16 @@ declare class BasicToolOperation extends EventListener {
|
|
|
143
143
|
setForbidOperation(forbidOperation: boolean): void;
|
|
144
144
|
setForbidCursorLine(forbidCursorLine: boolean): void;
|
|
145
145
|
setIsHidden(isHidden: boolean): void;
|
|
146
|
+
setDefaultAttribute(attribute: string): void;
|
|
147
|
+
getCoordinateInOrigin(e: MouseEvent): {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Get the textIconSvg by attribute.
|
|
153
|
+
* @param attribute
|
|
154
|
+
*/
|
|
155
|
+
getTextIconSvg(attribute?: string): any;
|
|
146
156
|
/**
|
|
147
157
|
* 用于外界直接控制序号的是否展示
|
|
148
158
|
* @param isShowOrder
|
|
@@ -244,7 +254,7 @@ declare class BasicToolOperation extends EventListener {
|
|
|
244
254
|
* @returns
|
|
245
255
|
*/
|
|
246
256
|
updateRotate(): false | undefined;
|
|
247
|
-
/**
|
|
257
|
+
/** Get the current property color */
|
|
248
258
|
getColor(attribute?: string, config?: any): any;
|
|
249
259
|
getLineColor(attribute?: string): any;
|
|
250
260
|
clearInvalidPage(): void;
|