优化:户型在各个视图都能复制

pull/1926/head
ChenX 2 years ago
parent a27eaa4191
commit 9a1b5ec2db

@ -60,7 +60,7 @@ export class Command_Copy implements Command
let ssRes = await app.Editor.GetSelection({
Msg: "请选择需要拷贝的实体:", UseSelect: true,
Filter: {
filterFunction: (obj, ent) => !(ent instanceof DirectionalLight || ent instanceof RoomFlatBase || ent instanceof RoomRegion)//避免拷贝太阳光 太阳光只能有一个
filterFunction: (obj, ent) => !(ent instanceof DirectionalLight)//避免拷贝太阳光 太阳光只能有一个
}
});
if (ssRes.Status !== PromptStatus.OK) return;

@ -208,8 +208,10 @@ export class RoomFlatBase extends RoomBase
{
if (renderType === RenderType.Wireframe)
{
return new Object3D;//在二维线框中,如果显示这个线框,操作时会选到这个,所以不绘制
return new TLine(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex));
// return new Object3D;//在二维线框中,如果显示这个线框,操作时会选到这个,所以不绘制
//避免在二维线框下无法选中!
return new TLine(BufferGeometryUtils.CreateFromPts([AsVector3(this.ContourData.pts[0]), AsVector3(this.ContourData.pts[0])]), ColorMaterial.GetLineMaterial(this.ColorIndex));
}
else if (renderType === RenderType.Conceptual)
{
@ -241,10 +243,11 @@ export class RoomFlatBase extends RoomBase
{
if (renderType === RenderType.Wireframe)
{
return;
let l = obj as TLine;
l.geometry = this.EdgeGeometry;
l.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
let l = obj as TLine<BufferGeometry>;
BufferGeometryUtils.UpdatePts(l.geometry, [AsVector3(this.ContourData.pts[0]), AsVector3(this.ContourData.pts[0])]);
// l.geometry = this.EdgeGeometry;
// l.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
}
else if (renderType === RenderType.Conceptual)
{

@ -1,6 +1,7 @@
import { Object3D, Vector2, Vector3 } from "three";
import { BufferGeometry, Line, Object3D, Vector2, Vector3 } from "three";
import { AddEntityDrawObject } from "../../../../Common/AddEntityDrawObject";
import { FixedNotZero } from "../../../../Common/Utils";
import { BufferGeometryUtils } from "../../../../Geometry/BufferGeometryUtils";
import { AsVector3, equaln } from "../../../../Geometry/GeUtils";
import { RenderType } from "../../../../GraphicsSystem/RenderType";
import { Factory } from "../../../CADFactory";
@ -98,8 +99,7 @@ export class RoomRegion extends RoomBase
InitDrawObject(renderType: RenderType = RenderType.Wireframe): Object3D
{
let obj = new Object3D;
if (renderType === RenderType.Wireframe || renderType === RenderType.Conceptual)
this.UpdateDrawObject(renderType, obj);
this.UpdateDrawObject(renderType, obj);
return obj;
}
@ -110,13 +110,27 @@ export class RoomRegion extends RoomBase
*/
UpdateDrawObject(renderType: RenderType, obj: Object3D)
{
obj.remove(...obj.children.slice(0));
if (renderType === RenderType.Wireframe || renderType === RenderType.Conceptual)
{
obj.remove(...obj.children.slice(0));
this.Text.TextAligen = TextAligen.Mid;
this._Text.TextString = `${this.TextString || "未命名"} ${FixedNotZero(this._Area * 1e-6, 2)}`;
AddEntityDrawObject(obj, this._Text, renderType);
}
else
{
//避免在真实视图无法选中!
let line = obj.children[0] as Line<BufferGeometry>;
let pts = this.GetGripPoints();
if (pts.length)
{
let p = pts[0].applyMatrix4(this.OCSInv);
if (!line)
obj.add(new Line(BufferGeometryUtils.CreateFromPts([p, p])));
else
BufferGeometryUtils.UpdatePts(line.geometry, [p, p]);
}
}
}
//#region -----------------------------File-----------------------------

@ -213,6 +213,8 @@ export class RoomRegionParse
let region = new RoomRegion(name, top.Id, floor.Id, floor.Area);
region.Position = pos;
this._UpdateDb.ModelSpace.Append(region);
floor.RegionId = region.Id;
top.RegionId = region.Id;
}
}
}

Loading…
Cancel
Save