@labelbee/lb-annotation 1.27.0-alpha.62 → 1.27.0-alpha.64
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/constant/tool.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const editStepWidth=320;exports.EPointCloudName=void 0,function(o){o.PointCloud="pointCloudTool"}(exports.EPointCloudName||(exports.EPointCloudName={})),exports.EVideoToolName=void 0,function(o){o.VideoTextTool="videoTextTool",o.VideoTagTool="videoTagTool",o.VideoClipTool="videoClipTool"}(exports.EVideoToolName||(exports.EVideoToolName={})),exports.EAudioToolName=void 0,function(o){o.AudioTextTool="audioTextTool"}(exports.EAudioToolName||(exports.EAudioToolName={})),exports.EToolType=void 0,function(o){o[o.Rect=0]="Rect",o[o.Tag=1]="Tag"}(exports.EToolType||(exports.EToolType={})),exports.EToolName=void 0,function(o){o.Rect="rectTool",o.Tag="tagTool",o.Point="pointTool",o.PointMarker="pointMarkerTool",o.Segmentation="segmentationTool",o.Filter="filterTool",o.Text="textTool",o.Polygon="polygonTool",o.Line="lineTool",o.LineMarker="lineMarkerTool",o.Empty="emptyTool",o.FolderTag="folderTagTool",o.RectTrack="rectTrackTool",o.ScribbleTool="scribbleTool",o.Face="faceTool",o.ClientAttribute="clientAttributeTool",o.OCRRelation="OCRRelationTool",o.SegmentByRect="segmentByRectTool",o.Cuboid="cuboidTool",o.PointCloudPolygon="pointCloudPolygon",o.LLM="LLMTool",o.NLP="NLPTool"}(exports.EToolName||(exports.EToolName={})),exports.ECheckModel=void 0,function(o){o.Check="check"}(exports.ECheckModel||(exports.ECheckModel={})),exports.ERectPattern=void 0,function(o){o[o.nothing=0]="nothing",o[o.RectBG=1]="RectBG",o[o.showOrder=2]="showOrder"}(exports.ERectPattern||(exports.ERectPattern={}));const TOOL_NAME={[exports.EToolName.Rect]:"\u62C9\u6846",[exports.EToolName.Tag]:"\u6807\u7B7E",[exports.EToolName.Point]:"\u6807\u70B9",[exports.EToolName.PointMarker]:"\u5217\u8868\u6807\u70B9",[exports.EToolName.Segmentation]:"\u524D\u666F\u5206\u5272",[exports.EToolName.Filter]:"\u7B5B\u9009",[exports.EToolName.Text]:"\u6587\u672C",[exports.EToolName.Polygon]:"\u591A\u8FB9\u5F62",[exports.EToolName.Line]:"\u7EBF\u6761",[exports.EToolName.LineMarker]:"\u5217\u8868\u7EBF\u6761",[exports.EToolName.FolderTag]:"\u6587\u4EF6\u5939\u6807\u7B7E",[exports.EToolName.RectTrack]:"\u62C9\u6846\u8DDF\u8E2A",[exports.EToolName.Face]:"\u4EBA\u8138106\u5DE5\u5177",[exports.EToolName.ClientAttribute]:"\u5BA2\u6237\u7AEF\u5C5E\u6027\u5DE5\u5177",[exports.EToolName.OCRRelation]:"OCR\u5173\u8054\u5173\u7CFB\u5DE5\u5177",[exports.EToolName.SegmentByRect]:"\u7B97\u6CD5\u5206\u5272\u8F85\u52A9\u5DE5\u5177",[exports.EVideoToolName.VideoTextTool]:"\u89C6\u9891\u6587\u672C",[exports.EVideoToolName.VideoTagTool]:"\u89C6\u9891\u6807\u7B7E",[exports.EVideoToolName.VideoClipTool]:"\u89C6\u9891\u622A\u53D6",[exports.EPointCloudName.PointCloud]:"\u70B9\u4E91",[exports.EToolName.Cuboid]:"\u7ACB\u4F53\u6846",[exports.EToolName.LLM]:"\u5927\u6A21\u578B",[exports.EToolName.NLP]:"NLP\u6807\u6CE8"},TOOL_NAME_EN={[exports.EToolName.Rect]:"Rect",[exports.EToolName.Tag]:"Tag",[exports.EToolName.Point]:"Point",[exports.EToolName.PointMarker]:"PointMarker",[exports.EToolName.Segmentation]:"Segmentation",[exports.EToolName.Filter]:"Filter",[exports.EToolName.Text]:"Text",[exports.EToolName.Polygon]:"Polygon",[exports.EToolName.Line]:"Line",[exports.EToolName.LineMarker]:"LineMarker",[exports.EToolName.FolderTag]:"FolderTag",[exports.EToolName.RectTrack]:"RectTrack",[exports.EToolName.Face]:"Face",[exports.EToolName.ClientAttribute]:"ClientAttribute",[exports.EToolName.OCRRelation]:"OCRRelation",[exports.EToolName.SegmentByRect]:"SegmentByRect",[exports.EVideoToolName.VideoTextTool]:"VideoTextTool",[exports.EVideoToolName.VideoTagTool]:"VideoTagTool",[exports.EVideoToolName.VideoClipTool]:"VideoClipTool",[exports.EPointCloudName.PointCloud]:"PointCloud",[exports.EToolName.Cuboid]:"Cuboid",[exports.EToolName.LLM]:"LLM",[exports.EToolName.NLP]:"NLP"};exports.EDependPattern=void 0,function(o){o[o.noDepend=1]="noDepend",o[o.dependOrigin=2]="dependOrigin",o[o.dependShape=3]="dependShape",o[o.dependLine=4]="dependLine",o[o.dependPolygon=5]="dependPolygon",o[o.dependPreShape=101]="dependPreShape",o[o.dependPreLine=102]="dependPreLine",o[o.dependPrePolygon=103]="dependPrePolygon"}(exports.EDependPattern||(exports.EDependPattern={})),exports.EFilterToolOperation=void 0,function(o){o.lc="leftClick",o.rc="rightClick",o.clc="ctrlLeftClick",o.crc="ctrlRightClick"}(exports.EFilterToolOperation||(exports.EFilterToolOperation={}));const OPERATION_LIST={leftClick:"\u9F20\u6807\u5DE6\u952E",rightClick:"\u9F20\u6807\u53F3\u952E",ctrlLeftClick:"ctrl + \u9F20\u6807\u5DE6\u952E",ctrlRightClick:"ctrl + \u9F20\u6807\u53F3\u952E"};exports.EAnnotationMode=void 0,function(o){o[o.Normal=1]="Normal",o[o.Modify=2]="Modify"}(exports.EAnnotationMode||(exports.EAnnotationMode={})),exports.ELineTypes=void 0,function(o){o[o.Line=0]="Line",o[o.Curve=1]="Curve"}(exports.ELineTypes||(exports.ELineTypes={})),exports.ELineColor=void 0,function(o){o[o.SingleColor=0]="SingleColor",o[o.MultiColor=1]="MultiColor"}(exports.ELineColor||(exports.ELineColor={})),exports.ESelectedType=void 0,function(o){o[o.Form=1]="Form",o[o.Json=2]="Json"}(exports.ESelectedType||(exports.ESelectedType={})),exports.EDragTarget=void 0,function(o){o[o.Point=0]="Point",o[o.Line=1]="Line",o[o.Plane=2]="Plane"}(exports.EDragTarget||(exports.EDragTarget={})),exports.EDrawPointPattern=void 0,function(o){o[o.None=0]="None",o[o.Drawing=1]="Drawing",o[o.Edit=2]="Edit"}(exports.EDrawPointPattern||(exports.EDrawPointPattern={})),exports.EPageOperator=void 0,function(o){o[o.Backward=0]="Backward",o[o.Forward=1]="Forward",o[o.JumpSkip=2]="JumpSkip",o[o.None=3]="None"}(exports.EPageOperator||(exports.EPageOperator={})),exports.EAuditStatus=void 0,function(o){o[o.Wait=0]="Wait",o[o.Pass=1]="Pass",o[o.Fail=2]="Fail",o[o.Loading=3]="Loading"}(exports.EAuditStatus||(exports.EAuditStatus={})),exports.ETextType=void 0,function(o){o[o.AnyString=0]="AnyString",o[o.Order=1]="Order",o[o.EnglishOnly=2]="EnglishOnly",o[o.NumberOnly=3]="NumberOnly",o[o.CustomFormat=4]="CustomFormat"}(exports.ETextType||(exports.ETextType={}));const TEXT_TYPE={0:"\u4EFB\u610F\u5B57\u7B26",1:"\u5E8F\u53F7",2:"\u4EC5\u82F1\u6587",3:"\u4EC5\u6570\u5B57"},TEXT_ATTRIBUTE_MAX_LENGTH=1e3,TEXT_ATTRIBUTE_LINE_HEIGHT=16,DEFAULT_TEXT_MAX_WIDTH=300,DEFAULT_FONT="normal normal 500 14px Arial";exports.EThumbnailOption=void 0,function(o){o[o.ImgList=1e3]="ImgList",o[o.TrackPrediction=1001]="TrackPrediction",o[o.ImgSearch=1002]="ImgSearch"}(exports.EThumbnailOption||(exports.EThumbnailOption={}));const CLIENT_TOOL_HEAD_TYPE={[exports.EPointCloudName.PointCloud]:"sensebeepc",[exports.EToolName.ClientAttribute]:"sensebeepc-EnumAttributeTool",[exports.EToolName.Face]:"sensebeepc-FacePointsLabellingTool",[exports.EToolName.OCRRelation]:"sensebeepc-OCRRelationTool"},CLIENT_TOOL_NAME={[exports.EPointCloudName.PointCloud]:"\u70B9\u4E91\u5BA2\u6237\u7AEF",[exports.EToolName.ClientAttribute]:"\u5BA2\u6237\u7AEF\u5C5E\u6027\u5DE5\u5177",[exports.EToolName.Face]:"\u4EBA\u8138106\u70B9\u5DE5\u5177",[exports.EToolName.OCRRelation]:"OCR\u5173\u8054\u5173\u7CFB\u5DE5\u5177"},SEGMENT_NUMBER=16,edgeAdsorptionScope=10;exports.EPolygonPattern=void 0,function(o){o[o.Normal=0]="Normal",o[o.Rect=1]="Rect"}(exports.EPolygonPattern||(exports.EPolygonPattern={})),exports.EScribblePattern=void 0,function(o){o[o.Scribble=1]="Scribble",o[o.Erase=2]="Erase"}(exports.EScribblePattern||(exports.EScribblePattern={})),exports.EOperationMode=void 0,function(o){o[o.General=1]="General",o[o.MultiMove=2]="MultiMove"}(exports.EOperationMode||(exports.EOperationMode={})),exports.CLIENT_TOOL_HEAD_TYPE=CLIENT_TOOL_HEAD_TYPE,exports.CLIENT_TOOL_NAME=CLIENT_TOOL_NAME,exports.DEFAULT_FONT=DEFAULT_FONT,exports.DEFAULT_TEXT_MAX_WIDTH=DEFAULT_TEXT_MAX_WIDTH,exports.OPERATION_LIST=OPERATION_LIST,exports.SEGMENT_NUMBER=SEGMENT_NUMBER,exports.TEXT_ATTRIBUTE_LINE_HEIGHT=TEXT_ATTRIBUTE_LINE_HEIGHT,exports.TEXT_ATTRIBUTE_MAX_LENGTH=TEXT_ATTRIBUTE_MAX_LENGTH,exports.TEXT_TYPE=TEXT_TYPE,exports.TOOL_NAME=TOOL_NAME,exports.TOOL_NAME_EN=TOOL_NAME_EN,exports.edgeAdsorptionScope=edgeAdsorptionScope,exports.editStepWidth=editStepWidth;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const editStepWidth=320;exports.EPointCloudName=void 0,function(o){o.PointCloud="pointCloudTool"}(exports.EPointCloudName||(exports.EPointCloudName={})),exports.EVideoToolName=void 0,function(o){o.VideoTextTool="videoTextTool",o.VideoTagTool="videoTagTool",o.VideoClipTool="videoClipTool"}(exports.EVideoToolName||(exports.EVideoToolName={})),exports.EAudioToolName=void 0,function(o){o.AudioTextTool="audioTextTool"}(exports.EAudioToolName||(exports.EAudioToolName={})),exports.EToolType=void 0,function(o){o[o.Rect=0]="Rect",o[o.Tag=1]="Tag"}(exports.EToolType||(exports.EToolType={})),exports.EToolName=void 0,function(o){o.Rect="rectTool",o.Tag="tagTool",o.Point="pointTool",o.PointMarker="pointMarkerTool",o.Segmentation="segmentationTool",o.Filter="filterTool",o.Text="textTool",o.Polygon="polygonTool",o.Line="lineTool",o.LineMarker="lineMarkerTool",o.Empty="emptyTool",o.FolderTag="folderTagTool",o.RectTrack="rectTrackTool",o.ScribbleTool="scribbleTool",o.Face="faceTool",o.ClientAttribute="clientAttributeTool",o.OCRRelation="OCRRelationTool",o.SegmentByRect="segmentByRectTool",o.Cuboid="cuboidTool",o.PointCloudPolygon="pointCloudPolygon",o.LLM="LLMTool",o.NLP="NLPTool",o.LLMMultiWheel="LLMMultiWheelTool"}(exports.EToolName||(exports.EToolName={})),exports.ECheckModel=void 0,function(o){o.Check="check"}(exports.ECheckModel||(exports.ECheckModel={})),exports.ERectPattern=void 0,function(o){o[o.nothing=0]="nothing",o[o.RectBG=1]="RectBG",o[o.showOrder=2]="showOrder"}(exports.ERectPattern||(exports.ERectPattern={}));const TOOL_NAME={[exports.EToolName.Rect]:"\u62C9\u6846",[exports.EToolName.Tag]:"\u6807\u7B7E",[exports.EToolName.Point]:"\u6807\u70B9",[exports.EToolName.PointMarker]:"\u5217\u8868\u6807\u70B9",[exports.EToolName.Segmentation]:"\u524D\u666F\u5206\u5272",[exports.EToolName.Filter]:"\u7B5B\u9009",[exports.EToolName.Text]:"\u6587\u672C",[exports.EToolName.Polygon]:"\u591A\u8FB9\u5F62",[exports.EToolName.Line]:"\u7EBF\u6761",[exports.EToolName.LineMarker]:"\u5217\u8868\u7EBF\u6761",[exports.EToolName.FolderTag]:"\u6587\u4EF6\u5939\u6807\u7B7E",[exports.EToolName.RectTrack]:"\u62C9\u6846\u8DDF\u8E2A",[exports.EToolName.Face]:"\u4EBA\u8138106\u5DE5\u5177",[exports.EToolName.ClientAttribute]:"\u5BA2\u6237\u7AEF\u5C5E\u6027\u5DE5\u5177",[exports.EToolName.OCRRelation]:"OCR\u5173\u8054\u5173\u7CFB\u5DE5\u5177",[exports.EToolName.SegmentByRect]:"\u7B97\u6CD5\u5206\u5272\u8F85\u52A9\u5DE5\u5177",[exports.EVideoToolName.VideoTextTool]:"\u89C6\u9891\u6587\u672C",[exports.EVideoToolName.VideoTagTool]:"\u89C6\u9891\u6807\u7B7E",[exports.EVideoToolName.VideoClipTool]:"\u89C6\u9891\u622A\u53D6",[exports.EPointCloudName.PointCloud]:"\u70B9\u4E91",[exports.EToolName.Cuboid]:"\u7ACB\u4F53\u6846",[exports.EToolName.LLM]:"\u5927\u6A21\u578B",[exports.EToolName.NLP]:"NLP\u6807\u6CE8",[exports.EToolName.LLMMultiWheel]:"\u5927\u6A21\u578B\uFF08\u591A\u8F6E\u5BF9\u8BDD\uFF09"},TOOL_NAME_EN={[exports.EToolName.Rect]:"Rect",[exports.EToolName.Tag]:"Tag",[exports.EToolName.Point]:"Point",[exports.EToolName.PointMarker]:"PointMarker",[exports.EToolName.Segmentation]:"Segmentation",[exports.EToolName.Filter]:"Filter",[exports.EToolName.Text]:"Text",[exports.EToolName.Polygon]:"Polygon",[exports.EToolName.Line]:"Line",[exports.EToolName.LineMarker]:"LineMarker",[exports.EToolName.FolderTag]:"FolderTag",[exports.EToolName.RectTrack]:"RectTrack",[exports.EToolName.Face]:"Face",[exports.EToolName.ClientAttribute]:"ClientAttribute",[exports.EToolName.OCRRelation]:"OCRRelation",[exports.EToolName.SegmentByRect]:"SegmentByRect",[exports.EVideoToolName.VideoTextTool]:"VideoTextTool",[exports.EVideoToolName.VideoTagTool]:"VideoTagTool",[exports.EVideoToolName.VideoClipTool]:"VideoClipTool",[exports.EPointCloudName.PointCloud]:"PointCloud",[exports.EToolName.Cuboid]:"Cuboid",[exports.EToolName.LLM]:"LLM",[exports.EToolName.NLP]:"NLP",[exports.EToolName.LLMMultiWheel]:"LLMMultiWheelTool"};exports.EDependPattern=void 0,function(o){o[o.noDepend=1]="noDepend",o[o.dependOrigin=2]="dependOrigin",o[o.dependShape=3]="dependShape",o[o.dependLine=4]="dependLine",o[o.dependPolygon=5]="dependPolygon",o[o.dependPreShape=101]="dependPreShape",o[o.dependPreLine=102]="dependPreLine",o[o.dependPrePolygon=103]="dependPrePolygon"}(exports.EDependPattern||(exports.EDependPattern={})),exports.EFilterToolOperation=void 0,function(o){o.lc="leftClick",o.rc="rightClick",o.clc="ctrlLeftClick",o.crc="ctrlRightClick"}(exports.EFilterToolOperation||(exports.EFilterToolOperation={}));const OPERATION_LIST={leftClick:"\u9F20\u6807\u5DE6\u952E",rightClick:"\u9F20\u6807\u53F3\u952E",ctrlLeftClick:"ctrl + \u9F20\u6807\u5DE6\u952E",ctrlRightClick:"ctrl + \u9F20\u6807\u53F3\u952E"};exports.EAnnotationMode=void 0,function(o){o[o.Normal=1]="Normal",o[o.Modify=2]="Modify"}(exports.EAnnotationMode||(exports.EAnnotationMode={})),exports.ELineTypes=void 0,function(o){o[o.Line=0]="Line",o[o.Curve=1]="Curve"}(exports.ELineTypes||(exports.ELineTypes={})),exports.ELineColor=void 0,function(o){o[o.SingleColor=0]="SingleColor",o[o.MultiColor=1]="MultiColor"}(exports.ELineColor||(exports.ELineColor={})),exports.ESelectedType=void 0,function(o){o[o.Form=1]="Form",o[o.Json=2]="Json"}(exports.ESelectedType||(exports.ESelectedType={})),exports.EDragTarget=void 0,function(o){o[o.Point=0]="Point",o[o.Line=1]="Line",o[o.Plane=2]="Plane"}(exports.EDragTarget||(exports.EDragTarget={})),exports.EDrawPointPattern=void 0,function(o){o[o.None=0]="None",o[o.Drawing=1]="Drawing",o[o.Edit=2]="Edit"}(exports.EDrawPointPattern||(exports.EDrawPointPattern={})),exports.EPageOperator=void 0,function(o){o[o.Backward=0]="Backward",o[o.Forward=1]="Forward",o[o.JumpSkip=2]="JumpSkip",o[o.None=3]="None"}(exports.EPageOperator||(exports.EPageOperator={})),exports.EAuditStatus=void 0,function(o){o[o.Wait=0]="Wait",o[o.Pass=1]="Pass",o[o.Fail=2]="Fail",o[o.Loading=3]="Loading"}(exports.EAuditStatus||(exports.EAuditStatus={})),exports.ETextType=void 0,function(o){o[o.AnyString=0]="AnyString",o[o.Order=1]="Order",o[o.EnglishOnly=2]="EnglishOnly",o[o.NumberOnly=3]="NumberOnly",o[o.CustomFormat=4]="CustomFormat"}(exports.ETextType||(exports.ETextType={}));const TEXT_TYPE={0:"\u4EFB\u610F\u5B57\u7B26",1:"\u5E8F\u53F7",2:"\u4EC5\u82F1\u6587",3:"\u4EC5\u6570\u5B57"},TEXT_ATTRIBUTE_MAX_LENGTH=1e3,TEXT_ATTRIBUTE_LINE_HEIGHT=16,DEFAULT_TEXT_MAX_WIDTH=300,DEFAULT_FONT="normal normal 500 14px Arial";exports.EThumbnailOption=void 0,function(o){o[o.ImgList=1e3]="ImgList",o[o.TrackPrediction=1001]="TrackPrediction",o[o.ImgSearch=1002]="ImgSearch"}(exports.EThumbnailOption||(exports.EThumbnailOption={}));const CLIENT_TOOL_HEAD_TYPE={[exports.EPointCloudName.PointCloud]:"sensebeepc",[exports.EToolName.ClientAttribute]:"sensebeepc-EnumAttributeTool",[exports.EToolName.Face]:"sensebeepc-FacePointsLabellingTool",[exports.EToolName.OCRRelation]:"sensebeepc-OCRRelationTool"},CLIENT_TOOL_NAME={[exports.EPointCloudName.PointCloud]:"\u70B9\u4E91\u5BA2\u6237\u7AEF",[exports.EToolName.ClientAttribute]:"\u5BA2\u6237\u7AEF\u5C5E\u6027\u5DE5\u5177",[exports.EToolName.Face]:"\u4EBA\u8138106\u70B9\u5DE5\u5177",[exports.EToolName.OCRRelation]:"OCR\u5173\u8054\u5173\u7CFB\u5DE5\u5177"},SEGMENT_NUMBER=16,edgeAdsorptionScope=10;exports.EPolygonPattern=void 0,function(o){o[o.Normal=0]="Normal",o[o.Rect=1]="Rect"}(exports.EPolygonPattern||(exports.EPolygonPattern={})),exports.EScribblePattern=void 0,function(o){o[o.Scribble=1]="Scribble",o[o.Erase=2]="Erase"}(exports.EScribblePattern||(exports.EScribblePattern={})),exports.EOperationMode=void 0,function(o){o[o.General=1]="General",o[o.MultiMove=2]="MultiMove"}(exports.EOperationMode||(exports.EOperationMode={})),exports.CLIENT_TOOL_HEAD_TYPE=CLIENT_TOOL_HEAD_TYPE,exports.CLIENT_TOOL_NAME=CLIENT_TOOL_NAME,exports.DEFAULT_FONT=DEFAULT_FONT,exports.DEFAULT_TEXT_MAX_WIDTH=DEFAULT_TEXT_MAX_WIDTH,exports.OPERATION_LIST=OPERATION_LIST,exports.SEGMENT_NUMBER=SEGMENT_NUMBER,exports.TEXT_ATTRIBUTE_LINE_HEIGHT=TEXT_ATTRIBUTE_LINE_HEIGHT,exports.TEXT_ATTRIBUTE_MAX_LENGTH=TEXT_ATTRIBUTE_MAX_LENGTH,exports.TEXT_TYPE=TEXT_TYPE,exports.TOOL_NAME=TOOL_NAME,exports.TOOL_NAME_EN=TOOL_NAME_EN,exports.edgeAdsorptionScope=edgeAdsorptionScope,exports.editStepWidth=editStepWidth;
|
|
@@ -185,5 +185,12 @@ export default class MathUtils {
|
|
|
185
185
|
static getModifiedRectangleCoordinates(coordinates: ICoordinate[], newWidth: number, newHeight: number): ICoordinate[];
|
|
186
186
|
static calculatePointsInsideBox: (params: ICalculatePointsInsideBoxParams) => number;
|
|
187
187
|
static isPointInsideCube(point: I3DSpaceCoord, polygon: IPolygonPoint[], zScope: [number, number]): boolean;
|
|
188
|
+
static getCurrentPosFromRectCenter(size: {
|
|
189
|
+
width: number;
|
|
190
|
+
height: number;
|
|
191
|
+
}, centerPoint: IPolygonPoint, zoom: number): {
|
|
192
|
+
x: number;
|
|
193
|
+
y: number;
|
|
194
|
+
};
|
|
188
195
|
}
|
|
189
196
|
export {};
|
package/dist/utils/MathUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MathUtilsWorker=require("../_virtual/MathUtilsWorker.js"),tool=require("../constant/tool.js"),polygonTool=require("./tool/polygonTool.js"),PolygonUtils=require("./tool/PolygonUtils.js"),VectorUtils=require("./VectorUtils.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=(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));class Trigonometric{static tanAPlusB(n,t){return(n+t)/(1-n*t)}static sinAPlusB(n,t,i,o){return o*n+t*i}static cosAPlusB(n,t,i,o){return t*o-n*i}}var CubePosition;(function(e){e[e.Outside=0]="Outside",e[e.PartiallyInside=1]="PartiallyInside",e[e.FullyInside=2]="FullyInside"})(CubePosition||(CubePosition={}));function getCubePosition(e,n,t){const i=[{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2}];let o=0;for(let s=0;s<i.length;s++)MathUtils.isPointInsideCube(i[s],e,n)&&o++;return o===0?0:o===8?2:1}const _MathUtils=class{static getRotate(e){return e+90>=360?e+90-360:e+90}static getLineLength(e,n){return Math.sqrt(Math.pow(n.y-e.y,2)+Math.pow(n.x-e.x,2))}static getTextArea(e,n,t=tool.DEFAULT_TEXT_MAX_WIDTH,i=tool.DEFAULT_FONT,o){if(typeof n!="string")return{width:0,height:0};const s=e.getContext("2d");s.font=i;let r=0;typeof o=="undefined"&&(o=e&&parseInt(window.getComputedStyle(e).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const a=e&&parseInt(window.getComputedStyle(e).fontSize,10)||parseInt(window.getComputedStyle(document.body).fontSize,10)||0,c=n.split(`
|
|
2
|
-
`);let y=0;for(let h=0;h<c.length;h++){const f=c[h].split("");let g="";for(let d=0;d<f.length;d++){const x=g+f[d],p=s.measureText(x).width;p>t&&d>0?(g=f[d],r+=o,y=t):(g=x,p>y&&(y=p))}h!==c.length-1&&(r+=o)}return{width:y,height:r+a,lineHeight:o,fontHeight:a}}static getLineCenterPoint(e){const[n,t]=e,i=VectorUtils.getVector(n,t);return{x:n.x+i.x/2,y:n.y+i.y/2}}static getPerpendicularLine(e){if(e.length!==2)return;const[n,t]=e,i={x:t.x+t.y-n.y,y:t.y-(t.x-n.x)};return[t,i]}static getPerpendicularFootOfLine(e,n){if(e.length!==2)return e;const t=this.getPerpendicularLine(e);if(!t)return e;const[i,o]=t;return this.getFootOfPerpendicular(n,i,o).footPoint}static getQuadrangleFromTriangle(e){if(e.length!==3)return e;const[n,t,i]=e,o={x:i.x+n.x-t.x,y:i.y+n.y-t.y};return[n,t,i,o]}static getRectPerpendicularOffset(e,n,t){const[i,o]=t,s=this.getFootOfPerpendicular(e,i,o).footPoint,r=this.getFootOfPerpendicular(n,i,o).footPoint,a={x:s.x-r.x,y:s.y-r.y},c=VectorUtils.add(n,a);return VectorUtils.getVector(e,c)}static getArrayIndex(e,n){return e<0?n+e:e>=n?e-n:e}static getPointListFromPointOffset(e,n,t){const i=this.getArrayIndex(n-1,e.length),o=this.getArrayIndex(n+1,e.length),s=this.getArrayIndex(n-2,e.length),r=[...e];r[n]=VectorUtils.add(r[n],t);const a=this.getFootOfPerpendicular(r[n],r[s],r[i]).footPoint,c=this.getFootOfPerpendicular(r[n],r[o],r[s]).footPoint;return r[i]=a,r[o]=c,r}static getRectCenterPoint(e){const[n,,t]=e;return{x:(n.x+t.x)/2,y:(n.y+t.y)/2}}static rotateRectPointList(e=5,n){const t=this.getRectCenterPoint(n),{PI:i}=Math,o=Math.sin(e*i/180),s=Math.cos(e*i/180);return n.map(r=>{const a=VectorUtils.getVector(t,r),c=VectorUtils.len(a),y=a.y/c,h=a.x/c;return{x:c*Trigonometric.cosAPlusB(y,h,o,s)+t.x,y:c*Trigonometric.sinAPlusB(y,h,o,s)+t.y}})}static getRectangleByRightAngle(e,n){if(n.length!==2)return n;const t=_MathUtils.getPerpendicularFootOfLine(n,e);return _MathUtils.getQuadrangleFromTriangle([...n,t])}static getRadiusFromQuadrangle(e){const[,n,t]=e,i=t.y-n.y,o=n.x-t.x,s=this.getLineLength(n,t),r=i/s,a=Math.acos(r);return o>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(e){const n=e.filter(o=>o.type==="point").map(o=>o.annotation),t=e.filter(o=>!!["polygon","line"].includes(o.type)).map(o=>o.type==="polygon"?__spreadProps(__spreadValues({},o.annotation),{pointList:PolygonUtils.concatBeginAndEnd(o.annotation.pointList)}):o.annotation),i=new MathUtilsWorker;return{promise:new Promise(function(s){i.postMessage({points:n,backgroundList:t}),i.onmessage=r=>{s(r.data),i.terminate()}}),close:()=>{i.terminate()}}}static getCollectionPointByAnnotationData(e){const n=[],t=new Set,i=e.filter(r=>r.type==="point").map(r=>r.annotation),o=e.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?__spreadProps(__spreadValues({},r.annotation),{pointList:PolygonUtils.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=(r,a)=>{const{dropFoot:c}=PolygonUtils.getClosestPoint(r,a,tool.ELineTypes.Line,1,{isClose:!1});if(c!==r){const y=`${c.x} + ${c.y}`;t.has(y)||n.push(r),t.add(y)}};return i.forEach(r=>{s(r,o)}),o.forEach(r=>{let a="";a=r.id,o.forEach((c,y)=>{if(c.id===a)return;const h=[...o];h.splice(y,1),c.pointList.forEach(f=>{s(f,h)})})}),{connectionPoints:n}}static getModifiedRectangleCoordinates(e,n,t){if(e.length!==4)throw new Error("Invalid number of coordinates. Four coordinates are required.");const i=e[0],o=e[1],s=e[2],r=Math.sqrt(__pow(o.x-i.x,2)+__pow(o.y-i.y,2)),a=Math.sqrt(__pow(s.x-o.x,2)+__pow(s.y-o.y,2)),c=n/r,y=t/a,h={x:i.x+(o.x-i.x)*c,y:i.y+(o.y-i.y)*c},f={x:h.x+(s.x-o.x)*y,y:h.y+(s.y-o.y)*y},g={x:i.x+(f.x-o.x),y:i.y+(f.y-o.y)};return[i,h,f,g]}static isPointInsideCube(e,n,t){const[i,o]=t;return!!(polygonTool.isInPolygon({x:e.x,y:e.y},n)&&e.z>=i&&e.z<=o)}};let MathUtils=_MathUtils;MathUtils.isInRange=(e,n)=>{const t=Math.min(...n),i=Math.max(...n),o=r=>r<=i&&r>=t;return(Array.isArray(e)?e:[e]).every(r=>o(r))},MathUtils.withinRange=(e,n)=>{const t=Math.min(...n),i=Math.max(...n);return e>i?i:e<t?t:e},MathUtils.calcViewportBoundaries=(e,n=!1,t=tool.SEGMENT_NUMBER,i=1)=>{if(!e)return{top:0,bottom:0,left:0,right:0};const o=20/i,s=[],r=[];let a=e;n&&(a=polygonTool.createSmoothCurvePointsFromPointList(e,t)),a.forEach(({x,y:u})=>{s.push(x),r.push(u)});let c=Math.min(...s),y=Math.max(...s),h=Math.min(...r),f=Math.max(...r);const g=y-c,d=f-h;if(g<o){const x=(o-g)/2;c-=x,y+=x}if(d<o){const x=(o-d)/2;h-=x,f+=x}return{top:h,bottom:f,left:c,right:y}},MathUtils.getFootOfPerpendicular=(e,n,t,i=!1,o=!1)=>{let s={x:0,y:0};const r=n.x-t.x,a=n.y-t.y;if(Math.abs(r)<1e-8&&Math.abs(a)<1e-8)return s=n,s;let c=(e.x-n.x)*(n.x-t.x)+(e.y-n.y)*(n.y-t.y);c/=r*r+a*a,s.x=n.x+c*r,s.y=n.y+c*a;const y=_MathUtils.getLineLength(e,s),h=2,f=Math.min(n.x,t.x),g=Math.max(n.x,t.x),d=Math.min(n.y,t.y),x=Math.max(n.y,t.y),u=!(_MathUtils.isInRange(e.x,[f,g])||_MathUtils.isInRange(e.y,[d,x])),p=e.x>g+h||e.x<f-h||e.y>x+h||e.y<d-h;return!o&&(i?u:p)?{footPoint:s,length:Infinity}:{footPoint:s,length:y}},MathUtils.calculatePointsInsideBox=e=>{const{indexMap:n,polygon:t,zScope:i,box:o}=e;let s=0;return n.forEach((r,a)=>{const c=a.split("@"),y=Number(c[0]),h=Number(c[1]),f=Number(c[2]),g={x:y-.5,y:h-.5,z:f-.5,width:1,height:1,depth:1},d=getCubePosition(t,i,g);d===2&&(s+=r.length),(d===1||d===0&&(o.width<=1||o.height<=1))&&r.forEach(x=>{_MathUtils.isPointInsideCube(x,t,i)&&s++})}),s};var MathUtils$1=MathUtils;exports.Trigonometric=Trigonometric,exports.default=MathUtils$1;
|
|
2
|
+
`);let y=0;for(let h=0;h<c.length;h++){const f=c[h].split("");let g="";for(let d=0;d<f.length;d++){const x=g+f[d],p=s.measureText(x).width;p>t&&d>0?(g=f[d],r+=o,y=t):(g=x,p>y&&(y=p))}h!==c.length-1&&(r+=o)}return{width:y,height:r+a,lineHeight:o,fontHeight:a}}static getLineCenterPoint(e){const[n,t]=e,i=VectorUtils.getVector(n,t);return{x:n.x+i.x/2,y:n.y+i.y/2}}static getPerpendicularLine(e){if(e.length!==2)return;const[n,t]=e,i={x:t.x+t.y-n.y,y:t.y-(t.x-n.x)};return[t,i]}static getPerpendicularFootOfLine(e,n){if(e.length!==2)return e;const t=this.getPerpendicularLine(e);if(!t)return e;const[i,o]=t;return this.getFootOfPerpendicular(n,i,o).footPoint}static getQuadrangleFromTriangle(e){if(e.length!==3)return e;const[n,t,i]=e,o={x:i.x+n.x-t.x,y:i.y+n.y-t.y};return[n,t,i,o]}static getRectPerpendicularOffset(e,n,t){const[i,o]=t,s=this.getFootOfPerpendicular(e,i,o).footPoint,r=this.getFootOfPerpendicular(n,i,o).footPoint,a={x:s.x-r.x,y:s.y-r.y},c=VectorUtils.add(n,a);return VectorUtils.getVector(e,c)}static getArrayIndex(e,n){return e<0?n+e:e>=n?e-n:e}static getPointListFromPointOffset(e,n,t){const i=this.getArrayIndex(n-1,e.length),o=this.getArrayIndex(n+1,e.length),s=this.getArrayIndex(n-2,e.length),r=[...e];r[n]=VectorUtils.add(r[n],t);const a=this.getFootOfPerpendicular(r[n],r[s],r[i]).footPoint,c=this.getFootOfPerpendicular(r[n],r[o],r[s]).footPoint;return r[i]=a,r[o]=c,r}static getRectCenterPoint(e){const[n,,t]=e;return{x:(n.x+t.x)/2,y:(n.y+t.y)/2}}static rotateRectPointList(e=5,n){const t=this.getRectCenterPoint(n),{PI:i}=Math,o=Math.sin(e*i/180),s=Math.cos(e*i/180);return n.map(r=>{const a=VectorUtils.getVector(t,r),c=VectorUtils.len(a),y=a.y/c,h=a.x/c;return{x:c*Trigonometric.cosAPlusB(y,h,o,s)+t.x,y:c*Trigonometric.sinAPlusB(y,h,o,s)+t.y}})}static getRectangleByRightAngle(e,n){if(n.length!==2)return n;const t=_MathUtils.getPerpendicularFootOfLine(n,e);return _MathUtils.getQuadrangleFromTriangle([...n,t])}static getRadiusFromQuadrangle(e){const[,n,t]=e,i=t.y-n.y,o=n.x-t.x,s=this.getLineLength(n,t),r=i/s,a=Math.acos(r);return o>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(e){const n=e.filter(o=>o.type==="point").map(o=>o.annotation),t=e.filter(o=>!!["polygon","line"].includes(o.type)).map(o=>o.type==="polygon"?__spreadProps(__spreadValues({},o.annotation),{pointList:PolygonUtils.concatBeginAndEnd(o.annotation.pointList)}):o.annotation),i=new MathUtilsWorker;return{promise:new Promise(function(s){i.postMessage({points:n,backgroundList:t}),i.onmessage=r=>{s(r.data),i.terminate()}}),close:()=>{i.terminate()}}}static getCollectionPointByAnnotationData(e){const n=[],t=new Set,i=e.filter(r=>r.type==="point").map(r=>r.annotation),o=e.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?__spreadProps(__spreadValues({},r.annotation),{pointList:PolygonUtils.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=(r,a)=>{const{dropFoot:c}=PolygonUtils.getClosestPoint(r,a,tool.ELineTypes.Line,1,{isClose:!1});if(c!==r){const y=`${c.x} + ${c.y}`;t.has(y)||n.push(r),t.add(y)}};return i.forEach(r=>{s(r,o)}),o.forEach(r=>{let a="";a=r.id,o.forEach((c,y)=>{if(c.id===a)return;const h=[...o];h.splice(y,1),c.pointList.forEach(f=>{s(f,h)})})}),{connectionPoints:n}}static getModifiedRectangleCoordinates(e,n,t){if(e.length!==4)throw new Error("Invalid number of coordinates. Four coordinates are required.");const i=e[0],o=e[1],s=e[2],r=Math.sqrt(__pow(o.x-i.x,2)+__pow(o.y-i.y,2)),a=Math.sqrt(__pow(s.x-o.x,2)+__pow(s.y-o.y,2)),c=n/r,y=t/a,h={x:i.x+(o.x-i.x)*c,y:i.y+(o.y-i.y)*c},f={x:h.x+(s.x-o.x)*y,y:h.y+(s.y-o.y)*y},g={x:i.x+(f.x-o.x),y:i.y+(f.y-o.y)};return[i,h,f,g]}static isPointInsideCube(e,n,t){const[i,o]=t;return!!(polygonTool.isInPolygon({x:e.x,y:e.y},n)&&e.z>=i&&e.z<=o)}static getCurrentPosFromRectCenter(e,n,t){return{x:e.width/2-n.x*t,y:e.height/2-n.y*t}}};let MathUtils=_MathUtils;MathUtils.isInRange=(e,n)=>{const t=Math.min(...n),i=Math.max(...n),o=r=>r<=i&&r>=t;return(Array.isArray(e)?e:[e]).every(r=>o(r))},MathUtils.withinRange=(e,n)=>{const t=Math.min(...n),i=Math.max(...n);return e>i?i:e<t?t:e},MathUtils.calcViewportBoundaries=(e,n=!1,t=tool.SEGMENT_NUMBER,i=1)=>{if(!e)return{top:0,bottom:0,left:0,right:0};const o=20/i,s=[],r=[];let a=e;n&&(a=polygonTool.createSmoothCurvePointsFromPointList(e,t)),a.forEach(({x,y:u})=>{s.push(x),r.push(u)});let c=Math.min(...s),y=Math.max(...s),h=Math.min(...r),f=Math.max(...r);const g=y-c,d=f-h;if(g<o){const x=(o-g)/2;c-=x,y+=x}if(d<o){const x=(o-d)/2;h-=x,f+=x}return{top:h,bottom:f,left:c,right:y}},MathUtils.getFootOfPerpendicular=(e,n,t,i=!1,o=!1)=>{let s={x:0,y:0};const r=n.x-t.x,a=n.y-t.y;if(Math.abs(r)<1e-8&&Math.abs(a)<1e-8)return s=n,s;let c=(e.x-n.x)*(n.x-t.x)+(e.y-n.y)*(n.y-t.y);c/=r*r+a*a,s.x=n.x+c*r,s.y=n.y+c*a;const y=_MathUtils.getLineLength(e,s),h=2,f=Math.min(n.x,t.x),g=Math.max(n.x,t.x),d=Math.min(n.y,t.y),x=Math.max(n.y,t.y),u=!(_MathUtils.isInRange(e.x,[f,g])||_MathUtils.isInRange(e.y,[d,x])),p=e.x>g+h||e.x<f-h||e.y>x+h||e.y<d-h;return!o&&(i?u:p)?{footPoint:s,length:Infinity}:{footPoint:s,length:y}},MathUtils.calculatePointsInsideBox=e=>{const{indexMap:n,polygon:t,zScope:i,box:o}=e;let s=0;return n.forEach((r,a)=>{const c=a.split("@"),y=Number(c[0]),h=Number(c[1]),f=Number(c[2]),g={x:y-.5,y:h-.5,z:f-.5,width:1,height:1,depth:1},d=getCubePosition(t,i,g);d===2&&(s+=r.length),(d===1||d===0&&(o.width<=1||o.height<=1))&&r.forEach(x=>{_MathUtils.isPointInsideCube(x,t,i)&&s++})}),s};var MathUtils$1=MathUtils;exports.Trigonometric=Trigonometric,exports.default=MathUtils$1;
|
package/es/constant/tool.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const v=320;var n;(function(u){u.PointCloud="pointCloudTool"})(n||(n={}));var i;(function(u){u.VideoTextTool="videoTextTool",u.VideoTagTool="videoTagTool",u.VideoClipTool="videoClipTool"})(i||(i={}));var l;(function(u){u.AudioTextTool="audioTextTool"})(l||(l={}));var e;(function(u){u[u.Rect=0]="Rect",u[u.Tag=1]="Tag"})(e||(e={}));var o;(function(u){u.Rect="rectTool",u.Tag="tagTool",u.Point="pointTool",u.PointMarker="pointMarkerTool",u.Segmentation="segmentationTool",u.Filter="filterTool",u.Text="textTool",u.Polygon="polygonTool",u.Line="lineTool",u.LineMarker="lineMarkerTool",u.Empty="emptyTool",u.FolderTag="folderTagTool",u.RectTrack="rectTrackTool",u.ScribbleTool="scribbleTool",u.Face="faceTool",u.ClientAttribute="clientAttributeTool",u.OCRRelation="OCRRelationTool",u.SegmentByRect="segmentByRectTool",u.Cuboid="cuboidTool",u.PointCloudPolygon="pointCloudPolygon",u.LLM="LLMTool",u.NLP="NLPTool",u.LLMMultiWheel="LLMMultiWheelTool"})(o||(o={}));var c;(function(u){u.Check="check"})(c||(c={}));var t;(function(u){u[u.nothing=0]="nothing",u[u.RectBG=1]="RectBG",u[u.showOrder=2]="showOrder"})(t||(t={}));const h={[o.Rect]:"\u62C9\u6846",[o.Tag]:"\u6807\u7B7E",[o.Point]:"\u6807\u70B9",[o.PointMarker]:"\u5217\u8868\u6807\u70B9",[o.Segmentation]:"\u524D\u666F\u5206\u5272",[o.Filter]:"\u7B5B\u9009",[o.Text]:"\u6587\u672C",[o.Polygon]:"\u591A\u8FB9\u5F62",[o.Line]:"\u7EBF\u6761",[o.LineMarker]:"\u5217\u8868\u7EBF\u6761",[o.FolderTag]:"\u6587\u4EF6\u5939\u6807\u7B7E",[o.RectTrack]:"\u62C9\u6846\u8DDF\u8E2A",[o.Face]:"\u4EBA\u8138106\u5DE5\u5177",[o.ClientAttribute]:"\u5BA2\u6237\u7AEF\u5C5E\u6027\u5DE5\u5177",[o.OCRRelation]:"OCR\u5173\u8054\u5173\u7CFB\u5DE5\u5177",[o.SegmentByRect]:"\u7B97\u6CD5\u5206\u5272\u8F85\u52A9\u5DE5\u5177",[i.VideoTextTool]:"\u89C6\u9891\u6587\u672C",[i.VideoTagTool]:"\u89C6\u9891\u6807\u7B7E",[i.VideoClipTool]:"\u89C6\u9891\u622A\u53D6",[n.PointCloud]:"\u70B9\u4E91",[o.Cuboid]:"\u7ACB\u4F53\u6846",[o.LLM]:"\u5927\u6A21\u578B",[o.NLP]:"NLP\u6807\u6CE8",[o.LLMMultiWheel]:"\u5927\u6A21\u578B\uFF08\u591A\u8F6E\u5BF9\u8BDD\uFF09"},_={[o.Rect]:"Rect",[o.Tag]:"Tag",[o.Point]:"Point",[o.PointMarker]:"PointMarker",[o.Segmentation]:"Segmentation",[o.Filter]:"Filter",[o.Text]:"Text",[o.Polygon]:"Polygon",[o.Line]:"Line",[o.LineMarker]:"LineMarker",[o.FolderTag]:"FolderTag",[o.RectTrack]:"RectTrack",[o.Face]:"Face",[o.ClientAttribute]:"ClientAttribute",[o.OCRRelation]:"OCRRelation",[o.SegmentByRect]:"SegmentByRect",[i.VideoTextTool]:"VideoTextTool",[i.VideoTagTool]:"VideoTagTool",[i.VideoClipTool]:"VideoClipTool",[n.PointCloud]:"PointCloud",[o.Cuboid]:"Cuboid",[o.LLM]:"LLM",[o.NLP]:"NLP",[o.LLMMultiWheel]:"LLMMultiWheelTool"};var r;(function(u){u[u.noDepend=1]="noDepend",u[u.dependOrigin=2]="dependOrigin",u[u.dependShape=3]="dependShape",u[u.dependLine=4]="dependLine",u[u.dependPolygon=5]="dependPolygon",u[u.dependPreShape=101]="dependPreShape",u[u.dependPreLine=102]="dependPreLine",u[u.dependPrePolygon=103]="dependPrePolygon"})(r||(r={}));var C;(function(u){u.lc="leftClick",u.rc="rightClick",u.clc="ctrlLeftClick",u.crc="ctrlRightClick"})(C||(C={}));const b={leftClick:"\u9F20\u6807\u5DE6\u952E",rightClick:"\u9F20\u6807\u53F3\u952E",ctrlLeftClick:"ctrl + \u9F20\u6807\u5DE6\u952E",ctrlRightClick:"ctrl + \u9F20\u6807\u53F3\u952E"};var d;(function(u){u[u.Normal=1]="Normal",u[u.Modify=2]="Modify"})(d||(d={}));var L;(function(u){u[u.Line=0]="Line",u[u.Curve=1]="Curve"})(L||(L={}));var F;(function(u){u[u.SingleColor=0]="SingleColor",u[u.MultiColor=1]="MultiColor"})(F||(F={}));var T;(function(u){u[u.Form=1]="Form",u[u.Json=2]="Json"})(T||(T={}));var g;(function(u){u[u.Point=0]="Point",u[u.Line=1]="Line",u[u.Plane=2]="Plane"})(g||(g={}));var B;(function(u){u[u.None=0]="None",u[u.Drawing=1]="Drawing",u[u.Edit=2]="Edit"})(B||(B={}));var R;(function(u){u[u.Backward=0]="Backward",u[u.Forward=1]="Forward",u[u.JumpSkip=2]="JumpSkip",u[u.None=3]="None"})(R||(R={}));var M;(function(u){u[u.Wait=0]="Wait",u[u.Pass=1]="Pass",u[u.Fail=2]="Fail",u[u.Loading=3]="Loading"})(M||(M={}));var s;(function(u){u[u.AnyString=0]="AnyString",u[u.Order=1]="Order",u[u.EnglishOnly=2]="EnglishOnly",u[u.NumberOnly=3]="NumberOnly",u[u.CustomFormat=4]="CustomFormat"})(s||(s={}));const O={0:"\u4EFB\u610F\u5B57\u7B26",1:"\u5E8F\u53F7",2:"\u4EC5\u82F1\u6587",3:"\u4EC5\u6570\u5B57"},S=1e3,I=16,P=300,V="normal normal 500 14px Arial";var A;(function(u){u[u.ImgList=1e3]="ImgList",u[u.TrackPrediction=1001]="TrackPrediction",u[u.ImgSearch=1002]="ImgSearch"})(A||(A={}));const y={[n.PointCloud]:"sensebeepc",[o.ClientAttribute]:"sensebeepc-EnumAttributeTool",[o.Face]:"sensebeepc-FacePointsLabellingTool",[o.OCRRelation]:"sensebeepc-OCRRelationTool"},m={[n.PointCloud]:"\u70B9\u4E91\u5BA2\u6237\u7AEF",[o.ClientAttribute]:"\u5BA2\u6237\u7AEF\u5C5E\u6027\u5DE5\u5177",[o.Face]:"\u4EBA\u8138106\u70B9\u5DE5\u5177",[o.OCRRelation]:"OCR\u5173\u8054\u5173\u7CFB\u5DE5\u5177"},W=16,N=10;var k;(function(u){u[u.Normal=0]="Normal",u[u.Rect=1]="Rect"})(k||(k={}));var f;(function(u){u[u.Scribble=1]="Scribble",u[u.Erase=2]="Erase"})(f||(f={}));var a;(function(u){u[u.General=1]="General",u[u.MultiMove=2]="MultiMove"})(a||(a={}));export{y as CLIENT_TOOL_HEAD_TYPE,m as CLIENT_TOOL_NAME,V as DEFAULT_FONT,P as DEFAULT_TEXT_MAX_WIDTH,d as EAnnotationMode,l as EAudioToolName,M as EAuditStatus,c as ECheckModel,r as EDependPattern,g as EDragTarget,B as EDrawPointPattern,C as EFilterToolOperation,F as ELineColor,L as ELineTypes,a as EOperationMode,R as EPageOperator,n as EPointCloudName,k as EPolygonPattern,t as ERectPattern,f as EScribblePattern,T as ESelectedType,s as ETextType,A as EThumbnailOption,o as EToolName,e as EToolType,i as EVideoToolName,b as OPERATION_LIST,W as SEGMENT_NUMBER,I as TEXT_ATTRIBUTE_LINE_HEIGHT,S as TEXT_ATTRIBUTE_MAX_LENGTH,O as TEXT_TYPE,h as TOOL_NAME,_ as TOOL_NAME_EN,N as edgeAdsorptionScope,v as editStepWidth};
|
package/es/utils/MathUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import z from"../_virtual/MathUtilsWorker.js";import{SEGMENT_NUMBER as E,DEFAULT_TEXT_MAX_WIDTH as R,DEFAULT_FONT as T,ELineTypes as S}from"../constant/tool.js";import{createSmoothCurvePointsFromPointList as v,isInPolygon as B}from"./tool/polygonTool.js";import O from"./tool/PolygonUtils.js";import P from"./VectorUtils.js";var U=Object.defineProperty,j=Object.defineProperties,N=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,M=Math.pow,
|
|
2
|
-
`);let y=0;for(let h=0;h<c.length;h++){const f=c[h].split("");let
|
|
1
|
+
import z from"../_virtual/MathUtilsWorker.js";import{SEGMENT_NUMBER as E,DEFAULT_TEXT_MAX_WIDTH as R,DEFAULT_FONT as T,ELineTypes as S}from"../constant/tool.js";import{createSmoothCurvePointsFromPointList as v,isInPolygon as B}from"./tool/polygonTool.js";import O from"./tool/PolygonUtils.js";import P from"./VectorUtils.js";var U=Object.defineProperty,j=Object.defineProperties,N=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,M=Math.pow,F=(n,o,t)=>o in n?U(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,I=(n,o)=>{for(var t in o||(o={}))V.call(o,t)&&F(n,t,o[t]);if(_)for(var t of _(o))X.call(o,t)&&F(n,t,o[t]);return n},A=(n,o)=>j(n,N(o));class m{static tanAPlusB(o,t){return(o+t)/(1-o*t)}static sinAPlusB(o,t,i,e){return e*o+t*i}static cosAPlusB(o,t,i,e){return t*e-o*i}}var L;(function(n){n[n.Outside=0]="Outside",n[n.PartiallyInside=1]="PartiallyInside",n[n.FullyInside=2]="FullyInside"})(L||(L={}));function D(n,o,t){const i=[{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2}];let e=0;for(let s=0;s<i.length;s++)u.isPointInsideCube(i[s],n,o)&&e++;return e===0?0:e===8?2:1}const p=class{static getRotate(n){return n+90>=360?n+90-360:n+90}static getLineLength(n,o){return Math.sqrt(Math.pow(o.y-n.y,2)+Math.pow(o.x-n.x,2))}static getTextArea(n,o,t=R,i=T,e){if(typeof o!="string")return{width:0,height:0};const s=n.getContext("2d");s.font=i;let r=0;typeof e=="undefined"&&(e=n&&parseInt(window.getComputedStyle(n).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const a=n&&parseInt(window.getComputedStyle(n).fontSize,10)||parseInt(window.getComputedStyle(document.body).fontSize,10)||0,c=o.split(`
|
|
2
|
+
`);let y=0;for(let h=0;h<c.length;h++){const f=c[h].split("");let g="";for(let d=0;d<f.length;d++){const x=g+f[d],l=s.measureText(x).width;l>t&&d>0?(g=f[d],r+=e,y=t):(g=x,l>y&&(y=l))}h!==c.length-1&&(r+=e)}return{width:y,height:r+a,lineHeight:e,fontHeight:a}}static getLineCenterPoint(n){const[o,t]=n,i=P.getVector(o,t);return{x:o.x+i.x/2,y:o.y+i.y/2}}static getPerpendicularLine(n){if(n.length!==2)return;const[o,t]=n,i={x:t.x+t.y-o.y,y:t.y-(t.x-o.x)};return[t,i]}static getPerpendicularFootOfLine(n,o){if(n.length!==2)return n;const t=this.getPerpendicularLine(n);if(!t)return n;const[i,e]=t;return this.getFootOfPerpendicular(o,i,e).footPoint}static getQuadrangleFromTriangle(n){if(n.length!==3)return n;const[o,t,i]=n,e={x:i.x+o.x-t.x,y:i.y+o.y-t.y};return[o,t,i,e]}static getRectPerpendicularOffset(n,o,t){const[i,e]=t,s=this.getFootOfPerpendicular(n,i,e).footPoint,r=this.getFootOfPerpendicular(o,i,e).footPoint,a={x:s.x-r.x,y:s.y-r.y},c=P.add(o,a);return P.getVector(n,c)}static getArrayIndex(n,o){return n<0?o+n:n>=o?n-o:n}static getPointListFromPointOffset(n,o,t){const i=this.getArrayIndex(o-1,n.length),e=this.getArrayIndex(o+1,n.length),s=this.getArrayIndex(o-2,n.length),r=[...n];r[o]=P.add(r[o],t);const a=this.getFootOfPerpendicular(r[o],r[s],r[i]).footPoint,c=this.getFootOfPerpendicular(r[o],r[e],r[s]).footPoint;return r[i]=a,r[e]=c,r}static getRectCenterPoint(n){const[o,,t]=n;return{x:(o.x+t.x)/2,y:(o.y+t.y)/2}}static rotateRectPointList(n=5,o){const t=this.getRectCenterPoint(o),{PI:i}=Math,e=Math.sin(n*i/180),s=Math.cos(n*i/180);return o.map(r=>{const a=P.getVector(t,r),c=P.len(a),y=a.y/c,h=a.x/c;return{x:c*m.cosAPlusB(y,h,e,s)+t.x,y:c*m.sinAPlusB(y,h,e,s)+t.y}})}static getRectangleByRightAngle(n,o){if(o.length!==2)return o;const t=p.getPerpendicularFootOfLine(o,n);return p.getQuadrangleFromTriangle([...o,t])}static getRadiusFromQuadrangle(n){const[,o,t]=n,i=t.y-o.y,e=o.x-t.x,s=this.getLineLength(o,t),r=i/s,a=Math.acos(r);return e>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(n){const o=n.filter(e=>e.type==="point").map(e=>e.annotation),t=n.filter(e=>!!["polygon","line"].includes(e.type)).map(e=>e.type==="polygon"?A(I({},e.annotation),{pointList:O.concatBeginAndEnd(e.annotation.pointList)}):e.annotation),i=new z;return{promise:new Promise(function(s){i.postMessage({points:o,backgroundList:t}),i.onmessage=r=>{s(r.data),i.terminate()}}),close:()=>{i.terminate()}}}static getCollectionPointByAnnotationData(n){const o=[],t=new Set,i=n.filter(r=>r.type==="point").map(r=>r.annotation),e=n.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?A(I({},r.annotation),{pointList:O.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=(r,a)=>{const{dropFoot:c}=O.getClosestPoint(r,a,S.Line,1,{isClose:!1});if(c!==r){const y=`${c.x} + ${c.y}`;t.has(y)||o.push(r),t.add(y)}};return i.forEach(r=>{s(r,e)}),e.forEach(r=>{let a="";a=r.id,e.forEach((c,y)=>{if(c.id===a)return;const h=[...e];h.splice(y,1),c.pointList.forEach(f=>{s(f,h)})})}),{connectionPoints:o}}static getModifiedRectangleCoordinates(n,o,t){if(n.length!==4)throw new Error("Invalid number of coordinates. Four coordinates are required.");const i=n[0],e=n[1],s=n[2],r=Math.sqrt(M(e.x-i.x,2)+M(e.y-i.y,2)),a=Math.sqrt(M(s.x-e.x,2)+M(s.y-e.y,2)),c=o/r,y=t/a,h={x:i.x+(e.x-i.x)*c,y:i.y+(e.y-i.y)*c},f={x:h.x+(s.x-e.x)*y,y:h.y+(s.y-e.y)*y},g={x:i.x+(f.x-e.x),y:i.y+(f.y-e.y)};return[i,h,f,g]}static isPointInsideCube(n,o,t){const[i,e]=t;return!!(B({x:n.x,y:n.y},o)&&n.z>=i&&n.z<=e)}static getCurrentPosFromRectCenter(n,o,t){return{x:n.width/2-o.x*t,y:n.height/2-o.y*t}}};let u=p;u.isInRange=(n,o)=>{const t=Math.min(...o),i=Math.max(...o),e=r=>r<=i&&r>=t;return(Array.isArray(n)?n:[n]).every(r=>e(r))},u.withinRange=(n,o)=>{const t=Math.min(...o),i=Math.max(...o);return n>i?i:n<t?t:n},u.calcViewportBoundaries=(n,o=!1,t=E,i=1)=>{if(!n)return{top:0,bottom:0,left:0,right:0};const e=20/i,s=[],r=[];let a=n;o&&(a=v(n,t)),a.forEach(({x,y:w})=>{s.push(x),r.push(w)});let c=Math.min(...s),y=Math.max(...s),h=Math.min(...r),f=Math.max(...r);const g=y-c,d=f-h;if(g<e){const x=(e-g)/2;c-=x,y+=x}if(d<e){const x=(e-d)/2;h-=x,f+=x}return{top:h,bottom:f,left:c,right:y}},u.getFootOfPerpendicular=(n,o,t,i=!1,e=!1)=>{let s={x:0,y:0};const r=o.x-t.x,a=o.y-t.y;if(Math.abs(r)<1e-8&&Math.abs(a)<1e-8)return s=o,s;let c=(n.x-o.x)*(o.x-t.x)+(n.y-o.y)*(o.y-t.y);c/=r*r+a*a,s.x=o.x+c*r,s.y=o.y+c*a;const y=p.getLineLength(n,s),h=2,f=Math.min(o.x,t.x),g=Math.max(o.x,t.x),d=Math.min(o.y,t.y),x=Math.max(o.y,t.y),w=!(p.isInRange(n.x,[f,g])||p.isInRange(n.y,[d,x])),l=n.x>g+h||n.x<f-h||n.y>x+h||n.y<d-h;return!e&&(i?w:l)?{footPoint:s,length:Infinity}:{footPoint:s,length:y}},u.calculatePointsInsideBox=n=>{const{indexMap:o,polygon:t,zScope:i,box:e}=n;let s=0;return o.forEach((r,a)=>{const c=a.split("@"),y=Number(c[0]),h=Number(c[1]),f=Number(c[2]),g={x:y-.5,y:h-.5,z:f-.5,width:1,height:1,depth:1},d=D(t,i,g);d===2&&(s+=r.length),(d===1||d===0&&(e.width<=1||e.height<=1))&&r.forEach(x=>{p.isPointInsideCube(x,t,i)&&s++})}),s};var W=u;export{m as Trigonometric,W as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-annotation",
|
|
3
|
-
"version": "1.27.0-alpha.
|
|
3
|
+
"version": "1.27.0-alpha.64",
|
|
4
4
|
"description": "Annotation tool collection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotation",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"typescript": "^4.2.3"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@labelbee/lb-utils": "1.19.0-alpha.
|
|
97
|
+
"@labelbee/lb-utils": "1.19.0-alpha.24",
|
|
98
98
|
"@turf/turf": "5.1.6",
|
|
99
99
|
"color-rgba": "^2.3.0",
|
|
100
100
|
"lodash": "^4.17.20",
|