mirror of https://gitee.com/cf-fz/WebCAD.git
parent
88c62acd5a
commit
6fd0fdeb6e
@ -0,0 +1,18 @@
|
|||||||
|
import { Command } from '../Editor/CommandMachine';
|
||||||
|
import { app } from '../ApplicationServices/Application';
|
||||||
|
import { commandStore } from '../UI/Store/CommandStore';
|
||||||
|
import * as THREE from 'three';
|
||||||
|
import { Line } from '../DatabaseServices/Entity';
|
||||||
|
export class DrawLine implements Command
|
||||||
|
{
|
||||||
|
async exec()
|
||||||
|
{
|
||||||
|
commandStore.Prompt("请输入一个点:");
|
||||||
|
var p1 = await app.m_Editor.GetPoint();
|
||||||
|
commandStore.Prompt("请输入点2:");
|
||||||
|
var p2 = await app.m_Editor.GetPoint({ BasePoint: p1 });
|
||||||
|
|
||||||
|
let line = new Line(p1, p2);
|
||||||
|
app.m_Database.appendEntity(line);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,14 @@
|
|||||||
|
import * as THREE from 'three';
|
||||||
|
import { Vector3 } from 'three';
|
||||||
export enum InputState
|
export enum InputState
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
Select = 1,
|
Select = 1,
|
||||||
GetPoint = 2,
|
GetPoint = 2,
|
||||||
Entsel = 4,
|
Entsel = 4,
|
||||||
|
}
|
||||||
|
export interface GetPointPrompt
|
||||||
|
{
|
||||||
|
Msg?: string
|
||||||
|
BasePoint?: Vector3
|
||||||
}
|
}
|
@ -1,7 +1,17 @@
|
|||||||
|
export interface Command
|
||||||
|
{
|
||||||
|
exec: Function;
|
||||||
|
}
|
||||||
|
|
||||||
//命令状态机.
|
//命令状态机.
|
||||||
export class CommandMachine
|
export class CommandMachine
|
||||||
{
|
{
|
||||||
|
//命令表
|
||||||
|
m_CommandList: Map<string, Command> = new Map<string, Command>();
|
||||||
|
async execCommand(cmdName: string)
|
||||||
|
{
|
||||||
|
if (this.m_CommandList.has(cmdName)) {
|
||||||
|
await this.m_CommandList.get(cmdName).exec();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue