@mlightcad/cad-simple-viewer 1.8.0-preview.2 → 1.8.0-preview.4
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/LICENSE +21 -21
- package/README.md +206 -204
- package/dist/cad-simple-viewer-AcApSimpleUiChrome-D_0b6okm.js +890 -0
- package/dist/cad-simple-viewer-AcApSimpleUiChrome-DcZiBNvh.js +1 -0
- package/dist/cad-simple-viewer-AcUiFileOpenSession-AGSCe0Nv.js +324 -0
- package/dist/{cad-simple-viewer-AcUiFileOpenSession-BCcqBAH9.js → cad-simple-viewer-AcUiFileOpenSession-Bo3U3wCu.js} +707 -167
- package/dist/cad-simple-viewer-file-open-panel.js +26 -24
- package/dist/cad-simple-viewer-file-open-panel.umd.cjs +1 -1
- package/dist/cad-simple-viewer.js +64100 -41238
- package/dist/cad-simple-viewer.umd.cjs +1659 -497
- package/dist/mtext-renderer-worker.js +4 -5
- package/file-open-panel.ts +6 -6
- package/icons.ts +7 -7
- package/lib/app/AcApClipboard.d.ts +97 -0
- package/lib/app/AcApClipboard.d.ts.map +1 -0
- package/lib/app/AcApClipboard.js +270 -0
- package/lib/app/AcApClipboard.js.map +1 -0
- package/lib/app/AcApContext.d.ts +10 -0
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +24 -8
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +63 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +264 -35
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +11 -11
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/app/AcApOpenFileDialog.d.ts +2 -2
- package/lib/app/AcApOpenFileDialog.js +2 -2
- package/lib/app/AcApPaletteService.d.ts +154 -0
- package/lib/app/AcApPaletteService.d.ts.map +1 -0
- package/lib/app/AcApPaletteService.js +327 -0
- package/lib/app/AcApPaletteService.js.map +1 -0
- package/lib/app/acapHealModelLayoutLink.d.ts +30 -0
- package/lib/app/acapHealModelLayoutLink.d.ts.map +1 -0
- package/lib/app/acapHealModelLayoutLink.js +192 -0
- package/lib/app/acapHealModelLayoutLink.js.map +1 -0
- package/lib/app/dataSource/AcApLocalDataSource.d.ts +1 -1
- package/lib/app/dataSource/AcApLocalDataSource.js +2 -2
- package/lib/app/dataSource/AcApLocalDataSource.js.map +1 -1
- package/lib/app/dataSource/AcApUrlDataSource.js +1 -1
- package/lib/app/dataSource/AcApUrlDataSource.js.map +1 -1
- package/lib/app/index.d.ts +2 -0
- package/lib/app/index.d.ts.map +1 -1
- package/lib/app/index.js +2 -0
- package/lib/app/index.js.map +1 -1
- package/lib/command/AcApShortCutToolbarDocBind.d.ts.map +1 -1
- package/lib/command/AcApShortCutToolbarDocBind.js +30 -3
- package/lib/command/AcApShortCutToolbarDocBind.js.map +1 -1
- package/lib/command/AcApUcsCmd.d.ts +26 -0
- package/lib/command/AcApUcsCmd.d.ts.map +1 -0
- package/lib/command/AcApUcsCmd.js +545 -0
- package/lib/command/AcApUcsCmd.js.map +1 -0
- package/lib/command/AcApViewRestoreCmd.d.ts +13 -0
- package/lib/command/AcApViewRestoreCmd.d.ts.map +1 -0
- package/lib/command/AcApViewRestoreCmd.js +101 -0
- package/lib/command/AcApViewRestoreCmd.js.map +1 -0
- package/lib/command/block/AcApDashBSearchCmd.d.ts +57 -0
- package/lib/command/block/AcApDashBSearchCmd.d.ts.map +1 -0
- package/lib/command/block/AcApDashBSearchCmd.js +618 -0
- package/lib/command/block/AcApDashBSearchCmd.js.map +1 -0
- package/lib/command/block/index.d.ts +2 -0
- package/lib/command/block/index.d.ts.map +1 -0
- package/lib/command/block/index.js +2 -0
- package/lib/command/block/index.js.map +1 -0
- package/lib/command/clipboard/AcApClipboardUtils.d.ts +61 -0
- package/lib/command/clipboard/AcApClipboardUtils.d.ts.map +1 -0
- package/lib/command/clipboard/AcApClipboardUtils.js +203 -0
- package/lib/command/clipboard/AcApClipboardUtils.js.map +1 -0
- package/lib/command/clipboard/AcApCopyBaseCmd.d.ts +13 -0
- package/lib/command/clipboard/AcApCopyBaseCmd.d.ts.map +1 -0
- package/lib/command/clipboard/AcApCopyBaseCmd.js +95 -0
- package/lib/command/clipboard/AcApCopyBaseCmd.js.map +1 -0
- package/lib/command/clipboard/AcApCopyClipCmd.d.ts +15 -0
- package/lib/command/clipboard/AcApCopyClipCmd.d.ts.map +1 -0
- package/lib/command/clipboard/AcApCopyClipCmd.js +85 -0
- package/lib/command/clipboard/AcApCopyClipCmd.js.map +1 -0
- package/lib/command/clipboard/AcApCutClipCmd.d.ts +11 -0
- package/lib/command/clipboard/AcApCutClipCmd.d.ts.map +1 -0
- package/lib/command/clipboard/AcApCutClipCmd.js +91 -0
- package/lib/command/clipboard/AcApCutClipCmd.js.map +1 -0
- package/lib/command/clipboard/AcApPasteBlockCmd.d.ts +23 -0
- package/lib/command/clipboard/AcApPasteBlockCmd.d.ts.map +1 -0
- package/lib/command/clipboard/AcApPasteBlockCmd.js +127 -0
- package/lib/command/clipboard/AcApPasteBlockCmd.js.map +1 -0
- package/lib/command/clipboard/AcApPasteClipCmd.d.ts +14 -0
- package/lib/command/clipboard/AcApPasteClipCmd.d.ts.map +1 -0
- package/lib/command/clipboard/AcApPasteClipCmd.js +100 -0
- package/lib/command/clipboard/AcApPasteClipCmd.js.map +1 -0
- package/lib/command/clipboard/AcApPasteOrigCmd.d.ts +15 -0
- package/lib/command/clipboard/AcApPasteOrigCmd.d.ts.map +1 -0
- package/lib/command/clipboard/AcApPasteOrigCmd.js +99 -0
- package/lib/command/clipboard/AcApPasteOrigCmd.js.map +1 -0
- package/lib/command/clipboard/AcApPastePreviewJig.d.ts +37 -0
- package/lib/command/clipboard/AcApPastePreviewJig.d.ts.map +1 -0
- package/lib/command/clipboard/AcApPastePreviewJig.js +87 -0
- package/lib/command/clipboard/AcApPastePreviewJig.js.map +1 -0
- package/lib/command/clipboard/index.d.ts +9 -0
- package/lib/command/clipboard/index.d.ts.map +1 -0
- package/lib/command/clipboard/index.js +9 -0
- package/lib/command/clipboard/index.js.map +1 -0
- package/lib/command/convert/AcApBlockPreviewConvertor.d.ts +8 -0
- package/lib/command/convert/AcApBlockPreviewConvertor.d.ts.map +1 -1
- package/lib/command/convert/AcApBlockPreviewConvertor.js +16 -0
- package/lib/command/convert/AcApBlockPreviewConvertor.js.map +1 -1
- package/lib/command/convert/AcApEntityPreviewConvertor.d.ts +32 -0
- package/lib/command/convert/AcApEntityPreviewConvertor.d.ts.map +1 -1
- package/lib/command/convert/AcApEntityPreviewConvertor.js +70 -14
- package/lib/command/convert/AcApEntityPreviewConvertor.js.map +1 -1
- package/lib/command/draw/AcApDimBlockUtil.d.ts +7 -0
- package/lib/command/draw/AcApDimBlockUtil.d.ts.map +1 -1
- package/lib/command/draw/AcApDimBlockUtil.js +16 -54
- package/lib/command/draw/AcApDimBlockUtil.js.map +1 -1
- package/lib/command/draw/AcApLeaderCmd.d.ts +49 -0
- package/lib/command/draw/AcApLeaderCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApLeaderCmd.js +611 -0
- package/lib/command/draw/AcApLeaderCmd.js.map +1 -0
- package/lib/command/draw/AcApMLeaderCmd.d.ts +41 -0
- package/lib/command/draw/AcApMLeaderCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApMLeaderCmd.js +632 -0
- package/lib/command/draw/AcApMLeaderCmd.js.map +1 -0
- package/lib/command/draw/AcApMLeaderCmdUtil.d.ts +137 -0
- package/lib/command/draw/AcApMLeaderCmdUtil.d.ts.map +1 -0
- package/lib/command/draw/AcApMLeaderCmdUtil.js +411 -0
- package/lib/command/draw/AcApMLeaderCmdUtil.js.map +1 -0
- package/lib/command/draw/AcApMLeaderEditCmd.d.ts +13 -0
- package/lib/command/draw/AcApMLeaderEditCmd.d.ts.map +1 -0
- package/lib/command/draw/AcApMLeaderEditCmd.js +245 -0
- package/lib/command/draw/AcApMLeaderEditCmd.js.map +1 -0
- package/lib/command/draw/acedRenderDimStylePreview.d.ts +7 -0
- package/lib/command/draw/acedRenderDimStylePreview.d.ts.map +1 -0
- package/lib/command/draw/acedRenderDimStylePreview.js +141 -0
- package/lib/command/draw/acedRenderDimStylePreview.js.map +1 -0
- package/lib/command/draw/dimStylePreview.d.ts +62 -0
- package/lib/command/draw/dimStylePreview.d.ts.map +1 -0
- package/lib/command/draw/dimStylePreview.js +723 -0
- package/lib/command/draw/dimStylePreview.js.map +1 -0
- package/lib/command/draw/index.d.ts +6 -0
- package/lib/command/draw/index.d.ts.map +1 -1
- package/lib/command/draw/index.js +6 -0
- package/lib/command/draw/index.js.map +1 -1
- package/lib/command/group/AcApDashGroupCmd.d.ts +18 -0
- package/lib/command/group/AcApDashGroupCmd.d.ts.map +1 -0
- package/lib/command/group/AcApDashGroupCmd.js +457 -0
- package/lib/command/group/AcApDashGroupCmd.js.map +1 -0
- package/lib/command/group/AcApGroupCmd.d.ts +18 -0
- package/lib/command/group/AcApGroupCmd.d.ts.map +1 -0
- package/lib/command/group/AcApGroupCmd.js +253 -0
- package/lib/command/group/AcApGroupCmd.js.map +1 -0
- package/lib/command/group/AcApGroupEditCmd.d.ts +14 -0
- package/lib/command/group/AcApGroupEditCmd.d.ts.map +1 -0
- package/lib/command/group/AcApGroupEditCmd.js +241 -0
- package/lib/command/group/AcApGroupEditCmd.js.map +1 -0
- package/lib/command/group/AcApUngroupCmd.d.ts +20 -0
- package/lib/command/group/AcApUngroupCmd.d.ts.map +1 -0
- package/lib/command/group/AcApUngroupCmd.js +249 -0
- package/lib/command/group/AcApUngroupCmd.js.map +1 -0
- package/lib/command/group/index.d.ts +5 -0
- package/lib/command/group/index.d.ts.map +1 -0
- package/lib/command/group/index.js +5 -0
- package/lib/command/group/index.js.map +1 -0
- package/lib/command/index.d.ts +5 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +5 -0
- package/lib/command/index.js.map +1 -1
- package/lib/command/markup/AcApMarkupSessionBootstrap.d.ts +9 -1
- package/lib/command/markup/AcApMarkupSessionBootstrap.d.ts.map +1 -1
- package/lib/command/markup/AcApMarkupSessionBootstrap.js +21 -7
- package/lib/command/markup/AcApMarkupSessionBootstrap.js.map +1 -1
- package/lib/command/markup/index.d.ts +1 -1
- package/lib/command/markup/index.d.ts.map +1 -1
- package/lib/command/markup/index.js +4 -2
- package/lib/command/markup/index.js.map +1 -1
- package/lib/command/measure/AcApMeasureArcCmd.d.ts +7 -0
- package/lib/command/measure/AcApMeasureArcCmd.d.ts.map +1 -1
- package/lib/command/measure/AcApMeasureArcCmd.js +183 -73
- package/lib/command/measure/AcApMeasureArcCmd.js.map +1 -1
- package/lib/command/measure/AcApMeasureArcLock.d.ts +23 -1
- package/lib/command/measure/AcApMeasureArcLock.d.ts.map +1 -1
- package/lib/command/measure/AcApMeasureArcLock.js +57 -1
- package/lib/command/measure/AcApMeasureArcLock.js.map +1 -1
- package/lib/command/measure/entity/AcApMeasureDrawUtil.d.ts +3 -1
- package/lib/command/measure/entity/AcApMeasureDrawUtil.d.ts.map +1 -1
- package/lib/command/measure/entity/AcApMeasureDrawUtil.js +44 -4
- package/lib/command/measure/entity/AcApMeasureDrawUtil.js.map +1 -1
- package/lib/command/modify/AcApScaleCmd.d.ts +115 -0
- package/lib/command/modify/AcApScaleCmd.d.ts.map +1 -0
- package/lib/command/modify/AcApScaleCmd.js +347 -0
- package/lib/command/modify/AcApScaleCmd.js.map +1 -0
- package/lib/command/modify/AcApScalePreviewJig.d.ts +56 -0
- package/lib/command/modify/AcApScalePreviewJig.d.ts.map +1 -0
- package/lib/command/modify/AcApScalePreviewJig.js +115 -0
- package/lib/command/modify/AcApScalePreviewJig.js.map +1 -0
- package/lib/command/modify/index.d.ts +1 -0
- package/lib/command/modify/index.d.ts.map +1 -1
- package/lib/command/modify/index.js +1 -0
- package/lib/command/modify/index.js.map +1 -1
- package/lib/command/ui/AcApFindUiCmd.d.ts +26 -0
- package/lib/command/ui/AcApFindUiCmd.d.ts.map +1 -0
- package/lib/command/ui/AcApFindUiCmd.js +83 -0
- package/lib/command/ui/AcApFindUiCmd.js.map +1 -0
- package/lib/command/ui/AcApLayerUiCmd.d.ts +65 -0
- package/lib/command/ui/AcApLayerUiCmd.d.ts.map +1 -0
- package/lib/command/ui/AcApLayerUiCmd.js +142 -0
- package/lib/command/ui/AcApLayerUiCmd.js.map +1 -0
- package/lib/command/ui/AcApMarkupPanelUiCmd.d.ts +26 -0
- package/lib/command/ui/AcApMarkupPanelUiCmd.d.ts.map +1 -0
- package/lib/command/ui/AcApMarkupPanelUiCmd.js +83 -0
- package/lib/command/ui/AcApMarkupPanelUiCmd.js.map +1 -0
- package/lib/command/ui/AcApMeasurementPanelUiCmd.d.ts +26 -0
- package/lib/command/ui/AcApMeasurementPanelUiCmd.d.ts.map +1 -0
- package/lib/command/ui/AcApMeasurementPanelUiCmd.js +83 -0
- package/lib/command/ui/AcApMeasurementPanelUiCmd.js.map +1 -0
- package/lib/command/ui/index.d.ts +5 -0
- package/lib/command/ui/index.d.ts.map +1 -0
- package/lib/command/ui/index.js +5 -0
- package/lib/command/ui/index.js.map +1 -0
- package/lib/editor/grip/AcEdGripEditSession.d.ts +13 -0
- package/lib/editor/grip/AcEdGripEditSession.d.ts.map +1 -1
- package/lib/editor/grip/AcEdGripEditSession.js +44 -9
- package/lib/editor/grip/AcEdGripEditSession.js.map +1 -1
- package/lib/editor/grip/AcEdGripManager.d.ts +21 -1
- package/lib/editor/grip/AcEdGripManager.d.ts.map +1 -1
- package/lib/editor/grip/AcEdGripManager.js +204 -22
- package/lib/editor/grip/AcEdGripManager.js.map +1 -1
- package/lib/editor/grip/AcEdGripPreviewJig.d.ts +7 -0
- package/lib/editor/grip/AcEdGripPreviewJig.d.ts.map +1 -1
- package/lib/editor/grip/AcEdGripPreviewJig.js +18 -1
- package/lib/editor/grip/AcEdGripPreviewJig.js.map +1 -1
- package/lib/editor/grip/AcEdGripViewport.d.ts +35 -0
- package/lib/editor/grip/AcEdGripViewport.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripViewport.js +68 -0
- package/lib/editor/grip/AcEdGripViewport.js.map +1 -0
- package/lib/editor/grip/AcEdGroupGripEditSession.d.ts +24 -0
- package/lib/editor/grip/AcEdGroupGripEditSession.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGroupGripEditSession.js +76 -0
- package/lib/editor/grip/AcEdGroupGripEditSession.js.map +1 -0
- package/lib/editor/grip/AcEdGroupGripPolicy.d.ts +46 -0
- package/lib/editor/grip/AcEdGroupGripPolicy.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGroupGripPolicy.js +187 -0
- package/lib/editor/grip/AcEdGroupGripPolicy.js.map +1 -0
- package/lib/editor/grip/index.d.ts +3 -0
- package/lib/editor/grip/index.d.ts.map +1 -1
- package/lib/editor/grip/index.js +3 -0
- package/lib/editor/grip/index.js.map +1 -1
- package/lib/editor/input/AcEdOrthoMode.d.ts +2 -2
- package/lib/editor/input/AcEdOrthoMode.d.ts.map +1 -1
- package/lib/editor/input/AcEdOrthoMode.js +20 -7
- package/lib/editor/input/AcEdOrthoMode.js.map +1 -1
- package/lib/editor/input/AcEdOsnapCenterMarks.d.ts +16 -0
- package/lib/editor/input/AcEdOsnapCenterMarks.d.ts.map +1 -1
- package/lib/editor/input/AcEdOsnapCenterMarks.js +24 -3
- package/lib/editor/input/AcEdOsnapCenterMarks.js.map +1 -1
- package/lib/editor/input/AcEdOsnapResolver.d.ts +0 -1
- package/lib/editor/input/AcEdOsnapResolver.d.ts.map +1 -1
- package/lib/editor/input/AcEdOsnapResolver.js +3 -16
- package/lib/editor/input/AcEdOsnapResolver.js.map +1 -1
- package/lib/editor/input/AcEdPolarTracking.d.ts.map +1 -1
- package/lib/editor/input/AcEdPolarTracking.js +16 -10
- package/lib/editor/input/AcEdPolarTracking.js.map +1 -1
- package/lib/editor/input/handler/AcEdPointHandler.d.ts +1 -1
- package/lib/editor/input/handler/AcEdPointHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdPointHandler.js +36 -16
- package/lib/editor/input/handler/AcEdPointHandler.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts +12 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js +20 -0
- package/lib/editor/input/prompt/AcEdPromptSelectionOptions.js.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.d.ts +5 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.js +33 -5
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +30 -7
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +47 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +80 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/editor/view/AcEdSelectionBoxIntersect.d.ts +40 -4
- package/lib/editor/view/AcEdSelectionBoxIntersect.d.ts.map +1 -1
- package/lib/editor/view/AcEdSelectionBoxIntersect.js +199 -3
- package/lib/editor/view/AcEdSelectionBoxIntersect.js.map +1 -1
- package/lib/editor/view/AcEdViewportBoxSelection.d.ts +10 -0
- package/lib/editor/view/AcEdViewportBoxSelection.d.ts.map +1 -1
- package/lib/editor/view/AcEdViewportBoxSelection.js +15 -8
- package/lib/editor/view/AcEdViewportBoxSelection.js.map +1 -1
- package/lib/file-open-panel.d.ts.map +1 -1
- package/lib/file-open-panel.js +4 -0
- package/lib/file-open-panel.js.map +1 -1
- package/lib/find/AcApFindNavigator.d.ts +47 -0
- package/lib/find/AcApFindNavigator.d.ts.map +1 -1
- package/lib/find/AcApFindNavigator.js +13 -5
- package/lib/find/AcApFindNavigator.js.map +1 -1
- package/lib/find/findDrawing.d.ts +1 -1
- package/lib/find/findDrawing.d.ts.map +1 -1
- package/lib/find/findDrawing.js +4 -3
- package/lib/find/findDrawing.js.map +1 -1
- package/lib/find/findText.d.ts +40 -13
- package/lib/find/findText.d.ts.map +1 -1
- package/lib/find/findText.js +100 -44
- package/lib/find/findText.js.map +1 -1
- package/lib/find/index.d.ts +8 -0
- package/lib/find/index.d.ts.map +1 -1
- package/lib/find/index.js +8 -0
- package/lib/find/index.js.map +1 -1
- package/lib/i18n/AcApI18n.d.ts +1 -1
- package/lib/i18n/AcApI18n.d.ts.map +1 -1
- package/lib/i18n/AcApI18n.js +2 -0
- package/lib/i18n/AcApI18n.js.map +1 -1
- package/lib/i18n/AcUiI18n.d.ts +23 -0
- package/lib/i18n/AcUiI18n.d.ts.map +1 -0
- package/lib/i18n/AcUiI18n.js +126 -0
- package/lib/i18n/AcUiI18n.js.map +1 -0
- package/lib/i18n/ar/command.d.ts +103 -6
- package/lib/i18n/ar/command.d.ts.map +1 -1
- package/lib/i18n/ar/command.js +601 -11
- package/lib/i18n/ar/command.js.map +1 -1
- package/lib/i18n/ar/jig.d.ts +1423 -579
- package/lib/i18n/ar/jig.d.ts.map +1 -1
- package/lib/i18n/ar/jig.js +2096 -322
- package/lib/i18n/ar/jig.js.map +1 -1
- package/lib/i18n/ar/main.d.ts +22 -0
- package/lib/i18n/ar/main.d.ts.map +1 -1
- package/lib/i18n/ar/main.js +22 -0
- package/lib/i18n/ar/main.js.map +1 -1
- package/lib/i18n/ar/simpleUi.d.ts +170 -0
- package/lib/i18n/ar/simpleUi.d.ts.map +1 -0
- package/lib/i18n/ar/simpleUi.js +169 -0
- package/lib/i18n/ar/simpleUi.js.map +1 -0
- package/lib/i18n/cs/command.d.ts +111 -1
- package/lib/i18n/cs/command.d.ts.map +1 -1
- package/lib/i18n/cs/command.js +112 -2
- package/lib/i18n/cs/command.js.map +1 -1
- package/lib/i18n/cs/jig.d.ts +867 -0
- package/lib/i18n/cs/jig.d.ts.map +1 -1
- package/lib/i18n/cs/jig.js +988 -24
- package/lib/i18n/cs/jig.js.map +1 -1
- package/lib/i18n/cs/main.d.ts +22 -0
- package/lib/i18n/cs/main.d.ts.map +1 -1
- package/lib/i18n/cs/main.js +23 -1
- package/lib/i18n/cs/main.js.map +1 -1
- package/lib/i18n/cs/simpleUi.d.ts +170 -0
- package/lib/i18n/cs/simpleUi.d.ts.map +1 -0
- package/lib/i18n/cs/simpleUi.js +169 -0
- package/lib/i18n/cs/simpleUi.js.map +1 -0
- package/lib/i18n/en/command.d.ts +98 -1
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +99 -2
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/jig.d.ts +844 -0
- package/lib/i18n/en/jig.d.ts.map +1 -1
- package/lib/i18n/en/jig.js +801 -1
- package/lib/i18n/en/jig.js.map +1 -1
- package/lib/i18n/en/main.d.ts +22 -0
- package/lib/i18n/en/main.d.ts.map +1 -1
- package/lib/i18n/en/main.js +22 -0
- package/lib/i18n/en/main.js.map +1 -1
- package/lib/i18n/en/simpleUi.d.ts +170 -0
- package/lib/i18n/en/simpleUi.d.ts.map +1 -0
- package/lib/i18n/en/simpleUi.js +169 -0
- package/lib/i18n/en/simpleUi.js.map +1 -0
- package/lib/i18n/index.d.ts +1 -0
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js +37 -6
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/ja/command.d.ts +605 -0
- package/lib/i18n/ja/command.d.ts.map +1 -0
- package/lib/i18n/ja/command.js +604 -0
- package/lib/i18n/ja/command.js.map +1 -0
- package/lib/i18n/ja/jig.d.ts +2425 -0
- package/lib/i18n/ja/jig.d.ts.map +1 -0
- package/lib/i18n/ja/jig.js +2316 -0
- package/lib/i18n/ja/jig.js.map +1 -0
- package/lib/i18n/ja/main.d.ts +216 -0
- package/lib/i18n/ja/main.d.ts.map +1 -0
- package/lib/i18n/ja/main.js +215 -0
- package/lib/i18n/ja/main.js.map +1 -0
- package/lib/i18n/ja/simpleUi.d.ts +170 -0
- package/lib/i18n/ja/simpleUi.d.ts.map +1 -0
- package/lib/i18n/ja/simpleUi.js +169 -0
- package/lib/i18n/ja/simpleUi.js.map +1 -0
- package/lib/i18n/ko/command.d.ts +605 -0
- package/lib/i18n/ko/command.d.ts.map +1 -0
- package/lib/i18n/ko/command.js +604 -0
- package/lib/i18n/ko/command.js.map +1 -0
- package/lib/i18n/ko/jig.d.ts +2425 -0
- package/lib/i18n/ko/jig.d.ts.map +1 -0
- package/lib/i18n/ko/jig.js +2316 -0
- package/lib/i18n/ko/jig.js.map +1 -0
- package/lib/i18n/ko/main.d.ts +216 -0
- package/lib/i18n/ko/main.d.ts.map +1 -0
- package/lib/i18n/ko/main.js +215 -0
- package/lib/i18n/ko/main.js.map +1 -0
- package/lib/i18n/ko/simpleUi.d.ts +170 -0
- package/lib/i18n/ko/simpleUi.d.ts.map +1 -0
- package/lib/i18n/ko/simpleUi.js +169 -0
- package/lib/i18n/ko/simpleUi.js.map +1 -0
- package/lib/i18n/tr/command.d.ts +111 -1
- package/lib/i18n/tr/command.d.ts.map +1 -1
- package/lib/i18n/tr/command.js +112 -2
- package/lib/i18n/tr/command.js.map +1 -1
- package/lib/i18n/tr/jig.d.ts +867 -0
- package/lib/i18n/tr/jig.d.ts.map +1 -1
- package/lib/i18n/tr/jig.js +1096 -24
- package/lib/i18n/tr/jig.js.map +1 -1
- package/lib/i18n/tr/main.d.ts +22 -0
- package/lib/i18n/tr/main.d.ts.map +1 -1
- package/lib/i18n/tr/main.js +23 -1
- package/lib/i18n/tr/main.js.map +1 -1
- package/lib/i18n/tr/simpleUi.d.ts +170 -0
- package/lib/i18n/tr/simpleUi.d.ts.map +1 -0
- package/lib/i18n/tr/simpleUi.js +169 -0
- package/lib/i18n/tr/simpleUi.js.map +1 -0
- package/lib/i18n/zh/command.d.ts +98 -1
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +99 -2
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/jig.d.ts +844 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -1
- package/lib/i18n/zh/jig.js +793 -1
- package/lib/i18n/zh/jig.js.map +1 -1
- package/lib/i18n/zh/main.d.ts +22 -0
- package/lib/i18n/zh/main.d.ts.map +1 -1
- package/lib/i18n/zh/main.js +22 -0
- package/lib/i18n/zh/main.js.map +1 -1
- package/lib/i18n/zh/simpleUi.d.ts +170 -0
- package/lib/i18n/zh/simpleUi.d.ts.map +1 -0
- package/lib/i18n/zh/simpleUi.js +169 -0
- package/lib/i18n/zh/simpleUi.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/service/AcApEntityService.d.ts +36 -2
- package/lib/service/AcApEntityService.d.ts.map +1 -1
- package/lib/service/AcApEntityService.js +92 -23
- package/lib/service/AcApEntityService.js.map +1 -1
- package/lib/service/AcApGroup.d.ts +95 -0
- package/lib/service/AcApGroup.d.ts.map +1 -0
- package/lib/service/AcApGroup.js +421 -0
- package/lib/service/AcApGroup.js.map +1 -0
- package/lib/service/AcApLlmSettingsService.d.ts +74 -0
- package/lib/service/AcApLlmSettingsService.d.ts.map +1 -0
- package/lib/service/AcApLlmSettingsService.js +126 -0
- package/lib/service/AcApLlmSettingsService.js.map +1 -0
- package/lib/service/AcApNamedViewService.d.ts +139 -0
- package/lib/service/AcApNamedViewService.d.ts.map +1 -0
- package/lib/service/AcApNamedViewService.js +407 -0
- package/lib/service/AcApNamedViewService.js.map +1 -0
- package/lib/service/AcApTextRecognitionService.d.ts +107 -0
- package/lib/service/AcApTextRecognitionService.d.ts.map +1 -0
- package/lib/service/AcApTextRecognitionService.js +304 -0
- package/lib/service/AcApTextRecognitionService.js.map +1 -0
- package/lib/service/AcApUcsService.d.ts +101 -0
- package/lib/service/AcApUcsService.d.ts.map +1 -0
- package/lib/service/AcApUcsService.js +753 -0
- package/lib/service/AcApUcsService.js.map +1 -0
- package/lib/service/index.d.ts +5 -0
- package/lib/service/index.d.ts.map +1 -1
- package/lib/service/index.js +5 -0
- package/lib/service/index.js.map +1 -1
- package/lib/smartBlock/AcApSmartBlockConvert.d.ts +98 -0
- package/lib/smartBlock/AcApSmartBlockConvert.d.ts.map +1 -0
- package/lib/smartBlock/AcApSmartBlockConvert.js +300 -0
- package/lib/smartBlock/AcApSmartBlockConvert.js.map +1 -0
- package/lib/smartBlock/AcApSmartBlockDetect.d.ts +149 -0
- package/lib/smartBlock/AcApSmartBlockDetect.d.ts.map +1 -0
- package/lib/smartBlock/AcApSmartBlockDetect.js +1464 -0
- package/lib/smartBlock/AcApSmartBlockDetect.js.map +1 -0
- package/lib/smartBlock/AcApSmartBlockSearch.d.ts +161 -0
- package/lib/smartBlock/AcApSmartBlockSearch.d.ts.map +1 -0
- package/lib/smartBlock/AcApSmartBlockSearch.js +712 -0
- package/lib/smartBlock/AcApSmartBlockSearch.js.map +1 -0
- package/lib/smartBlock/AcApSmartBlockSession.d.ts +85 -0
- package/lib/smartBlock/AcApSmartBlockSession.d.ts.map +1 -0
- package/lib/smartBlock/AcApSmartBlockSession.js +233 -0
- package/lib/smartBlock/AcApSmartBlockSession.js.map +1 -0
- package/lib/smartBlock/AcEdShapeFeatures.d.ts +33 -0
- package/lib/smartBlock/AcEdShapeFeatures.d.ts.map +1 -0
- package/lib/smartBlock/AcEdShapeFeatures.js +571 -0
- package/lib/smartBlock/AcEdShapeFeatures.js.map +1 -0
- package/lib/smartBlock/AcEdShapeMatcher.d.ts +146 -0
- package/lib/smartBlock/AcEdShapeMatcher.d.ts.map +1 -0
- package/lib/smartBlock/AcEdShapeMatcher.js +749 -0
- package/lib/smartBlock/AcEdShapeMatcher.js.map +1 -0
- package/lib/smartBlock/index.d.ts +7 -0
- package/lib/smartBlock/index.d.ts.map +1 -0
- package/lib/smartBlock/index.js +7 -0
- package/lib/smartBlock/index.js.map +1 -0
- package/lib/ui/AcApSimpleUiChrome.d.ts +374 -0
- package/lib/ui/AcApSimpleUiChrome.d.ts.map +1 -0
- package/lib/ui/AcApSimpleUiChrome.js +1308 -0
- package/lib/ui/AcApSimpleUiChrome.js.map +1 -0
- package/lib/ui/AcUiColorPicker.d.ts +47 -0
- package/lib/ui/AcUiColorPicker.d.ts.map +1 -0
- package/lib/ui/AcUiColorPicker.js +133 -0
- package/lib/ui/AcUiColorPicker.js.map +1 -0
- package/lib/ui/AcUiFileOpenPanel.js +1 -1
- package/lib/ui/AcUiFileOpenPanel.js.map +1 -1
- package/lib/ui/AcUiFindPaletteView.d.ts +99 -0
- package/lib/ui/AcUiFindPaletteView.d.ts.map +1 -0
- package/lib/ui/AcUiFindPaletteView.js +426 -0
- package/lib/ui/AcUiFindPaletteView.js.map +1 -0
- package/lib/ui/AcUiLayerListView.d.ts +114 -0
- package/lib/ui/AcUiLayerListView.d.ts.map +1 -0
- package/lib/ui/AcUiLayerListView.js +443 -0
- package/lib/ui/AcUiLayerListView.js.map +1 -0
- package/lib/ui/AcUiMeasurementPaletteView.d.ts +83 -0
- package/lib/ui/AcUiMeasurementPaletteView.d.ts.map +1 -0
- package/lib/ui/AcUiMeasurementPaletteView.js +341 -0
- package/lib/ui/AcUiMeasurementPaletteView.js.map +1 -0
- package/lib/ui/AcUiReviewPaletteView.d.ts +141 -0
- package/lib/ui/AcUiReviewPaletteView.d.ts.map +1 -0
- package/lib/ui/AcUiReviewPaletteView.js +524 -0
- package/lib/ui/AcUiReviewPaletteView.js.map +1 -0
- package/lib/ui/AcUiShortCutToolbar.d.ts +24 -2
- package/lib/ui/AcUiShortCutToolbar.d.ts.map +1 -1
- package/lib/ui/AcUiShortCutToolbar.js +48 -6
- package/lib/ui/AcUiShortCutToolbar.js.map +1 -1
- package/lib/ui/AcUiSimpleUiOptions.d.ts +88 -0
- package/lib/ui/AcUiSimpleUiOptions.d.ts.map +1 -0
- package/lib/ui/AcUiSimpleUiOptions.js +2 -0
- package/lib/ui/AcUiSimpleUiOptions.js.map +1 -0
- package/lib/ui/AcUiSimpleUiStyles.d.ts +12 -0
- package/lib/ui/AcUiSimpleUiStyles.d.ts.map +1 -0
- package/lib/ui/AcUiSimpleUiStyles.js +28 -0
- package/lib/ui/AcUiSimpleUiStyles.js.map +1 -0
- package/lib/ui/AcUiThemeSync.d.ts +58 -0
- package/lib/ui/AcUiThemeSync.d.ts.map +1 -0
- package/lib/ui/AcUiThemeSync.js +114 -0
- package/lib/ui/AcUiThemeSync.js.map +1 -0
- package/lib/ui/acuiNormalizeSimpleUiOptions.d.ts +20 -0
- package/lib/ui/acuiNormalizeSimpleUiOptions.d.ts.map +1 -0
- package/lib/ui/acuiNormalizeSimpleUiOptions.js +46 -0
- package/lib/ui/acuiNormalizeSimpleUiOptions.js.map +1 -0
- package/lib/ui/dock/AcUiDockPanel.d.ts +204 -0
- package/lib/ui/dock/AcUiDockPanel.d.ts.map +1 -0
- package/lib/ui/dock/AcUiDockPanel.js +926 -0
- package/lib/ui/dock/AcUiDockPanel.js.map +1 -0
- package/lib/ui/dock/acuiDockPanelStyles.d.ts +9 -0
- package/lib/ui/dock/acuiDockPanelStyles.d.ts.map +1 -0
- package/lib/ui/dock/acuiDockPanelStyles.js +27 -0
- package/lib/ui/dock/acuiDockPanelStyles.js.map +1 -0
- package/lib/ui/dock/index.d.ts +3 -0
- package/lib/ui/dock/index.d.ts.map +1 -0
- package/lib/ui/dock/index.js +3 -0
- package/lib/ui/dock/index.js.map +1 -0
- package/lib/ui/icons.d.ts +22 -14
- package/lib/ui/icons.d.ts.map +1 -1
- package/lib/ui/icons.js +42 -32
- package/lib/ui/icons.js.map +1 -1
- package/lib/ui/index.d.ts +12 -0
- package/lib/ui/index.d.ts.map +1 -1
- package/lib/ui/index.js +11 -0
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/toolbar/AcUiToolbar.d.ts +1 -1
- package/lib/ui/toolbar/AcUiToolbar.js +1 -1
- package/lib/ui/toolbar/createLayoutToolbarItem.d.ts +41 -0
- package/lib/ui/toolbar/createLayoutToolbarItem.d.ts.map +1 -0
- package/lib/ui/toolbar/createLayoutToolbarItem.js +103 -0
- package/lib/ui/toolbar/createLayoutToolbarItem.js.map +1 -0
- package/lib/ui/toolbar/createToolbarLayoutSwitcher.d.ts +40 -0
- package/lib/ui/toolbar/createToolbarLayoutSwitcher.d.ts.map +1 -0
- package/lib/ui/toolbar/createToolbarLayoutSwitcher.js +65 -0
- package/lib/ui/toolbar/createToolbarLayoutSwitcher.js.map +1 -0
- package/lib/ui/toolbar/defaultToolbarItems.d.ts +44 -0
- package/lib/ui/toolbar/defaultToolbarItems.d.ts.map +1 -0
- package/lib/ui/toolbar/defaultToolbarItems.js +614 -0
- package/lib/ui/toolbar/defaultToolbarItems.js.map +1 -0
- package/lib/ui/toolbar/index.d.ts +3 -1
- package/lib/ui/toolbar/index.d.ts.map +1 -1
- package/lib/ui/toolbar/index.js +1 -0
- package/lib/ui/toolbar/index.js.map +1 -1
- package/lib/ui/toolbar/mergeToolbarOptionsForLayout.d.ts +25 -0
- package/lib/ui/toolbar/mergeToolbarOptionsForLayout.d.ts.map +1 -0
- package/lib/ui/toolbar/mergeToolbarOptionsForLayout.js +164 -0
- package/lib/ui/toolbar/mergeToolbarOptionsForLayout.js.map +1 -0
- package/lib/ui/toolbar/resolveDockMountTarget.d.ts +22 -0
- package/lib/ui/toolbar/resolveDockMountTarget.d.ts.map +1 -0
- package/lib/ui/toolbar/resolveDockMountTarget.js +47 -0
- package/lib/ui/toolbar/resolveDockMountTarget.js.map +1 -0
- package/lib/ui/toolbar/resolveToolbarItems.d.ts +46 -0
- package/lib/ui/toolbar/resolveToolbarItems.d.ts.map +1 -0
- package/lib/ui/toolbar/resolveToolbarItems.js +161 -0
- package/lib/ui/toolbar/resolveToolbarItems.js.map +1 -0
- package/lib/ui/toolbar/resolveToolbarMountTarget.d.ts +17 -0
- package/lib/ui/toolbar/resolveToolbarMountTarget.d.ts.map +1 -0
- package/lib/ui/toolbar/resolveToolbarMountTarget.js +39 -0
- package/lib/ui/toolbar/resolveToolbarMountTarget.js.map +1 -0
- package/lib/ui/toolbar/simpleUiPresets.d.ts +15 -0
- package/lib/ui/toolbar/simpleUiPresets.d.ts.map +1 -0
- package/lib/ui/toolbar/simpleUiPresets.js +14 -0
- package/lib/ui/toolbar/simpleUiPresets.js.map +1 -0
- package/lib/ui/toolbar/types.d.ts +18 -0
- package/lib/ui/toolbar/types.d.ts.map +1 -1
- package/lib/util/AcApFontUtil.d.ts +19 -0
- package/lib/util/AcApFontUtil.d.ts.map +1 -1
- package/lib/util/AcApFontUtil.js +108 -13
- package/lib/util/AcApFontUtil.js.map +1 -1
- package/lib/util/AcApGeTransform.d.ts +8 -0
- package/lib/util/AcApGeTransform.d.ts.map +1 -1
- package/lib/util/AcApGeTransform.js +13 -0
- package/lib/util/AcApGeTransform.js.map +1 -1
- package/lib/util/AcApLayoutViewFraming.d.ts +22 -0
- package/lib/util/AcApLayoutViewFraming.d.ts.map +1 -1
- package/lib/util/AcApLayoutViewFraming.js +24 -0
- package/lib/util/AcApLayoutViewFraming.js.map +1 -1
- package/lib/util/AcApTextMeasure.d.ts +43 -0
- package/lib/util/AcApTextMeasure.d.ts.map +1 -0
- package/lib/util/AcApTextMeasure.js +82 -0
- package/lib/util/AcApTextMeasure.js.map +1 -0
- package/lib/util/acapResolveOpenFileType.d.ts +12 -0
- package/lib/util/acapResolveOpenFileType.d.ts.map +1 -0
- package/lib/util/acapResolveOpenFileType.js +22 -0
- package/lib/util/acapResolveOpenFileType.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -1
- package/lib/view/AcApUcsIconOverlay.d.ts +26 -0
- package/lib/view/AcApUcsIconOverlay.d.ts.map +1 -0
- package/lib/view/AcApUcsIconOverlay.js +143 -0
- package/lib/view/AcApUcsIconOverlay.js.map +1 -0
- package/lib/view/AcEdViewKeyHandler.d.ts +11 -0
- package/lib/view/AcEdViewKeyHandler.d.ts.map +1 -1
- package/lib/view/AcEdViewKeyHandler.js +39 -3
- package/lib/view/AcEdViewKeyHandler.js.map +1 -1
- package/lib/view/AcTrEntityDisplayController.d.ts +5 -0
- package/lib/view/AcTrEntityDisplayController.d.ts.map +1 -1
- package/lib/view/AcTrEntityDisplayController.js +5 -0
- package/lib/view/AcTrEntityDisplayController.js.map +1 -1
- package/lib/view/AcTrLayer.d.ts +27 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +40 -0
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +55 -1
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +252 -51
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrLayoutView.d.ts +0 -12
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +0 -20
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +6 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
- package/lib/view/AcTrLayoutViewManager.js +8 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +12 -0
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +65 -16
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +92 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +371 -96
- package/lib/view/AcTrView2d.js.map +1 -1
- package/lib/view/AcTrViewSessionState.d.ts +5 -0
- package/lib/view/AcTrViewSessionState.d.ts.map +1 -1
- package/package.json +12 -16
- package/src/file-open-panel.ts +93 -89
- package/src/ui/icons.ts +428 -411
- package/dist/cad-simple-viewer-AcUiFileOpenSession-drptdOYc.js +0 -324
- package/find.ts +0 -7
- package/src/find/AcApFindNavigator.ts +0 -190
- package/src/find/findDrawing.ts +0 -211
- package/src/find/findText.ts +0 -624
- package/src/find/index.ts +0 -2
|
@@ -0,0 +1,1464 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __values = (this && this.__values) || function(o) {
|
|
49
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
50
|
+
if (m) return m.call(o);
|
|
51
|
+
if (o && typeof o.length === "number") return {
|
|
52
|
+
next: function () {
|
|
53
|
+
if (o && i >= o.length) o = void 0;
|
|
54
|
+
return { value: o && o[i++], done: !o };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
58
|
+
};
|
|
59
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
60
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
61
|
+
if (!m) return o;
|
|
62
|
+
var i = m.call(o), r, ar = [], e;
|
|
63
|
+
try {
|
|
64
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
65
|
+
}
|
|
66
|
+
catch (error) { e = { error: error }; }
|
|
67
|
+
finally {
|
|
68
|
+
try {
|
|
69
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
70
|
+
}
|
|
71
|
+
finally { if (e) throw e.error; }
|
|
72
|
+
}
|
|
73
|
+
return ar;
|
|
74
|
+
};
|
|
75
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
76
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
77
|
+
if (ar || !(i in from)) {
|
|
78
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
79
|
+
ar[i] = from[i];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
83
|
+
};
|
|
84
|
+
import { excludeLockedLayerIds } from '../service/AcApLockedLayer';
|
|
85
|
+
import { acapConvertSmartBlock, acapInvertAffine2d } from './AcApSmartBlockConvert';
|
|
86
|
+
import { acapBuildSmartBlockTemplate, acapComposeAffine2d, acapFindSmartBlockMatches, AcApSmartBlockCandidatePool, AcApSmartBlockFeatureCache, acapSmartBlockTemplateCenter, acapSmartBlockVariableTexts } from './AcApSmartBlockSearch';
|
|
87
|
+
import { acedApplyAffine2d, acedFindShapeMatches, acedShapeLandsOn } from './AcEdShapeMatcher';
|
|
88
|
+
/**
|
|
89
|
+
* Converts a detected group into a new block: the representative and every
|
|
90
|
+
* instance become references of it. Call it inside one undo mark, like
|
|
91
|
+
* {@link acapConvertSmartBlock}. Instances must still be unchanged since
|
|
92
|
+
* detection.
|
|
93
|
+
*
|
|
94
|
+
* @param db - Drawing database the group was detected in.
|
|
95
|
+
* @param cluster - Group from {@link acapDetectSmartBlocks}.
|
|
96
|
+
* @param options - Block name, insertion point and attributes.
|
|
97
|
+
*/
|
|
98
|
+
export function acapConvertSmartBlockCluster(db, cluster, options) {
|
|
99
|
+
var _a, _b, _c;
|
|
100
|
+
var template = acapBuildSmartBlockTemplate(db, cluster.ids, {
|
|
101
|
+
matchLayer: (_a = options.matchLayer) !== null && _a !== void 0 ? _a : true
|
|
102
|
+
});
|
|
103
|
+
if (template.ids.length !== cluster.ids.length) {
|
|
104
|
+
throw new Error('Detected group changed since detection');
|
|
105
|
+
}
|
|
106
|
+
var attributes = (_b = options.attributes) !== null && _b !== void 0 ? _b : acapSmartBlockVariableTexts(template, cluster.matches).map(function (index, i) { return ({
|
|
107
|
+
index: index,
|
|
108
|
+
tag: "TEXT".concat(i + 1)
|
|
109
|
+
}); });
|
|
110
|
+
return acapConvertSmartBlock(db, template, cluster.matches, {
|
|
111
|
+
target: {
|
|
112
|
+
kind: 'new',
|
|
113
|
+
name: options.name,
|
|
114
|
+
basePoint: (_c = options.basePoint) !== null && _c !== void 0 ? _c : acapSmartBlockTemplateCenter(template),
|
|
115
|
+
attributes: attributes
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Finds groups of identical shapes anywhere in model space, without a
|
|
121
|
+
* selection: the heuristic counterpart of AutoCAD's Detect and Convert
|
|
122
|
+
* (`BDETECT`), which uses a cloud recognition model.
|
|
123
|
+
*
|
|
124
|
+
* Steps:
|
|
125
|
+
*
|
|
126
|
+
* 1. Every describable shape gets its neighbors, nearest first: shapes that
|
|
127
|
+
* touch it (a characteristic point in its padded bounds) and shapes
|
|
128
|
+
* whose bounds are closer than the smaller one's size.
|
|
129
|
+
* 2. Each neighbor pair gets a key that does not change under translation,
|
|
130
|
+
* rotation and (optionally) mirroring: kinds, sizes, distance and the
|
|
131
|
+
* second moments of both shapes in the pair's own frame. Keys that occur
|
|
132
|
+
* at least `minInstances` times seed a group, most frequent first.
|
|
133
|
+
* 3. The seed occurrences grow together, round by round: a shape touching
|
|
134
|
+
* the first occurrence joins when, in enough other occurrences, a shape
|
|
135
|
+
* lands on it under that occurrence's transform. Walls and other shapes
|
|
136
|
+
* that differ around each copy are left out.
|
|
137
|
+
* 4. Every round is rated by the exact matcher on just the shapes growth
|
|
138
|
+
* collected; the best round is then verified on the whole drawing by
|
|
139
|
+
* the Smart Blocks search ({@link acapFindSmartBlockMatches}).
|
|
140
|
+
* 5. A seed pair may play different roles in one symbol (an arc at a
|
|
141
|
+
* corner and at an end), which stops growth early. The verified copies
|
|
142
|
+
* are consistent, so the group grows again from them, absorbing earlier
|
|
143
|
+
* groups that turn out to be parts of it when the whole saves more.
|
|
144
|
+
* 6. Texts inside the group join it when most copies have one there; with
|
|
145
|
+
* text variations they become attributes on conversion.
|
|
146
|
+
* 7. The copies' entities are claimed so groups never share entities.
|
|
147
|
+
* Groups saving fewer than `minSavings` entities are dropped.
|
|
148
|
+
*
|
|
149
|
+
* Every group can be reviewed and converted with `AcApSmartBlockSearch`
|
|
150
|
+
* from its {@link AcApSmartBlockCluster.ids}. That search may find more
|
|
151
|
+
* copies than reported here: copies used by another group are not counted.
|
|
152
|
+
*
|
|
153
|
+
* Groups are returned largest saving first.
|
|
154
|
+
*
|
|
155
|
+
* @param db - Drawing database.
|
|
156
|
+
* @param options - Thresholds and allowed transforms.
|
|
157
|
+
* @param cache - Feature cache shared with later searches.
|
|
158
|
+
*/
|
|
159
|
+
export function acapDetectSmartBlocks(db, options, cache) {
|
|
160
|
+
if (options === void 0) { options = {}; }
|
|
161
|
+
if (cache === void 0) { cache = new AcApSmartBlockFeatureCache(); }
|
|
162
|
+
var run = detect(db, options, cache);
|
|
163
|
+
for (;;) {
|
|
164
|
+
var step = run.next();
|
|
165
|
+
if (step.done)
|
|
166
|
+
return step.value;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* {@link acapDetectSmartBlocks} in slices, yielding to the event loop
|
|
171
|
+
* between them so a UI stays responsive, with progress and cancellation.
|
|
172
|
+
* Single steps (one exact search) can still take a moment in large
|
|
173
|
+
* drawings.
|
|
174
|
+
*
|
|
175
|
+
* @param db - Drawing database; do not edit it until the promise settles.
|
|
176
|
+
* @param options - Thresholds and allowed transforms.
|
|
177
|
+
* @param control - Progress callback, abort signal and slice length.
|
|
178
|
+
* @param cache - Feature cache shared with later searches.
|
|
179
|
+
*/
|
|
180
|
+
export function acapDetectSmartBlocksAsync(db_1) {
|
|
181
|
+
return __awaiter(this, arguments, void 0, function (db, options, control, cache) {
|
|
182
|
+
var slice, run, last, step;
|
|
183
|
+
var _a, _b, _c, _d;
|
|
184
|
+
if (options === void 0) { options = {}; }
|
|
185
|
+
if (control === void 0) { control = {}; }
|
|
186
|
+
if (cache === void 0) { cache = new AcApSmartBlockFeatureCache(); }
|
|
187
|
+
return __generator(this, function (_e) {
|
|
188
|
+
switch (_e.label) {
|
|
189
|
+
case 0:
|
|
190
|
+
slice = (_a = control.sliceMs) !== null && _a !== void 0 ? _a : 30;
|
|
191
|
+
run = detect(db, options, cache);
|
|
192
|
+
last = performance.now();
|
|
193
|
+
_e.label = 1;
|
|
194
|
+
case 1:
|
|
195
|
+
(_b = control.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
196
|
+
step = run.next();
|
|
197
|
+
if (step.done) {
|
|
198
|
+
(_c = control.onProgress) === null || _c === void 0 ? void 0 : _c.call(control, { fraction: 1, groups: step.value.length });
|
|
199
|
+
return [2 /*return*/, step.value];
|
|
200
|
+
}
|
|
201
|
+
if (!(performance.now() - last >= slice)) return [3 /*break*/, 3];
|
|
202
|
+
(_d = control.onProgress) === null || _d === void 0 ? void 0 : _d.call(control, step.value);
|
|
203
|
+
return [4 /*yield*/, yieldToEventLoop()];
|
|
204
|
+
case 2:
|
|
205
|
+
_e.sent();
|
|
206
|
+
last = performance.now();
|
|
207
|
+
_e.label = 3;
|
|
208
|
+
case 3: return [3 /*break*/, 1];
|
|
209
|
+
case 4: return [2 /*return*/];
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Lets pending events run. A message is used rather than `setTimeout(0)`,
|
|
216
|
+
* which browsers clamp to about a second in background tabs: detection
|
|
217
|
+
* would crawl as soon as the user switched tabs.
|
|
218
|
+
*/
|
|
219
|
+
function yieldToEventLoop() {
|
|
220
|
+
if (typeof MessageChannel === 'undefined') {
|
|
221
|
+
return new Promise(function (resolve) { return setTimeout(resolve, 0); });
|
|
222
|
+
}
|
|
223
|
+
return new Promise(function (resolve) {
|
|
224
|
+
var channel = new MessageChannel();
|
|
225
|
+
channel.port1.onmessage = function () {
|
|
226
|
+
channel.port1.close();
|
|
227
|
+
channel.port2.close();
|
|
228
|
+
resolve();
|
|
229
|
+
};
|
|
230
|
+
channel.port2.postMessage(undefined);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/** The detection, yielding progress at points where it may pause. */
|
|
234
|
+
function detect(db, options, cache) {
|
|
235
|
+
var minInstances, minEntities, minSavings, maxEntities, agreement, neighborLimit, maxSeeds, allowMirror, allowScale, searchOptions, _a, nodes, texts, _b, _c, done, e_1_1, seeds, i, _d, _e, j, ab, ba, _f, key, a, b, list, keys, claimed, index, textGrid, clusterOf, context, pool, clusters, k, pairs, occurrences, aligned, need, idsOf, rounds, members, localSaving, estimate, rounds_1, rounds_1_1, round, labels, size, local, saving, best, pass, grown, absorbed, grown_1, grown_1_1, i, owner, released, verified, before, after, absorbed_1, absorbed_1_1, cluster_1, _g, _h, id, shapeIds, inside, withTexts, instanceCount, cluster, _j, _k, id;
|
|
236
|
+
var e_1, _l, e_2, _m, e_3, _o, e_4, _p, e_5, _q, e_6, _r, e_7, _s;
|
|
237
|
+
var _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
238
|
+
return __generator(this, function (_4) {
|
|
239
|
+
switch (_4.label) {
|
|
240
|
+
case 0:
|
|
241
|
+
minInstances = Math.max(2, (_t = options.minInstances) !== null && _t !== void 0 ? _t : 3);
|
|
242
|
+
minEntities = Math.max(1, (_u = options.minEntities) !== null && _u !== void 0 ? _u : 2);
|
|
243
|
+
minSavings = (_v = options.minSavings) !== null && _v !== void 0 ? _v : 10;
|
|
244
|
+
maxEntities = (_w = options.maxEntities) !== null && _w !== void 0 ? _w : 64;
|
|
245
|
+
agreement = (_x = options.agreement) !== null && _x !== void 0 ? _x : 0.8;
|
|
246
|
+
neighborLimit = (_y = options.neighborLimit) !== null && _y !== void 0 ? _y : 24;
|
|
247
|
+
maxSeeds = (_z = options.maxSeeds) !== null && _z !== void 0 ? _z : Infinity;
|
|
248
|
+
allowMirror = (_0 = options.allowMirror) !== null && _0 !== void 0 ? _0 : true;
|
|
249
|
+
allowScale = (_1 = options.allowScale) !== null && _1 !== void 0 ? _1 : false;
|
|
250
|
+
searchOptions = {
|
|
251
|
+
allowRotation: options.allowRotation,
|
|
252
|
+
allowMirror: allowMirror,
|
|
253
|
+
allowScale: allowScale,
|
|
254
|
+
matchLayer: (_2 = options.matchLayer) !== null && _2 !== void 0 ? _2 : true,
|
|
255
|
+
textVariations: (_3 = options.textVariations) !== null && _3 !== void 0 ? _3 : true
|
|
256
|
+
};
|
|
257
|
+
_a = collect(db, searchOptions.matchLayer, cache), nodes = _a.nodes, texts = _a.texts;
|
|
258
|
+
if (nodes.length < minInstances * minEntities)
|
|
259
|
+
return [2 /*return*/, []];
|
|
260
|
+
return [4 /*yield*/, { fraction: 0.02, groups: 0 }];
|
|
261
|
+
case 1:
|
|
262
|
+
_4.sent();
|
|
263
|
+
_4.label = 2;
|
|
264
|
+
case 2:
|
|
265
|
+
_4.trys.push([2, 7, 8, 9]);
|
|
266
|
+
_b = __values(linkNeighbors(nodes, neighborLimit)), _c = _b.next();
|
|
267
|
+
_4.label = 3;
|
|
268
|
+
case 3:
|
|
269
|
+
if (!!_c.done) return [3 /*break*/, 6];
|
|
270
|
+
done = _c.value;
|
|
271
|
+
return [4 /*yield*/, { fraction: 0.02 + 0.13 * done, groups: 0 }];
|
|
272
|
+
case 4:
|
|
273
|
+
_4.sent();
|
|
274
|
+
_4.label = 5;
|
|
275
|
+
case 5:
|
|
276
|
+
_c = _b.next();
|
|
277
|
+
return [3 /*break*/, 3];
|
|
278
|
+
case 6: return [3 /*break*/, 9];
|
|
279
|
+
case 7:
|
|
280
|
+
e_1_1 = _4.sent();
|
|
281
|
+
e_1 = { error: e_1_1 };
|
|
282
|
+
return [3 /*break*/, 9];
|
|
283
|
+
case 8:
|
|
284
|
+
try {
|
|
285
|
+
if (_c && !_c.done && (_l = _b.return)) _l.call(_b);
|
|
286
|
+
}
|
|
287
|
+
finally { if (e_1) throw e_1.error; }
|
|
288
|
+
return [7 /*endfinally*/];
|
|
289
|
+
case 9:
|
|
290
|
+
seeds = new Map();
|
|
291
|
+
i = 0;
|
|
292
|
+
_4.label = 10;
|
|
293
|
+
case 10:
|
|
294
|
+
if (!(i < nodes.length)) return [3 /*break*/, 14];
|
|
295
|
+
if (!(i % 1000 === 0)) return [3 /*break*/, 12];
|
|
296
|
+
return [4 /*yield*/, { fraction: 0.15 + (0.1 * i) / nodes.length, groups: 0 }];
|
|
297
|
+
case 11:
|
|
298
|
+
_4.sent();
|
|
299
|
+
_4.label = 12;
|
|
300
|
+
case 12:
|
|
301
|
+
try {
|
|
302
|
+
for (_d = (e_2 = void 0, __values(nodes[i].neighbors)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
303
|
+
j = _e.value;
|
|
304
|
+
if (j <= i)
|
|
305
|
+
continue;
|
|
306
|
+
ab = pairKey(nodes[i], nodes[j], allowMirror, allowScale);
|
|
307
|
+
ba = pairKey(nodes[j], nodes[i], allowMirror, allowScale);
|
|
308
|
+
if (!ab || !ba)
|
|
309
|
+
continue;
|
|
310
|
+
_f = __read(ab <= ba ? [ab, i, j] : [ba, j, i], 3), key = _f[0], a = _f[1], b = _f[2];
|
|
311
|
+
list = seeds.get(key);
|
|
312
|
+
if (list)
|
|
313
|
+
list.push(a, b);
|
|
314
|
+
else
|
|
315
|
+
seeds.set(key, [a, b]);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
319
|
+
finally {
|
|
320
|
+
try {
|
|
321
|
+
if (_e && !_e.done && (_m = _d.return)) _m.call(_d);
|
|
322
|
+
}
|
|
323
|
+
finally { if (e_2) throw e_2.error; }
|
|
324
|
+
}
|
|
325
|
+
_4.label = 13;
|
|
326
|
+
case 13:
|
|
327
|
+
i++;
|
|
328
|
+
return [3 /*break*/, 10];
|
|
329
|
+
case 14:
|
|
330
|
+
keys = __spreadArray([], __read(seeds.entries()), false).filter(function (_a) {
|
|
331
|
+
var _b = __read(_a, 2), pairs = _b[1];
|
|
332
|
+
return pairs.length / 2 >= minInstances;
|
|
333
|
+
})
|
|
334
|
+
.sort(function (x, y) { return y[1].length - x[1].length; })
|
|
335
|
+
.slice(0, maxSeeds);
|
|
336
|
+
claimed = new Set();
|
|
337
|
+
index = new NodeIndex(nodes);
|
|
338
|
+
textGrid = new TextGrid(texts, medianRadius(nodes));
|
|
339
|
+
clusterOf = new Map();
|
|
340
|
+
context = {
|
|
341
|
+
db: db,
|
|
342
|
+
options: searchOptions,
|
|
343
|
+
cache: cache,
|
|
344
|
+
claimed: claimed
|
|
345
|
+
};
|
|
346
|
+
pool = AcApSmartBlockCandidatePool.fromDatabase(db, searchOptions.matchLayer, cache);
|
|
347
|
+
clusters = [];
|
|
348
|
+
k = 0;
|
|
349
|
+
_4.label = 15;
|
|
350
|
+
case 15:
|
|
351
|
+
if (!(k < keys.length)) return [3 /*break*/, 18];
|
|
352
|
+
return [4 /*yield*/, { fraction: 0.25 + (0.75 * k) / keys.length, groups: clusters.length }];
|
|
353
|
+
case 16:
|
|
354
|
+
_4.sent();
|
|
355
|
+
pairs = keys[k][1];
|
|
356
|
+
occurrences = pickOccurrences(nodes, pairs, claimed);
|
|
357
|
+
if (occurrences.length < minInstances)
|
|
358
|
+
return [3 /*break*/, 17];
|
|
359
|
+
aligned = alignOccurrences(nodes, occurrences, allowMirror);
|
|
360
|
+
if (aligned.length < minInstances)
|
|
361
|
+
return [3 /*break*/, 17];
|
|
362
|
+
need = Math.max(minInstances, Math.ceil(agreement * aligned.length));
|
|
363
|
+
idsOf = function (list) { return list.map(function (i) { return nodes[i].id; }); };
|
|
364
|
+
rounds = grow(nodes, aligned, claimed, need, maxEntities);
|
|
365
|
+
members = [];
|
|
366
|
+
localSaving = 0;
|
|
367
|
+
estimate = 0;
|
|
368
|
+
try {
|
|
369
|
+
for (rounds_1 = (e_3 = void 0, __values(rounds)), rounds_1_1 = rounds_1.next(); !rounds_1_1.done; rounds_1_1 = rounds_1.next()) {
|
|
370
|
+
round = rounds_1_1.value;
|
|
371
|
+
if (round.members.length < minEntities)
|
|
372
|
+
continue;
|
|
373
|
+
if (round.complete < minInstances)
|
|
374
|
+
continue;
|
|
375
|
+
labels = textsInside(textGrid, round.members.map(function (i) { return nodes[i]; }), claimed).length;
|
|
376
|
+
size = round.members.length + labels;
|
|
377
|
+
if (round.complete * (size - 1) < minSavings)
|
|
378
|
+
continue;
|
|
379
|
+
if (isDegenerate(round.members.map(function (i) { return nodes[i].feature; })))
|
|
380
|
+
continue;
|
|
381
|
+
local = localCopies(nodes, round, searchOptions);
|
|
382
|
+
saving = (local + 1) * (round.members.length - 1);
|
|
383
|
+
if (local + 1 >= minInstances && saving >= localSaving) {
|
|
384
|
+
members = round.members;
|
|
385
|
+
localSaving = saving;
|
|
386
|
+
estimate = (local + 1) * (size - 1);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
391
|
+
finally {
|
|
392
|
+
try {
|
|
393
|
+
if (rounds_1_1 && !rounds_1_1.done && (_o = rounds_1.return)) _o.call(rounds_1);
|
|
394
|
+
}
|
|
395
|
+
finally { if (e_3) throw e_3.error; }
|
|
396
|
+
}
|
|
397
|
+
if (members.length === 0 || estimate < minSavings)
|
|
398
|
+
return [3 /*break*/, 17];
|
|
399
|
+
best = verify(context, idsOf(members), pool);
|
|
400
|
+
if (best.length + 1 < minInstances)
|
|
401
|
+
return [3 /*break*/, 17];
|
|
402
|
+
// The seed occurrences may play different roles inside one symbol
|
|
403
|
+
// (the same arc-and-line pair at a corner and at an end), which stops
|
|
404
|
+
// growth early. Verified copies are consistent, so grow again from them
|
|
405
|
+
// and keep the result while it saves more.
|
|
406
|
+
for (pass = 0; pass < 8 && members.length < maxEntities; pass++) {
|
|
407
|
+
grown = refine(nodes, index, members, best, Math.max(minInstances, Math.ceil(agreement * (best.length + 1))), maxEntities);
|
|
408
|
+
if (grown.length === members.length)
|
|
409
|
+
break;
|
|
410
|
+
absorbed = new Set();
|
|
411
|
+
try {
|
|
412
|
+
for (grown_1 = (e_4 = void 0, __values(grown)), grown_1_1 = grown_1.next(); !grown_1_1.done; grown_1_1 = grown_1.next()) {
|
|
413
|
+
i = grown_1_1.value;
|
|
414
|
+
owner = clusterOf.get(nodes[i].id);
|
|
415
|
+
if (owner)
|
|
416
|
+
absorbed.add(owner);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
420
|
+
finally {
|
|
421
|
+
try {
|
|
422
|
+
if (grown_1_1 && !grown_1_1.done && (_p = grown_1.return)) _p.call(grown_1);
|
|
423
|
+
}
|
|
424
|
+
finally { if (e_4) throw e_4.error; }
|
|
425
|
+
}
|
|
426
|
+
released = __spreadArray([], __read(absorbed), false).flatMap(clusterIds);
|
|
427
|
+
released.forEach(function (id) { return claimed.delete(id); });
|
|
428
|
+
verified = verify(context, idsOf(grown), pool);
|
|
429
|
+
before = (best.length + 1) * (members.length - 1) +
|
|
430
|
+
__spreadArray([], __read(absorbed), false).reduce(function (sum, c) { return sum + c.savings; }, 0);
|
|
431
|
+
after = (verified.length + 1) * (grown.length - 1);
|
|
432
|
+
if (verified.length + 1 < minInstances || after <= before) {
|
|
433
|
+
released.forEach(function (id) { return claimed.add(id); });
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
for (absorbed_1 = (e_5 = void 0, __values(absorbed)), absorbed_1_1 = absorbed_1.next(); !absorbed_1_1.done; absorbed_1_1 = absorbed_1.next()) {
|
|
438
|
+
cluster_1 = absorbed_1_1.value;
|
|
439
|
+
clusters.splice(clusters.indexOf(cluster_1), 1);
|
|
440
|
+
try {
|
|
441
|
+
for (_g = (e_6 = void 0, __values(clusterIds(cluster_1))), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
442
|
+
id = _h.value;
|
|
443
|
+
clusterOf.delete(id);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
447
|
+
finally {
|
|
448
|
+
try {
|
|
449
|
+
if (_h && !_h.done && (_r = _g.return)) _r.call(_g);
|
|
450
|
+
}
|
|
451
|
+
finally { if (e_6) throw e_6.error; }
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
456
|
+
finally {
|
|
457
|
+
try {
|
|
458
|
+
if (absorbed_1_1 && !absorbed_1_1.done && (_q = absorbed_1.return)) _q.call(absorbed_1);
|
|
459
|
+
}
|
|
460
|
+
finally { if (e_5) throw e_5.error; }
|
|
461
|
+
}
|
|
462
|
+
members = grown;
|
|
463
|
+
best = verified;
|
|
464
|
+
}
|
|
465
|
+
shapeIds = idsOf(members);
|
|
466
|
+
inside = textsInside(textGrid, members.map(function (i) { return nodes[i]; }), claimed);
|
|
467
|
+
if (inside.length > 0) {
|
|
468
|
+
withTexts = verify(context, __spreadArray(__spreadArray([], __read(shapeIds), false), __read(inside), false), pool);
|
|
469
|
+
if (withTexts.length + 1 >= Math.max(2, agreement * (best.length + 1))) {
|
|
470
|
+
best = withTexts;
|
|
471
|
+
shapeIds.push.apply(shapeIds, __spreadArray([], __read(inside), false));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (best.length + 1 < minInstances)
|
|
475
|
+
return [3 /*break*/, 17];
|
|
476
|
+
if ((best.length + 1) * (shapeIds.length - 1) < minSavings)
|
|
477
|
+
return [3 /*break*/, 17];
|
|
478
|
+
instanceCount = best.length + 1;
|
|
479
|
+
cluster = {
|
|
480
|
+
ids: shapeIds,
|
|
481
|
+
matches: best,
|
|
482
|
+
instanceCount: instanceCount,
|
|
483
|
+
entityCount: shapeIds.length,
|
|
484
|
+
savings: instanceCount * (shapeIds.length - 1)
|
|
485
|
+
};
|
|
486
|
+
clusters.push(cluster);
|
|
487
|
+
try {
|
|
488
|
+
for (_j = (e_7 = void 0, __values(clusterIds(cluster))), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
489
|
+
id = _k.value;
|
|
490
|
+
claimed.add(id);
|
|
491
|
+
clusterOf.set(id, cluster);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
495
|
+
finally {
|
|
496
|
+
try {
|
|
497
|
+
if (_k && !_k.done && (_s = _j.return)) _s.call(_j);
|
|
498
|
+
}
|
|
499
|
+
finally { if (e_7) throw e_7.error; }
|
|
500
|
+
}
|
|
501
|
+
_4.label = 17;
|
|
502
|
+
case 17:
|
|
503
|
+
k++;
|
|
504
|
+
return [3 /*break*/, 15];
|
|
505
|
+
case 18: return [2 /*return*/, clusters.sort(function (x, y) { return y.savings - x.savings; })];
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
function collect(db, matchLayer, cache) {
|
|
510
|
+
var e_8, _a, e_9, _b, e_10, _c;
|
|
511
|
+
var entities = new Map();
|
|
512
|
+
try {
|
|
513
|
+
for (var _d = __values(db.tables.blockTable.modelSpace.newIterator()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
514
|
+
var entity = _e.value;
|
|
515
|
+
if (entity.visibility)
|
|
516
|
+
entities.set(entity.objectId, entity);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
520
|
+
finally {
|
|
521
|
+
try {
|
|
522
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
523
|
+
}
|
|
524
|
+
finally { if (e_8) throw e_8.error; }
|
|
525
|
+
}
|
|
526
|
+
var unlocked = excludeLockedLayerIds(db, __spreadArray([], __read(entities.keys()), false)).ids;
|
|
527
|
+
var nodes = [];
|
|
528
|
+
var texts = [];
|
|
529
|
+
try {
|
|
530
|
+
for (var unlocked_1 = __values(unlocked), unlocked_1_1 = unlocked_1.next(); !unlocked_1_1.done; unlocked_1_1 = unlocked_1.next()) {
|
|
531
|
+
var id = unlocked_1_1.value;
|
|
532
|
+
var entity = entities.get(id);
|
|
533
|
+
var feature = cache.get(entity, matchLayer);
|
|
534
|
+
if (!feature)
|
|
535
|
+
continue;
|
|
536
|
+
if (feature.label !== undefined) {
|
|
537
|
+
var ext = entity.geometricExtents;
|
|
538
|
+
texts.push({
|
|
539
|
+
id: id,
|
|
540
|
+
center: ext.isEmpty()
|
|
541
|
+
? feature.center
|
|
542
|
+
: {
|
|
543
|
+
x: (ext.min.x + ext.max.x) / 2,
|
|
544
|
+
y: (ext.min.y + ext.max.y) / 2
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
var radius = 0;
|
|
550
|
+
try {
|
|
551
|
+
for (var _f = (e_10 = void 0, __values(feature.points)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
552
|
+
var p = _g.value;
|
|
553
|
+
radius = Math.max(radius, dist(p, feature.center));
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
557
|
+
finally {
|
|
558
|
+
try {
|
|
559
|
+
if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
|
|
560
|
+
}
|
|
561
|
+
finally { if (e_10) throw e_10.error; }
|
|
562
|
+
}
|
|
563
|
+
if (feature.points.length === 0)
|
|
564
|
+
radius = feature.size;
|
|
565
|
+
nodes.push({ id: id, feature: feature, radius: radius, neighbors: [] });
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
569
|
+
finally {
|
|
570
|
+
try {
|
|
571
|
+
if (unlocked_1_1 && !unlocked_1_1.done && (_b = unlocked_1.return)) _b.call(unlocked_1);
|
|
572
|
+
}
|
|
573
|
+
finally { if (e_9) throw e_9.error; }
|
|
574
|
+
}
|
|
575
|
+
return { nodes: nodes, texts: texts };
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Links shapes that touch: a characteristic point (or center) of one lies
|
|
579
|
+
* in the other's padded bounds. Points are indexed in a uniform grid, so a
|
|
580
|
+
* lookup only scans the cells the bounds cover; very long shapes only look
|
|
581
|
+
* around their own points.
|
|
582
|
+
*/
|
|
583
|
+
function linkNeighbors(nodes, limit) {
|
|
584
|
+
var grid, points, found, scan, boxes, i, n, minX, minY, maxX, maxY, _a, _b, p, pad, cells, _c, _d, p, centers, extent, _loop_1, i;
|
|
585
|
+
var e_11, _e, e_12, _f;
|
|
586
|
+
return __generator(this, function (_g) {
|
|
587
|
+
switch (_g.label) {
|
|
588
|
+
case 0:
|
|
589
|
+
grid = new CellGrid(medianRadius(nodes));
|
|
590
|
+
points = nodes.map(function (n) { return __spreadArray([n.feature.center], __read(n.feature.points), false); });
|
|
591
|
+
points.forEach(function (list, i) {
|
|
592
|
+
var e_13, _a;
|
|
593
|
+
try {
|
|
594
|
+
for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
|
|
595
|
+
var p = list_1_1.value;
|
|
596
|
+
grid.add(p.x, p.y, i);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
600
|
+
finally {
|
|
601
|
+
try {
|
|
602
|
+
if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
|
|
603
|
+
}
|
|
604
|
+
finally { if (e_13) throw e_13.error; }
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
found = nodes.map(function () { return new Set(); });
|
|
608
|
+
scan = function (i, minX, minY, maxX, maxY) {
|
|
609
|
+
grid.forEachIn(minX, minY, maxX, maxY, function (j) {
|
|
610
|
+
var e_14, _a;
|
|
611
|
+
if (j === i || found[i].has(j))
|
|
612
|
+
return;
|
|
613
|
+
try {
|
|
614
|
+
for (var _b = __values(points[j]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
615
|
+
var p = _c.value;
|
|
616
|
+
if (p.x >= minX && p.x <= maxX && p.y >= minY && p.y <= maxY) {
|
|
617
|
+
found[i].add(j);
|
|
618
|
+
found[j].add(i);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
624
|
+
finally {
|
|
625
|
+
try {
|
|
626
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
627
|
+
}
|
|
628
|
+
finally { if (e_14) throw e_14.error; }
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
boxes = [];
|
|
633
|
+
i = 0;
|
|
634
|
+
_g.label = 1;
|
|
635
|
+
case 1:
|
|
636
|
+
if (!(i < nodes.length)) return [3 /*break*/, 5];
|
|
637
|
+
if (!(i % 2000 === 0)) return [3 /*break*/, 3];
|
|
638
|
+
return [4 /*yield*/, (0.6 * i) / nodes.length];
|
|
639
|
+
case 2:
|
|
640
|
+
_g.sent();
|
|
641
|
+
_g.label = 3;
|
|
642
|
+
case 3:
|
|
643
|
+
n = nodes[i];
|
|
644
|
+
minX = Infinity;
|
|
645
|
+
minY = Infinity;
|
|
646
|
+
maxX = -Infinity;
|
|
647
|
+
maxY = -Infinity;
|
|
648
|
+
try {
|
|
649
|
+
for (_a = (e_11 = void 0, __values(points[i])), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
650
|
+
p = _b.value;
|
|
651
|
+
minX = Math.min(minX, p.x);
|
|
652
|
+
minY = Math.min(minY, p.y);
|
|
653
|
+
maxX = Math.max(maxX, p.x);
|
|
654
|
+
maxY = Math.max(maxY, p.y);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
658
|
+
finally {
|
|
659
|
+
try {
|
|
660
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
661
|
+
}
|
|
662
|
+
finally { if (e_11) throw e_11.error; }
|
|
663
|
+
}
|
|
664
|
+
if (n.feature.points.length === 0) {
|
|
665
|
+
minX -= n.radius;
|
|
666
|
+
minY -= n.radius;
|
|
667
|
+
maxX += n.radius;
|
|
668
|
+
maxY += n.radius;
|
|
669
|
+
}
|
|
670
|
+
boxes.push({ minX: minX, minY: minY, maxX: maxX, maxY: maxY });
|
|
671
|
+
pad = Math.max(n.radius * 0.05, grid.cell * 1e-3);
|
|
672
|
+
cells = ((maxX - minX) / grid.cell + 1) * ((maxY - minY) / grid.cell + 1);
|
|
673
|
+
if (cells <= 400) {
|
|
674
|
+
scan(i, minX - pad, minY - pad, maxX + pad, maxY + pad);
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
try {
|
|
678
|
+
// Long shapes only look around their own points.
|
|
679
|
+
for (_c = (e_12 = void 0, __values(points[i])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
680
|
+
p = _d.value;
|
|
681
|
+
scan(i, p.x - pad, p.y - pad, p.x + pad, p.y + pad);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
685
|
+
finally {
|
|
686
|
+
try {
|
|
687
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
688
|
+
}
|
|
689
|
+
finally { if (e_12) throw e_12.error; }
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
_g.label = 4;
|
|
693
|
+
case 4:
|
|
694
|
+
i++;
|
|
695
|
+
return [3 /*break*/, 1];
|
|
696
|
+
case 5:
|
|
697
|
+
centers = new CellGrid(grid.cell);
|
|
698
|
+
nodes.forEach(function (n, i) {
|
|
699
|
+
return centers.add(n.feature.center.x, n.feature.center.y, i);
|
|
700
|
+
});
|
|
701
|
+
extent = function (b) { return Math.max(b.maxX - b.minX, b.maxY - b.minY); };
|
|
702
|
+
_loop_1 = function (i) {
|
|
703
|
+
var n, reach, c, box;
|
|
704
|
+
return __generator(this, function (_h) {
|
|
705
|
+
switch (_h.label) {
|
|
706
|
+
case 0:
|
|
707
|
+
if (!(i % 2000 === 0)) return [3 /*break*/, 2];
|
|
708
|
+
return [4 /*yield*/, 0.6 + (0.3 * i) / nodes.length];
|
|
709
|
+
case 1:
|
|
710
|
+
_h.sent();
|
|
711
|
+
_h.label = 2;
|
|
712
|
+
case 2:
|
|
713
|
+
n = nodes[i];
|
|
714
|
+
if (!(n.radius > 0) || n.radius > grid.cell * 10)
|
|
715
|
+
return [2 /*return*/, "continue"];
|
|
716
|
+
reach = n.radius * 3;
|
|
717
|
+
c = n.feature.center;
|
|
718
|
+
box = boxes[i];
|
|
719
|
+
centers.forEachIn(c.x - reach, c.y - reach, c.x + reach, c.y + reach, function (j) {
|
|
720
|
+
if (j === i || found[i].has(j))
|
|
721
|
+
return;
|
|
722
|
+
var other = boxes[j];
|
|
723
|
+
var gap = Math.max(other.minX - box.maxX, box.minX - other.maxX, other.minY - box.maxY, box.minY - other.maxY, 0);
|
|
724
|
+
if (gap <= Math.min(extent(box), extent(other))) {
|
|
725
|
+
found[i].add(j);
|
|
726
|
+
found[j].add(i);
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
return [2 /*return*/];
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
};
|
|
733
|
+
i = 0;
|
|
734
|
+
_g.label = 6;
|
|
735
|
+
case 6:
|
|
736
|
+
if (!(i < nodes.length)) return [3 /*break*/, 9];
|
|
737
|
+
return [5 /*yield**/, _loop_1(i)];
|
|
738
|
+
case 7:
|
|
739
|
+
_g.sent();
|
|
740
|
+
_g.label = 8;
|
|
741
|
+
case 8:
|
|
742
|
+
i++;
|
|
743
|
+
return [3 /*break*/, 6];
|
|
744
|
+
case 9: return [4 /*yield*/, 0.9];
|
|
745
|
+
case 10:
|
|
746
|
+
_g.sent();
|
|
747
|
+
nodes.forEach(function (n, i) {
|
|
748
|
+
n.neighbors = __spreadArray([], __read(found[i]), false).sort(function (a, b) {
|
|
749
|
+
return dist(nodes[a].feature.center, n.feature.center) -
|
|
750
|
+
dist(nodes[b].feature.center, n.feature.center);
|
|
751
|
+
})
|
|
752
|
+
.slice(0, limit);
|
|
753
|
+
});
|
|
754
|
+
// Keep the relation symmetric after the cut.
|
|
755
|
+
nodes.forEach(function (n, i) {
|
|
756
|
+
var e_15, _a;
|
|
757
|
+
try {
|
|
758
|
+
for (var _b = __values(n.neighbors), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
759
|
+
var j = _c.value;
|
|
760
|
+
if (!nodes[j].neighbors.includes(i))
|
|
761
|
+
nodes[j].neighbors.push(i);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
765
|
+
finally {
|
|
766
|
+
try {
|
|
767
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
768
|
+
}
|
|
769
|
+
finally { if (e_15) throw e_15.error; }
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
return [2 /*return*/];
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Frame of the pair `a → b`: the axis runs between the centers; for shapes
|
|
778
|
+
* sharing a center it points at `a`'s (else `b`'s) farthest point.
|
|
779
|
+
*/
|
|
780
|
+
function pairFrame(a, b) {
|
|
781
|
+
var _a;
|
|
782
|
+
var origin = a.feature.center;
|
|
783
|
+
var length = Math.max(dist(origin, b.feature.center), a.radius, b.radius);
|
|
784
|
+
if (!(length > 0))
|
|
785
|
+
return undefined;
|
|
786
|
+
// Centers closer than the key's resolution count as shared: the
|
|
787
|
+
// direction between them is noise (concentric arcs from PDF imports).
|
|
788
|
+
var eps = length * 0.01;
|
|
789
|
+
var v = sub(b.feature.center, origin);
|
|
790
|
+
if (Math.hypot(v.x, v.y) <= eps) {
|
|
791
|
+
var far = (_a = farthest(a)) !== null && _a !== void 0 ? _a : farthest(b);
|
|
792
|
+
v = far ? sub(far, origin) : { x: 1, y: 0 };
|
|
793
|
+
}
|
|
794
|
+
var len = Math.hypot(v.x, v.y);
|
|
795
|
+
if (!(len > 0))
|
|
796
|
+
return undefined;
|
|
797
|
+
return { origin: origin, u: { x: v.x / len, y: v.y / len }, length: length };
|
|
798
|
+
}
|
|
799
|
+
function farthest(n) {
|
|
800
|
+
var e_16, _a;
|
|
801
|
+
var max = 0;
|
|
802
|
+
try {
|
|
803
|
+
for (var _b = __values(n.feature.points), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
804
|
+
var p = _c.value;
|
|
805
|
+
max = Math.max(max, dist(p, n.feature.center));
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
809
|
+
finally {
|
|
810
|
+
try {
|
|
811
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
812
|
+
}
|
|
813
|
+
finally { if (e_16) throw e_16.error; }
|
|
814
|
+
}
|
|
815
|
+
if (!(max > 0))
|
|
816
|
+
return undefined;
|
|
817
|
+
// Near-ties (arc end points, symmetric outlines) go to the first point,
|
|
818
|
+
// so copies pick the same one despite rounding noise.
|
|
819
|
+
return n.feature.points.find(function (p) { return dist(p, n.feature.center) >= max * 0.999; });
|
|
820
|
+
}
|
|
821
|
+
/** Second moments of a shape's points about its center, in `frame`. */
|
|
822
|
+
function moments(n, frame) {
|
|
823
|
+
var e_17, _a;
|
|
824
|
+
var points = n.feature.points;
|
|
825
|
+
if (points.length === 0)
|
|
826
|
+
return [0, 0, 0];
|
|
827
|
+
var xx = 0;
|
|
828
|
+
var yy = 0;
|
|
829
|
+
var xy = 0;
|
|
830
|
+
try {
|
|
831
|
+
for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {
|
|
832
|
+
var p = points_1_1.value;
|
|
833
|
+
var d = sub(p, n.feature.center);
|
|
834
|
+
var x = d.x * frame.u.x + d.y * frame.u.y;
|
|
835
|
+
var y = d.y * frame.u.x - d.x * frame.u.y;
|
|
836
|
+
xx += x * x;
|
|
837
|
+
yy += y * y;
|
|
838
|
+
xy += x * y;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
842
|
+
finally {
|
|
843
|
+
try {
|
|
844
|
+
if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);
|
|
845
|
+
}
|
|
846
|
+
finally { if (e_17) throw e_17.error; }
|
|
847
|
+
}
|
|
848
|
+
var k = points.length * frame.length * frame.length;
|
|
849
|
+
return [xx / k, yy / k, xy / k];
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Key of the ordered pair `a → b` that is invariant under translation and
|
|
853
|
+
* rotation, under mirroring when allowed, and under scaling when allowed.
|
|
854
|
+
*/
|
|
855
|
+
function pairKey(a, b, allowMirror, allowScale) {
|
|
856
|
+
var frame = pairFrame(a, b);
|
|
857
|
+
if (!frame)
|
|
858
|
+
return undefined;
|
|
859
|
+
var q = function (v) { return Math.round(v * 50); };
|
|
860
|
+
var qm = function (v) { return Math.round(v * 200); };
|
|
861
|
+
var ma = moments(a, frame).map(qm);
|
|
862
|
+
var mb = moments(b, frame).map(qm);
|
|
863
|
+
if (allowMirror) {
|
|
864
|
+
// Mirroring across the axis flips the xy moments of both shapes.
|
|
865
|
+
var first = ma[2] !== 0 ? ma[2] : mb[2];
|
|
866
|
+
if (first < 0) {
|
|
867
|
+
ma[2] = -ma[2];
|
|
868
|
+
mb[2] = -mb[2];
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
var scale = allowScale
|
|
872
|
+
? 0
|
|
873
|
+
: Math.round(Math.log(frame.length) / Math.log(1.05));
|
|
874
|
+
return __spreadArray(__spreadArray(__spreadArray([
|
|
875
|
+
a.feature.kind,
|
|
876
|
+
b.feature.kind,
|
|
877
|
+
q(a.feature.size / frame.length),
|
|
878
|
+
q(b.feature.size / frame.length),
|
|
879
|
+
q(dist(a.feature.center, b.feature.center) / frame.length)
|
|
880
|
+
], __read(ma), false), __read(mb), false), [
|
|
881
|
+
scale
|
|
882
|
+
], false).join('|');
|
|
883
|
+
}
|
|
884
|
+
/** Free, non-overlapping occurrences of a seed key (evenly sampled). */
|
|
885
|
+
function pickOccurrences(nodes, pairs, claimed) {
|
|
886
|
+
var used = new Set();
|
|
887
|
+
var result = [];
|
|
888
|
+
for (var k = 0; k < pairs.length; k += 2) {
|
|
889
|
+
var a = pairs[k];
|
|
890
|
+
var b = pairs[k + 1];
|
|
891
|
+
if (used.has(a) || used.has(b))
|
|
892
|
+
continue;
|
|
893
|
+
if (claimed.has(nodes[a].id) || claimed.has(nodes[b].id))
|
|
894
|
+
continue;
|
|
895
|
+
var frame = pairFrame(nodes[a], nodes[b]);
|
|
896
|
+
if (!frame)
|
|
897
|
+
continue;
|
|
898
|
+
used.add(a);
|
|
899
|
+
used.add(b);
|
|
900
|
+
result.push({ a: a, b: b, frame: frame });
|
|
901
|
+
}
|
|
902
|
+
// Voting on a sample keeps dense patterns cheap; verification later
|
|
903
|
+
// finds every copy anyway.
|
|
904
|
+
var max = 200;
|
|
905
|
+
if (result.length <= max)
|
|
906
|
+
return result;
|
|
907
|
+
var step = result.length / max;
|
|
908
|
+
return Array.from({ length: max }, function (_, i) { return result[Math.floor(i * step)]; });
|
|
909
|
+
}
|
|
910
|
+
/** Maps a frame's local coordinates (scaled) into the drawing. */
|
|
911
|
+
function frameAffine(frame, scale) {
|
|
912
|
+
var u = frame.u, origin = frame.origin;
|
|
913
|
+
return {
|
|
914
|
+
a: u.x * scale,
|
|
915
|
+
b: u.y * scale,
|
|
916
|
+
c: -u.y * scale,
|
|
917
|
+
d: u.x * scale,
|
|
918
|
+
e: origin.x,
|
|
919
|
+
f: origin.y
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Computes, for every occurrence, the similarity that maps the first
|
|
924
|
+
* occurrence onto it, checking that both seed shapes really land on their
|
|
925
|
+
* counterparts. Occurrences that do not fit are dropped.
|
|
926
|
+
*/
|
|
927
|
+
function alignOccurrences(nodes, occurrences, allowMirror) {
|
|
928
|
+
var e_18, _a, e_19, _b, e_20, _c;
|
|
929
|
+
var ref = occurrences[0];
|
|
930
|
+
var toLocal = acapInvertAffine2d(frameAffine(ref.frame, 1));
|
|
931
|
+
var flip = { a: 1, b: 0, c: 0, d: -1, e: 0, f: 0 };
|
|
932
|
+
var locals = allowMirror
|
|
933
|
+
? [toLocal, acapComposeAffine2d(flip, toLocal)]
|
|
934
|
+
: [toLocal];
|
|
935
|
+
var result = [];
|
|
936
|
+
try {
|
|
937
|
+
for (var occurrences_1 = __values(occurrences), occurrences_1_1 = occurrences_1.next(); !occurrences_1_1.done; occurrences_1_1 = occurrences_1.next()) {
|
|
938
|
+
var occ = occurrences_1_1.value;
|
|
939
|
+
var scale = occ.frame.length / ref.frame.length;
|
|
940
|
+
var tol = occ.frame.length * 0.01;
|
|
941
|
+
// A pair of equal shapes may appear in either order.
|
|
942
|
+
var orders = [[occ.a, occ.b]];
|
|
943
|
+
if (nodes[occ.a].feature.kind === nodes[occ.b].feature.kind) {
|
|
944
|
+
orders.push([occ.b, occ.a]);
|
|
945
|
+
}
|
|
946
|
+
var transforms = [];
|
|
947
|
+
try {
|
|
948
|
+
for (var orders_1 = (e_19 = void 0, __values(orders)), orders_1_1 = orders_1.next(); !orders_1_1.done; orders_1_1 = orders_1.next()) {
|
|
949
|
+
var _d = __read(orders_1_1.value, 2), a = _d[0], b = _d[1];
|
|
950
|
+
var frame = pairFrame(nodes[a], nodes[b]);
|
|
951
|
+
if (!frame)
|
|
952
|
+
continue;
|
|
953
|
+
var toWorld = frameAffine(frame, scale);
|
|
954
|
+
try {
|
|
955
|
+
for (var locals_1 = (e_20 = void 0, __values(locals)), locals_1_1 = locals_1.next(); !locals_1_1.done; locals_1_1 = locals_1.next()) {
|
|
956
|
+
var local = locals_1_1.value;
|
|
957
|
+
var t = acapComposeAffine2d(toWorld, local);
|
|
958
|
+
if (lands(nodes[ref.a], nodes[a], t, scale, tol) &&
|
|
959
|
+
lands(nodes[ref.b], nodes[b], t, scale, tol)) {
|
|
960
|
+
transforms.push(t);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
965
|
+
finally {
|
|
966
|
+
try {
|
|
967
|
+
if (locals_1_1 && !locals_1_1.done && (_c = locals_1.return)) _c.call(locals_1);
|
|
968
|
+
}
|
|
969
|
+
finally { if (e_20) throw e_20.error; }
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
974
|
+
finally {
|
|
975
|
+
try {
|
|
976
|
+
if (orders_1_1 && !orders_1_1.done && (_b = orders_1.return)) _b.call(orders_1);
|
|
977
|
+
}
|
|
978
|
+
finally { if (e_19) throw e_19.error; }
|
|
979
|
+
}
|
|
980
|
+
if (transforms.length > 0)
|
|
981
|
+
result.push(__assign(__assign({}, occ), { transforms: transforms, scale: scale }));
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
985
|
+
finally {
|
|
986
|
+
try {
|
|
987
|
+
if (occurrences_1_1 && !occurrences_1_1.done && (_a = occurrences_1.return)) _a.call(occurrences_1);
|
|
988
|
+
}
|
|
989
|
+
finally { if (e_18) throw e_18.error; }
|
|
990
|
+
}
|
|
991
|
+
return result;
|
|
992
|
+
}
|
|
993
|
+
function lands(from, to, t, scale, tol) {
|
|
994
|
+
if (Math.abs(from.feature.size * scale - to.feature.size) > tol)
|
|
995
|
+
return false;
|
|
996
|
+
if (dist(acedApplyAffine2d(t, from.feature.center), to.feature.center) > tol)
|
|
997
|
+
return false;
|
|
998
|
+
return acedShapeLandsOn(from.feature, to.feature, t, tol);
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Grows the seed pair into the shapes most occurrences share. Returns one
|
|
1002
|
+
* snapshot per round (the seed pair first): the member nodes of the first
|
|
1003
|
+
* (reference) occurrence and how many occurrences found all of them.
|
|
1004
|
+
*
|
|
1005
|
+
* Each round looks at the free shapes touching the reference occurrence's
|
|
1006
|
+
* newest members. A shape joins when, in enough other occurrences, a
|
|
1007
|
+
* touching shape lands on it under that occurrence's transform (same kind,
|
|
1008
|
+
* size and characteristic points). Shapes that differ around each copy,
|
|
1009
|
+
* such as walls of varying length, never collect enough votes.
|
|
1010
|
+
*/
|
|
1011
|
+
function grow(nodes, occurrences, claimed, need, maxEntities) {
|
|
1012
|
+
var e_21, _a;
|
|
1013
|
+
var ref = occurrences[0];
|
|
1014
|
+
var members = occurrences.map(function (o) { return new Set([o.a, o.b]); });
|
|
1015
|
+
var frontier = occurrences.map(function (o) { return [o.a, o.b]; });
|
|
1016
|
+
// Every shape belongs to one occurrence only.
|
|
1017
|
+
var owner = new Map();
|
|
1018
|
+
occurrences.forEach(function (o, i) {
|
|
1019
|
+
owner.set(o.a, i);
|
|
1020
|
+
owner.set(o.b, i);
|
|
1021
|
+
});
|
|
1022
|
+
var free = function (i) {
|
|
1023
|
+
var e_22, _a, e_23, _b;
|
|
1024
|
+
var seen = new Set();
|
|
1025
|
+
try {
|
|
1026
|
+
for (var _c = __values(frontier[i]), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1027
|
+
var f = _d.value;
|
|
1028
|
+
try {
|
|
1029
|
+
for (var _e = (e_23 = void 0, __values(nodes[f].neighbors)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1030
|
+
var nb = _f.value;
|
|
1031
|
+
if (members[i].has(nb) || claimed.has(nodes[nb].id))
|
|
1032
|
+
continue;
|
|
1033
|
+
var o = owner.get(nb);
|
|
1034
|
+
if (o === undefined || o === i)
|
|
1035
|
+
seen.add(nb);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1039
|
+
finally {
|
|
1040
|
+
try {
|
|
1041
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1042
|
+
}
|
|
1043
|
+
finally { if (e_23) throw e_23.error; }
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1048
|
+
finally {
|
|
1049
|
+
try {
|
|
1050
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1051
|
+
}
|
|
1052
|
+
finally { if (e_22) throw e_22.error; }
|
|
1053
|
+
}
|
|
1054
|
+
return __spreadArray([], __read(seen), false);
|
|
1055
|
+
};
|
|
1056
|
+
var rounds = [];
|
|
1057
|
+
var snapshot = function () {
|
|
1058
|
+
var size = members[0].size;
|
|
1059
|
+
rounds.push({
|
|
1060
|
+
members: __spreadArray([], __read(members[0]), false),
|
|
1061
|
+
complete: members.filter(function (m) { return m.size === size; }).length,
|
|
1062
|
+
collected: members.slice(1).flatMap(function (m) { return __spreadArray([], __read(m), false); })
|
|
1063
|
+
});
|
|
1064
|
+
};
|
|
1065
|
+
snapshot();
|
|
1066
|
+
while (members[0].size < maxEntities) {
|
|
1067
|
+
var candidates = occurrences.map(function (_, i) { return free(i); });
|
|
1068
|
+
var next = occurrences.map(function () { return []; });
|
|
1069
|
+
var _loop_2 = function (r) {
|
|
1070
|
+
var e_24, _d;
|
|
1071
|
+
if (owner.has(r))
|
|
1072
|
+
return "continue";
|
|
1073
|
+
var hits = [];
|
|
1074
|
+
// Transform errors grow with the distance from the seed.
|
|
1075
|
+
var reach = dist(nodes[r].feature.center, ref.frame.origin);
|
|
1076
|
+
var _loop_3 = function (i) {
|
|
1077
|
+
var e_25, _f;
|
|
1078
|
+
var occ = occurrences[i];
|
|
1079
|
+
var tol = occ.scale * (ref.frame.length * 0.01 + reach * 0.03);
|
|
1080
|
+
var _loop_4 = function (c) {
|
|
1081
|
+
if (owner.has(c))
|
|
1082
|
+
return "continue";
|
|
1083
|
+
if (nodes[c].feature.kind !== nodes[r].feature.kind)
|
|
1084
|
+
return "continue";
|
|
1085
|
+
var fits = occ.transforms.filter(function (t) {
|
|
1086
|
+
return lands(nodes[r], nodes[c], t, occ.scale, tol);
|
|
1087
|
+
});
|
|
1088
|
+
if (fits.length > 0) {
|
|
1089
|
+
hits.push([i, c, fits]);
|
|
1090
|
+
return "break";
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
try {
|
|
1094
|
+
for (var _g = (e_25 = void 0, __values(candidates[i])), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1095
|
+
var c = _h.value;
|
|
1096
|
+
var state_2 = _loop_4(c);
|
|
1097
|
+
if (state_2 === "break")
|
|
1098
|
+
break;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1102
|
+
finally {
|
|
1103
|
+
try {
|
|
1104
|
+
if (_h && !_h.done && (_f = _g.return)) _f.call(_g);
|
|
1105
|
+
}
|
|
1106
|
+
finally { if (e_25) throw e_25.error; }
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
for (var i = 1; i < occurrences.length; i++) {
|
|
1110
|
+
_loop_3(i);
|
|
1111
|
+
}
|
|
1112
|
+
if (hits.length + 1 < need)
|
|
1113
|
+
return "continue";
|
|
1114
|
+
owner.set(r, 0);
|
|
1115
|
+
members[0].add(r);
|
|
1116
|
+
next[0].push(r);
|
|
1117
|
+
try {
|
|
1118
|
+
for (var hits_1 = (e_24 = void 0, __values(hits)), hits_1_1 = hits_1.next(); !hits_1_1.done; hits_1_1 = hits_1.next()) {
|
|
1119
|
+
var _e = __read(hits_1_1.value, 3), i = _e[0], x = _e[1], fits = _e[2];
|
|
1120
|
+
occurrences[i].transforms = fits;
|
|
1121
|
+
owner.set(x, i);
|
|
1122
|
+
members[i].add(x);
|
|
1123
|
+
next[i].push(x);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
1127
|
+
finally {
|
|
1128
|
+
try {
|
|
1129
|
+
if (hits_1_1 && !hits_1_1.done && (_d = hits_1.return)) _d.call(hits_1);
|
|
1130
|
+
}
|
|
1131
|
+
finally { if (e_24) throw e_24.error; }
|
|
1132
|
+
}
|
|
1133
|
+
if (members[0].size >= maxEntities)
|
|
1134
|
+
return "break";
|
|
1135
|
+
};
|
|
1136
|
+
try {
|
|
1137
|
+
for (var _b = (e_21 = void 0, __values(candidates[0])), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1138
|
+
var r = _c.value;
|
|
1139
|
+
var state_1 = _loop_2(r);
|
|
1140
|
+
if (state_1 === "break")
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
1145
|
+
finally {
|
|
1146
|
+
try {
|
|
1147
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1148
|
+
}
|
|
1149
|
+
finally { if (e_21) throw e_21.error; }
|
|
1150
|
+
}
|
|
1151
|
+
if (next[0].length === 0)
|
|
1152
|
+
break;
|
|
1153
|
+
frontier = next;
|
|
1154
|
+
snapshot();
|
|
1155
|
+
}
|
|
1156
|
+
return rounds;
|
|
1157
|
+
}
|
|
1158
|
+
/** Uniform grid of indices; cells are nested numeric maps (no string keys). */
|
|
1159
|
+
var CellGrid = /** @class */ (function () {
|
|
1160
|
+
function CellGrid(cell) {
|
|
1161
|
+
this.cell = cell;
|
|
1162
|
+
this.cells = new Map();
|
|
1163
|
+
}
|
|
1164
|
+
/** Adds `index` at `(x, y)`; repeated adds of the same index are folded. */
|
|
1165
|
+
CellGrid.prototype.add = function (x, y, index) {
|
|
1166
|
+
var gx = Math.floor(x / this.cell);
|
|
1167
|
+
var gy = Math.floor(y / this.cell);
|
|
1168
|
+
var column = this.cells.get(gx);
|
|
1169
|
+
if (!column)
|
|
1170
|
+
this.cells.set(gx, (column = new Map()));
|
|
1171
|
+
var list = column.get(gy);
|
|
1172
|
+
if (!list)
|
|
1173
|
+
column.set(gy, [index]);
|
|
1174
|
+
else if (list[list.length - 1] !== index)
|
|
1175
|
+
list.push(index);
|
|
1176
|
+
};
|
|
1177
|
+
/** Visits the indices of every cell the box touches (may repeat). */
|
|
1178
|
+
CellGrid.prototype.forEachIn = function (minX, minY, maxX, maxY, visit) {
|
|
1179
|
+
var e_26, _a;
|
|
1180
|
+
var y0 = Math.floor(minY / this.cell);
|
|
1181
|
+
var y1 = Math.floor(maxY / this.cell);
|
|
1182
|
+
for (var gx = Math.floor(minX / this.cell); gx <= Math.floor(maxX / this.cell); gx++) {
|
|
1183
|
+
var column = this.cells.get(gx);
|
|
1184
|
+
if (!column)
|
|
1185
|
+
continue;
|
|
1186
|
+
for (var gy = y0; gy <= y1; gy++) {
|
|
1187
|
+
var list = column.get(gy);
|
|
1188
|
+
if (list)
|
|
1189
|
+
try {
|
|
1190
|
+
for (var list_2 = (e_26 = void 0, __values(list)), list_2_1 = list_2.next(); !list_2_1.done; list_2_1 = list_2.next()) {
|
|
1191
|
+
var index = list_2_1.value;
|
|
1192
|
+
visit(index);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1196
|
+
finally {
|
|
1197
|
+
try {
|
|
1198
|
+
if (list_2_1 && !list_2_1.done && (_a = list_2.return)) _a.call(list_2);
|
|
1199
|
+
}
|
|
1200
|
+
finally { if (e_26) throw e_26.error; }
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
return CellGrid;
|
|
1206
|
+
}());
|
|
1207
|
+
function medianRadius(nodes) {
|
|
1208
|
+
var _a;
|
|
1209
|
+
var radii = nodes
|
|
1210
|
+
.map(function (n) { return n.radius; })
|
|
1211
|
+
.filter(function (r) { return r > 0; })
|
|
1212
|
+
.sort(function (a, b) { return a - b; });
|
|
1213
|
+
return Math.max((_a = radii[Math.floor(radii.length / 2)]) !== null && _a !== void 0 ? _a : 1, 1e-9);
|
|
1214
|
+
}
|
|
1215
|
+
/** Node lookup by center position. */
|
|
1216
|
+
var NodeIndex = /** @class */ (function () {
|
|
1217
|
+
function NodeIndex(nodes) {
|
|
1218
|
+
var _this = this;
|
|
1219
|
+
this.nodes = nodes;
|
|
1220
|
+
this.grid = new CellGrid(medianRadius(nodes));
|
|
1221
|
+
nodes.forEach(function (n, i) {
|
|
1222
|
+
return _this.grid.add(n.feature.center.x, n.feature.center.y, i);
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
/** Nodes whose center is within `radius` of `p`. */
|
|
1226
|
+
NodeIndex.prototype.near = function (p, radius) {
|
|
1227
|
+
var _this = this;
|
|
1228
|
+
var result = [];
|
|
1229
|
+
this.grid.forEachIn(p.x - radius, p.y - radius, p.x + radius, p.y + radius, function (i) {
|
|
1230
|
+
if (dist(_this.nodes[i].feature.center, p) <= radius)
|
|
1231
|
+
result.push(i);
|
|
1232
|
+
});
|
|
1233
|
+
return result;
|
|
1234
|
+
};
|
|
1235
|
+
return NodeIndex;
|
|
1236
|
+
}());
|
|
1237
|
+
/**
|
|
1238
|
+
* Grows a verified group: a shape touching the representative joins when
|
|
1239
|
+
* enough verified copies have the same shape at the same place under their
|
|
1240
|
+
* exact transform. Shapes of other groups may join too; the caller decides
|
|
1241
|
+
* whether absorbing those groups pays off. Returns the member list.
|
|
1242
|
+
*/
|
|
1243
|
+
function refine(nodes, index, members, matches, need, maxEntities) {
|
|
1244
|
+
var e_27, _a, e_28, _b, e_29, _c;
|
|
1245
|
+
var result = new Set(members);
|
|
1246
|
+
var frontier = members;
|
|
1247
|
+
var extent = 0;
|
|
1248
|
+
try {
|
|
1249
|
+
for (var members_1 = __values(members), members_1_1 = members_1.next(); !members_1_1.done; members_1_1 = members_1.next()) {
|
|
1250
|
+
var i = members_1_1.value;
|
|
1251
|
+
extent = Math.max(extent, dist(nodes[i].feature.center, nodes[members[0]].feature.center) +
|
|
1252
|
+
nodes[i].radius);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
1256
|
+
finally {
|
|
1257
|
+
try {
|
|
1258
|
+
if (members_1_1 && !members_1_1.done && (_a = members_1.return)) _a.call(members_1);
|
|
1259
|
+
}
|
|
1260
|
+
finally { if (e_27) throw e_27.error; }
|
|
1261
|
+
}
|
|
1262
|
+
while (frontier.length > 0 && result.size < maxEntities) {
|
|
1263
|
+
var next = [];
|
|
1264
|
+
var seen = new Set();
|
|
1265
|
+
try {
|
|
1266
|
+
for (var frontier_1 = (e_28 = void 0, __values(frontier)), frontier_1_1 = frontier_1.next(); !frontier_1_1.done; frontier_1_1 = frontier_1.next()) {
|
|
1267
|
+
var f = frontier_1_1.value;
|
|
1268
|
+
var _loop_5 = function (r) {
|
|
1269
|
+
var e_30, _f;
|
|
1270
|
+
if (seen.has(r) || result.has(r))
|
|
1271
|
+
return "continue";
|
|
1272
|
+
seen.add(r);
|
|
1273
|
+
var node = nodes[r];
|
|
1274
|
+
var tol = Math.max(extent, node.radius) * 0.01;
|
|
1275
|
+
var hits = 1;
|
|
1276
|
+
var _loop_6 = function (match) {
|
|
1277
|
+
if (match.blockReference)
|
|
1278
|
+
return "continue";
|
|
1279
|
+
var t = match.transform;
|
|
1280
|
+
var c = acedApplyAffine2d(t, node.feature.center);
|
|
1281
|
+
var found = index
|
|
1282
|
+
.near(c, tol * match.scale)
|
|
1283
|
+
.some(function (k) {
|
|
1284
|
+
return k !== r &&
|
|
1285
|
+
nodes[k].feature.kind === node.feature.kind &&
|
|
1286
|
+
lands(node, nodes[k], t, match.scale, tol * match.scale);
|
|
1287
|
+
});
|
|
1288
|
+
if (found)
|
|
1289
|
+
hits++;
|
|
1290
|
+
};
|
|
1291
|
+
try {
|
|
1292
|
+
for (var matches_1 = (e_30 = void 0, __values(matches)), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
1293
|
+
var match = matches_1_1.value;
|
|
1294
|
+
_loop_6(match);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
1298
|
+
finally {
|
|
1299
|
+
try {
|
|
1300
|
+
if (matches_1_1 && !matches_1_1.done && (_f = matches_1.return)) _f.call(matches_1);
|
|
1301
|
+
}
|
|
1302
|
+
finally { if (e_30) throw e_30.error; }
|
|
1303
|
+
}
|
|
1304
|
+
if (hits < need)
|
|
1305
|
+
return "continue";
|
|
1306
|
+
result.add(r);
|
|
1307
|
+
next.push(r);
|
|
1308
|
+
if (result.size >= maxEntities)
|
|
1309
|
+
return "break";
|
|
1310
|
+
};
|
|
1311
|
+
try {
|
|
1312
|
+
for (var _d = (e_29 = void 0, __values(nodes[f].neighbors)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1313
|
+
var r = _e.value;
|
|
1314
|
+
var state_3 = _loop_5(r);
|
|
1315
|
+
if (state_3 === "break")
|
|
1316
|
+
break;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
1320
|
+
finally {
|
|
1321
|
+
try {
|
|
1322
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1323
|
+
}
|
|
1324
|
+
finally { if (e_29) throw e_29.error; }
|
|
1325
|
+
}
|
|
1326
|
+
if (result.size >= maxEntities)
|
|
1327
|
+
break;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
1331
|
+
finally {
|
|
1332
|
+
try {
|
|
1333
|
+
if (frontier_1_1 && !frontier_1_1.done && (_b = frontier_1.return)) _b.call(frontier_1);
|
|
1334
|
+
}
|
|
1335
|
+
finally { if (e_28) throw e_28.error; }
|
|
1336
|
+
}
|
|
1337
|
+
frontier = next;
|
|
1338
|
+
}
|
|
1339
|
+
return __spreadArray([], __read(result), false);
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Rejects groups that are only lines running in one direction (dashed
|
|
1343
|
+
* line pieces, hatch strokes, grid lines) or just two lines (corners):
|
|
1344
|
+
* they repeat everywhere but are not symbols.
|
|
1345
|
+
*/
|
|
1346
|
+
function isDegenerate(features) {
|
|
1347
|
+
var e_31, _a;
|
|
1348
|
+
// Two lines (a corner, a pair of strokes) occur everywhere in a drawing.
|
|
1349
|
+
if (features.length <= 2 && features.every(isLine)) {
|
|
1350
|
+
return true;
|
|
1351
|
+
}
|
|
1352
|
+
var dir;
|
|
1353
|
+
try {
|
|
1354
|
+
for (var features_1 = __values(features), features_1_1 = features_1.next(); !features_1_1.done; features_1_1 = features_1.next()) {
|
|
1355
|
+
var f = features_1_1.value;
|
|
1356
|
+
if (!isLine(f) || f.points.length !== 2)
|
|
1357
|
+
return false;
|
|
1358
|
+
var d = sub(f.points[1], f.points[0]);
|
|
1359
|
+
var len = Math.hypot(d.x, d.y);
|
|
1360
|
+
if (len === 0)
|
|
1361
|
+
continue;
|
|
1362
|
+
var u = { x: d.x / len, y: d.y / len };
|
|
1363
|
+
if (!dir)
|
|
1364
|
+
dir = u;
|
|
1365
|
+
else if (Math.abs(dir.x * u.y - dir.y * u.x) > 1e-3)
|
|
1366
|
+
return false;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
catch (e_31_1) { e_31 = { error: e_31_1 }; }
|
|
1370
|
+
finally {
|
|
1371
|
+
try {
|
|
1372
|
+
if (features_1_1 && !features_1_1.done && (_a = features_1.return)) _a.call(features_1);
|
|
1373
|
+
}
|
|
1374
|
+
finally { if (e_31) throw e_31.error; }
|
|
1375
|
+
}
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
function isLine(f) {
|
|
1379
|
+
return f.kind === 'line' || f.kind.endsWith('|line');
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Copies of a growth round's template among the shapes the other
|
|
1383
|
+
* occurrences collected, found by the exact matcher: a cheap lower bound
|
|
1384
|
+
* of what searching the whole drawing finds.
|
|
1385
|
+
*/
|
|
1386
|
+
function localCopies(nodes, round, options) {
|
|
1387
|
+
return acedFindShapeMatches(round.members.map(function (i) { return nodes[i].feature; }), round.collected.map(function (i) { return nodes[i].feature; }), {
|
|
1388
|
+
tolerance: options.tolerance,
|
|
1389
|
+
allowRotation: options.allowRotation,
|
|
1390
|
+
allowMirror: options.allowMirror,
|
|
1391
|
+
allowScale: options.allowScale
|
|
1392
|
+
}).length;
|
|
1393
|
+
}
|
|
1394
|
+
/** Every entity a group uses: the representative and its copies. */
|
|
1395
|
+
function clusterIds(cluster) {
|
|
1396
|
+
return __spreadArray(__spreadArray([], __read(cluster.ids), false), __read(cluster.matches.flatMap(function (m) { return m.ids; })), false);
|
|
1397
|
+
}
|
|
1398
|
+
/** Texts indexed by their extents center. */
|
|
1399
|
+
var TextGrid = /** @class */ (function () {
|
|
1400
|
+
function TextGrid(texts, cell) {
|
|
1401
|
+
var _this = this;
|
|
1402
|
+
this.texts = texts;
|
|
1403
|
+
this.grid = new CellGrid(cell);
|
|
1404
|
+
texts.forEach(function (t, i) { return _this.grid.add(t.center.x, t.center.y, i); });
|
|
1405
|
+
}
|
|
1406
|
+
/** Texts whose center lies in the box. */
|
|
1407
|
+
TextGrid.prototype.inBox = function (minX, minY, maxX, maxY) {
|
|
1408
|
+
var _this = this;
|
|
1409
|
+
var found = new Set();
|
|
1410
|
+
this.grid.forEachIn(minX, minY, maxX, maxY, function (i) {
|
|
1411
|
+
var c = _this.texts[i].center;
|
|
1412
|
+
if (c.x >= minX && c.x <= maxX && c.y >= minY && c.y <= maxY) {
|
|
1413
|
+
found.add(i);
|
|
1414
|
+
}
|
|
1415
|
+
});
|
|
1416
|
+
return __spreadArray([], __read(found), false).map(function (i) { return _this.texts[i]; });
|
|
1417
|
+
};
|
|
1418
|
+
return TextGrid;
|
|
1419
|
+
}());
|
|
1420
|
+
/** Free texts whose extents center lies within the group's bounds. */
|
|
1421
|
+
function textsInside(texts, members, claimed) {
|
|
1422
|
+
var e_32, _a;
|
|
1423
|
+
var minX = Infinity;
|
|
1424
|
+
var minY = Infinity;
|
|
1425
|
+
var maxX = -Infinity;
|
|
1426
|
+
var maxY = -Infinity;
|
|
1427
|
+
try {
|
|
1428
|
+
for (var members_2 = __values(members), members_2_1 = members_2.next(); !members_2_1.done; members_2_1 = members_2.next()) {
|
|
1429
|
+
var n = members_2_1.value;
|
|
1430
|
+
var c = n.feature.center;
|
|
1431
|
+
minX = Math.min(minX, c.x - n.radius);
|
|
1432
|
+
minY = Math.min(minY, c.y - n.radius);
|
|
1433
|
+
maxX = Math.max(maxX, c.x + n.radius);
|
|
1434
|
+
maxY = Math.max(maxY, c.y + n.radius);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
catch (e_32_1) { e_32 = { error: e_32_1 }; }
|
|
1438
|
+
finally {
|
|
1439
|
+
try {
|
|
1440
|
+
if (members_2_1 && !members_2_1.done && (_a = members_2.return)) _a.call(members_2);
|
|
1441
|
+
}
|
|
1442
|
+
finally { if (e_32) throw e_32.error; }
|
|
1443
|
+
}
|
|
1444
|
+
return texts
|
|
1445
|
+
.inBox(minX, minY, maxX, maxY)
|
|
1446
|
+
.filter(function (t) { return !claimed.has(t.id); })
|
|
1447
|
+
.map(function (t) { return t.id; });
|
|
1448
|
+
}
|
|
1449
|
+
/** Verified copies of `ids` that use no claimed entity. */
|
|
1450
|
+
function verify(context, ids, pool) {
|
|
1451
|
+
var db = context.db, options = context.options, cache = context.cache, claimed = context.claimed;
|
|
1452
|
+
var template = acapBuildSmartBlockTemplate(db, ids, options);
|
|
1453
|
+
var r = acapFindSmartBlockMatches(db, template, options, cache, pool);
|
|
1454
|
+
return r.filter(function (m) { return m.ids.every(function (id) { return !claimed.has(id); }); });
|
|
1455
|
+
}
|
|
1456
|
+
function dist(a, b) {
|
|
1457
|
+
var dx = a.x - b.x;
|
|
1458
|
+
var dy = a.y - b.y;
|
|
1459
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
1460
|
+
}
|
|
1461
|
+
function sub(a, b) {
|
|
1462
|
+
return { x: a.x - b.x, y: a.y - b.y };
|
|
1463
|
+
}
|
|
1464
|
+
//# sourceMappingURL=AcApSmartBlockDetect.js.map
|