统一使用Oblique来标识斜,(eg:斜酒格)

pull/457/MERGE
ChenX 5 years ago
parent 2e8e52fa9e
commit 9c1ada0086

@ -1,5 +1,5 @@
import { Vector3 } from "three"; import { Vector3 } from "three";
import { DrawBlisWineRackTool } from "../../src/Add-on/DrawWineRack/DrawBlisWineRackTool"; import { DrawObliqueWineRackTool } from "../../src/Add-on/DrawWineRack/DrawObliqueWineRackTool";
import { DrawUprightWineRackTool } from "../../src/Add-on/DrawWineRack/DrawUprightWineRackTool"; import { DrawUprightWineRackTool } from "../../src/Add-on/DrawWineRack/DrawUprightWineRackTool";
import { Board } from "../../src/DatabaseServices/Entity/Board"; import { Board } from "../../src/DatabaseServices/Entity/Board";
import { Box3Ext } from "../../src/Geometry/Box"; import { Box3Ext } from "../../src/Geometry/Box";
@ -7,10 +7,10 @@ import { ISpaceParse } from "../../src/Geometry/SpaceParse/ISpaceParse";
import { EFullDir, EFullType, EWineRackType, EWRackArrayType, IWineRackOption } from "../../src/UI/Store/WineRackInterface"; import { EFullDir, EFullType, EWineRackType, EWRackArrayType, IWineRackOption } from "../../src/UI/Store/WineRackInterface";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
const UprightTool = DrawUprightWineRackTool.GetInstance() as DrawUprightWineRackTool; const UprightTool = DrawUprightWineRackTool.GetInstance() as DrawUprightWineRackTool;
const blisTool = DrawBlisWineRackTool.GetInstance() as DrawBlisWineRackTool; const ObliqueTool = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool;
const option: IWineRackOption = { const option: IWineRackOption = {
type: EWineRackType.Bias, type: EWineRackType.Oblique,
arrayType: EWRackArrayType.ByWidth, arrayType: EWRackArrayType.ByWidth,
fullType: EFullType.ByWidth, fullType: EFullType.ByWidth,
isFull: false, isFull: false,
@ -50,8 +50,8 @@ describe("酒格功能测试", () =>
spaceParse.SpaceBox = new Box3Ext(new Vector3(), new Vector3(1200, 600, 2000)); spaceParse.SpaceBox = new Box3Ext(new Vector3(), new Vector3(1200, 600, 2000));
spaceParse.Parse(); spaceParse.Parse();
UprightTool.Parse(spaceParse, option); UprightTool.Parse(spaceParse, option);
blisTool.Parse(spaceParse, option); ObliqueTool.Parse(spaceParse, option);
expect(UprightTool.boardlist.length).toMatchSnapshot(); expect(UprightTool.boardlist.length).toMatchSnapshot();
expect(blisTool.boardlist.length).toMatchSnapshot(); expect(ObliqueTool.boardlist.length).toMatchSnapshot();
}) })
}) })

