@mlightcad/cad-simple-viewer 1.0.0
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 -0
- package/README.md +26 -0
- package/dist/index.js +2422 -0
- package/dist/index.umd.cjs +9 -0
- package/lib/app/AcApContext.d.ts +15 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +56 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocCreator.d.ts +17 -0
- package/lib/app/AcApDocCreator.d.ts.map +1 -0
- package/lib/app/AcApDocCreator.js +140 -0
- package/lib/app/AcApDocCreator.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +60 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +275 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +27 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +165 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +20 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +135 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +44 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +122 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +5 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +5 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +6 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +30 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +6 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +29 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +6 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +30 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +6 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +30 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +6 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +30 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +5 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +55 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +6 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +28 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +11 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +101 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +10 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +10 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +42 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +60 -0
- package/lib/editor/command/AcEdCommand.js.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.js +65 -0
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
- package/lib/editor/command/AcEdCommandStack.d.ts +66 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +192 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -0
- package/lib/editor/command/index.d.ts +3 -0
- package/lib/editor/command/index.d.ts.map +1 -0
- package/lib/editor/command/index.js +3 -0
- package/lib/editor/command/index.js.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.js +14 -0
- package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
- package/lib/editor/global/AcEdMessage.d.ts +5 -0
- package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
- package/lib/editor/global/AcEdMessage.js +6 -0
- package/lib/editor/global/AcEdMessage.js.map +1 -0
- package/lib/editor/global/eventBus.d.ts +34 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +3 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +3 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +3 -0
- package/lib/editor/global/index.js.map +1 -0
- package/lib/editor/index.d.ts +5 -0
- package/lib/editor/index.d.ts.map +1 -0
- package/lib/editor/index.js +5 -0
- package/lib/editor/index.js.map +1 -0
- package/lib/editor/input/AcEdBaseInput.d.ts +25 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +105 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +27 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +140 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +43 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +71 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +14 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +41 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +14 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +92 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +14 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +43 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +26 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +63 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +27 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +103 -0
- package/lib/editor/input/AcEditor.js.map +1 -0
- package/lib/editor/input/index.d.ts +5 -0
- package/lib/editor/input/index.d.ts.map +1 -0
- package/lib/editor/input/index.js +5 -0
- package/lib/editor/input/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +261 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +260 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/index.d.ts +2 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +2 -0
- package/lib/editor/view/index.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/util/AcTrGeometryUtil.d.ts +18 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +33 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +97 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +170 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +114 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +344 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +57 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +151 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +43 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +74 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +115 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +319 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +160 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +473 -0
- package/lib/view/AcTrView2d.js.map +1 -0
- package/lib/view/index.d.ts +2 -0
- package/lib/view/index.d.ts.map +1 -0
- package/lib/view/index.js +2 -0
- package/lib/view/index.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function(u,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@mlightcad/data-model"),require("@mlightcad/svg-renderer"),require("lodash-es"),require("@mlightcad/three-renderer"),require("three"),require("three/examples/jsm/libs/stats.module"),require("@mlightcad/three-viewcube")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/data-model","@mlightcad/svg-renderer","lodash-es","@mlightcad/three-renderer","three","three/examples/jsm/libs/stats.module","@mlightcad/three-viewcube"],c):(u=typeof globalThis<"u"?globalThis:u||self,c(u["cad-simple-viewer"]={},u.dataModel,u.svgRenderer,u.lodashEs,u.threeRenderer,u.THREE,u.Stats,u.threeViewcube))})(this,function(u,c,rt,O,T,at,ct,V){"use strict";function ht(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>s[e]})}}return t.default=s,Object.freeze(t)}const f=ht(at);class z{constructor(t,e){this._view=t,this._doc=e,e.database.events.entityAppended.addEventListener(i=>{this.view.addEntity(i.entity)}),e.database.events.entityModified.addEventListener(i=>{this.view.updateEntity(i.entity)}),e.database.events.layerModified.addEventListener(i=>{this._view.setLayerVisibility(i.layer.name,!i.layer.isOff)}),e.database.events.headerSysVarChanged.addEventListener(i=>{i.name=="pdmode"&&this._view.rerenderPoints(i.database.pdmode)}),t.selectionSet.events.selectionAdded.addEventListener(i=>{t.highlight(i.ids)}),t.selectionSet.events.selectionRemoved.addEventListener(i=>{t.unhighlight(i.ids)})}get view(){return this._view}get doc(){return this._doc}}class g{constructor(){this.events={commandWillStart:new c.AcCmEventManager,commandEnded:new c.AcCmEventManager},this._globalName="",this._localName=""}get globalName(){return this._globalName}set globalName(t){this._globalName=t}get localName(){return this._localName}set localName(t){this._localName=t}tirgger(t){this.events.commandWillStart.dispatch({command:this}),this.execute(t),this.events.commandEnded.dispatch({command:this})}execute(t){}}class ut{constructor(t){this._index=0,this._commands=[],t.forEach(e=>{const i=e.groupName;e.commandsByGlobalName.forEach(n=>{this._commands.push({command:n,commandGroup:i})})})}[Symbol.iterator](){return this}get command(){return this._index<this._commands.length?this._commands[this._index].command:null}get commandGroup(){return this._index<this._commands.length?this._commands[this._index].commandGroup:null}next(){for(;this._index<this._commands.length;){const t=this._commands[this._index];return this._index+=1,{value:t,done:!1}}return{value:null,done:!0}}}const v=class v{constructor(){this._commandsByGroup=[],this._systemCommandGroup={groupName:v.SYSTEMT_COMMAND_GROUP_NAME,commandsByGlobalName:new Map,commandsByLocalName:new Map},this._defaultCommandGroup={groupName:v.DEFAUT_COMMAND_GROUP_NAME,commandsByGlobalName:new Map,commandsByLocalName:new Map},this._commandsByGroup.push(this._systemCommandGroup),this._commandsByGroup.push(this._defaultCommandGroup)}static get instance(){return v._instance||(v._instance=new v),v._instance}addCommand(t,e,i,n){if(!e)throw new Error("[AcEdCommandStack] The global name of the command is required!");i||(i=e);let o=this._defaultCommandGroup;if(t){const r=this._commandsByGroup.find(a=>a.groupName==t);r?o=r:o={groupName:t,commandsByGlobalName:new Map,commandsByLocalName:new Map}}if(o.commandsByGlobalName.has(e))throw new Error(`[AcEdCommandStack] The command with global name '${e}' already exists!`);if(o.commandsByLocalName.has(i))throw new Error(`[AcEdCommandStack] The command with local name '${i}' already exists!`);o.commandsByGlobalName.set(e,n),o.commandsByLocalName.set(i,n),n.globalName=e,n.localName=i}iterator(){return new ut(this._commandsByGroup)}lookupGlobalCmd(t){let e;for(const i of this._commandsByGroup)if(e=i.commandsByGlobalName.get(t),e)break;return e}lookupLocalCmd(t){let e;for(const i of this._commandsByGroup)if(e=i.commandsByLocalName.get(t),e)break;return e}removeCmd(t,e){for(const i of this._commandsByGroup)if(i.groupName==t)return i.commandsByGlobalName.delete(e);return!1}removeGroup(t){let e=-1;return this._commandsByGroup.some((i,n)=>(e=n,i.groupName==t)),e>=0?(this._commandsByGroup.splice(e,1),!0):!1}};v.SYSTEMT_COMMAND_GROUP_NAME="ACAD",v.DEFAUT_COMMAND_GROUP_NAME="USER";let _=v;function lt(s){return{all:s=s||new Map,on:function(t,e){var i=s.get(t);i?i.push(e):s.set(t,[e])},off:function(t,e){var i=s.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):s.set(t,[]))},emit:function(t,e){var i=s.get(t);i&&i.slice().map(function(n){n(e)}),(i=s.get("*"))&&i.slice().map(function(n){n(t,e)})}}}const y=lt();function dt(s){y.emit("message",{message:s,type:"warning"})}var b=(s=>(s[s.NoSpecialCursor=-1]="NoSpecialCursor",s[s.Crosshair=0]="Crosshair",s[s.RectCursor=1]="RectCursor",s[s.RubberBand=2]="RubberBand",s[s.NotRotated=3]="NotRotated",s[s.TargetBox=4]="TargetBox",s[s.RotatedCrosshair=5]="RotatedCrosshair",s[s.CrosshairNoRotate=6]="CrosshairNoRotate",s[s.Invisible=7]="Invisible",s[s.EntitySelect=8]="EntitySelect",s[s.Parallelogram=9]="Parallelogram",s[s.EntitySelectNoPersp=10]="EntitySelectNoPersp",s[s.PkfirstOrGrips=11]="PkfirstOrGrips",s[s.CrosshairDashed=12]="CrosshairDashed",s[s.Grab=13]="Grab",s))(b||{});class Y{constructor(){this._cursorMap=new Map,this._cursorMap.set(0,this.createRectCrossIcon(10,10))}setCursor(t,e){if(t<=-1)e.style.cursor="default";else if(t==13)e.style.cursor="grab";else{const i=this._cursorMap.get(t);i&&(e.style.cursor=i)}}encodeSvg(t,e=0,i=0){return`url('data:image/svg+xml;base64,${btoa(t)}') ${e} ${i}, auto`}createRectCrossIcon(t,e,i="white"){const n=t/2,o=t+2*e,r=`
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${o}" viewBox="0 0 ${o} ${o}">
|
|
3
|
+
<rect x="${e}" y="${e}" width="${t}" height="${t}" fill="none" stroke="${i}" />
|
|
4
|
+
<line x1="${n+e}" y1="0" x2="${n+e}" y2="${e}" stroke="${i}" />
|
|
5
|
+
<line x1="${t+e}" y1="${n+e}" x2="${t+2*e}" y2="${n+e}" stroke="${i}" />
|
|
6
|
+
<line x1="${n+e}" y1="${t+e}" x2="${n+e}" y2="${t+2*e}" stroke="${i}" />
|
|
7
|
+
<line x1="0" y1="${n+e}" x2="${e}" y2="${n+e}" stroke="${i}" />
|
|
8
|
+
</svg>
|
|
9
|
+
`;return this.encodeSvg(r,n+e,n+e)}}class P{constructor(t){this.active=!1,this.isResolvedOrRejected=!1,this.onKeyDown=e=>{e.code==="Escape"&&this.reject("Canceled by user!")},this.view=t}get isActive(){return this.active}activate(){this.isActive&&console.warn("Something wrong here!"),this.active=!0,this.view.canvas.addEventListener("keydown",this.onKeyDown)}deactivate(){this.active=!1,this.view.canvas.removeEventListener("keydown",this.onKeyDown)}resolve(t){this.deactivate(),this._resolve&&!this.isResolvedOrRejected&&(this._resolve(t),this.isResolvedOrRejected=!0)}reject(t){this.deactivate(),this._reject&&!this.isResolvedOrRejected&&(this._reject(t),this.isResolvedOrRejected=!0)}async start(){return this.isResolvedOrRejected=!1,new Promise((t,e)=>{this._resolve=t,this._reject=e,this.activate()})}}class mt extends P{constructor(t){super(t),this.events={update:new c.AcCmEventManager},this.onMouseMove=e=>{this.curPos.set(e.clientX,e.clientY),this.events.update.dispatch()},this.curPos=new c.AcGePoint2d}activate(){super.activate(),this.view.canvas.addEventListener("mousemove",this.onMouseMove)}deactivate(){super.deactivate(),this.view.canvas.removeEventListener("mousemove",this.onMouseMove)}}class X{constructor(t){this.onUpdate=()=>{this.update()},this._view=t,this._jigLoop=new mt(t),this._jigLoop.events.update.addEventListener(this.onUpdate)}get view(){return this._view}resolve(t){this._jigLoop.events.update.removeEventListener(this.onUpdate),this._jigLoop.resolve(t)}reject(t){this._jigLoop.events.update.removeEventListener(this.onUpdate),this._jigLoop.reject(t)}async drag(){const t=this._jigLoop.start(),e=this.sampler();await Promise.allSettled([t,e])}async sampler(){}update(){}}const _t=16777215,wt="1px";class ft extends P{constructor(t){super(t),this.mouseDown=!1,this.mouseMove=!1,this.mouseDownPositionX=-1,this.mouseDownPositionY=-1,this.mousedown=e=>{if(e.button===0){this.mouseDown=!0;const i=new c.AcGePoint2d(e.x,e.y);this.mouseDownPositionX=i.x,this.mouseDownPositionY=i.y}},this.mousemove=e=>{if(!this.mouseDown)return;const i=new c.AcGePoint2d(e.x,e.y);if(this.mouseDownPositionX>=0&&this.mouseDownPositionY>=0&&(Math.abs(i.x-this.mouseDownPositionX)>=5||Math.abs(i.y-this.mouseDownPositionY)>=5)){this.mouseMove=!0;const o=new c.AcGePoint2d(Math.min(this.mouseDownPositionX,i.x),Math.min(this.mouseDownPositionY,i.y)),r=new c.AcGePoint2d(Math.max(this.mouseDownPositionX,i.x),Math.max(this.mouseDownPositionY,i.y));this.drawRect(o,r)}},this.mouseup=e=>{if(this.mouseDown&&this.mouseMove){const i=new c.AcGePoint2d(e.x,e.y),n=new c.AcGePoint2d(Math.min(this.mouseDownPositionX,i.x),Math.min(this.mouseDownPositionY,i.y)),o=new c.AcGePoint2d(Math.max(this.mouseDownPositionX,i.x),Math.max(this.mouseDownPositionY,i.y)),r=new c.AcGeBox2d(n,o);this.resolve(this.toWcs(r))}this.mouseDown=!1,this.mouseMove=!1,this.mouseDownPositionX=-1,this.mouseDownPositionY=-1},this.container=t.canvas,this.color=_t}activate(){super.activate(),this.active=!0,this.container.addEventListener("pointerdown",this.mousedown),this.container.addEventListener("pointermove",this.mousemove),this.container.addEventListener("pointerup",this.mouseup)}deactivate(){super.deactivate(),this.container.removeEventListener("pointerdown",this.mousedown),this.container.removeEventListener("pointermove",this.mousemove),this.container.removeEventListener("pointerup",this.mouseup),this.setRectDomVisible(!1)}reject(t){var e;super.reject(t),(e=this.boxDom)==null||e.remove(),this.boxDom=void 0}drawRect(t,e){if(!this.boxDom){const o=new c.AcCmColor;o.color=this.color,this.boxDom=document.createElement("div"),this.boxDom.style.cssText=`position: absolute;border: ${wt} solid ${o.cssColor};`,document.body.appendChild(this.boxDom)}this.setRectDomVisible(!0),t.x<=0&&(t.x=0),t.y<=0&&(t.y=0),e.x>=this.container.clientWidth-2&&(e.x=this.container.clientWidth-2),e.y>=this.container.clientHeight-2&&(e.y=this.container.clientHeight-2),this.boxDom.style.left=`${t.x}px`,this.boxDom.style.top=`${t.y}px`;const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);this.boxDom.style.width=`${i}px`,this.boxDom.style.height=`${n}px`}setRectDomVisible(t){this.boxDom&&(this.boxDom.style.display=t?"inline-block":"none")}toWcs(t){const e=new c.AcGeBox2d,i=new c.AcGePoint2d(t.min.x,t.min.y),n=new c.AcGePoint2d(t.max.x,t.max.y);return e.expandByPoint(this.view.cwcs2Wcs(i)),e.expandByPoint(this.view.cwcs2Wcs(n)),e}}class vt extends P{constructor(t){super(t),this.onClick=e=>{this.resolve(this.view.cwcs2Wcs({x:e.clientX,y:e.clientY}))}}activate(){super.activate(),this.view.canvas.addEventListener("click",this.onClick)}deactivate(){super.deactivate(),this.view.canvas.removeEventListener("click",this.onClick)}}class F{constructor(t){this._view=t,this._cursorManager=new Y}get currentCursor(){return this._currentCursor}restoreCursor(){this._previousCursor!=null&&this.setCursor(this._previousCursor)}setCursor(t){this._cursorManager.setCursor(t,this._view.canvas),this._previousCursor=this._currentCursor,this._currentCursor=t}async getPoint(){return await new vt(this._view).start()}async getSelection(){return await new ft(this._view).start()}}class U{constructor(t=[]){this.events={selectionAdded:new c.AcCmEventManager,selectionRemoved:new c.AcCmEventManager},this._ids=new Set(t)}get ids(){return Array.from(this._ids)}get count(){return this._ids.size}add(t){Array.isArray(t)?(t.forEach(e=>this._ids.add(e)),this.events.selectionAdded.dispatch({ids:t})):(this._ids.add(t),this.events.selectionAdded.dispatch({ids:[t]}))}delete(t){Array.isArray(t)?(t.forEach(e=>this._ids.delete(e)),this.events.selectionRemoved.dispatch({ids:t})):(this._ids.delete(t),this.events.selectionRemoved.dispatch({ids:[t]}))}has(t){return this._ids.has(t)}clear(){if(this._ids.size>0){const t=Array.from(this._ids);this._ids.clear(),this.events.selectionRemoved.dispatch({ids:t})}}}var p=(s=>(s[s.SELECTION=0]="SELECTION",s[s.PAN=1]="PAN",s))(p||{});class k{constructor(t){this.events={mouseMove:new c.AcCmEventManager,viewResize:new c.AcCmEventManager,hover:new c.AcCmEventManager,unhover:new c.AcCmEventManager},this._canvas=t;const e=t.getBoundingClientRect();this._bbox=new c.AcGeBox3d,this._width=e.width,this._height=e.height,this._curPos=new c.AcGePoint2d,this._curScreenPos=new c.AcGePoint2d,this._selectionSet=new U,this._editor=new F(this),this._canvas.addEventListener("mousemove",i=>this.onMouseMove(i)),this._canvas.addEventListener("mousedown",i=>{i.button===1&&this._editor.setCursor(b.Grab)}),this._canvas.addEventListener("mouseup",i=>{i.button===1&&this._editor.restoreCursor()}),window.addEventListener("resize",this.onWindowResize.bind(this)),this._selectionBoxSize=4,this._hoverTimer=null,this._pauseTimer=null,this._hoveredObjectId=null}get editor(){return this._editor}get selectionBoxSize(){return this._selectionBoxSize}set selectionBoxSize(t){this._selectionBoxSize=t}setCursor(t){this._editor.setCursor(t)}setCalculateSizeCallback(t){this._calculateSizeCallback=t}get width(){return this._width}set width(t){this._width=t}get height(){return this._height}set height(t){this._height=t}get bbox(){return this._bbox}get canvas(){return this._canvas}get aspect(){return this._width/this._height}get curPos(){return this._curPos}get curScreenPos(){return this._curScreenPos}get selectionSet(){return this._selectionSet}onWindowResize(){if(this._calculateSizeCallback){const{width:t,height:e}=this._calculateSizeCallback();this._width=t,this._height=e}else this._width=this._canvas.clientWidth,this._height=this._canvas.clientHeight;this.events.viewResize.dispatch({width:this._width,height:this._height})}onMouseMove(t){this._curScreenPos=new c.AcGePoint2d(t.clientX,t.clientY);const e=this.cwcs2Wcs(this._curScreenPos);this._curPos.copy(e),this.events.mouseMove.dispatch({x:e.x,y:e.y}),this.mode==0&&this.startHoverTimer(e.x,e.y)}setHoveredObjectId(t){this._hoveredObjectId&&(this.events.unhover.dispatch({id:this._hoveredObjectId,x:this.curScreenPos.x,y:this.curScreenPos.y}),this.onUnhover(this._hoveredObjectId)),this._hoveredObjectId=t,t&&(this.startPauseTimer(t),this.onHover(t))}hoverAt(t,e){const i=this.pick({x:t,y:e});i.length>0?this.setHoveredObjectId(i[0]):(this.setHoveredObjectId(null),this.clearPauseTimer())}clearHoverTimer(){this._hoverTimer&&clearTimeout(this._hoverTimer)}clearPauseTimer(){this._pauseTimer&&clearTimeout(this._pauseTimer)}startHoverTimer(t,e){this.clearHoverTimer(),this._hoverTimer=setTimeout(()=>{this.hoverAt(t,e)},50)}startPauseTimer(t){this._pauseTimer=setTimeout(()=>{this.events.hover.dispatch({id:t,x:this.curScreenPos.x,y:this.curScreenPos.y})},500)}}class ${constructor(){this._fileName="",this._docTitle="",this._isReadOnly=!0,this._database=new c.AcDbDatabase,this.docTitle="Untitled"}async openUri(t,e){this._uri=t,this._isReadOnly=e&&e.readOnly||!1,this._fileName=this.getFileNameFromUri(t);let i=!0;try{await this._database.openUri(t,e),this.docTitle=this._fileName}catch{i=!1,y.emit("failed-to-open-file",{fileName:t})}return i}async openDocument(t,e,i){var o;let n=!0;this._fileName=t;try{const r=(o=t.split(".").pop())==null?void 0:o.toLocaleLowerCase();await this._database.read(e,i,r=="dwg"?c.AcDbFileType.DWG:c.AcDbFileType.DXF),this.docTitle=this._fileName}catch(r){n=!1,y.emit("failed-to-open-file",{fileName:t}),console.error(r)}return n}get uri(){return this._uri}get database(){return this._database}get docTitle(){return this._docTitle}set docTitle(t){this._docTitle=t,typeof document<"u"&&(document.title=t)}get isReadOnly(){return this._isReadOnly}getFileNameFromUri(t){try{const i=new URL(t).pathname.split("/");return i[i.length-1]||""}catch(e){return console.error("Invalid URI:",e),""}}}class yt{convert(){const t=w.instance.curDocument.database.tables.blockTable.modelSpace.newIterator(),e=new rt.AcSvgRenderer;for(const i of t)i.draw(e);this.createFileAndDownloadIt(e.export())}createFileAndDownloadIt(t){const e=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download="example.svg",document.body.appendChild(n),n.click()}}class W extends g{execute(t){new yt().convert()}}class H extends g{execute(t){y.emit("open-file",{})}}class q extends g{execute(t){w.instance.openUrl("https://cdn.jsdelivr.net/gh/mlight-lee/cad-data/templates/"+"acadiso.dxf")}}class J extends g{execute(t){t.view.mode=p.SELECTION,t.view.setCursor(b.Crosshair)}}class Z extends g{execute(t){t.view.zoomToFit()}}class K extends X{constructor(t){super(t)}async sampler(){await w.instance.editor.getSelection().then(t=>this.view.zoomTo(t,1))}}class Q extends g{async execute(t){await new K(t.view).drag()}}class tt extends g{execute(t){t.view.mode=p.PAN,t.view.setCursor(b.Grab)}}const pt={threeBo2dToGeBox2d:s=>new c.AcGeBox2d(s.min,s.max),goBox2dToThreeBox2d:s=>new f.Box2(s.min,s.max),threeBox3dToGeBox3d:s=>new c.AcGeBox3d(s.min,s.max),goBox3dToThreeBox3d:s=>new f.Box3(s.min,s.max),threeBox3dToGeBox2d:s=>new c.AcGeBox2d(s.min,s.max),goBox2dToThreeBox3d:s=>{const t=new f.Box3;return t.min.set(s.min.x,s.min.y,0),t.max.set(s.max.x,s.max.y,0),t}};class gt extends T.AcTrBaseView{constructor(t,e,i,n){super(t,i,n),this._layoutBtrId=e,this._mode=p.SELECTION,this._axesGizmo=this.createAxesGizmo(),this._viewportViews=new Map}get layoutBtrId(){return this._layoutBtrId}get mode(){return this._mode}set mode(t){t==p.SELECTION?this._cameraControls.mouseButtons={MIDDLE:f.MOUSE.PAN}:t==p.PAN&&(this._cameraControls.mouseButtons={LEFT:f.MOUSE.PAN}),this._cameraControls.update(),this._mode=t}get viewportCount(){return this._viewportViews.size}addViewport(t){this._viewportViews.set(t.viewport.id,t)}removeViewport(t){this._viewportViews.delete(t)}resize(t,e){this._height=e,this._width=t,this.updateCameraFrustum(),this._viewportViews.forEach(i=>{i.update()})}render(t){var i;this._renderer.clear(),this._renderer.render(t.internalScene,this._camera);const e=t.modelSpaceLayout;e&&this.drawViewports(e.internalObject),(i=this._axesGizmo)==null||i.update()}createAxesGizmo(){return new V.AxesGizmo(this._camera.internalCamera,this._renderer.internalRenderer,{hasZAxis:!1,pos:V.ObjectPosition.LEFT_BOTTOM})}drawViewports(t){if(this._viewportViews.size>0){const e=this._renderer.autoClear;this._renderer.autoClear=!1;const i=new f.Vector4;this._renderer.getViewport(i),this._renderer.clearDepth();const n=t.visible;t.visible=!0,this._viewportViews.forEach(o=>{o.render(t)}),t.visible=n,this._renderer.setViewport(i.x,i.y,i.z,i.w),this._renderer.autoClear=e}}}class xt{constructor(){this._activeLayoutBtrId="",this._layoutViews=new Map}get activeLayoutBtrId(){return this._activeLayoutBtrId}set activeLayoutBtrId(t){this._activeLayoutBtrId=t,this._layoutViews.forEach(e=>{e.enabled=e.layoutBtrId==t})}get activeLayoutView(){return this._layoutViews.get(this._activeLayoutBtrId)}has(t){return this._layoutViews.has(t)}getAt(t){return this._layoutViews.get(t)}resize(t,e){this._layoutViews.forEach(i=>{i.resize(t,e)})}add(t){this._layoutViews.set(t.layoutBtrId,t)}render(t){var e;(e=this.activeLayoutView)==null||e.render(t)}}function et(s,t,e=0,i=s.length-1,n=bt){for(;i>e;){if(i-e>600){const h=i-e+1,d=t-e+1,l=Math.log(h),m=.5*Math.exp(2*l/3),x=.5*Math.sqrt(l*m*(h-m)/h)*(d-h/2<0?-1:1),j=Math.max(e,Math.floor(t-d*m/h+x)),Pt=Math.min(i,Math.floor(t+(h-d)*m/h+x));et(s,t,j,Pt,n)}const o=s[t];let r=e,a=i;for(L(s,e,t),n(s[i],o)>0&&L(s,e,i);r<a;){for(L(s,r,a),r++,a--;n(s[r],o)<0;)r++;for(;n(s[a],o)>0;)a--}n(s[e],o)===0?L(s,e,a):(a++,L(s,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function L(s,t,e){const i=s[t];s[t]=s[e],s[e]=i}function bt(s,t){return s<t?-1:s>t?1:0}class St{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!M(t,e))return i;const n=this.toBBox,o=[];for(;e;){for(let r=0;r<e.children.length;r++){const a=e.children[r],h=e.leaf?n(a):a;M(t,h)&&(e.leaf?i.push(a):G(t,h)?this._all(a,i):o.push(a))}e=o.pop()}return i}collides(t){let e=this.data;if(!M(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const o=e.children[n],r=e.leaf?this.toBBox(o):o;if(M(t,r)){if(e.leaf||G(t,r))return!0;i.push(o)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=B([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),o=[],r=[];let a,h,d;for(;i||o.length;){if(i||(i=o.pop(),h=o[o.length-1],a=r.pop(),d=!0),i.leaf){const l=Bt(t,i.children,e);if(l!==-1)return i.children.splice(l,1),o.push(i),this._condense(o),this}!d&&!i.leaf&&G(i,n)?(o.push(i),r.push(a),a=0,h=i,i=i.children[0]):h?(a++,i=h.children[a],d=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const o=i-e+1;let r=this._maxEntries,a;if(o<=r)return a=B(t.slice(e,i+1)),S(a,this.toBBox),a;n||(n=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,n-1))),a=B([]),a.leaf=!1,a.height=n;const h=Math.ceil(o/r),d=h*Math.ceil(Math.sqrt(r));it(t,e,i,d,this.compareMinX);for(let l=e;l<=i;l+=d){const m=Math.min(l+d-1,i);it(t,l,m,h,this.compareMinY);for(let x=l;x<=m;x+=h){const j=Math.min(x+h-1,m);a.children.push(this._build(t,x,j,n-1))}}return S(a,this.toBBox),a}_chooseSubtree(t,e,i,n){for(;n.push(e),!(e.leaf||n.length-1===i);){let o=1/0,r=1/0,a;for(let h=0;h<e.children.length;h++){const d=e.children[h],l=N(d),m=Lt(t,d)-l;m<r?(r=m,o=l<o?l:o,a=d):m===r&&l<o&&(o=l,a=d)}e=a||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),o=[],r=this._chooseSubtree(n,this.data,e,o);for(r.children.push(t),D(r,n);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(n,o,e)}_split(t,e){const i=t[e],n=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,n);const r=this._chooseSplitIndex(i,o,n),a=B(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,S(i,this.toBBox),S(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=B([t,e]),this.data.height=t.height+1,this.data.leaf=!1,S(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,o=1/0,r=1/0;for(let a=e;a<=i-e;a++){const h=C(t,0,a,this.toBBox),d=C(t,a,i,this.toBBox),l=Ct(h,d),m=N(h)+N(d);l<o?(o=l,n=a,r=m<r?m:r):l===o&&m<r&&(r=m,n=a)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:At,o=t.leaf?this.compareMinY:Et,r=this._allDistMargin(t,e,i,n),a=this._allDistMargin(t,e,i,o);r<a&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const o=this.toBBox,r=C(t,0,e,o),a=C(t,i-e,i,o);let h=I(r)+I(a);for(let d=e;d<i-e;d++){const l=t.children[d];D(r,t.leaf?o(l):l),h+=I(r)}for(let d=i-e-1;d>=e;d--){const l=t.children[d];D(a,t.leaf?o(l):l),h+=I(a)}return h}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)D(e[n],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():S(t[e],this.toBBox)}}function Bt(s,t,e){if(!e)return t.indexOf(s);for(let i=0;i<t.length;i++)if(e(s,t[i]))return i;return-1}function S(s,t){C(s,0,s.children.length,t,s)}function C(s,t,e,i,n){n||(n=B(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let o=t;o<e;o++){const r=s.children[o];D(n,s.leaf?i(r):r)}return n}function D(s,t){return s.minX=Math.min(s.minX,t.minX),s.minY=Math.min(s.minY,t.minY),s.maxX=Math.max(s.maxX,t.maxX),s.maxY=Math.max(s.maxY,t.maxY),s}function At(s,t){return s.minX-t.minX}function Et(s,t){return s.minY-t.minY}function N(s){return(s.maxX-s.minX)*(s.maxY-s.minY)}function I(s){return s.maxX-s.minX+(s.maxY-s.minY)}function Lt(s,t){return(Math.max(t.maxX,s.maxX)-Math.min(t.minX,s.minX))*(Math.max(t.maxY,s.maxY)-Math.min(t.minY,s.minY))}function Ct(s,t){const e=Math.max(s.minX,t.minX),i=Math.max(s.minY,t.minY),n=Math.min(s.maxX,t.maxX),o=Math.min(s.maxY,t.maxY);return Math.max(0,n-e)*Math.max(0,o-i)}function G(s,t){return s.minX<=t.minX&&s.minY<=t.minY&&t.maxX<=s.maxX&&t.maxY<=s.maxY}function M(s,t){return t.minX<=s.maxX&&t.minY<=s.maxY&&t.maxX>=s.minX&&t.maxY>=s.minY}function B(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function it(s,t,e,i,n){const o=[t,e];for(;o.length;){if(e=o.pop(),t=o.pop(),e-t<=i)continue;const r=t+Math.ceil((e-t)/i/2)*i;et(s,r,t,e,n),o.push(t,r,r,e)}}class Dt{constructor(t){this._group=new T.AcTrBatchedGroup,this._name=t}get name(){return this._name}set name(t){this._name=t}get visible(){return this._group.visible}set visible(t){this._group.visible=t}get internalObject(){return this._group}get stats(){const t=this._group.stats;return{name:this._name,...t}}get entityCount(){return this._group.entityCount}rerenderPoints(t){this._group.rerenderPoints(t)}hasEntity(t){return this._group.hasEntity(t)}addEntity(t){this._group.addEntity(t)}isIntersectWith(t,e){return this._group.isIntersectWith(t,e)}remove(t){throw new Error("Not implemented yet!")}update(t){return this._group.add(t),!0}hover(t){t.forEach(e=>{this._group.hover(e)})}unhover(t){t.forEach(e=>{this._group.unhover(e)})}select(t){t.forEach(e=>{this._group.select(e)})}unselect(t){t.forEach(e=>{this._group.unselect(e)})}}class Tt{constructor(){this._group=new f.Group,this._indexTree=new St,this._box=new f.Box3,this._layers=new Map}get internalObject(){return this._group}get layers(){return this._layers}get box(){return this._box}get visible(){return this._group.visible}set visible(t){this._group.visible=t}get entityCount(){let t=0;return this._layers.forEach(e=>t+=e.entityCount),t}get stats(){const t=[];let e=0,i=0,n=0,o=0,r=0;return this._layers.forEach(a=>{const h=a.stats;t.push(h),n+=h.line.indexed.geometrySize+h.line.nonIndexed.geometrySize,o+=h.mesh.indexed.geometrySize+h.mesh.nonIndexed.geometrySize,r+=h.point.indexed.geometrySize+h.point.nonIndexed.geometrySize,e+=h.summary.totalGeometrySize,i+=h.summary.totalMappingSize}),{layers:t,summary:{entityCount:this.entityCount,totalSize:{line:n,mesh:o,point:r,geometry:e,mapping:i}}}}clear(){return this._layers.forEach(t=>{this._group.remove(t.internalObject)}),this._layers.clear(),this._box.makeEmpty(),this._indexTree.clear(),this}rerenderPoints(t){this._layers.forEach(e=>{e.rerenderPoints(t)})}isIntersectWith(t,e){const i=this.getLayerByObjectId(t);return i&&i.isIntersectWith(t,e)}addEntity(t,e=!0){if(!t.objectId)throw new Error("[AcTrEntity] Object id is required to add one entity!");if(!t.layerName)throw new Error("[AcTrEntity] Layer name is required to add one entity!");const i=this.getLayer(t.layerName,!0);if(i){i.addEntity(t);const n=t.box;e&&this._box.union(n),this._indexTree.insert({minX:n.min.x,minY:n.min.y,maxX:n.max.x,maxY:n.max.y,id:t.objectId})}return this}remove(t){for(const[e,i]of this._layers)if(i.remove(t))return!0;return!1}update(t){for(const[e,i]of this._layers)if(i.update(t))return!0;return!1}hover(t){t.forEach(e=>{const i=this.getLayerByObjectId(e);i&&i.hover([e])})}unhover(t){t.forEach(e=>{const i=this.getLayerByObjectId(e);i&&i.unhover([e])})}select(t){t.forEach(e=>{const i=this.getLayerByObjectId(e);i&&i.select([e])})}unselect(t){t.forEach(e=>{const i=this.getLayerByObjectId(e);i&&i.unselect([e])})}setSnapObject(t){this._snapPointsObject&&this._group.remove(this._snapPointsObject),this._snapPointsObject=t,this._group.add(t)}search(t){return this._indexTree.search({minX:t.min.x,minY:t.min.y,maxX:t.max.x,maxY:t.max.y})}getLayerByObjectId(t){for(const[e,i]of this._layers)if(i.hasEntity(t))return i}getLayer(t,e=!0){let i=this._layers.get(t);return i===void 0&&e&&(i=new Dt(t),this._layers.set(t,i),this._group.add(i.internalObject)),i}}class It{constructor(){this._scene=new f.Scene,this._layouts=new Map,this._activeLayoutBtrId="",this._modelSpaceBtrId=""}get layouts(){return this._layouts}get box(){var t;return(t=this.activeLayout)==null?void 0:t.box}get internalScene(){return this._scene}get modelSpaceBtrId(){return this._modelSpaceBtrId}set modelSpaceBtrId(t){if(this._modelSpaceBtrId=t,!this._layouts.has(t))throw new Error(`[AcTrScene] No layout assiciated with the specified block table record id '${t}'!`)}get activeLayoutBtrId(){return this._activeLayoutBtrId}set activeLayoutBtrId(t){this._activeLayoutBtrId=t,this._layouts.forEach((e,i)=>{e.visible=t==i})}get activeLayout(){if(this._activeLayoutBtrId&&this._layouts.has(this._activeLayoutBtrId))return this._layouts.get(this._activeLayoutBtrId)}get modelSpaceLayout(){if(this._modelSpaceBtrId&&this._layouts.has(this._modelSpaceBtrId))return this._layouts.get(this._modelSpaceBtrId)}get stats(){const t=[];return this._layouts.forEach(e=>t.push(e.stats)),{layouts:t}}addEmptyLayout(t){const e=new Tt;return this._layouts.set(t,e),this._scene.add(e.internalObject),e.visible=t==this._activeLayoutBtrId,e}clear(){return this._layouts.forEach(t=>{this._scene.remove(t.internalObject),t.clear()}),this._layouts.clear(),this._scene.clear(),this}setLayerVisibility(t,e){var n;let i=!1;return(n=this.activeLayout)==null||n.layers.forEach(o=>{o.name===t&&(o.visible=e,i=!0)}),i}hover(t){return this.activeLayout?(this.activeLayout.hover(t),!0):!1}unhover(t){return this.activeLayout?(this.activeLayout.unhover(t),!0):!1}select(t){return this.activeLayout?(this.activeLayout.select(t),!0):!1}unselect(t){return this.activeLayout?(this.activeLayout.unselect(t),!0):!1}search(t){const e=this.activeLayout;return e?e==null?void 0:e.search(t):[]}addEntity(t,e=!0){const i=t.ownerId;if(i){let n=this._layouts.get(i);n||(n=this.addEmptyLayout(i)),n.addEntity(t,e)}else console.warn("[AcTrSecene] The owner id of one entity cannot be empty!");return this}remove(t){for(const[e,i]of this._layouts)if(i.remove(t))return!0;return!1}update(t){for(const[e,i]of this._layouts)if(i.update(t))return!0;return!1}setSnapObject(t){return this._layouts.forEach(e=>{e.setSnapObject(t)}),this}}const R={background:0};class st extends k{constructor(t=R){const e={...R,...t},i=new f.WebGLRenderer({antialias:!0,alpha:!0,canvas:t.canvas});e.canvas==null&&(e.canvas=i.domElement),super(e.canvas),t.calculateSizeCallback&&this.setCalculateSizeCallback(t.calculateSizeCallback),i.setPixelRatio(Math.min(window.devicePixelRatio,2)),i.setSize(this.width,this.height),i.setClearColor(e.background||0),this._renderer=new T.AcTrRenderer(i);const n=E.instance.fontMapping;this._renderer.setFontMapping(n),this._renderer.events.fontNotFound.addEventListener(o=>{y.emit("font-not-found",{fontName:o.fontName,count:o.count??0})}),this._scene=this.createScene(),this._stats=this.createStats(E.instance.isShowStats),E.instance.events.modified.addEventListener(o=>{o.key=="isShowStats"&&this.toggleStatsVisibility(this._stats,o.value)}),this.canvas.addEventListener("click",()=>{this.mode==p.SELECTION&&this.select()}),document.addEventListener("keydown",o=>{o.code==="Escape"&&this.selectionSet.clear()}),c.acdbHostApplicationServices().layoutManager.events.layoutSwitched.addEventListener(o=>{this.activeLayoutBtrId=o.newLayout.blockTableRecordId}),this._missedImages=new Map,this._layoutViewManager=new xt,this.initialize(),this.onWindowResize(),this.animate(),this._isDirty=!0}initialize(){this.setCursor(b.Crosshair)}get mode(){const t=this.activeLayoutView;return t?t.mode:p.SELECTION}set mode(t){this.activeLayoutView.mode=t,this.editor.getPoint()}get renderer(){return this._renderer}get isDirty(){return this._isDirty}set isDirty(t){this._isDirty=t}get missedData(){return{fonts:this._renderer.missedFonts,images:this._missedImages}}get center(){return this.activeLayoutView.center}set center(t){this.activeLayoutView.center=t}get modelSpaceBtrId(){return this._scene.modelSpaceBtrId}set modelSpaceBtrId(t){this._scene.modelSpaceBtrId=t}get activeLayoutBtrId(){return this._scene.activeLayoutBtrId}set activeLayoutBtrId(t){this._layoutViewManager.activeLayoutBtrId=t,this._scene.activeLayoutBtrId=t,this._isDirty=!0}get activeLayoutView(){return this._layoutViewManager.activeLayoutView}get stats(){return this._scene.stats}animate(){var t;requestAnimationFrame(this.animate.bind(this)),this._isDirty&&(this._layoutViewManager.render(this._scene),(t=this._stats)==null||t.update(),this._isDirty=!1)}cwcs2Wcs(t){const e=this.activeLayoutView;return e?e.cwcs2Wcs(t):new c.AcGePoint2d(t)}wcs2Cwcs(t){const e=this.activeLayoutView;return e?e.wcs2Cwcs(t):new c.AcGePoint2d(t)}zoomTo(t,e=1.1){this.activeLayoutView.zoomTo(t,e),this._isDirty=!0}rerenderPoints(t){const e=this._scene.activeLayout;e&&(e.rerenderPoints(t),this._isDirty=!0)}zoomToFit(){if(this._scene.box){const t=pt.threeBox3dToGeBox2d(this._scene.box);this.zoomTo(t),this._isDirty=!0}}pick(t){t==null&&(t=this.curPos);const e=[],i=this._scene.activeLayout;if(i){const n=this.activeLayoutView,o=n.pointToBox(t,this.selectionBoxSize),r=this._scene.search(o),a=Math.max(o.size.width/2,o.size.height/2),h=n.resetRaycaster(t,a);r.forEach(d=>{const l=d.id;i.isIntersectWith(l,h)&&e.push(l)})}return e}search(t){return this._scene.search(t)}select(t){const e=[];this.pick(t).forEach(n=>e.push(n)),e.length>0&&this.selectionSet.add(e)}selectByBox(t){const e=[];this._scene.search(t).forEach(n=>e.push(n.id)),this.selectionSet.add(e)}addEntity(t){const e=this.createLayoutViewIfNeeded(t.ownerId);let i=t.draw(this._renderer);if(i){i.objectId=t.objectId,i.ownerId=t.ownerId,i.layerName=t.layer,i.visible=t.visibility;const n=!(t instanceof c.AcDbRay||t instanceof c.AcDbXline);this._scene.addEntity(i,n),this._isDirty=!0,i.dispose(),i=null}if(t instanceof c.AcDbViewport){if(t.number>1){const n=new T.AcTrViewportView(e,t.toGiViewport(),this._renderer);e.addViewport(n)}}else if(t instanceof c.AcDbRasterImage){const n=t.imageFileName;n&&this._missedImages.set(t.objectId,n)}}removeEntity(t){this._scene.remove(t)}updateEntity(t){const e=t.draw(this._renderer);return e&&(e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility,this._scene.update(e),this._isDirty=!0,setTimeout(()=>{this._isDirty=!0},100)),e}clear(){this._scene.clear(),this._isDirty=!0,this._missedImages.clear(),this._renderer.clearMissedFonts()}highlight(t){this._isDirty=this._scene.select(t)}unhighlight(t){this._isDirty=this._scene.unselect(t)}setLayerVisibility(t,e){this._isDirty=this._scene.setLayerVisibility(t,e)}onHover(t){this._isDirty=this._scene.hover([t])}onUnhover(t){this._isDirty=this._scene.unhover([t])}createScene(){const t=new It;return t.layouts.forEach(e=>{e.setSnapObject(this.renderer.createObject())}),t}createStats(t){const e=new ct;document.body.appendChild(e.dom);const i=e.dom;return i.style.position="fixed",i.style.inset="unset",i.style.bottom="30px",i.style.right="0px",this.toggleStatsVisibility(e,t),e}onWindowResize(){super.onWindowResize(),this._renderer.setSize(this.width,this.height),this._layoutViewManager.resize(this.width,this.height),this._isDirty=!0}createLayoutViewIfNeeded(t){let e=this._layoutViewManager.getAt(t);return e==null&&(e=new gt(this._renderer,t,this.width,this.height),e.events.viewChanged.addEventListener(()=>{this._isDirty=!0}),this._layoutViewManager.add(e)),e}toggleStatsVisibility(t,e){e?t.dom.style.display="block":t.dom.style.display="none"}}const nt="simsun";class A{static get instance(){return A._instance||(A._instance=new A),A._instance}createExampleDoc1(t){for(let n=0;n<2;++n)for(let o=0;o<2;++o){const r=new c.AcDbHatch,a=new c.AcGePolyline2d;a.addVertexAt(0,{x:o*100,y:n*100,bulge:1}),a.addVertexAt(1,{x:o*100+100,y:n*100,bulge:1}),a.closed=!0,r.add(a),t.tables.blockTable.modelSpace.appendEntity(r)}}createExampleDoc2(t){const e=t.tables.blockTable.modelSpace;e.appendEntity(this.createArc()),this.createLines().forEach(n=>{t.tables.blockTable.modelSpace.appendEntity(new c.AcDbLine(n.startPoint,n.endPoint))}),e.appendEntity(this.createHatch()),t.tables.textStyleTable.add(this.createTextStyle()),e.appendEntity(this.createMText())}createTextStyle(){const t={bigFont:"",color:16777215,extendedFont:nt,fixedTextHeight:0,font:nt,lastHeight:.2,name:"Standard",obliqueAngle:0,standardFlag:0,textGenerationFlag:0,widthFactor:.667};return new c.AcDbTextStyleTableRecord(t)}createMText(){const t=new c.AcDbMText;return t.attachmentPoint=c.AcGiMTextAttachmentPoint.MiddleLeft,t.color=new c.AcCmColor().setColorName("red"),t.layer="0",t.location=new c.AcGePoint3d(9850,86773,0),t.contents="{\\W0.667;\\T1.1;智慧8081}",t.height=200,t.width=1e3,t.styleName="Standard",t}createHatch(){const t=this.createLines(),e=new c.AcDbHatch,i=new c.AcGeLoop2d;return i.add(new c.AcGeCircArc2d({x:20241.23355899991,y:174118.6312674369},89258.30757455899,c.AcGeMathUtil.degToRad(262.2471115358437),c.AcGeMathUtil.degToRad(264.444541053754),!1)),t.forEach(n=>{i.add(new c.AcGeLine2d(n.startPoint,n.endPoint))}),e.add(i),e}createArc(){return new c.AcDbArc({x:20241.23355899991,y:174118.6312674369,z:0},89258.30757455899,c.AcGeMathUtil.degToRad(262.2471115358437),c.AcGeMathUtil.degToRad(264.444541053754))}createLines(){const t=[];return t.push(new c.AcGeLine3d({x:11600.20888122753,y:85279.57362051727,z:0},{x:11600.20890652924,y:86546.03982284805,z:0})),t.push(new c.AcGeLine3d({x:11600.20890652924,y:86546.03982284805,z:0},{x:10850.20885583921,y:86546.03980174381,z:0})),t.push(new c.AcGeLine3d({x:10850.2088602169,y:86546.03967292747,z:0},{x:9050.208860216895,y:86546.039672927,z:0})),t.push(new c.AcGeLine3d({x:9050.208855839213,y:86546.0397510943,z:0},{x:8200.209067034302,y:86546.039727177,z:0})),t.push(new c.AcGeLine3d({x:8200.209067034302,y:86546.039727177,z:0},{x:8200.209067033837,y:85676.22514764359,z:0})),t}}class Mt{constructor(t){this._cadRenderer=t,this._avaiableFonts=[]}get avaiableFonts(){return this._avaiableFonts}async getAvaiableFonts(){if(this._avaiableFonts.length==0){const t="https://cdn.jsdelivr.net/gh/mlight-lee/cad-data/fonts/",e=t+"fonts.json";try{const i=await fetch(e);this._avaiableFonts=await i.json()}catch{y.emit("failed-to-get-avaiable-fonts",{url:e})}this._avaiableFonts.forEach(i=>{i.url=t+i.file})}return this._avaiableFonts}async load(t){await this.getAvaiableFonts();const e=[];t.forEach(n=>{const o=n.toLowerCase(),r=O.find(this._avaiableFonts,a=>O.findIndex(a.name,h=>h.toLowerCase()==o)>=0);r&&e.push(r.url)}),(await this._cadRenderer.loadFonts(e)).forEach(n=>{n.status||y.emit("font-not-loaded",{fontName:n.fontName,url:n.url})})}}class w{constructor(t){this.events={documentCreated:new c.AcCmEventManager,documentActivated:new c.AcCmEventManager};const e=new $;e.database.events.openProgress.addEventListener(o=>{y.emit("open-file-progress",{percentage:o.percentage,stage:o.stage,stageStatus:o.stageStatus})});const i=()=>({width:window.innerWidth,height:window.innerHeight-30}),n=new st({canvas:t,calculateSizeCallback:i});this._context=new z(n,e),this._fontLoader=new Mt(n.renderer),c.acdbHostApplicationServices().workingDatabase=e.database,this.registerCommands(),this.createExampleDoc()}static createInstance(t){return w._instance==null&&(w._instance=new w(t)),this._instance}static get instance(){return w._instance||(w._instance=new w),w._instance}get context(){return this._context}get curDocument(){return this._context.doc}get mdiActiveDocument(){return this._context.doc}get curView(){return this._context.view}get editor(){return this._context.view.editor}get avaiableFonts(){return this._fontLoader.avaiableFonts}async loadFonts(t){await this._fontLoader.load(t)}async loadDefaultFonts(){const t=["simkai"];await this._fontLoader.load(t)}createExampleDoc(){setTimeout(async()=>{await this.loadDefaultFonts(),A.instance.createExampleDoc2(this.curDocument.database),this.setLayoutInfo(),this.curView.zoomToFit()})}async openUrl(t,e){this.onBeforeOpenDocument(),e=this.setOptions(e);const i=await this.context.doc.openUri(t,e);this.onAfterOpenDocument(i)}async openDocument(t,e,i){this.onBeforeOpenDocument(),i=this.setOptions(i);const n=await this.context.doc.openDocument(t,e,i);this.onAfterOpenDocument(n)}registerCommands(){const t=_.instance;t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"pan","pan",new tt),t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"select","select",new J),t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"zoom","zoom",new Z),t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"zoomw","zoomw",new Q),t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"csvg","csvg",new W),t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"qnew","qnew",new q),t.addCommand(_.SYSTEMT_COMMAND_GROUP_NAME,"open","open",new H)}sendStringToExecute(t){const i=_.instance.lookupGlobalCmd(t);i==null||i.execute(this.context)}onBeforeOpenDocument(){this.curView.clear()}onAfterOpenDocument(t){t&&(this.events.documentActivated.dispatch({doc:this.context.doc}),this.setLayoutInfo(),this.curView.zoomToFit())}setOptions(t){return t==null?t={fontLoader:this._fontLoader}:t.fontLoader==null&&(t.fontLoader=this._fontLoader),t}setLayoutInfo(){const t=this.curView;t.activeLayoutBtrId=this.curDocument.database.currentSpaceId,t.modelSpaceBtrId=this.curDocument.database.currentSpaceId}}const Ot={isDebug:!1,isShowCommandLine:!0,isShowCoordinate:!0,isShowToolbar:!0,isShowStats:!1,fontMapping:{}},ot="settings";class E{constructor(){this.events={modified:new c.AcCmEventManager}}static get instance(){return this._instance||(this._instance=new E),this._instance}set(t,e){const i=this.settings;i[t]=e,localStorage.setItem(ot,JSON.stringify(i)),this.events.modified.dispatch({key:t,value:e})}get(t){return this.settings[t]}toggle(t){const e=this.get(t);this.set(t,!e)}get isDebug(){return this.get("isDebug")}set isDebug(t){this.set("isDebug",t)}get isShowCommandLine(){return this.get("isShowCommandLine")}set isShowCommandLine(t){this.set("isShowCommandLine",t)}get isShowCoordinate(){return this.get("isShowCoordinate")}set isShowCoordinate(t){this.set("isShowCoordinate",t)}get isShowToolbar(){return this.get("isShowToolbar")}set isShowToolbar(t){this.set("isShowToolbar",t)}get isShowStats(){return this.get("isShowStats")}set isShowStats(t){this.set("isShowStats",t)}get fontMapping(){return this.get("fontMapping")}set fontMapping(t){this.set("fontMapping",t)}setFontMapping(t,e){const i=this.get("fontMapping");i[t]=e,this.set("fontMapping",i)}get settings(){const t=localStorage.getItem(ot),e=t==null?{}:JSON.parse(t);return O.defaults(e,Ot)}}u.AcApContext=z,u.AcApConvertToSvgCmd=W,u.AcApDocManager=w,u.AcApDocument=$,u.AcApOpenCmd=H,u.AcApPanCmd=tt,u.AcApQNewCmd=q,u.AcApSelectCmd=J,u.AcApSettingManager=E,u.AcApZoomCmd=Z,u.AcApZoomToBoxCmd=Q,u.AcApZoomToBoxJig=K,u.AcEdBaseView=k,u.AcEdCommand=g,u.AcEdCommandStack=_,u.AcEdCorsorType=b,u.AcEdCursorManager=Y,u.AcEdJig=X,u.AcEdSelectionSet=U,u.AcEdViewMode=p,u.AcEditor=F,u.AcTrView2d=st,u.DEFAULT_VIEW_2D_OPTIONS=R,u.acedAlert=dt,u.eventBus=y,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AcEdBaseView } from '../editor/view/AcEdBaseView';
|
|
2
|
+
import { AcApDocument } from './AcApDocument';
|
|
3
|
+
export declare class AcApContext {
|
|
4
|
+
private _view;
|
|
5
|
+
private _doc;
|
|
6
|
+
/**
|
|
7
|
+
* Construct one context to bind one drawing database with its viewer
|
|
8
|
+
* @param view Input the view used to show the specified drawing
|
|
9
|
+
* @param doc Input the document associated with the drawing database
|
|
10
|
+
*/
|
|
11
|
+
constructor(view: AcEdBaseView, doc: AcApDocument);
|
|
12
|
+
get view(): AcEdBaseView;
|
|
13
|
+
get doc(): AcApDocument;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AcApContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApContext.d.ts","sourceRoot":"","sources":["../../src/app/AcApContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,IAAI,CAAc;IAE1B;;;;OAIG;gBACS,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;IAqCjD,IAAI,IAAI,iBAEP;IAED,IAAI,GAAG,IAAI,YAAY,CAEtB;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var AcApContext = /** @class */ (function () {
|
|
2
|
+
/**
|
|
3
|
+
* Construct one context to bind one drawing database with its viewer
|
|
4
|
+
* @param view Input the view used to show the specified drawing
|
|
5
|
+
* @param doc Input the document associated with the drawing database
|
|
6
|
+
*/
|
|
7
|
+
function AcApContext(view, doc) {
|
|
8
|
+
var _this = this;
|
|
9
|
+
this._view = view;
|
|
10
|
+
this._doc = doc;
|
|
11
|
+
// Add entity to scene
|
|
12
|
+
doc.database.events.entityAppended.addEventListener(function (args) {
|
|
13
|
+
_this.view.addEntity(args.entity);
|
|
14
|
+
});
|
|
15
|
+
// Update entity
|
|
16
|
+
doc.database.events.entityModified.addEventListener(function (args) {
|
|
17
|
+
_this.view.updateEntity(args.entity);
|
|
18
|
+
});
|
|
19
|
+
// Set layer visibility
|
|
20
|
+
doc.database.events.layerModified.addEventListener(function (args) {
|
|
21
|
+
_this._view.setLayerVisibility(args.layer.name, !args.layer.isOff);
|
|
22
|
+
});
|
|
23
|
+
// Set point display mode
|
|
24
|
+
doc.database.events.headerSysVarChanged.addEventListener(function (args) {
|
|
25
|
+
if (args.name == 'pdmode') {
|
|
26
|
+
;
|
|
27
|
+
_this._view.rerenderPoints(args.database.pdmode);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
// Show their grip points when entities are selected
|
|
31
|
+
view.selectionSet.events.selectionAdded.addEventListener(function (args) {
|
|
32
|
+
view.highlight(args.ids);
|
|
33
|
+
});
|
|
34
|
+
// Hide their grip points when entities are deselected
|
|
35
|
+
view.selectionSet.events.selectionRemoved.addEventListener(function (args) {
|
|
36
|
+
view.unhighlight(args.ids);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
Object.defineProperty(AcApContext.prototype, "view", {
|
|
40
|
+
get: function () {
|
|
41
|
+
return this._view;
|
|
42
|
+
},
|
|
43
|
+
enumerable: false,
|
|
44
|
+
configurable: true
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(AcApContext.prototype, "doc", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return this._doc;
|
|
49
|
+
},
|
|
50
|
+
enumerable: false,
|
|
51
|
+
configurable: true
|
|
52
|
+
});
|
|
53
|
+
return AcApContext;
|
|
54
|
+
}());
|
|
55
|
+
export { AcApContext };
|
|
56
|
+
//# sourceMappingURL=AcApContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|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AgB,CAAC,UAAA,IAAI;YAC3D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QAEF,sDAAsD;QACtD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,UAAA,IAAI;YAC7D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,sBAAI,6BAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;;;OAAA;IAED,sBAAI,4BAAG;aAAP;YACE,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;;;OAAA;IACH,kBAAC;AAAD,CAAC,AArDD,IAqDC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AcDbDatabase } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* This is an internal class used to create some exmaple data.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class AcApDocCreator {
|
|
7
|
+
private static _instance?;
|
|
8
|
+
static get instance(): AcApDocCreator;
|
|
9
|
+
createExampleDoc1(db: AcDbDatabase): void;
|
|
10
|
+
createExampleDoc2(db: AcDbDatabase): void;
|
|
11
|
+
private createTextStyle;
|
|
12
|
+
private createMText;
|
|
13
|
+
private createHatch;
|
|
14
|
+
private createArc;
|
|
15
|
+
private createLines;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=AcApDocCreator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApDocCreator.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAcb,MAAM,uBAAuB,CAAA;AAI9B;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAgB;IAEzC,MAAM,KAAK,QAAQ,mBAKlB;IAED,iBAAiB,CAAC,EAAE,EAAE,YAAY;IAgBlC,iBAAiB,CAAC,EAAE,EAAE,YAAY;IAelC,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,WAAW;CA0EpB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { AcCmColor, AcDbArc, AcDbHatch, AcDbLine, AcDbMText, AcDbTextStyleTableRecord, AcGeCircArc2d, AcGeLine2d, AcGeLine3d, AcGeLoop2d, AcGeMathUtil, AcGePoint3d, AcGePolyline2d, AcGiMTextAttachmentPoint } from '@mlightcad/data-model';
|
|
2
|
+
var DEFAULT_FONT = 'simsun';
|
|
3
|
+
/**
|
|
4
|
+
* This is an internal class used to create some exmaple data.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
var AcApDocCreator = /** @class */ (function () {
|
|
8
|
+
function AcApDocCreator() {
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(AcApDocCreator, "instance", {
|
|
11
|
+
get: function () {
|
|
12
|
+
if (!AcApDocCreator._instance) {
|
|
13
|
+
AcApDocCreator._instance = new AcApDocCreator();
|
|
14
|
+
}
|
|
15
|
+
return AcApDocCreator._instance;
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
AcApDocCreator.prototype.createExampleDoc1 = function (db) {
|
|
21
|
+
var rowCount = 2;
|
|
22
|
+
var colCount = 2;
|
|
23
|
+
for (var i = 0; i < rowCount; ++i) {
|
|
24
|
+
for (var j = 0; j < colCount; ++j) {
|
|
25
|
+
var hatch = new AcDbHatch();
|
|
26
|
+
var circle = new AcGePolyline2d();
|
|
27
|
+
circle.addVertexAt(0, { x: j * 100, y: i * 100, bulge: 1 });
|
|
28
|
+
circle.addVertexAt(1, { x: j * 100 + 100, y: i * 100, bulge: 1 });
|
|
29
|
+
circle.closed = true;
|
|
30
|
+
hatch.add(circle);
|
|
31
|
+
db.tables.blockTable.modelSpace.appendEntity(hatch);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
AcApDocCreator.prototype.createExampleDoc2 = function (db) {
|
|
36
|
+
var modelSpace = db.tables.blockTable.modelSpace;
|
|
37
|
+
modelSpace.appendEntity(this.createArc());
|
|
38
|
+
var lines = this.createLines();
|
|
39
|
+
lines.forEach(function (line) {
|
|
40
|
+
db.tables.blockTable.modelSpace.appendEntity(new AcDbLine(line.startPoint, line.endPoint));
|
|
41
|
+
});
|
|
42
|
+
modelSpace.appendEntity(this.createHatch());
|
|
43
|
+
db.tables.textStyleTable.add(this.createTextStyle());
|
|
44
|
+
modelSpace.appendEntity(this.createMText());
|
|
45
|
+
};
|
|
46
|
+
AcApDocCreator.prototype.createTextStyle = function () {
|
|
47
|
+
var textStyle = {
|
|
48
|
+
bigFont: '',
|
|
49
|
+
color: 0xffffff,
|
|
50
|
+
extendedFont: DEFAULT_FONT,
|
|
51
|
+
fixedTextHeight: 0,
|
|
52
|
+
font: DEFAULT_FONT,
|
|
53
|
+
lastHeight: 0.2,
|
|
54
|
+
name: 'Standard',
|
|
55
|
+
obliqueAngle: 0,
|
|
56
|
+
standardFlag: 0,
|
|
57
|
+
textGenerationFlag: 0,
|
|
58
|
+
widthFactor: 0.667
|
|
59
|
+
};
|
|
60
|
+
return new AcDbTextStyleTableRecord(textStyle);
|
|
61
|
+
};
|
|
62
|
+
AcApDocCreator.prototype.createMText = function () {
|
|
63
|
+
var mtext = new AcDbMText();
|
|
64
|
+
mtext.attachmentPoint = AcGiMTextAttachmentPoint.MiddleLeft;
|
|
65
|
+
mtext.color = new AcCmColor().setColorName('red');
|
|
66
|
+
mtext.layer = '0';
|
|
67
|
+
mtext.location = new AcGePoint3d(9850, 86773, 0);
|
|
68
|
+
mtext.contents = '{\\W0.667;\\T1.1;智慧8081}';
|
|
69
|
+
mtext.height = 200;
|
|
70
|
+
mtext.width = 1000;
|
|
71
|
+
mtext.styleName = 'Standard';
|
|
72
|
+
return mtext;
|
|
73
|
+
};
|
|
74
|
+
AcApDocCreator.prototype.createHatch = function () {
|
|
75
|
+
var lines = this.createLines();
|
|
76
|
+
var hatch = new AcDbHatch();
|
|
77
|
+
var loops = new AcGeLoop2d();
|
|
78
|
+
loops.add(new AcGeCircArc2d({ x: 20241.23355899991, y: 174118.6312674369 }, 89258.30757455899, AcGeMathUtil.degToRad(262.2471115358437), AcGeMathUtil.degToRad(264.444541053754), false));
|
|
79
|
+
lines.forEach(function (line) {
|
|
80
|
+
loops.add(new AcGeLine2d(line.startPoint, line.endPoint));
|
|
81
|
+
});
|
|
82
|
+
hatch.add(loops);
|
|
83
|
+
return hatch;
|
|
84
|
+
};
|
|
85
|
+
AcApDocCreator.prototype.createArc = function () {
|
|
86
|
+
return new AcDbArc({ x: 20241.23355899991, y: 174118.6312674369, z: 0 }, 89258.30757455899, AcGeMathUtil.degToRad(262.2471115358437), AcGeMathUtil.degToRad(264.444541053754));
|
|
87
|
+
};
|
|
88
|
+
AcApDocCreator.prototype.createLines = function () {
|
|
89
|
+
var lines = [];
|
|
90
|
+
lines.push(new AcGeLine3d({
|
|
91
|
+
x: 11600.20888122753,
|
|
92
|
+
y: 85279.57362051727,
|
|
93
|
+
z: 0
|
|
94
|
+
}, {
|
|
95
|
+
x: 11600.20890652924,
|
|
96
|
+
y: 86546.03982284805,
|
|
97
|
+
z: 0
|
|
98
|
+
}));
|
|
99
|
+
lines.push(new AcGeLine3d({
|
|
100
|
+
x: 11600.20890652924,
|
|
101
|
+
y: 86546.03982284805,
|
|
102
|
+
z: 0
|
|
103
|
+
}, {
|
|
104
|
+
x: 10850.20885583921,
|
|
105
|
+
y: 86546.03980174381,
|
|
106
|
+
z: 0
|
|
107
|
+
}));
|
|
108
|
+
lines.push(new AcGeLine3d({
|
|
109
|
+
x: 10850.2088602169,
|
|
110
|
+
y: 86546.03967292747,
|
|
111
|
+
z: 0
|
|
112
|
+
}, {
|
|
113
|
+
x: 9050.208860216895,
|
|
114
|
+
y: 86546.039672927,
|
|
115
|
+
z: 0
|
|
116
|
+
}));
|
|
117
|
+
lines.push(new AcGeLine3d({
|
|
118
|
+
x: 9050.208855839213,
|
|
119
|
+
y: 86546.0397510943,
|
|
120
|
+
z: 0
|
|
121
|
+
}, {
|
|
122
|
+
x: 8200.209067034302,
|
|
123
|
+
y: 86546.039727177,
|
|
124
|
+
z: 0
|
|
125
|
+
}));
|
|
126
|
+
lines.push(new AcGeLine3d({
|
|
127
|
+
x: 8200.209067034302,
|
|
128
|
+
y: 86546.039727177,
|
|
129
|
+
z: 0
|
|
130
|
+
}, {
|
|
131
|
+
x: 8200.209067033837,
|
|
132
|
+
y: 85676.22514764359,
|
|
133
|
+
z: 0
|
|
134
|
+
}));
|
|
135
|
+
return lines;
|
|
136
|
+
};
|
|
137
|
+
return AcApDocCreator;
|
|
138
|
+
}());
|
|
139
|
+
export { AcApDocCreator };
|
|
140
|
+
//# sourceMappingURL=AcApDocCreator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApDocCreator.js","sourceRoot":"","sources":["../../src/app/AcApDocCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EAEP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,aAAa,EACb,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,cAAc,EACd,wBAAwB,EAEzB,MAAM,uBAAuB,CAAA;AAE9B,IAAM,YAAY,GAAG,QAAQ,CAAA;AAE7B;;;GAGG;AACH;IAAA;IA8KA,CAAC;IA3KC,sBAAW,0BAAQ;aAAnB;YACE,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;gBAC9B,cAAc,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAA;YACjD,CAAC;YAC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,EAAE,CAAC;SACL,EACD;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,CAAC;SACL,CACF,CACF,CAAA;QACD,KAAK,CAAC,IAAI,CACR,IAAI,UAAU,CACZ;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,CAAC;SACL,EACD;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,CAAC;SACL,CACF,CACF,CAAA;QACD,KAAK,CAAC,IAAI,CACR,IAAI,UAAU,CACZ;YACE,CAAC,EAAE,gBAAgB;YACnB,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,CAAC;SACL,EACD;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,eAAe;YAClB,CAAC,EAAE,CAAC;SACL,CACF,CACF,CAAA;QACD,KAAK,CAAC,IAAI,CACR,IAAI,UAAU,CACZ;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,gBAAgB;YACnB,CAAC,EAAE,CAAC;SACL,EACD;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,eAAe;YAClB,CAAC,EAAE,CAAC;SACL,CACF,CACF,CAAA;QACD,KAAK,CAAC,IAAI,CACR,IAAI,UAAU,CACZ;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,eAAe;YAClB,CAAC,EAAE,CAAC;SACL,EACD;YACE,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,iBAAiB;YACpB,CAAC,EAAE,CAAC;SACL,CACF,CACF,CAAA;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IACH,qBAAC;AAAD,CAAC,AA9KD,IA8KC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AcCmEventManager, AcDbOpenDatabaseOptions } from '@mlightcad/data-model';
|
|
2
|
+
import { AcTrView2d } from '../view';
|
|
3
|
+
import { AcApContext } from './AcApContext';
|
|
4
|
+
import { AcApDocument } from './AcApDocument';
|
|
5
|
+
export interface AcDbDocumentEventArgs {
|
|
6
|
+
doc: AcApDocument;
|
|
7
|
+
}
|
|
8
|
+
export declare class AcApDocManager {
|
|
9
|
+
private _context;
|
|
10
|
+
private _fontLoader;
|
|
11
|
+
private static _instance?;
|
|
12
|
+
readonly events: {
|
|
13
|
+
documentCreated: AcCmEventManager<AcDbDocumentEventArgs>;
|
|
14
|
+
documentActivated: AcCmEventManager<AcDbDocumentEventArgs>;
|
|
15
|
+
};
|
|
16
|
+
private constructor();
|
|
17
|
+
static createInstance(canvas?: HTMLCanvasElement): AcApDocManager | undefined;
|
|
18
|
+
static get instance(): AcApDocManager;
|
|
19
|
+
/**
|
|
20
|
+
* Current context
|
|
21
|
+
*/
|
|
22
|
+
get context(): AcApContext;
|
|
23
|
+
/**
|
|
24
|
+
* Current open drawing
|
|
25
|
+
*/
|
|
26
|
+
get curDocument(): AcApDocument;
|
|
27
|
+
/**
|
|
28
|
+
* For now, it is same as property `curDocument`.
|
|
29
|
+
*/
|
|
30
|
+
get mdiActiveDocument(): AcApDocument;
|
|
31
|
+
/**
|
|
32
|
+
* Current view used to show current drawing
|
|
33
|
+
*/
|
|
34
|
+
get curView(): AcTrView2d;
|
|
35
|
+
get editor(): import("../editor").AcEditor;
|
|
36
|
+
/**
|
|
37
|
+
* Avaiable fonts to load. It means those fonts are avaiable to load. However, it
|
|
38
|
+
* doesn't mean those fonts are already loaded and avaiable to use.
|
|
39
|
+
*/
|
|
40
|
+
get avaiableFonts(): import("@mlightcad/data-model").AcDbFontInfo[];
|
|
41
|
+
/**
|
|
42
|
+
* Load the specified fonts
|
|
43
|
+
* @param fonts Input one list of font names
|
|
44
|
+
*/
|
|
45
|
+
loadFonts(fonts: string[]): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Load default fonts
|
|
48
|
+
*/
|
|
49
|
+
loadDefaultFonts(): Promise<void>;
|
|
50
|
+
createExampleDoc(): void;
|
|
51
|
+
openUrl(url: string, options?: AcDbOpenDatabaseOptions): Promise<void>;
|
|
52
|
+
openDocument(fileName: string, content: string | ArrayBuffer, options: AcDbOpenDatabaseOptions): Promise<void>;
|
|
53
|
+
registerCommands(): void;
|
|
54
|
+
sendStringToExecute(cmdStr: string): void;
|
|
55
|
+
protected onBeforeOpenDocument(): void;
|
|
56
|
+
protected onAfterOpenDocument(isSuccess: boolean): void;
|
|
57
|
+
private setOptions;
|
|
58
|
+
private setLayoutInfo;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=AcApDocManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApDocManager.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,uBAAuB,EACxB,MAAM,uBAAuB,CAAA;AAa9B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,YAAY,CAAA;CAClB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAgB;IAEzC,SAAgB,MAAM;;;MAGrB;IAED,OAAO;IAwBP,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,iBAAiB;IAOhD,MAAM,KAAK,QAAQ,mBAKlB;IAED;;OAEG;IACH,IAAI,OAAO,gBAEV;IAED;;OAEG;IACH,IAAI,WAAW,iBAEd;IAED;;OAEG;IACH,IAAI,iBAAiB,iBAEpB;IAED;;OAEG;IACH,IAAI,OAAO,IACoB,UAAU,CACxC;IAED,IAAI,MAAM,iCAET;IAED;;;OAGG;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