开发:单例的类型定义自动化

pull/2149/MERGE
ChenX 1 year ago
parent 8577c8992a
commit 00186bde84

@ -3,7 +3,7 @@ import "../Utils/jest.util";
import { LoadBoardsFromFileData } from "../Utils/LoadEntity.util"; import { LoadBoardsFromFileData } from "../Utils/LoadEntity.util";
import { testPathCount } from "./testPathCount"; import { testPathCount } from "./testPathCount";
export let feedUtil = FeedingToolPath.GetInstance() as FeedingToolPath; export let feedUtil = FeedingToolPath.GetInstance();
test("千年舟 绿色健康之家", () => test("千年舟 绿色健康之家", () =>
{ {

@ -1,6 +1,6 @@
import { Board } from "../../src/DatabaseServices/Entity/Board"; import { Board } from "../../src/DatabaseServices/Entity/Board";
import { FeedingToolPath } from "../../src/GraphicsSystem/ToolPath/FeedingToolPath"; import { FeedingToolPath } from "../../src/GraphicsSystem/ToolPath/FeedingToolPath";
export let feedUtil = FeedingToolPath.GetInstance() as FeedingToolPath; export let feedUtil = FeedingToolPath.GetInstance();
export function testPathCount(br: Board, count?: number) export function testPathCount(br: Board, count?: number)
{ {

@ -7,8 +7,8 @@ import { ISpaceParse } from "../../src/Geometry/SpaceParse/ISpaceParse";
import { EFullDir, EFullType, EWineRackStyle, EWineRackType, EWRackArrayType, IWineRackOption } from "../../src/UI/Store/WineRackInterface"; import { EFullDir, EFullType, EWineRackStyle, EWineRackType, EWRackArrayType, IWineRackOption } from "../../src/UI/Store/WineRackInterface";
import "../Utils/jest.util"; import "../Utils/jest.util";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
const UprightTool = DrawUprightWineRackTool.GetInstance() as DrawUprightWineRackTool; const UprightTool = DrawUprightWineRackTool.GetInstance();
const ObliqueTool = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool; const ObliqueTool = DrawObliqueWineRackTool.GetInstance();
const option: IWineRackOption = { const option: IWineRackOption = {
type: EWineRackType.Oblique, type: EWineRackType.Oblique,

@ -10,7 +10,7 @@ export class Command_999 implements Command
{ {
async exec() async exec()
{ {
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
if (!fileServer.m_CurFileId) if (!fileServer.m_CurFileId)
{ {
AppToaster.show({ AppToaster.show({

@ -17,7 +17,7 @@ export class ActicityLayerBoard implements Command
{ {
async exec() async exec()
{ {
const store = ActivityLayerBoardStore.GetInstance() as ActivityLayerBoardStore; const store = ActivityLayerBoardStore.GetInstance();
app.Editor.ModalManage.RenderModal(ActivityLayerBoard, { store }); app.Editor.ModalManage.RenderModal(ActivityLayerBoard, { store });
let res = await app.Editor.ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();

@ -47,7 +47,7 @@ export class BatchModify implements Command
if (keyRes.Status !== PromptStatus.Keyword) return; if (keyRes.Status !== PromptStatus.Keyword) return;
const store = RightPanelStore.GetInstance() as RightPanelStore; const store = RightPanelStore.GetInstance();
store.m_IsShow = true; store.m_IsShow = true;
if (keyRes.StringResult === "S") if (keyRes.StringResult === "S")
{ {

@ -14,7 +14,7 @@ export class BatchModifyPanel implements Command
{ {
async exec() async exec()
{ {
let store = BatchModifyPanelStore.GetInstance() as BatchModifyPanelStore; let store = BatchModifyPanelStore.GetInstance();
let enRes = await app.Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择需要修改的板件", Msg: "选择需要修改的板件",

@ -36,7 +36,7 @@ export class BoardBatchCurtail implements Command
{ {
async exec() async exec()
{ {
let store = BoardBatchCurtailStore.GetInstance() as BoardBatchCurtailStore; let store = BoardBatchCurtailStore.GetInstance();
let enRes = await app.Editor.GetSelection({ let enRes = await app.Editor.GetSelection({
Msg: "选择需要修改的板件", Msg: "选择需要修改的板件",

@ -10,7 +10,7 @@ import { Box3Ext } from "../../Geometry/Box";
export function CuttingBoardByBoard(meats: Board[], knifs: Board[], isRelevance = true) export function CuttingBoardByBoard(meats: Board[], knifs: Board[], isRelevance = true)
{ {
// //进度条 // //进度条
// let down = DownPanelStore.GetInstance() as DownPanelStore; // let down = DownPanelStore.GetInstance();
// down.StartProgress("切割1:"); // down.StartProgress("切割1:");
for (let i = 0; i < meats.length; i++) for (let i = 0; i < meats.length; i++)
@ -89,7 +89,7 @@ export async function CuttingBoardByHardware(meats: Board[], hardwares: Hardware
} }
// //进度条 // //进度条
// let down = DownPanelStore.GetInstance() as DownPanelStore; // let down = DownPanelStore.GetInstance();
// down.StartProgress("切割2:"); // down.StartProgress("切割2:");
for (let i = 0; i < meats.length; i++) for (let i = 0; i < meats.length; i++)

@ -53,7 +53,7 @@ export class ReferenceCutting implements Command
//偏移量 //偏移量
let offset: number; let offset: number;
//对话框 设置偏移类型 //对话框 设置偏移类型
let referenceCuttingStore = ReferenceCuttingStore.GetInstance() as ReferenceCuttingStore; let referenceCuttingStore = ReferenceCuttingStore.GetInstance();
let option = referenceCuttingStore.m_Option; let option = referenceCuttingStore.m_Option;
option.halfThickness = brKnife.Thickness / 2; option.halfThickness = brKnife.Thickness / 2;
option.boardType = brKnife.BoardType; option.boardType = brKnife.BoardType;

@ -2,9 +2,9 @@ import { toJS } from "mobx";
import { app } from "../ApplicationServices/Application"; import { app } from "../ApplicationServices/Application";
import { arrayLast } from "../Common/ArrayExt"; import { arrayLast } from "../Common/ArrayExt";
import { EBoardKeyList } from "../Common/BoardKeyList"; import { EBoardKeyList } from "../Common/BoardKeyList";
import { safeEval } from "../Common/eval";
import { UpdateDraw } from "../Common/Status"; import { UpdateDraw } from "../Common/Status";
import { FixedNotZero } from "../Common/Utils"; import { FixedNotZero } from "../Common/Utils";
import { safeEval } from "../Common/eval";
import { CylinderHole, GangDrillType } from "../DatabaseServices/3DSolid/CylinderHole"; import { CylinderHole, GangDrillType } from "../DatabaseServices/3DSolid/CylinderHole";
import { BoardIsLong, BoardIsShort } from "../DatabaseServices/BoardLinesReactor"; import { BoardIsLong, BoardIsShort } from "../DatabaseServices/BoardLinesReactor";
import { LineAngularDimension } from "../DatabaseServices/Dimension/2LineAngularDimension"; import { LineAngularDimension } from "../DatabaseServices/Dimension/2LineAngularDimension";
@ -30,7 +30,7 @@ export class BoardFindModify implements Command
private isModifyHwMatrial = false; private isModifyHwMatrial = false;
async exec() async exec()
{ {
const store = BoardFindStore.GetInstance() as BoardFindStore; const store = BoardFindStore.GetInstance();
app.Editor.ModalManage.RenderModeless(BoardFindModifyModal, { store }); app.Editor.ModalManage.RenderModeless(BoardFindModifyModal, { store });
app.Editor.SelectCtrl.Cancel(); app.Editor.SelectCtrl.Cancel();

@ -16,7 +16,7 @@ export class CheckHoles implements Command
{ {
async exec() async exec()
{ {
const drillTool = DrawDrillingTool.GetInstance() as DrawDrillingTool; const drillTool = DrawDrillingTool.GetInstance();
let brRes = await app.Editor.GetSelection({ let brRes = await app.Editor.GetSelection({
Msg: "选择要检查排钻碰撞的板件", Msg: "选择要检查排钻碰撞的板件",
@ -160,7 +160,7 @@ export class CheckHoles implements Command
} }
private IsCollsion(boxlist: Box3Ext[][], boxlist2: Box3Ext[][]) private IsCollsion(boxlist: Box3Ext[][], boxlist2: Box3Ext[][])
{ {
const drillTool = DrawDrillingTool.GetInstance() as DrawDrillingTool; const drillTool = DrawDrillingTool.GetInstance();
for (let boxs of boxlist) for (let boxs of boxlist)
{ {

@ -30,7 +30,7 @@ export class CheckModeling implements Command
brs.push(...en.SplitBoards); brs.push(...en.SplitBoards);
} }
let feedingTool = FeedingToolPath.GetInstance() as FeedingToolPath; let feedingTool = FeedingToolPath.GetInstance();
let errGrooves: ExtrudeSolid[] = []; let errGrooves: ExtrudeSolid[] = [];
let errHoles: ExtrudeHole[] = []; let errHoles: ExtrudeHole[] = [];

@ -7,7 +7,7 @@ export class Command_Options implements Command
constructor(private selectedTabId: EOptionTabId) { } constructor(private selectedTabId: EOptionTabId) { }
async exec() async exec()
{ {
let OptionStore = ConfigStore.GetInstance() as ConfigStore; let OptionStore = ConfigStore.GetInstance();
app.Editor.ModalManage.RenderModal(ConfigDialog, { store: OptionStore, selectedTabId: this.selectedTabId }); app.Editor.ModalManage.RenderModal(ConfigDialog, { store: OptionStore, selectedTabId: this.selectedTabId });
} }
} }

@ -62,7 +62,7 @@ export class DrawClosingStrip implements Command
}); });
//store初始化 //store初始化
let store = ClosingStripStore.GetInstance() as ClosingStripStore; let store = ClosingStripStore.GetInstance();
store.GetBoardProcessOption(boards[0]);//设置房名和柜名(这个是个神奇的特性 默认使用周围板的板名和柜名) store.GetBoardProcessOption(boards[0]);//设置房名和柜名(这个是个神奇的特性 默认使用周围板的板名和柜名)
store.ChangeCabinetName();//修改柜名(柜名+收口条 有的用户不喜欢这个) store.ChangeCabinetName();//修改柜名(柜名+收口条 有的用户不喜欢这个)

@ -23,7 +23,7 @@ export class DrawDoor implements Command
let spaceParse = selectSpace.SpaceParse; let spaceParse = selectSpace.SpaceParse;
let size = spaceParse.Size; let size = spaceParse.Size;
let store = DoorStore.GetInstance() as DoorStore; let store = DoorStore.GetInstance();
if (spaceParse.Boards.length > 0) if (spaceParse.Boards.length > 0)
{ {
const surroundOption = spaceParse.Boards[0].BoardProcessOption; const surroundOption = spaceParse.Boards[0].BoardProcessOption;

@ -2,10 +2,10 @@ import { toJS } from "mobx";
import { Box3 } from "three"; import { Box3 } from "three";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList"; import { EBoardKeyList } from "../../Common/BoardKeyList";
import { safeEval } from "../../Common/eval";
import { Log, LogType } from "../../Common/Log"; import { Log, LogType } from "../../Common/Log";
import { DuplicateRecordCloning } from "../../Common/Status"; import { DuplicateRecordCloning } from "../../Common/Status";
import { FixedNotZero } from "../../Common/Utils"; import { FixedNotZero } from "../../Common/Utils";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board"; import { Board } from "../../DatabaseServices/Entity/Board";
import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity"; import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity";
import { HardwareTopline } from "../../DatabaseServices/Hardware/HardwareTopline"; import { HardwareTopline } from "../../DatabaseServices/Hardware/HardwareTopline";
@ -40,7 +40,7 @@ export class DrawDrawrer implements Command
let spaceParse = selectSpace.SpaceParse; let spaceParse = selectSpace.SpaceParse;
let size = spaceParse.Size; let size = spaceParse.Size;
let store = DrawerStore.GetInstance() as DrawerStore; let store = DrawerStore.GetInstance();
if (spaceParse.Boards.length > 0) if (spaceParse.Boards.length > 0)
store.m_Option.boardName = spaceParse.Boards[0].BoardProcessOption.cabinetName; store.m_Option.boardName = spaceParse.Boards[0].BoardProcessOption.cabinetName;
store.totalHeight = safeEval(FixedNotZero(size.z, 2)); store.totalHeight = safeEval(FixedNotZero(size.z, 2));

@ -13,7 +13,7 @@ import { JigUtils } from '../../Editor/JigUtils';
import { PromptPointResult, PromptStatus } from '../../Editor/PromptResult'; import { PromptPointResult, PromptStatus } from '../../Editor/PromptResult';
import { ParsePlaceEntitys } from '../../Editor/TranstrolControl/ParsePlaceEntitys'; import { ParsePlaceEntitys } from '../../Editor/TranstrolControl/ParsePlaceEntitys';
import { ParsePlacePos, ParsePlacePosWithTemplate, ParsePlacePosWithTemplate2 } from '../../Editor/TranstrolControl/ParsePlacePos'; import { ParsePlacePos, ParsePlacePosWithTemplate, ParsePlacePosWithTemplate2 } from '../../Editor/TranstrolControl/ParsePlacePos';
import { ZeroVec, equalv3 } from '../../Geometry/GeUtils'; import { equalv3, ZeroVec } from '../../Geometry/GeUtils';
import { PointSelectSpaceClamp } from '../../Geometry/SpaceParse/PointSelectSpaceClamp'; import { PointSelectSpaceClamp } from '../../Geometry/SpaceParse/PointSelectSpaceClamp';
import { BoardModal } from '../../UI/Components/Board/BoardModal'; import { BoardModal } from '../../UI/Components/Board/BoardModal';
import { BoardModalType } from "../../UI/Components/Board/BoardModalType"; import { BoardModalType } from "../../UI/Components/Board/BoardModalType";
@ -25,7 +25,7 @@ export class DrawLeftRight implements Command
{ {
async exec() async exec()
{ {
let store = SideBoardStore.GetInstance() as SideBoardStore; let store = SideBoardStore.GetInstance();
app.Editor.ModalManage.RenderModeless(BoardModal, { store, type: BoardModalType.LR, helpUrlName: CommandNames.LRBoard }); app.Editor.ModalManage.RenderModeless(BoardModal, { store, type: BoardModalType.LR, helpUrlName: CommandNames.LRBoard });
@ -41,7 +41,7 @@ export class DrawLeftRight implements Command
} }
private GetLRBoards() private GetLRBoards()
{ {
let store = SideBoardStore.GetInstance() as SideBoardStore; let store = SideBoardStore.GetInstance();
let data = store.m_Option; let data = store.m_Option;
let height = data.height; let height = data.height;
let width = data.width; let width = data.width;
@ -60,7 +60,7 @@ export class DrawLeftRight implements Command
} }
private InsertByPoint = async () => private InsertByPoint = async () =>
{ {
let store = SideBoardStore.GetInstance() as SideBoardStore; let store = SideBoardStore.GetInstance();
let data = store.m_Option; let data = store.m_Option;
let height = data.height; let height = data.height;
let width = data.width; let width = data.width;
@ -236,7 +236,7 @@ export class DrawLeftRight implements Command
Log("请选择有效板件", LogType.Error); Log("请选择有效板件", LogType.Error);
return; return;
} }
let store = SideBoardStore.GetInstance() as SideBoardStore; let store = SideBoardStore.GetInstance();
let data = store.m_Option; let data = store.m_Option;
let thickness = data.thickness; let thickness = data.thickness;

@ -14,7 +14,7 @@ export class DrawSingleBoard implements Command
{ {
async exec() async exec()
{ {
let store = SingleBoardStore.GetInstance() as SingleBoardStore; let store = SingleBoardStore.GetInstance();
app.Editor.ModalManage.RenderModeless(BoardModal, { store, type: BoardModalType.Sg, helpUrlName: CommandNames.SingleBoard }); app.Editor.ModalManage.RenderModeless(BoardModal, { store, type: BoardModalType.Sg, helpUrlName: CommandNames.SingleBoard });
app.Editor.ModalManage.SetCallback(async () => app.Editor.ModalManage.SetCallback(async () =>

@ -1,8 +1,8 @@
import { Matrix4 } from "three"; import { Matrix4 } from "three";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { safeEval } from "../../Common/eval";
import { LogType } from "../../Common/Log"; import { LogType } from "../../Common/Log";
import { FixedNotZero } from "../../Common/Utils"; import { FixedNotZero } from "../../Common/Utils";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board"; import { Board } from "../../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude"; import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
import { Command } from "../../Editor/CommandMachine"; import { Command } from "../../Editor/CommandMachine";
@ -21,7 +21,7 @@ export class DrawSpecialShapedBoard implements Command
if (useCurvesMap?.size) if (useCurvesMap?.size)
{ {
const store = SpecialShapeStore.GetInstance() as SpecialShapeStore; const store = SpecialShapeStore.GetInstance();
store.isMore = useCurvesMap.size > 1; store.isMore = useCurvesMap.size > 1;
if (store.isMore) if (store.isMore)

@ -17,7 +17,7 @@ export class DrawTopBottomBoard implements Command
{ {
async exec() async exec()
{ {
let store = TopBottomBoardStore.GetInstance() as TopBottomBoardStore; let store = TopBottomBoardStore.GetInstance();
app.Editor.ModalManage.RenderModal(BoardModal, { store, type: BoardModalType.TB, helpUrlName: CommandNames.TBBoard }); app.Editor.ModalManage.RenderModal(BoardModal, { store, type: BoardModalType.TB, helpUrlName: CommandNames.TBBoard });
let res = await app.Editor.ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();

@ -28,22 +28,22 @@ export class EditorBoardTemplate implements Command
if (template instanceof TemplateLayerBoard) if (template instanceof TemplateLayerBoard)
{ {
store = LayerBoardStore.GetInstance() as LayerBoardStore; store = LayerBoardStore.GetInstance();
type = BoardModalType.Ly; type = BoardModalType.Ly;
} }
else if (template instanceof TemplateVerticalBoard) else if (template instanceof TemplateVerticalBoard)
{ {
store = VerticalBoardStore.GetInstance() as VerticalBoardStore; store = VerticalBoardStore.GetInstance();
type = BoardModalType.Ve; type = BoardModalType.Ve;
} }
else if (template instanceof TemplateBehindBoard) else if (template instanceof TemplateBehindBoard)
{ {
store = BehindBoardStore.GetInstance() as BehindBoardStore; store = BehindBoardStore.GetInstance();
type = BoardModalType.Be; type = BoardModalType.Be;
} }
else if (template instanceof TemplateLeftRightBoardRecord) else if (template instanceof TemplateLeftRightBoardRecord)
{ {
store = SideBoardStore.GetInstance() as SideBoardStore; store = SideBoardStore.GetInstance();
type = BoardModalType.LR; type = BoardModalType.LR;
config = { config = {
option: { option: {
@ -58,7 +58,7 @@ export class EditorBoardTemplate implements Command
} }
else if (template instanceof TemplateTopBottomBoard) else if (template instanceof TemplateTopBottomBoard)
{ {
store = TopBottomBoardStore.GetInstance() as TopBottomBoardStore; store = TopBottomBoardStore.GetInstance();
type = BoardModalType.TB; type = BoardModalType.TB;
config = { config = {
topBoardData: template.TopOption, topBoardData: template.TopOption,

@ -19,7 +19,7 @@ export class CheckDrawHole implements Command
let brs = ssRes.SelectSet.SelectEntityList as Board[]; let brs = ssRes.SelectSet.SelectEntityList as Board[];
let tool = DrawDrillingTool.GetInstance() as DrawDrillingTool; let tool = DrawDrillingTool.GetInstance();
let result = await tool.Check(brs.slice(0, 2)); let result = await tool.Check(brs.slice(0, 2));
ShowLinesToaster(result.length === 0 ? ["没检查出无法排钻原因"] : result, { ShowLinesToaster(result.length === 0 ? ["没检查出无法排钻原因"] : result, {

@ -1,10 +1,10 @@
import { Command } from "../../Editor/CommandMachine";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { CylinderHole, GangDrillType } from "../../DatabaseServices/3DSolid/CylinderHole";
import { Hole } from "../../DatabaseServices/3DSolid/Hole";
import { Board } from "../../DatabaseServices/Entity/Board"; import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult"; import { PromptStatus } from "../../Editor/PromptResult";
import { DrawDrillingTool } from "./DrawDrillingTool"; import { DrawDrillingTool } from "./DrawDrillingTool";
import { CylinderHole, GangDrillType } from "../../DatabaseServices/3DSolid/CylinderHole";
import { Hole } from "../../DatabaseServices/3DSolid/Hole";
enum EDeleteDrillType enum EDeleteDrillType
{ {
@ -80,7 +80,7 @@ export class DeleteDrill implements Command
} }
return; return;
case EDeleteDrillType.Face: case EDeleteDrillType.Face:
(DrawDrillingTool.GetInstance() as DrawDrillingTool).ClearExitDrilling(ens as Board[]); DrawDrillingTool.GetInstance().ClearExitDrilling(ens as Board[]);
return; return;
case EDeleteDrillType.Nail: case EDeleteDrillType.Nail:
for (let b of ens as Board[]) for (let b of ens as Board[])

@ -20,7 +20,7 @@ export class DrawDrilling implements Command
let ens = brsRes.SelectSet.SelectEntityList as Board[]; let ens = brsRes.SelectSet.SelectEntityList as Board[];
const tool = DrawDrillingTool.GetInstance() as DrawDrillingTool; const tool = DrawDrillingTool.GetInstance();
await tool.ClassifyAndDrilling(ens); await tool.ClassifyAndDrilling(ens);
} }

@ -1128,7 +1128,7 @@ export class DrawDrillingTool extends Singleton
private async GetSpliteBoards(brs: Board[]) private async GetSpliteBoards(brs: Board[])
{ {
//进度条 //进度条
let down = DownPanelStore.GetInstance() as DownPanelStore; let down = DownPanelStore.GetInstance();
down.StartProgress("分裂:"); down.StartProgress("分裂:");
let brList: Board[] = []; let brList: Board[] = [];

@ -7,7 +7,7 @@ export class DrillConfig implements Command
{ {
async exec() async exec()
{ {
let store = DrillStore.GetInstance() as DrillStore; let store = DrillStore.GetInstance();
app.Editor.ModalManage.RenderModal(DrillModal, { store }); app.Editor.ModalManage.RenderModal(DrillModal, { store });
} }
} }

@ -148,7 +148,7 @@ export class DrillingReactor
brs.add(br); brs.add(br);
} }
const tool = DrawDrillingTool.GetInstance() as DrawDrillingTool; const tool = DrawDrillingTool.GetInstance();
await tool.ClassifyAndDrilling(brs); await tool.ClassifyAndDrilling(brs);
for (let br of brs) for (let br of brs)

@ -42,7 +42,7 @@ export class DrawText implements Command
return; return;
angle = aRes.Distance; angle = aRes.Distance;
} }
let text = TextArea.GetInstance() as TextArea; let text = TextArea.GetInstance();
text.StartDrawText(startPoint, height, angle, ""); text.StartDrawText(startPoint, height, angle, "");
await text.Wait(); await text.Wait();
} }

@ -25,7 +25,7 @@ import { HideEntityText } from "./Viewport/OneKeyLayout";
async function GetViewportInfo(): Promise<{ p1: Vector3; p2: Vector3; ens: Entity[]; }> async function GetViewportInfo(): Promise<{ p1: Vector3; p2: Vector3; ens: Entity[]; }>
{ {
const downStore = (DownPanelStore.GetInstance() as DownPanelStore); const downStore = DownPanelStore.GetInstance();
let bak = downStore.isLayout; let bak = downStore.isLayout;
downStore.isLayout = false; downStore.isLayout = false;
const SelectEns = async () => const SelectEns = async () =>

@ -7,7 +7,7 @@ export class ConfigureWineRack implements Command
{ {
async exec() async exec()
{ {
let store = WineRackStore.GetInstance() as WineRackStore; let store = WineRackStore.GetInstance();
app.Editor.ModalManage.RenderModal(WineRackModal, { store }); app.Editor.ModalManage.RenderModal(WineRackModal, { store });
} }
} }

@ -12,7 +12,7 @@ export class EditorWineRack implements Command
let editorTemp = await SelectTempate("选择要编辑的酒格", t => t instanceof TemplateWineRackRecord) as TemplateWineRackRecord; let editorTemp = await SelectTempate("选择要编辑的酒格", t => t instanceof TemplateWineRackRecord) as TemplateWineRackRecord;
if (!editorTemp) return; if (!editorTemp) return;
const store = WineRackStore.GetInstance() as WineRackStore; const store = WineRackStore.GetInstance();
store.EditorTemplate = editorTemp; store.EditorTemplate = editorTemp;
store.UpdateOption({ option: editorTemp.Option }); store.UpdateOption({ option: editorTemp.Option });
app.Editor.ModalManage.RenderModal(WineRackModal, { store }); app.Editor.ModalManage.RenderModal(WineRackModal, { store });

@ -36,7 +36,7 @@ export class Polyline2Winerack implements Command
let plss = this.Classify(pllist.filter(c => c.IsClose)); let plss = this.Classify(pllist.filter(c => c.IsClose));
let tool = Rect2WinerackTool.GetInstance() as Rect2WinerackTool; let tool = Rect2WinerackTool.GetInstance();
let ucsInv = new Matrix4().getInverse(app.Editor.UCSMatrix); let ucsInv = new Matrix4().getInverse(app.Editor.UCSMatrix);

@ -51,7 +51,7 @@ export class ShoWYouHua implements Command
{ {
async exec() async exec()
{ {
let store = BoardStore.GetInstance() as BoardStore; let store = BoardStore.GetInstance();
let routeInfo: ErpRouteInfo = GetRouteInfo(ErpRoutes.); let routeInfo: ErpRouteInfo = GetRouteInfo(ErpRoutes.);
app.Editor.ModalManage.RenderModal(ErpView, { app.Editor.ModalManage.RenderModal(ErpView, {
erpRoute: routeInfo, erpRoute: routeInfo,
@ -198,7 +198,7 @@ async function ExecChaiDan(chaiDanRoute: ErpRoutes)
}); });
} }
let store = BoardStore.GetInstance() as BoardStore; let store = BoardStore.GetInstance();
if (userConfig.isMaster == false && userConfig.rights.includes('377') == false) if (userConfig.isMaster == false && userConfig.rights.includes('377') == false)
{ {
AppToaster.show({ AppToaster.show({
@ -350,7 +350,7 @@ async function DecomposeObject()
{ {
let selction = await GetProductsEntitys(); let selction = await GetProductsEntitys();
if (!selction) return; if (!selction) return;
let store = BoardStore.GetInstance() as BoardStore; let store = BoardStore.GetInstance();
let routeInfo: ErpRouteInfo; let routeInfo: ErpRouteInfo;
routeInfo = GetRouteInfo(ErpRoutes.); routeInfo = GetRouteInfo(ErpRoutes.);
let parseData = new ErpParseData().DecomposeObject(selction.metalsList); let parseData = new ErpParseData().DecomposeObject(selction.metalsList);

@ -20,7 +20,7 @@ export class Command_OpenHistory implements Command
NoHistory = true; NoHistory = true;
async exec() async exec()
{ {
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
if (!fileServer.m_CurFileId) if (!fileServer.m_CurFileId)
Log("无法获得当前文件的id", LogType.Warning); Log("无法获得当前文件的id", LogType.Warning);

@ -27,7 +27,7 @@ export class OperLogs implements Command
async exec() async exec()
{ {
let fid = (FileServer.GetInstance() as FileServer).m_CurFileId; let fid = FileServer.GetInstance().m_CurFileId;
if (!fid) if (!fid)
{ {
AppToaster.show({ AppToaster.show({

@ -29,7 +29,7 @@ export class Command_Insert implements Command
export async function InsertDocument(fid: string) export async function InsertDocument(fid: string)
{ {
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
let fileData = await fileServer.GetFileInfo(fid); let fileData = await fileServer.GetFileInfo(fid);
@ -48,7 +48,7 @@ export async function InsertDatabase(db: Database)
{ {
if (db.ModelSpace.Entitys.length > 0 || db.Lights.Entitys.length > 0) if (db.ModelSpace.Entitys.length > 0 || db.Lights.Entitys.length > 0)
{ {
const down = DownPanelStore.GetInstance() as DownPanelStore; const down = DownPanelStore.GetInstance();
let box = new Box3; let box = new Box3;
let ens = db.ModelSpace.Entitys as Entity[]; let ens = db.ModelSpace.Entitys as Entity[];

@ -14,7 +14,7 @@ export class DrawLattice implements Command
{ {
async exec() async exec()
{ {
const store = LatticeDrawerStore.GetInstance() as LatticeDrawerStore; const store = LatticeDrawerStore.GetInstance();
app.Editor.ModalManage.RenderModal(LatticeDrawer, { store }); app.Editor.ModalManage.RenderModal(LatticeDrawer, { store });
let res = await app.Editor.ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();

@ -25,7 +25,7 @@ export class EditorLattice implements Command
let brs = brRes.SelectSet.SelectEntityList as Board[]; let brs = brRes.SelectSet.SelectEntityList as Board[];
let editorTemp = brs[0].Template.Object as TemplateLatticeRecord; let editorTemp = brs[0].Template.Object as TemplateLatticeRecord;
const store = LatticeDrawerStore.GetInstance() as LatticeDrawerStore; const store = LatticeDrawerStore.GetInstance();
store.EditorTemplate = editorTemp; store.EditorTemplate = editorTemp;
store.UpdateOption({ option: editorTemp.Option }); store.UpdateOption({ option: editorTemp.Option });
app.Editor.ModalManage.RenderModal(LatticeDrawer, { store }); app.Editor.ModalManage.RenderModal(LatticeDrawer, { store });

@ -9,6 +9,6 @@ export class Open implements Command
TopPanelStore.GetInstance().m_FileManageOpen = true; TopPanelStore.GetInstance().m_FileManageOpen = true;
// let fid = localStorage.getItem(StoreageKeys.LastOpenFileId); // let fid = localStorage.getItem(StoreageKeys.LastOpenFileId);
// if (fid) // if (fid)
// (FileServer.GetInstance() as FileServer).OpenFile(fid); // (FileServer.GetInstance()).OpenFile(fid);
} }
} }

@ -22,7 +22,7 @@ export class ReOpen implements Command
return; return;
} }
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
if (fileServer.m_CurFileId) if (fileServer.m_CurFileId)
{ {
let id = fileServer.m_CurFileId; let id = fileServer.m_CurFileId;
@ -33,7 +33,7 @@ export class ReOpen implements Command
{ {
let fid = localStorage.getItem(StoreageKeys.LastOpenFileId); let fid = localStorage.getItem(StoreageKeys.LastOpenFileId);
if (fid) if (fid)
(FileServer.GetInstance() as FileServer).OpenFile(fid); FileServer.GetInstance().OpenFile(fid);
} }
} }
} }

@ -33,7 +33,7 @@ export class RotateLayerBoard implements Command
private errBr: number = 0; private errBr: number = 0;
async exec() async exec()
{ {
let store = RotateLayerBoardStore.GetInstance() as RotateLayerBoardStore; let store = RotateLayerBoardStore.GetInstance();
app.Editor.ModalManage.RenderModal(RotateLayerBoardModal, { store }); app.Editor.ModalManage.RenderModal(RotateLayerBoardModal, { store });
let res = await app.Editor.ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();

@ -69,7 +69,7 @@ export class Save implements Command
AppToaster.dismiss("vp"); AppToaster.dismiss("vp");
//文件未命名和选中保存目录 //文件未命名和选中保存目录
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
//如果文件从未保存过,那么让用户选一个保存位置 //如果文件从未保存过,那么让用户选一个保存位置
if (!fileServer.currentFileInfo.name || (!fileServer.m_CurFileId && !fileServer.currentFileInfo.dir?.id)) if (!fileServer.currentFileInfo.name || (!fileServer.m_CurFileId && !fileServer.currentFileInfo.dir?.id))
@ -203,7 +203,7 @@ export class New implements Command
NoHistory = true; NoHistory = true;
async exec() async exec()
{ {
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
server._CurrentFilePath = ""; server._CurrentFilePath = "";
await server.AddNewFile(); await server.AddNewFile();
} }
@ -224,7 +224,7 @@ export class SaveAs implements Command
return; return;
} }
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
app.Editor.ModalManage.RenderModal(SaveAsModal, { currentName: fileServer.currentFileInfo.name }, { position: ModalPosition.Top }); app.Editor.ModalManage.RenderModal(SaveAsModal, { currentName: fileServer.currentFileInfo.name }, { position: ModalPosition.Top });
let res = await app.Editor.ModalManage.Wait(); let res = await app.Editor.ModalManage.Wait();
@ -265,7 +265,7 @@ export class SaveToLocal implements Command
NoHistory = true; NoHistory = true;
async exec() async exec()
{ {
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
let fileStr = app.FileOut().ToString(); let fileStr = app.FileOut().ToString();
//帮用户把文件下载下来 //帮用户把文件下载下来
FS.WriteFile( FS.WriteFile(
@ -356,7 +356,7 @@ export class SaveToDxf implements Command
dxf.modelSpace.addEntity(dxfEntity); dxf.modelSpace.addEntity(dxfEntity);
} }
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
FS.WriteFile( FS.WriteFile(
`${fileServer.currentFileInfo.name || "未命名"}.dxf`, `${fileServer.currentFileInfo.name || "未命名"}.dxf`,
dxf.stringify() dxf.stringify()
@ -377,7 +377,7 @@ export function UploadFileHistory(fileDataStr?: string)
fileDataStr = deflate(JSON.stringify(fileData)); fileDataStr = deflate(JSON.stringify(fileData));
} }
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
let fileId = fileServer.m_CurFileId; let fileId = fileServer.m_CurFileId;
let userName = localStorage.getItem(StoreageKeys.UserName); let userName = localStorage.getItem(StoreageKeys.UserName);

@ -27,7 +27,7 @@ export const SendFile = async () =>
{ {
let resV = await res.json(); let resV = await res.json();
let fileid = resV.file_id; let fileid = resV.file_id;
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
window["easemobim"] && window["easemobim"].sendExt({ window["easemobim"] && window["easemobim"].sendExt({
ext: { ext: {

@ -94,7 +94,7 @@ export class Command_ShareView implements Command
const props = JSON.stringify({ showBom: store.m_Option.showBom }); const props = JSON.stringify({ showBom: store.m_Option.showBom });
const formData = new FormData(); const formData = new FormData();
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
formData.append("name", fileServer.currentFileInfo.name); formData.append("name", fileServer.currentFileInfo.name);
formData.append("logo", GetCurrentViewPreViewImage(), "cover.jpg"); formData.append("logo", GetCurrentViewPreViewImage(), "cover.jpg");
formData.append("file", deflate(f.ToString())); formData.append("file", deflate(f.ToString()));

@ -78,7 +78,7 @@ export class ShareViewLayout
ToasterShowEntityMsgInjectFunctions.push(__AppToasterShowEntityMsg); ToasterShowEntityMsgInjectFunctions.push(__AppToasterShowEntityMsg);
// let fileServer = FileServer.GetInstance() as FileServer; // let fileServer = FileServer.GetInstance();
// ReportFunctionList.push(async (msg: string) => // ReportFunctionList.push(async (msg: string) =>
// { // {
// if (!fileServer.m_CurFileId) // if (!fileServer.m_CurFileId)

@ -97,7 +97,7 @@ export class ShareViewService extends ApplicationService
originUpdateSelectEvent.call(this.Editor.SelectCtrl); // 单选显示标注 originUpdateSelectEvent.call(this.Editor.SelectCtrl); // 单选显示标注
}); });
DbClickManager.GetInstance().OnDbClick = () => { }; DbClickManager.GetInstance().OnDbClick = async () => { };
DownPanelStore.GetInstance().posEl = document.createElement("div"); DownPanelStore.GetInstance().posEl = document.createElement("div");
// 屏蔽编辑交互 // 屏蔽编辑交互
this.Editor.UcsServices.Visible = false; // 移除坐标系显示 this.Editor.UcsServices.Visible = false; // 移除坐标系显示

@ -9,7 +9,7 @@ export class Command_ShowProcessingGroupModal implements Command
NoHistory = true;//呼出时,我们没有任何的操作记录 NoHistory = true;//呼出时,我们没有任何的操作记录
async exec() async exec()
{ {
let store = ProcessingGroupModalStore.GetInstance() as ProcessingGroupModalStore; let store = ProcessingGroupModalStore.GetInstance();
let config = await userConfigStore.GetConfig(BoardModalType.ProcessGroupCategory); let config = await userConfigStore.GetConfig(BoardModalType.ProcessGroupCategory);
if (!config) if (!config)
{ {

@ -24,7 +24,7 @@ export class Stretch implements Command
let changeRendertypeEns: Entity[]; let changeRendertypeEns: Entity[];
let olducs: Matrix4; let olducs: Matrix4;
let cameraBak = new CADFiler(); let cameraBak = new CADFiler();
let viewBtnTitle = (CameraControlBtnStore.GetInstance() as CameraControlBtnStore).ViewBtnTitle; let viewBtnTitle = CameraControlBtnStore.GetInstance().ViewBtnTitle;
if (this.useSelectFilter) if (this.useSelectFilter)
{ {
app.Viewer.CameraCtrl.WriteFile(cameraBak); app.Viewer.CameraCtrl.WriteFile(cameraBak);
@ -171,7 +171,7 @@ export class Stretch implements Command
app.Editor.UCSMatrix = olducs; app.Editor.UCSMatrix = olducs;
cameraBak.Reset(); cameraBak.Reset();
app.Viewer.CameraCtrl.ReadFile(cameraBak); app.Viewer.CameraCtrl.ReadFile(cameraBak);
(CameraControlBtnStore.GetInstance() as CameraControlBtnStore).ViewBtnTitle = viewBtnTitle; CameraControlBtnStore.GetInstance().ViewBtnTitle = viewBtnTitle;
if (changeRendertypeEns) if (changeRendertypeEns)
{ {
for (let e of changeRendertypeEns) for (let e of changeRendertypeEns)

@ -9,7 +9,7 @@ export class ShowTemplate implements Command
constructor(private type: "Administration" | "Collection", private tag?: ITempTagProps) { } constructor(private type: "Administration" | "Collection", private tag?: ITempTagProps) { }
async exec() async exec()
{ {
let store = TempalteEditorStore.GetInstance() as TempalteEditorStore; let store = TempalteEditorStore.GetInstance();
app.Editor.ModalManage.RenderModeless(TemplateManage, { store, currentTag: this.tag, type: this.type }); app.Editor.ModalManage.RenderModeless(TemplateManage, { store, currentTag: this.tag, type: this.type });
} }
} }

@ -37,7 +37,7 @@ export class ShowTemplateDesign implements Command
let template = await InitTemplate(ents); let template = await InitTemplate(ents);
if (!template) return; if (!template) return;
let store = TempalteEditorStore.GetInstance() as TempalteEditorStore; let store = TempalteEditorStore.GetInstance();
template.Name = template.Name || "模板"; template.Name = template.Name || "模板";
store.Template = template; store.Template = template;
store.InitParams(); store.InitParams();

@ -4,7 +4,7 @@ export class Command_ToggleUI
{ {
async exec() async exec()
{ {
let store = DownPanelStore.GetInstance() as DownPanelStore; let store = DownPanelStore.GetInstance();
if (store.isSmallScreen) if (store.isSmallScreen)
store.isTopToolBarShowMin = !store.isTopToolBarShowMin; store.isTopToolBarShowMin = !store.isTopToolBarShowMin;
else else

@ -18,7 +18,7 @@ export class UpdateEntityDrawTask
async UpdateDraw(ens: Entity[]) async UpdateDraw(ens: Entity[])
{ {
let down = DownPanelStore.GetInstance() as DownPanelStore; let down = DownPanelStore.GetInstance();
down.StartProgress("渲染:"); down.StartProgress("渲染:");
let i = 0; let i = 0;

@ -48,7 +48,7 @@ export class EditViewport implements Command
await userConfigStore.UpdateBoardOption(this.store.configName, BoardModalType.EditViewSetting, this.store); await userConfigStore.UpdateBoardOption(this.store.configName, BoardModalType.EditViewSetting, this.store);
} }
const downStore = (DownPanelStore.GetInstance() as DownPanelStore); const downStore = DownPanelStore.GetInstance();
downStore.isLayout = true;; downStore.isLayout = true;;
let ssRes = await app.Editor.GetSelection({ let ssRes = await app.Editor.GetSelection({

@ -442,7 +442,7 @@ export class OneKeyLayout implements Command
i++; i++;
} }
const down = DownPanelStore.GetInstance() as DownPanelStore; const down = DownPanelStore.GetInstance();
down.progress = 0.1; down.progress = 0.1;
for (let index = 0; index < vps.length; index++) for (let index = 0; index < vps.length; index++)
{ {

@ -25,7 +25,7 @@ export class Command_Wblock implements Command
for (let en of cloneEns) for (let en of cloneEns)
en.ApplyMatrix(moveM); en.ApplyMatrix(moveM);
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
let f = newDb.FileWrite().Data; let f = newDb.FileWrite().Data;

@ -58,7 +58,7 @@ export class Interfere implements Command
} }
//进度条 //进度条
let down = DownPanelStore.GetInstance() as DownPanelStore; let down = DownPanelStore.GetInstance();
down.progress = 0.1; down.progress = 0.1;
AppToaster.show({ AppToaster.show({

@ -42,7 +42,7 @@ export class Command_Curve2Polyline implements Command
async exec() async exec()
{ {
let store = Curve2RecModalStore.GetInstance() as Curve2RecModalStore; let store = Curve2RecModalStore.GetInstance();
app.Editor.ModalManage.RenderModal(Curve2RecModal, { store: store }); app.Editor.ModalManage.RenderModal(Curve2RecModal, { store: store });
app.Editor.ModalManage.SetCallback(async () => app.Editor.ModalManage.SetCallback(async () =>
{ {

@ -35,7 +35,7 @@ export class ParseBoardName extends Component<IParseBoardProps>
["knifeRadius", "刀半径"], ["knifeRadius", "刀半径"],
["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"] ["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"]
]; ];
rec2BrStore = Rec2BrStore.GetInstance() as Rec2BrStore; rec2BrStore = Rec2BrStore.GetInstance();
render() render()
{ {
const store = this.props.store; const store = this.props.store;

@ -36,7 +36,7 @@ const MaxBoardDistance = 200;//左右侧板,顶底板距离边缘的最大距离
@HotCMD @HotCMD
export class Polyline2Board implements Command export class Polyline2Board implements Command
{ {
store = Rec2BrStore.GetInstance() as Rec2BrStore; store = Rec2BrStore.GetInstance();
SpaceOCS: Matrix4; SpaceOCS: Matrix4;
SpaceOCSInv: Matrix4; SpaceOCSInv: Matrix4;
async exec() async exec()

@ -136,7 +136,7 @@ export class R2BConfigComponent extends React.Component<IR2BConfigComponentProps
onClick={async () => onClick={async () =>
{ {
let modal = app.Editor.ModalManage.CurrentModal; let modal = app.Editor.ModalManage.CurrentModal;
let tempalteStore = TempalteEditorStore.GetInstance() as TempalteEditorStore; let tempalteStore = TempalteEditorStore.GetInstance();
app.Editor.ModalManage.RenderModeless(TemplateManage, { tempalteStore, R2bReplace: { isR2bReplace: true } }); app.Editor.ModalManage.RenderModeless(TemplateManage, { tempalteStore, R2bReplace: { isR2bReplace: true } });
let state = await app.Editor.ModalManage.Wait(); let state = await app.Editor.ModalManage.Wait();

@ -485,7 +485,7 @@ export class ApplicationService
CreateDocument(name: string = "新文件") CreateDocument(name: string = "新文件")
{ {
this.Viewer.ViewPorts.length = 0; this.Viewer.ViewPorts.length = 0;
(DownPanelStore.GetInstance() as DownPanelStore).isLayout = false; DownPanelStore.GetInstance().isLayout = false;
this.Database.FileRead(new Database(true).FileWrite()); this.Database.FileRead(new Database(true).FileWrite());

@ -56,7 +56,7 @@ export async function ReportError(stack: any, msg: string = "未捕获的错误!
let userName = localStorage.getItem(StoreageKeys.UserName); let userName = localStorage.getItem(StoreageKeys.UserName);
let userPhone = localStorage.getItem(StoreageKeys.UserPhone); let userPhone = localStorage.getItem(StoreageKeys.UserPhone);
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
let lastFileKey = fileServer.m_CurFileId; let lastFileKey = fileServer.m_CurFileId;
await fetch("https://cf.qcad.cc:25111/logs/error", { await fetch("https://cf.qcad.cc:25111/logs/error", {

@ -2,6 +2,20 @@
let instanceMap = new Map(); let instanceMap = new Map();
export interface PrototypeType<T> extends Function
{
prototype: T;
}
export interface ConstructorFunctionType<T = any> extends PrototypeType<T>
{
new(...args: any[]): T;
}
export type ConstructorType<T = unknown, Static extends Record<string, any> = PrototypeType<T>> = (ConstructorFunctionType<T> | PrototypeType<T>) & {
[Key in keyof Static]: Static[Key];
};
/** /**
* . * .
* # Example: * # Example:
@ -13,8 +27,8 @@ export class Singleton
{ {
protected constructor() { } protected constructor() { }
//FIXME: https://github.com/Microsoft/TypeScript/issues/5863 //ref:https://github.com/Microsoft/TypeScript/issues/5863
static GetInstance<T = any>(): T static GetInstance<T extends Singleton>(this: ConstructorType<T, typeof Singleton>): T
{ {
if (instanceMap.has(this)) if (instanceMap.has(this))
return instanceMap.get(this); return instanceMap.get(this);

@ -45,7 +45,7 @@ export class TemplateLatticeRecord extends TemplateRecord
if (thickness) if (thickness)
this.option.thickness = thickness; this.option.thickness = thickness;
let tool = DrawLatticeDrawerTool.GetInstance() as DrawLatticeDrawerTool; let tool = DrawLatticeDrawerTool.GetInstance();
let sbrs = this.PositioningSupportBoards; let sbrs = this.PositioningSupportBoards;
let space = new ISpaceParse(sbrs, this._CacheSpaceCS); let space = new ISpaceParse(sbrs, this._CacheSpaceCS);

@ -45,9 +45,9 @@ export class TemplateWineRackRecord extends TemplateRecord
let wineRack: DrawWineRackTool; let wineRack: DrawWineRackTool;
if (this.option.type === EWineRackType.Oblique) if (this.option.type === EWineRackType.Oblique)
wineRack = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool; wineRack = DrawObliqueWineRackTool.GetInstance();
else else
wineRack = DrawUprightWineRackTool.GetInstance() as DrawUprightWineRackTool; wineRack = DrawUprightWineRackTool.GetInstance();
let sbrs = this.PositioningSupportBoards; let sbrs = this.PositioningSupportBoards;
let space = new ISpaceParse(sbrs, this._CacheSpaceCS); let space = new ISpaceParse(sbrs, this._CacheSpaceCS);

@ -4,15 +4,15 @@ import { ExtendsbrThick2 } from "../../Add-on/DrawBoard/BuildBoardTool";
import { IsHinge } from "../../Add-on/HideSelect/HideSelectUtils"; import { IsHinge } from "../../Add-on/HideSelect/HideSelectUtils";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { arrayRemoveOnce } from "../../Common/ArrayExt"; import { arrayRemoveOnce } from "../../Common/ArrayExt";
import { CheckExpr, safeEval } from "../../Common/eval";
import { TemplateUrls } from "../../Common/HostUrl"; import { TemplateUrls } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { Log, LogType } from "../../Common/Log"; import { Log, LogType } from "../../Common/Log";
import { PostJson, RequestStatus } from "../../Common/Request"; import { PostJson, RequestStatus } from "../../Common/Request";
import { GetEntitysLogo, TemplateIn, TemplateOut, TemplateParamsOut, deflate } from "../../Common/SerializeMaterial"; import { deflate, GetEntitysLogo, TemplateIn, TemplateOut, TemplateParamsOut } from "../../Common/SerializeMaterial";
import { DuplicateRecordCloning } from "../../Common/Status"; import { DuplicateRecordCloning } from "../../Common/Status";
import { StretchParse } from "../../Common/StretchParse"; import { StretchParse } from "../../Common/StretchParse";
import { FixedNotZero } from "../../Common/Utils"; import { FixedNotZero } from "../../Common/Utils";
import { CheckExpr, safeEval } from "../../Common/eval";
import { inflateBase64 } from "../../Common/inflate";
import { CommandWrap } from "../../Editor/CommandMachine"; import { CommandWrap } from "../../Editor/CommandMachine";
import { Jig } from "../../Editor/Jig"; import { Jig } from "../../Editor/Jig";
import { PromptStatus } from "../../Editor/PromptResult"; import { PromptStatus } from "../../Editor/PromptResult";
@ -21,7 +21,7 @@ import { SelectPick } from "../../Editor/SelectPick";
import { AxisSnapMode } from "../../Editor/SnapServices"; import { AxisSnapMode } from "../../Editor/SnapServices";
import { TempEditor } from "../../Editor/TempEditor"; import { TempEditor } from "../../Editor/TempEditor";
import { Box3Ext } from "../../Geometry/Box"; import { Box3Ext } from "../../Geometry/Box";
import { AsVector3, ZAxis, ZeroVec, equaln, isParallelTo, isPerpendicularityTo } from "../../Geometry/GeUtils"; import { AsVector3, equaln, isParallelTo, isPerpendicularityTo, ZAxis, ZeroVec } from "../../Geometry/GeUtils";
import { ClampSpaceParse } from "../../Geometry/SpaceParse/ClampSpaceParse"; import { ClampSpaceParse } from "../../Geometry/SpaceParse/ClampSpaceParse";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse"; import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { IGetRoomInfo } from "../../UI/Components/Template/GetRoomCabName"; import { IGetRoomInfo } from "../../UI/Components/Template/GetRoomCabName";
@ -1143,7 +1143,7 @@ export async function EditorOnlineTemplate(template: TemplateRecord, module_id:
await CommandWrap(async () => await CommandWrap(async () =>
{ {
template = app.Database.WblockCloneObejcts([template], app.Database.TemplateTable, new Map(), DuplicateRecordCloning.Ignore)[0] as TemplateRecord; template = app.Database.WblockCloneObejcts([template], app.Database.TemplateTable, new Map(), DuplicateRecordCloning.Ignore)[0] as TemplateRecord;
const store = TempalteEditorStore.GetInstance() as TempalteEditorStore; const store = TempalteEditorStore.GetInstance();
store.Template = template; store.Template = template;
store.InitParams(); store.InitParams();
app.Editor.ModalManage.DestoryAll(); app.Editor.ModalManage.DestoryAll();

@ -50,7 +50,7 @@ export class TextArea extends Singleton
if (text) if (text)
{ {
if (text instanceof Text) if (text instanceof Text)
(DownPanelStore.GetInstance() as DownPanelStore).fontName = text._FontName; DownPanelStore.GetInstance().fontName = text._FontName;
document.getElementById('Webgl').parentNode.appendChild(this._AreaContiner); document.getElementById('Webgl').parentNode.appendChild(this._AreaContiner);
textObj.visible = false; textObj.visible = false;
app.Editor.UpdateScreen(); app.Editor.UpdateScreen();
@ -184,7 +184,7 @@ export class TextArea extends Singleton
if (this._EditoringObject) if (this._EditoringObject)
{ {
let t = GetEntity(this._EditoringObject) as Text; let t = GetEntity(this._EditoringObject) as Text;
let f = FontLoader.GetLoader((DownPanelStore.GetInstance() as DownPanelStore).fontName); let f = FontLoader.GetLoader(DownPanelStore.GetInstance().fontName);
f.LoadGlyphs(el.innerText); f.LoadGlyphs(el.innerText);
await f.AwaitLoaded(); await f.AwaitLoaded();
t.TextString = el.innerText; t.TextString = el.innerText;
@ -209,7 +209,7 @@ export class TextArea extends Singleton
async EndEditor() async EndEditor()
{ {
this.ClearEvent(); this.ClearEvent();
let f = FontLoader.GetLoader((DownPanelStore.GetInstance() as DownPanelStore).fontName); let f = FontLoader.GetLoader(DownPanelStore.GetInstance().fontName);
for (let [el, pos] of this._EditorElList) for (let [el, pos] of this._EditorElList)
{ {
f.LoadGlyphs(el.innerText); f.LoadGlyphs(el.innerText);

@ -20,7 +20,7 @@ export class ViewportEntityUpdateTask
{ {
console.time(this.timeId.toString()); console.time(this.timeId.toString());
let down = DownPanelStore.GetInstance() as DownPanelStore; let down = DownPanelStore.GetInstance();
down.StartProgress("视口:"); down.StartProgress("视口:");
let i = 0; let i = 0;

@ -91,7 +91,7 @@ export class AutoSaveServer
async SavaData(data: any[]) async SavaData(data: any[])
{ {
const indexDbStore = await IndexedDbStore.CADStore(); const indexDbStore = await IndexedDbStore.CADStore();
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
const uid = localStorage.getItem(StoreageKeys.Uid); const uid = localStorage.getItem(StoreageKeys.Uid);
if (uid) if (uid)
{ {

@ -135,7 +135,7 @@ export class DbClickManager extends Singleton
} }
else if (pickEnt instanceof Text || pickEnt instanceof RoomRegion) else if (pickEnt instanceof Text || pickEnt instanceof RoomRegion)
{ {
let textarea = TextArea.GetInstance() as TextArea; let textarea = TextArea.GetInstance();
CommandWrap(async () => CommandWrap(async () =>
{ {
textarea.StartEditorText(pickObj); textarea.StartEditorText(pickObj);
@ -144,7 +144,7 @@ export class DbClickManager extends Singleton
} }
else if (pickEnt instanceof Board) else if (pickEnt instanceof Board)
{ {
let rightStore = RightPanelStore.GetInstance() as RightPanelStore; let rightStore = RightPanelStore.GetInstance();
if (!(rightStore.m_TabId === RightTabId.BoardProps && rightStore.m_IsShow)) if (!(rightStore.m_TabId === RightTabId.BoardProps && rightStore.m_IsShow))
app.Editor.ModalManage.RenderModeless( app.Editor.ModalManage.RenderModeless(
BoardOptionModal, BoardOptionModal,
@ -155,12 +155,12 @@ export class DbClickManager extends Singleton
{ {
CommandWrap(async () => CommandWrap(async () =>
{ {
await DBClickPolyline.GetInstance().HandlePolyline(pickEnt); await DBClickPolyline.GetInstance().HandlePolyline(pickEnt as Polyline);
}, "_pedit"); }, "_pedit");
} }
else if (pickEnt instanceof AlignedDimension || pickEnt instanceof LineAngularDimension || pickEnt instanceof RadiusDimension || pickEnt instanceof ArcDimension) else if (pickEnt instanceof AlignedDimension || pickEnt instanceof LineAngularDimension || pickEnt instanceof RadiusDimension || pickEnt instanceof ArcDimension)
{ {
let textarea = TextArea.GetInstance() as TextArea; let textarea = TextArea.GetInstance();
if (pickObj.children.length > 0) if (pickObj.children.length > 0)
CommandWrap(async () => CommandWrap(async () =>
{ {
@ -226,7 +226,7 @@ export class DbClickManager extends Singleton
}); });
let index = dists.indexOf(Math.min(...dists)) % 3; let index = dists.indexOf(Math.min(...dists)) % 3;
let rightStore = RightPanelStore.GetInstance() as RightPanelStore; let rightStore = RightPanelStore.GetInstance();
rightStore.m_TabId = RightTabId.TemplateParam; rightStore.m_TabId = RightTabId.TemplateParam;
rightStore.m_IsShow = true; rightStore.m_IsShow = true;
rightStore.templateParamInputFocus(description[index]); rightStore.templateParamInputFocus(description[index]);
@ -294,7 +294,7 @@ export class DbClickManager extends Singleton
} }
else if (pickEnt instanceof RoomBase) else if (pickEnt instanceof RoomBase)
{ {
let rightStore = RightPanelStore.GetInstance() as RightPanelStore; let rightStore = RightPanelStore.GetInstance();
rightStore.m_IsShow = true; rightStore.m_IsShow = true;
rightStore.m_TabId = RightTabId.ModuelParams; rightStore.m_TabId = RightTabId.ModuelParams;
return; return;

@ -32,7 +32,7 @@ export class LightsMenu extends React.Component<{ GetLightType: (ent: Entity) =>
} }
RenderMenu = () => RenderMenu = () =>
{ {
const downStore = DownPanelStore.GetInstance() as DownPanelStore; const downStore = DownPanelStore.GetInstance();
return ( return (
<Menu <Menu
className="snapMenu-fixed" className="snapMenu-fixed"

@ -39,7 +39,7 @@ export class SnapMenuFixed extends React.Component<{}>
} }
RenderMenu = () => RenderMenu = () =>
{ {
const downStore = DownPanelStore.GetInstance() as DownPanelStore; const downStore = DownPanelStore.GetInstance();
return ( return (
<Menu <Menu
className="snapMenu-fixed" className="snapMenu-fixed"
@ -79,7 +79,7 @@ export class SnapMenuFixed extends React.Component<{}>
private close = () => private close = () =>
{ {
let store = DownPanelStore.GetInstance() as DownPanelStore; let store = DownPanelStore.GetInstance();
store.Upload(); store.Upload();
}; };
} }

@ -661,7 +661,7 @@ export class Viewer
// console.time("开图渲染"); // console.time("开图渲染");
Entity.__ReadFileIng__ = true; Entity.__ReadFileIng__ = true;
const down = DownPanelStore.GetInstance() as DownPanelStore; const down = DownPanelStore.GetInstance();
let i = 0; let i = 0;
down.progress = 0.1; down.progress = 0.1;
let brs: Board[] = []; let brs: Board[] = [];
@ -729,7 +729,7 @@ export class Viewer
{ {
UpdateWallParse(); UpdateWallParse();
const down = DownPanelStore.GetInstance() as DownPanelStore; const down = DownPanelStore.GetInstance();
Entity.__ReadFileIng__ = true; Entity.__ReadFileIng__ = true;
let i = 0; let i = 0;
let space = 50; let space = 50;
@ -848,7 +848,7 @@ export class Viewer
async UpdateRenderType(db: Database, type: RenderType) async UpdateRenderType(db: Database, type: RenderType)
{ {
let i = 0; let i = 0;
let down = DownPanelStore.GetInstance() as DownPanelStore; let down = DownPanelStore.GetInstance();
down.progress = 0.1; down.progress = 0.1;
for (let index = 0; index < db.ModelSpace.Entitys.length; index++) for (let index = 0; index < db.ModelSpace.Entitys.length; index++)

@ -303,7 +303,7 @@ export namespace Production
} }
export function GetBoardModelingData(br: Board, offsetTanslation: Vector3) export function GetBoardModelingData(br: Board, offsetTanslation: Vector3)
{ {
const tool = FeedingToolPath.GetInstance() as FeedingToolPath; const tool = FeedingToolPath.GetInstance();
const tMtx = MoveMatrix(offsetTanslation.clone().negate()); const tMtx = MoveMatrix(offsetTanslation.clone().negate());
const getModelings = (ms: IModeling[], isSide: boolean): IModelingData[] => const getModelings = (ms: IModeling[], isSide: boolean): IModelingData[] =>
{ {
@ -1004,7 +1004,7 @@ export namespace Production
{ {
const { thickness, boardContour, dir, addLen, addWidth, addDepth, knifeRadius, brThickness } = data; const { thickness, boardContour, dir, addLen, addWidth, addDepth, knifeRadius, brThickness } = data;
let brContour = Data2Polyline(boardContour); let brContour = Data2Polyline(boardContour);
const tool = FeedingToolPath.GetInstance() as FeedingToolPath; const tool = FeedingToolPath.GetInstance();
const outline = Contour.CreateContour(Data2Polyline(data.outline)); const outline = Contour.CreateContour(Data2Polyline(data.outline));
const holes = data.holes.map(h => Contour.CreateContour(Data2Polyline(h))); const holes = data.holes.map(h => Contour.CreateContour(Data2Polyline(h)));
let shape = new Shape(outline, holes); let shape = new Shape(outline, holes);

@ -41,7 +41,7 @@ async function UpdateRelevanceGroove(ents: CADObject[])
} }
//进度条 //进度条
let down = DownPanelStore.GetInstance() as DownPanelStore; let down = DownPanelStore.GetInstance();
down.StartProgress("更新:"); down.StartProgress("更新:");
let allCount = needUpdateBoardSet.size; let allCount = needUpdateBoardSet.size;

@ -12,11 +12,11 @@ import { app } from "../../../ApplicationServices/Application";
import { arrayRemove } from "../../../Common/ArrayExt"; import { arrayRemove } from "../../../Common/ArrayExt";
import { EBoardKeyList } from "../../../Common/BoardKeyList"; import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { CheckObjectType, CheckoutValid } from "../../../Common/CheckoutVaildValue"; import { CheckObjectType, CheckoutValid } from "../../../Common/CheckoutVaildValue";
import { safeEval } from "../../../Common/eval";
import { FS } from "../../../Common/FileSystem"; import { FS } from "../../../Common/FileSystem";
import { KeyBoard } from "../../../Common/KeyEnum"; import { KeyBoard } from "../../../Common/KeyEnum";
import { Log, LogType } from "../../../Common/Log"; import { Log, LogType } from "../../../Common/Log";
import { FixedNotZero } from "../../../Common/Utils"; import { FixedNotZero } from "../../../Common/Utils";
import { safeEval } from "../../../Common/eval";
import { CylinderHole } from "../../../DatabaseServices/3DSolid/CylinderHole"; import { CylinderHole } from "../../../DatabaseServices/3DSolid/CylinderHole";
import { CommandHistoryRecord } from "../../../DatabaseServices/CommandHistoryRecord"; import { CommandHistoryRecord } from "../../../DatabaseServices/CommandHistoryRecord";
import { CreateObjectData } from "../../../DatabaseServices/CreateObjectData"; import { CreateObjectData } from "../../../DatabaseServices/CreateObjectData";
@ -34,7 +34,7 @@ import { SelectSetBase } from "../../../Editor/SelectBase";
import { userConfig } from "../../../Editor/UserConfig"; import { userConfig } from "../../../Editor/UserConfig";
import { equaln } from "../../../Geometry/GeUtils"; import { equaln } from "../../../Geometry/GeUtils";
import { IHardwareType } from "../../../Production/Product"; import { IHardwareType } from "../../../Production/Product";
import { TotalTabbarTitlesInfos, bbsEditorStore } from "../../Store/BBSEditorStore"; import { bbsEditorStore, TotalTabbarTitlesInfos } from "../../Store/BBSEditorStore";
import { EFindType } from "../../Store/BoardFindInterface"; import { EFindType } from "../../Store/BoardFindInterface";
import { ComposingType, FaceDirection, LinesType } from "../../Store/BoardInterface"; import { ComposingType, FaceDirection, LinesType } from "../../Store/BoardInterface";
import { userConfigStore } from "../../Store/UserConfigStore"; import { userConfigStore } from "../../Store/UserConfigStore";
@ -884,7 +884,7 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
HandleExportCSV = () => HandleExportCSV = () =>
{ {
this.ConvertBoardListDataToArray(); this.ConvertBoardListDataToArray();
let fileServer = FileServer.GetInstance() as FileServer; let fileServer = FileServer.GetInstance();
let str = ""; let str = "";
for (let data of this.boardDataInArray) for (let data of this.boardDataInArray)
{ {

@ -680,7 +680,7 @@ export class DrillTypeSelectCom extends React.Component<IDrillTypeSelect, { isDa
} }
app.Editor.ModalManage.DestoryAll(); app.Editor.ModalManage.DestoryAll();
let store = RightPanelStore.GetInstance() as RightPanelStore; let store = RightPanelStore.GetInstance();
store.m_IsShow = true; store.m_IsShow = true;
store.m_TabId = RightTabId.Drill; store.m_TabId = RightTabId.Drill;
store.drillingStore.StartEditor([br]); store.drillingStore.StartEditor([br]);

@ -25,7 +25,7 @@ import { PromptStatus } from "../../../Editor/PromptResult";
import { SelectBox, SelectType } from "../../../Editor/SelectBox"; import { SelectBox, SelectType } from "../../../Editor/SelectBox";
import { CreateContours } from "../../../Geometry/CreateContour2"; import { CreateContours } from "../../../Geometry/CreateContour2";
import { ContourTreeNode } from "../../../Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2"; import { ContourTreeNode } from "../../../Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2";
import { AsVector2, MoveMatrix, equaln, isParallelTo } from "../../../Geometry/GeUtils"; import { AsVector2, equaln, isParallelTo, MoveMatrix } from "../../../Geometry/GeUtils";
import { BoardConfigOption, BoardProcessOption, FaceDirection, IGrooveOption, IUiOption } from '../../Store/BoardInterface'; import { BoardConfigOption, BoardProcessOption, FaceDirection, IGrooveOption, IUiOption } from '../../Store/BoardInterface';
import { RightPanelStore } from "../../Store/RightPanelStore/RightPanelStore"; import { RightPanelStore } from "../../Store/RightPanelStore/RightPanelStore";
import { RightTabId } from "../RightPanel/RightPanel"; import { RightTabId } from "../RightPanel/RightPanel";
@ -334,7 +334,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
let cu = JigUtils.Draw(br.ContourCurve.Clone().ApplyMatrix(br.OCS)); let cu = JigUtils.Draw(br.ContourCurve.Clone().ApplyMatrix(br.OCS));
let moveCus: Curve[] = [cu]; let moveCus: Curve[] = [cu];
let store = RightPanelStore.GetInstance() as RightPanelStore; let store = RightPanelStore.GetInstance();
//载入配置,设置配置 //载入配置,设置配置
let config = new DialogUserConfig(store.modeling2Store, BoardModalType.ZX2); let config = new DialogUserConfig(store.modeling2Store, BoardModalType.ZX2);
@ -394,7 +394,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
TempEditor.Start(); TempEditor.Start();
app.Database.hm.lockIndex++;//禁止初始化动作被撤销 app.Database.hm.lockIndex++;//禁止初始化动作被撤销
const store = RightPanelStore.GetInstance() as RightPanelStore; const store = RightPanelStore.GetInstance();
//载入配置,设置配置 //载入配置,设置配置
let config = new DialogUserConfig(store.modeling3Store, BoardModalType.ZX3); let config = new DialogUserConfig(store.modeling3Store, BoardModalType.ZX3);
@ -500,7 +500,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
box.expandByVector(new Vector3(1, 1, 1)); box.expandByVector(new Vector3(1, 1, 1));
let selectBox = new SelectBox(app.Viewer, AsVector2(box.min), AsVector2(box.max), SelectType.C); let selectBox = new SelectBox(app.Viewer, AsVector2(box.min), AsVector2(box.max), SelectType.C);
const rightStore = RightPanelStore.GetInstance() as RightPanelStore; const rightStore = RightPanelStore.GetInstance();
let contourMap = new Map<number, Contour[]>(); let contourMap = new Map<number, Contour[]>();
@ -589,7 +589,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
app.Viewer.WorldToScreen(box.max); app.Viewer.WorldToScreen(box.max);
let selectBox = new SelectBox(app.Viewer, AsVector2(box.min), AsVector2(box.max), SelectType.C); let selectBox = new SelectBox(app.Viewer, AsVector2(box.min), AsVector2(box.max), SelectType.C);
const rightStore = RightPanelStore.GetInstance() as RightPanelStore; const rightStore = RightPanelStore.GetInstance();
let pathMap = new Map<number, Polyline[]>(); let pathMap = new Map<number, Polyline[]>();
@ -648,7 +648,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
if (contourMap.size > 0) if (contourMap.size > 0)
{ {
let br = this.props.br; let br = this.props.br;
const rightStore = RightPanelStore.GetInstance() as RightPanelStore; const rightStore = RightPanelStore.GetInstance();
for (let [color, contours] of contourMap) for (let [color, contours] of contourMap)
{ {
@ -700,7 +700,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
if (contourMap.size > 0) if (contourMap.size > 0)
{ {
let br = this.props.br; let br = this.props.br;
const rightStore = RightPanelStore.GetInstance() as RightPanelStore; const rightStore = RightPanelStore.GetInstance();
br.ClearModeling2DList(); br.ClearModeling2DList();
let modelings: I2DModeling[] = []; let modelings: I2DModeling[] = [];
for (let [color, contours] of contourMap) for (let [color, contours] of contourMap)
@ -747,7 +747,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
await app.Editor.ModalManage.EndExecingCmd(); await app.Editor.ModalManage.EndExecingCmd();
const store = (RightPanelStore.GetInstance() as RightPanelStore).modeling3Store; const store = RightPanelStore.GetInstance().modeling3Store;
let curvesMap = new Map<number, (Line | Arc)[]>(); let curvesMap = new Map<number, (Line | Arc)[]>();
for (let o of app.Viewer.Scene.children) for (let o of app.Viewer.Scene.children)

@ -57,7 +57,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
return; return;
} }
app.Editor.ModalManage.Destory(); app.Editor.ModalManage.Destory();
let store = RightPanelStore.GetInstance() as RightPanelStore; let store = RightPanelStore.GetInstance();
//提前载入封边配置 //提前载入封边配置
store.sealingStore.isNotUpdateStore = true;//禁止UI再次更新配置 store.sealingStore.isNotUpdateStore = true;//禁止UI再次更新配置
let config = new DialogUserConfig(store.sealingStore, BoardModalType.Sealing); let config = new DialogUserConfig(store.sealingStore, BoardModalType.Sealing);

@ -214,7 +214,7 @@ export class CameraControlBtn extends React.Component<{}, {}>
/> />
)} )}
{ {
!(DownPanelStore.GetInstance() as DownPanelStore).isLayout && !DownPanelStore.GetInstance().isLayout &&
<> <>
{VisualStyleData2.map( {VisualStyleData2.map(
(data) => (data) =>
@ -252,7 +252,7 @@ export class CameraControlBtn extends React.Component<{}, {}>
/> />
} }
{ {
(DownPanelStore.GetInstance() as DownPanelStore).isLayout && DownPanelStore.GetInstance().isLayout &&
<Button <Button
minimal minimal
className="btn-style" className="btn-style"
@ -280,7 +280,7 @@ export class CameraControlBtn extends React.Component<{}, {}>
RenderControlsMenu = () => RenderControlsMenu = () =>
{ {
let downStore = DownPanelStore.GetInstance() as DownPanelStore; let downStore = DownPanelStore.GetInstance();
return ( return (
<Menu <Menu
className="controlsMenu-fixed" className="controlsMenu-fixed"
@ -388,7 +388,7 @@ export class CameraControlBtn extends React.Component<{}, {}>
) )
} }
{ {
!(DownPanelStore.GetInstance() as DownPanelStore).isLayout ? !DownPanelStore.GetInstance().isLayout ?
<> <>
{VisualStyleData2.map( {VisualStyleData2.map(
(data) => (data) =>

@ -62,7 +62,7 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
//设置最后一次的滚动条位置 //设置最后一次的滚动条位置
async UseLastScrollTop() async UseLastScrollTop()
{ {
let cserver = CommandServer.GetInstance() as CommandServer; let cserver = CommandServer.GetInstance();
let last = await cserver.GetLastScrollTop(); let last = await cserver.GetLastScrollTop();
if (last && this.scrollCard !== null) if (last && this.scrollCard !== null)
this.scrollCard.scrollTop = last; this.scrollCard.scrollTop = last;
@ -204,7 +204,7 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
className="bp3-card bp3-elevation-0" className="bp3-card bp3-elevation-0"
onScroll={async () => onScroll={async () =>
{ {
let cserver = CommandServer.GetInstance() as CommandServer; let cserver = CommandServer.GetInstance();
let stop = this.scrollCard.scrollTop; let stop = this.scrollCard.scrollTop;
let lastVisId: string;//最后一个可见的tabId let lastVisId: string;//最后一个可见的tabId
for (let i = 0; i < this.state.tabArr.length; i++) for (let i = 0; i < this.state.tabArr.length; i++)

@ -28,7 +28,7 @@ export class ContentComponent extends React.Component<{ store?: TopPanelStore; }
//添加新文件 //添加新文件
handleAddNewFile = async () => handleAddNewFile = async () =>
{ {
await (FileServer.GetInstance() as FileServer).AddNewFile(); await FileServer.GetInstance().AddNewFile();
this.props.store.openMain = false; this.props.store.openMain = false;
this.props.store.editoring = true; this.props.store.editoring = true;
}; };
@ -41,7 +41,7 @@ export class ContentComponent extends React.Component<{ store?: TopPanelStore; }
} }
this.props.store.openMain = false; this.props.store.openMain = false;
this.props.store.editoring = true; this.props.store.editoring = true;
await (FileServer.GetInstance() as FileServer).OpenFile(file.file_id, file.path); await FileServer.GetInstance().OpenFile(file.file_id, file.path);
}; };
private StartDesign = () => private StartDesign = () =>

@ -109,7 +109,7 @@ export default class Login extends React.Component<{ store?: TopPanelStore; }, I
if (status) if (status)
{ {
app.Saved = true; app.Saved = true;
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
await server.AddNewFile(); await server.AddNewFile();
} }
else return; else return;

@ -72,7 +72,7 @@ export class MainContent extends React.Component<{ store?: TopPanelStore; }>
let fid = localStorage.getItem(StoreageKeys.LastOpenFileId); let fid = localStorage.getItem(StoreageKeys.LastOpenFileId);
if (fid) if (fid)
{ {
(FileServer.GetInstance() as FileServer).OpenFile(fid); FileServer.GetInstance().OpenFile(fid);
StartEditor(); StartEditor();
} }
} }

@ -210,7 +210,7 @@ export class ConfigDialog extends React.Component<{ store: ConfigStore; selected
} }
getFileName = async () => getFileName = async () =>
{ {
let fserver = FileServer.GetInstance() as FileServer; let fserver = FileServer.GetInstance();
if (fserver.m_CurFileId) if (fserver.m_CurFileId)
this._curFileTitle = fserver.currentFileInfo.name; this._curFileTitle = fserver.currentFileInfo.name;
else else

@ -15,7 +15,7 @@ import { Light } from '../../DatabaseServices/Lights/Light';
import { PointLight } from '../../DatabaseServices/Lights/PointLight'; import { PointLight } from '../../DatabaseServices/Lights/PointLight';
import { RectAreaLight } from '../../DatabaseServices/Lights/RectAreaLight'; import { RectAreaLight } from '../../DatabaseServices/Lights/RectAreaLight';
import { SpotLight } from '../../DatabaseServices/Lights/SpotLight'; import { SpotLight } from '../../DatabaseServices/Lights/SpotLight';
import { CommandWrap, commandMachine } from '../../Editor/CommandMachine'; import { commandMachine, CommandWrap } from '../../Editor/CommandMachine';
import { CommandState } from '../../Editor/CommandState'; import { CommandState } from '../../Editor/CommandState';
import { LightsMenu } from '../../Editor/LightsMenu'; import { LightsMenu } from '../../Editor/LightsMenu';
import { SnapMenuFixed } from '../../Editor/SnapMenuFixed'; import { SnapMenuFixed } from '../../Editor/SnapMenuFixed';
@ -57,7 +57,7 @@ declare const version: string;
@observer @observer
export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}> export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}>
{ {
private topStore = DownPanelStore.GetInstance() as DownPanelStore; private topStore = DownPanelStore.GetInstance();
state: TopPanelState; state: TopPanelState;
constructor(props) constructor(props)
{ {
@ -102,7 +102,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}>
let data = await Post(SignUrl.loginOut); let data = await Post(SignUrl.loginOut);
if (data.err_code === RequestStatus.Ok) if (data.err_code === RequestStatus.Ok)
{ {
(DownPanelStore.GetInstance() as DownPanelStore).isLayout = false; DownPanelStore.GetInstance().isLayout = false;
userConfigStore.ClearUserData(); userConfigStore.ClearUserData();
} }
}; };
@ -249,7 +249,7 @@ export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}>
{ {
@observable showHideSyncEnable = false; //显隐同步显示 @observable showHideSyncEnable = false; //显隐同步显示
rStore: RightPanelStore = RightPanelStore.GetInstance(); rStore: RightPanelStore = RightPanelStore.GetInstance();
private downStore = DownPanelStore.GetInstance() as DownPanelStore; private downStore = DownPanelStore.GetInstance();
private handleChange = async (e: React.FormEvent<HTMLInputElement>) => private handleChange = async (e: React.FormEvent<HTMLInputElement>) =>
{ {
let key = e.currentTarget.getAttribute("data-key"); let key = e.currentTarget.getAttribute("data-key");
@ -354,7 +354,7 @@ export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}>
{ {
userConfig.lightHelper = !userConfig.lightHelper; userConfig.lightHelper = !userConfig.lightHelper;
Light.DefaultShowHelpr = userConfig.lightHelper; Light.DefaultShowHelpr = userConfig.lightHelper;
const downStore = DownPanelStore.GetInstance() as DownPanelStore; const downStore = DownPanelStore.GetInstance();
let Lights: string[] = []; let Lights: string[] = [];
for (let light of downStore.lightsData) for (let light of downStore.lightsData)
{ {

@ -34,8 +34,8 @@ export class MetalPanel extends React.Component<IMetalPanelProps> {
onChange={e => { this.tabId = e; }} onChange={e => { this.tabId = e; }}
renderActiveTabPanelOnly renderActiveTabPanelOnly
> >
{/* <Tab className="tab-unstyle" id={MatalTabId.Cy} title="圆柱体" panel={<CylinderMatalPanel store={CylinderMetalsStore.GetInstance() as CylinderMetalsStore} />} /> */} {/* <Tab className="tab-unstyle" id={MatalTabId.Cy} title="圆柱体" panel={<CylinderMatalPanel store={CylinderMetalsStore.GetInstance()} />} /> */}
{/* <Tab className="tab-unstyle" id={MatalTabId.Ext} title="拉伸实体" panel={<ExtrudeMatalPanel store={ExtrudeMetalsStore.GetInstance() as ExtrudeMetalsStore} />} /> */} {/* <Tab className="tab-unstyle" id={MatalTabId.Ext} title="拉伸实体" panel={<ExtrudeMatalPanel store={ExtrudeMetalsStore.GetInstance()} />} /> */}
<Tab className="tab-unstyle" id={MetalTabId.Com} title="复合实体" panel={<CompositeMatalPanel store={compositeMetalsStore} />} /> <Tab className="tab-unstyle" id={MetalTabId.Com} title="复合实体" panel={<CompositeMatalPanel store={compositeMetalsStore} />} />
</ Tabs> </ Tabs>
</> </>

@ -163,7 +163,7 @@ export class TemplateParamPanel extends React.Component<{}, {}>
text="编辑模块" text="编辑模块"
onClick={() => onClick={() =>
{ {
let store = TempalteEditorStore.GetInstance() as TempalteEditorStore; let store = TempalteEditorStore.GetInstance();
store.Template = curTemp; store.Template = curTemp;
store.InitParams(); store.InitParams();
app.Editor.ModalManage.RenderModeless(TemplateEditor, { store }); app.Editor.ModalManage.RenderModeless(TemplateEditor, { store });

@ -36,12 +36,12 @@ export class FileList extends React.Component<IFileListProps, {}> {
handleOpenFile = async (file: IFileInfo) => handleOpenFile = async (file: IFileInfo) =>
{ {
this.props.store.m_FileManageOpen = false; this.props.store.m_FileManageOpen = false;
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
await server.OpenFile(file.file_id, this.props.currentDir.path); await server.OpenFile(file.file_id, this.props.currentDir.path);
}; };
// private handleDownloadFile = async (fid: string) => // private handleDownloadFile = async (fid: string) =>
// { // {
// let server = FileServer.GetInstance() as FileServer; // let server = FileServer.GetInstance();
// await server.Download(fid); // await server.Download(fid);
// }; // };
private showContextMenu = (e: React.MouseEvent<HTMLElement>, data) => private showContextMenu = (e: React.MouseEvent<HTMLElement>, data) =>

@ -33,7 +33,7 @@ export class FilePanel extends React.Component<Props, {}>
{ {
if (!app.Saved && !confirm("您当前图纸还未保存,是否放弃保存?")) if (!app.Saved && !confirm("您当前图纸还未保存,是否放弃保存?"))
return false; return false;
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
server.Clear(); server.Clear();
server._CurrentFilePath = currentDir.path; server._CurrentFilePath = currentDir.path;
Object.assign(server.currentFileInfo, { Object.assign(server.currentFileInfo, {
@ -46,7 +46,7 @@ export class FilePanel extends React.Component<Props, {}>
//输入文件名称 选择目录 -> 保存 //输入文件名称 选择目录 -> 保存
handleFile = async (name: string, currentDir: IDirectoryProps, callBack: () => void) => handleFile = async (name: string, currentDir: IDirectoryProps, callBack: () => void) =>
{ {
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
if (this.currentFileInfo.fid) if (this.currentFileInfo.fid)
{ {
if (name !== this.currentFileInfo.name) if (name !== this.currentFileInfo.name)
@ -69,7 +69,7 @@ export class FilePanel extends React.Component<Props, {}>
handleMutDown = async () => handleMutDown = async () =>
{ {
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
let data = this.commonPanel.selectIds; let data = this.commonPanel.selectIds;
if (data.size === 0) if (data.size === 0)
{ {
@ -86,7 +86,7 @@ export class FilePanel extends React.Component<Props, {}>
}; };
handleDelete = (data: { file_ids: string[]; }) => handleDelete = (data: { file_ids: string[]; }) =>
{ {
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
if (data.file_ids.includes(server.m_CurFileId) && this.commonPanel) if (data.file_ids.includes(server.m_CurFileId) && this.commonPanel)
this.handleAddNewFile("新文件", this.commonPanel.currentDir); this.handleAddNewFile("新文件", this.commonPanel.currentDir);
let lastFileId = localStorage.getItem(StoreageKeys.LastOpenFileId); let lastFileId = localStorage.getItem(StoreageKeys.LastOpenFileId);

@ -27,7 +27,7 @@ export class HistoryList extends React.Component<HistoryListProps, {}> {
handleOpenFile = async (file: IFileInfo) => handleOpenFile = async (file: IFileInfo) =>
{ {
this.props.store.m_FileManageOpen = false; this.props.store.m_FileManageOpen = false;
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
await server.OpenFile(file.file_id, file.path); await server.OpenFile(file.file_id, file.path);
}; };
private showContextMenu = (e: React.MouseEvent<HTMLElement>, data) => private showContextMenu = (e: React.MouseEvent<HTMLElement>, data) =>

@ -72,7 +72,7 @@ export class ImportFile extends React.Component<{ commonPanel: CommonPanel, type
} }
else else
{ {
let fserver = FileServer.GetInstance() as FileServer; let fserver = FileServer.GetInstance();
await fserver.UploadFile({ await fserver.UploadFile({
dir_id, dir_id,
name: f.name.replace(".json", ""), name: f.name.replace(".json", ""),

@ -18,13 +18,13 @@ import { JigUtils } from "../../../Editor/JigUtils";
import { PromptStatus } from "../../../Editor/PromptResult"; import { PromptStatus } from "../../../Editor/PromptResult";
import { ParsePlaceEntitys } from "../../../Editor/TranstrolControl/ParsePlaceEntitys"; import { ParsePlaceEntitys } from "../../../Editor/TranstrolControl/ParsePlaceEntitys";
import { ParsePlacePos, ParsePlacePosWithTemplate, ParsePlacePosWithTemplate2 } from "../../../Editor/TranstrolControl/ParsePlacePos"; import { ParsePlacePos, ParsePlacePosWithTemplate, ParsePlacePosWithTemplate2 } from "../../../Editor/TranstrolControl/ParsePlacePos";
import { ZeroVec, equaln, equalv3 } from "../../../Geometry/GeUtils"; import { equaln, equalv3, ZeroVec } from "../../../Geometry/GeUtils";
import { DownPanelStore } from "../../Store/DownPanelStore"; import { DownPanelStore } from "../../Store/DownPanelStore";
import { IGetRoomInfo } from "./GetRoomCabName"; import { IGetRoomInfo } from "./GetRoomCabName";
export async function InsertTemplateByBasePoint(template: TemplateRecord, roomInfo?: IGetRoomInfo, isOnce = false) export async function InsertTemplateByBasePoint(template: TemplateRecord, roomInfo?: IGetRoomInfo, isOnce = false)
{ {
const down = DownPanelStore.GetInstance() as DownPanelStore; const down = DownPanelStore.GetInstance();
let ens = template.Db.ModelSpace.Entitys as Entity[]; let ens = template.Db.ModelSpace.Entitys as Entity[];
ens = ens.concat(template.Db.Lights.Entitys.filter(l => l.Id.Index > 99)); ens = ens.concat(template.Db.Lights.Entitys.filter(l => l.Id.Index > 99));

@ -8,12 +8,12 @@ import { ITempTagProps, templateTagCommand } from '../../../Add-on/Template/Temp
import { R2bReplaceProps } from '../../../Add-on/twoD2threeD/R2bConfigComponent'; import { R2bReplaceProps } from '../../../Add-on/twoD2threeD/R2bConfigComponent';
import { app } from '../../../ApplicationServices/Application'; import { app } from '../../../ApplicationServices/Application';
import { EBoardKeyList } from '../../../Common/BoardKeyList'; import { EBoardKeyList } from '../../../Common/BoardKeyList';
import { safeEval } from '../../../Common/eval';
import { TemplateUrls } from '../../../Common/HostUrl'; import { TemplateUrls } from '../../../Common/HostUrl';
import { LogType } from '../../../Common/Log'; import { LogType } from '../../../Common/Log';
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request'; import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
import { DuplicateRecordCloning } from '../../../Common/Status'; import { DuplicateRecordCloning } from '../../../Common/Status';
import { StoreageKeys } from '../../../Common/StoreageKeys'; import { StoreageKeys } from '../../../Common/StoreageKeys';
import { safeEval } from '../../../Common/eval';
import { CADObject } from '../../../DatabaseServices/CADObject'; import { CADObject } from '../../../DatabaseServices/CADObject';
import { Board } from '../../../DatabaseServices/Entity/Board'; import { Board } from '../../../DatabaseServices/Entity/Board';
import { Entity } from '../../../DatabaseServices/Entity/Entity'; import { Entity } from '../../../DatabaseServices/Entity/Entity';
@ -160,7 +160,7 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
}; };
handleMutDown = async () => handleMutDown = async () =>
{ {
let server = FileServer.GetInstance() as FileServer; let server = FileServer.GetInstance();
let data = this.commonPanel.current.selectIds; let data = this.commonPanel.current.selectIds;
if (data.size === 0) if (data.size === 0)
{ {

@ -61,7 +61,7 @@ export class TemplateDetail extends React.Component<ITemplateDetailProps> {
}; };
private renderHandleConfig = () => private renderHandleConfig = () =>
{ {
const store = DoorStore.GetInstance() as DoorStore; const store = DoorStore.GetInstance();
return ( return (
<div style={{ textAlign: "left" }}> <div style={{ textAlign: "left" }}>
<Divider /> <Divider />
@ -135,7 +135,7 @@ export class TemplateDetail extends React.Component<ITemplateDetailProps> {
}; };
private renderHingeConfigs = () => private renderHingeConfigs = () =>
{ {
const store = HingeStore.GetInstance() as HingeStore; const store = HingeStore.GetInstance();
return ( return (
<div style={{ textAlign: "left" }}> <div style={{ textAlign: "left" }}>
<Divider /> <Divider />
@ -153,7 +153,7 @@ export class TemplateDetail extends React.Component<ITemplateDetailProps> {
{ {
let disabledKeys = this.props.disableKeys || []; let disabledKeys = this.props.disableKeys || [];
const store = DoorStore.GetInstance() as DoorStore; const store = DoorStore.GetInstance();
return ( return (
<div className={"template-detail " + (this.props.className ?? "")} style={this.props.style}> <div className={"template-detail " + (this.props.className ?? "")} style={this.props.style}>

@ -19,7 +19,7 @@ export class TemplateDrawHandleTool
{ {
AddHandleToDoor = async (door: Board | HardwareCompositeEntity, handleTemp: TemplateRecord) => AddHandleToDoor = async (door: Board | HardwareCompositeEntity, handleTemp: TemplateRecord) =>
{ {
const doorStore = DoorStore.GetInstance() as DoorStore; const doorStore = DoorStore.GetInstance();
const isAuto = doorStore.byOpenDir; const isAuto = doorStore.byOpenDir;
let doorTr = door.Template?.Object as TemplateRecord; let doorTr = door.Template?.Object as TemplateRecord;

@ -89,7 +89,7 @@ export class TemplateDrawHingeTool
let tempSpace = (door.Template.Object as TemplateRecord).Parent.Object as TemplateRecord; let tempSpace = (door.Template.Object as TemplateRecord).Parent.Object as TemplateRecord;
const isLROpen = [BoardOpenDir.Left, BoardOpenDir.Right].includes(openDir); const isLROpen = [BoardOpenDir.Left, BoardOpenDir.Right].includes(openDir);
const hingestore = HingeStore.GetInstance() as HingeStore; const hingestore = HingeStore.GetInstance();
let count = hingestore.m_Option.hingeCount; let count = hingestore.m_Option.hingeCount;
let jlsjExpr = hingestore.m_Option.hindeTopDist.toString(); let jlsjExpr = hingestore.m_Option.hindeTopDist.toString();

@ -29,9 +29,4 @@ export class PropertiesStore extends EntityStore
autorun(UpdateEntityMap); autorun(UpdateEntityMap);
} }
static GetInstance(): PropertiesStore
{
return super.GetInstance() as PropertiesStore;
}
} }

@ -6,14 +6,14 @@ import React, { RefObject } from "react";
import { Object3D } from "three"; import { Object3D } from "three";
import { end } from "xaop"; import { end } from "xaop";
import { app } from "../../../ApplicationServices/Application"; import { app } from "../../../ApplicationServices/Application";
import { safeEval } from "../../../Common/eval";
import { KeyBoard, KeyCode } from "../../../Common/KeyEnum"; import { KeyBoard, KeyCode } from "../../../Common/KeyEnum";
import { LogType } from "../../../Common/Log"; import { LogType } from "../../../Common/Log";
import { clamp } from "../../../Common/Utils"; import { clamp } from "../../../Common/Utils";
import { safeEval } from "../../../Common/eval";
import { DimStyleKeyCode } from "../../../DatabaseServices/DimStyle/DimstyleKeyCodeEnum";
import { AlignedDimension } from "../../../DatabaseServices/Dimension/AlignedDimension"; import { AlignedDimension } from "../../../DatabaseServices/Dimension/AlignedDimension";
import { Dimension } from "../../../DatabaseServices/Dimension/Dimension"; import { Dimension } from "../../../DatabaseServices/Dimension/Dimension";
import { CommandWrap, commandMachine } from "../../../Editor/CommandMachine"; import { DimStyleKeyCode } from "../../../DatabaseServices/DimStyle/DimstyleKeyCodeEnum";
import { commandMachine, CommandWrap } from "../../../Editor/CommandMachine";
import { CommandState } from "../../../Editor/CommandState"; import { CommandState } from "../../../Editor/CommandState";
import { AppToaster } from "../Toaster"; import { AppToaster } from "../Toaster";
import { DimParamsPanel } from "./DimParamsPanel"; import { DimParamsPanel } from "./DimParamsPanel";
@ -112,7 +112,7 @@ export class Properties_DimPanel extends React.Component<Properties_DimPanelProp
} }
private Dim_UseDefault(als: Dimension[]) private Dim_UseDefault(als: Dimension[])
{ {
let propsStore = PropertiesStore.GetInstance() as PropertiesStore; let propsStore = PropertiesStore.GetInstance();
CommandWrap(() => CommandWrap(() =>
{ {
for (let al of als) for (let al of als)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save