@ -26,7 +26,11 @@ export interface IParsePlRes
basePt?: Vector3; basePt?: Vector3;
} }
export class DrawBlisWineRackTool extends DrawWineRackTool
/**
*
*/
export class DrawObliqueWineRackTool extends DrawWineRackTool
{ {
Parse(space: ISpaceParse, config: IWineRackOption) Parse(space: ISpaceParse, config: IWineRackOption)
{ {

@ -5,6 +5,10 @@ import { MoveMatrix, AsVector2 } from "../../Geometry/GeUtils";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse"; import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { EWRackArrayType, IWineRackOption } from "../../UI/Store/WineRackInterface"; import { EWRackArrayType, IWineRackOption } from "../../UI/Store/WineRackInterface";
import { DrawWineRackTool } from "./DrawWinRackTool"; import { DrawWineRackTool } from "./DrawWinRackTool";
/**
*
*/
export class DrawUprightWineRackTool extends DrawWineRackTool export class DrawUprightWineRackTool extends DrawWineRackTool
{ {
Parse(space: ISpaceParse, config: IWineRackOption) Parse(space: ISpaceParse, config: IWineRackOption)

@ -1,6 +1,6 @@
import { Command } from "../../Editor/CommandMachine"; import { Command } from "../../Editor/CommandMachine";
import { PointSelectSpaceClamp } from "../../Geometry/SpaceParse/PointSelectSpaceClamp"; import { PointSelectSpaceClamp } from "../../Geometry/SpaceParse/PointSelectSpaceClamp";
import { DrawBlisWineRackTool } from "./DrawBlisWineRackTool"; import { DrawObliqueWineRackTool } from "./DrawObliqueWineRackTool";
import { DrawUprightWineRackTool } from "./DrawUprightWineRackTool"; import { DrawUprightWineRackTool } from "./DrawUprightWineRackTool";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { userConfig } from "../../Editor/UserConfig"; import { userConfig } from "../../Editor/UserConfig";
@ -34,7 +34,7 @@ export class DrawWineRack2 implements Command
if (!userConfig.winerackConfig) if (!userConfig.winerackConfig)
await userConfigStore.InitWinerackConfig(); await userConfigStore.InitWinerackConfig();
let space = selectSpace.SpaceParse; let space = selectSpace.SpaceParse;
const tool = DrawBlisWineRackTool.GetInstance() as DrawBlisWineRackTool; const tool = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool;
tool.Parse(space, userConfig.winerackConfig); tool.Parse(space, userConfig.winerackConfig);
tool.boardlist.forEach(b => app.Database.ModelSpace.Append(b)); tool.boardlist.forEach(b => app.Database.ModelSpace.Append(b));
} }

@ -1,5 +1,5 @@
import { Vector3 } from "three"; import { Vector3 } from "three";
import { DrawBlisWineRackTool } from "../../Add-on/DrawWineRack/DrawBlisWineRackTool"; import { DrawObliqueWineRackTool } from "../../Add-on/DrawWineRack/DrawObliqueWineRackTool";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { Box3Ext } from "../../Geometry/Box"; import { Box3Ext } from "../../Geometry/Box";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse"; import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
@ -23,7 +23,7 @@ export class TemplateWineRackRecord extends TemplateRecord
{ {
super.InitBaseParams(); super.InitBaseParams();
this.option = { this.option = {
type: EWineRackType.Bias, type: EWineRackType.Oblique,
arrayType: EWRackArrayType.ByWidth, arrayType: EWRackArrayType.ByWidth,
fullType: EFullType.ByWidth, fullType: EFullType.ByWidth,
isFull: false, isFull: false,
@ -58,7 +58,7 @@ export class TemplateWineRackRecord extends TemplateRecord
{ {
await super.Update(); await super.Update();
let wineRack = DrawBlisWineRackTool.GetInstance() as DrawBlisWineRackTool; let wineRack = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool;
let brs: Board[] = []; let brs: Board[] = [];
if (this.Positioning && this.Positioning instanceof PositioningClampSpace) if (this.Positioning && this.Positioning instanceof PositioningClampSpace)

@ -90,8 +90,8 @@ export class SnapServices
this.InitDynPrompt(); this.InitDynPrompt();
this.InitCrossCursor(); this.InitCrossCursor();
this.InitSquareCursor(); this.InitSquareCursor();
this.InitBiasCrossCursor(); this.InitObliqueCrossCursor();
this.InitBiasOutline(); this.InitObliqueOutline();
this.InitSupportExtLine(); this.InitSupportExtLine();
if (prompt.BasePoint) if (prompt.BasePoint)
@ -167,8 +167,8 @@ export class SnapServices
{ {
this.UpdateSquareCursor(); this.UpdateSquareCursor();
this.UpdateCrossCursor(); this.UpdateCrossCursor();
this.UpdateBiasCrossCursor(); this.UpdateObliqueCrossCursor();
this.UpdateBiasOutline(); this.UpdateObliqueOutline();
this.UpdateDynPrompt(); this.UpdateDynPrompt();
this.UpdateSupportExtLine(); this.UpdateSupportExtLine();
@ -788,7 +788,7 @@ export class SnapServices
pts = PointShapeUtils.PerPts(this.SnapSize); pts = PointShapeUtils.PerPts(this.SnapSize);
break; break;
case ObjectSnapMode.Int: case ObjectSnapMode.Int:
pts = PointShapeUtils.BiasCrossLinePts(this.SnapSize); pts = PointShapeUtils.ObliqueCrossLinePts(this.SnapSize);
break; break;
default: default:
break; break;
@ -801,34 +801,34 @@ export class SnapServices
} }
} }
private m_BiasCrossCursor: Line; private m_ObliqueCrossCursor: Line;
//×光标,用于捕捉轴线 //×光标,用于捕捉轴线
private InitBiasCrossCursor() private InitObliqueCrossCursor()
{ {
if (!this.m_BiasCrossCursor) if (!this.m_ObliqueCrossCursor)
{ {
this.m_BiasCrossCursor = app.Viewer.PreViewer.Draw( this.m_ObliqueCrossCursor = app.Viewer.PreViewer.Draw(
DrawMode.BaisCross, DrawMode.ObliqueCross,
8, 8,
new Vector3(), new Vector3(),
ColorMaterial.GetLineMaterial(7) ColorMaterial.GetLineMaterial(7)
); );
} }
} }
private UpdateBiasCrossCursor() private UpdateObliqueCrossCursor()
{ {
this.UpdateObjectPosition( this.UpdateObjectPosition(
this.m_BiasCrossCursor, this.m_ObliqueCrossCursor,
this.m_SupportExtLinePts.length > 0 this.m_SupportExtLinePts.length > 0
); );
} }
private m_BiasOutline: Line; private m_ObliqueOutline: Line;
//初始化X光标外包围框(虚线),用户显示光标交叉 //初始化X光标外包围框(虚线),用户显示光标交叉
private InitBiasOutline() private InitObliqueOutline()
{ {
if (!this.m_BiasOutline) if (!this.m_ObliqueOutline)
this.m_BiasOutline = app.Viewer.PreViewer.Draw( this.m_ObliqueOutline = app.Viewer.PreViewer.Draw(
DrawMode.Square, DrawMode.Square,
this.SnapSize, this.SnapSize,
new Vector3(), new Vector3(),
@ -836,10 +836,10 @@ export class SnapServices
); );
} }
private UpdateBiasOutline() private UpdateObliqueOutline()
{ {
this.UpdateObjectPosition( this.UpdateObjectPosition(
this.m_BiasOutline, this.m_ObliqueOutline,
this.m_SupportExtLinePts.length > 2 this.m_SupportExtLinePts.length > 2
); );
} }

@ -74,11 +74,11 @@ export class PointShapeUtils
return pts; return pts;
} }
static BiasCrossPts(size) static ObliqueCrossPts(size: number)
{ {
return [new Vector3(-size, size), new Vector3(size, -size), new Vector3(-size, -size), new Vector3(size, size)]; return [new Vector3(-size, size), new Vector3(size, -size), new Vector3(-size, -size), new Vector3(size, size)];
} }
static BiasCrossLinePts(size) static ObliqueCrossLinePts(size: number)
{ {
return [new Vector3(-size, size), new Vector3(size, -size), new Vector3(), new Vector3(-size, -size), new Vector3(size, size)]; return [new Vector3(-size, size), new Vector3(size, -size), new Vector3(), new Vector3(-size, -size), new Vector3(size, size)];
} }

@ -10,7 +10,7 @@ export enum DrawMode
{ {
Square = 0, Square = 0,
Cross = 1, Cross = 1,
BaisCross = 2, ObliqueCross = 2,
} }
@ -160,8 +160,8 @@ export class PreViewer
PF = PointShapeUtils.CrossLinePts; PF = PointShapeUtils.CrossLinePts;
DrawType = LineSegments; DrawType = LineSegments;
break; break;
case DrawMode.BaisCross: case DrawMode.ObliqueCross:
PF = PointShapeUtils.BiasCrossPts; PF = PointShapeUtils.ObliqueCrossPts;
DrawType = LineSegments; DrawType = LineSegments;
break; break;
default: default:

@ -239,7 +239,7 @@ export class WineRackModal extends React.Component<{ store?: WineRackStore }, {}
store.m_Option.type = parseInt(e.currentTarget.value); store.m_Option.type = parseInt(e.currentTarget.value);
}} }}
> >
<Radio label="斜酒格" value={EWineRackType.Bias} /> <Radio label="斜酒格" value={EWineRackType.Oblique} />
<Radio label="正酒格" value={EWineRackType.Upright} /> <Radio label="正酒格" value={EWineRackType.Upright} />
</RadioGroup> </RadioGroup>
<H5></H5> <H5></H5>

@ -1,6 +1,6 @@
export enum EWineRackType export enum EWineRackType
{ {
Bias = 0, Oblique = 0,
Upright = 1, Upright = 1,
} }

@ -8,7 +8,7 @@ import { CheckoutValid, CheckObjectType } from "../../Common/CheckoutVaildValue"
export class WineRackStore extends BoardStore export class WineRackStore extends BoardStore
{ {
@observable m_Option: IWineRackOption = { @observable m_Option: IWineRackOption = {
type: EWineRackType.Bias, type: EWineRackType.Oblique,
arrayType: EWRackArrayType.ByWidth, arrayType: EWRackArrayType.ByWidth,
fullType: EFullType.ByWidth, fullType: EFullType.ByWidth,
isFull: false, isFull: false,

Loading…
Cancel
Save