public static List <CeilingPanel> GetAll(int floor) { var list = new List <CeilingPanel>(); var layerIds = CeilingPanel.GetLayers(); foreach (var layerId in layerIds) { var layerName = AutoCad.Db.LayerTableRecord.GetLayerName(layerId); if (layerName.Contains(Const.Layer.電気_天井パネル補足)) { continue; } var lines = Filters.GetCeilingPanelLineIds(layerName); if (lines.Count == 0) { continue; } if (2 <= lines.Count) { throw new ApplicationException("There are 2 or more ceiling panel lines for " + layerName); } var panel = new CeilingPanel(floor, layerName, lines[0]); list.Add(panel); } list.Sort((a, b) => a.Name.CompareTo(b.Name)); return(list); }
public void SetIntersectCeilingRecievers(CeilingPanel ceilingPanel) { if (ceilingPanel == null) { return; } this.CeilingRecievers.Clear(); this.CeilingRecievers.AddRange(this.GetCrossingCeilingReciever(ceilingPanel)); }
public CeilingReciever(CeilingPanel panel, int objectId, int floor) : base(objectId, floor) { this.ObjectId = objectId; this.Floor = floor; var bound = AutoCad.Db.Entity.GetEntityBound(objectId); this.PositionBottomLeft = bound[0]; this.PositionTopRight = bound[1]; this.IsOnCeilingPanelEdge = this.GetPanelEdgeFlg(panel); this.ceilingPanel = panel; }
/// <summary>天井パネルの表示状態を切り替える</summary> public static void ChangeVisibleOfCeilingPanel() { var layers = CeilingPanel.GetLayers(); if (layers.Count == 0) { return; } var isFrozen = AutoCad.Db.LayerTableRecord.IsFrozen(layers[0]); ViewController.ChangeVisibleOfCeilingPanel(isFrozen); }
/// <summary> /// 配線が天井パネルの端をまたぐ時true /// </summary> public virtual bool IsCrossover(CeilingPanel panel) { if (this.Floor != panel.Floor) { return(false); } if (!AutoCad.Db.Entity.IsIntersect(this.ObjectId, panel.ObjectId)) { return(false); } return(true); }
/// <summary>天井パネルを指定した表示状態にする</summary> public static void ChangeVisibleOfCeilingPanel(bool isVisible) { AutoCad.Command.Prepare(); AutoCad.Command.SetCurrentLayer("0"); //現在の画層をフリーズすることはできないので。 var layers = CeilingPanel.GetLayers(); foreach (var layerid in layers) { AutoCad.Db.LayerTableRecord.SetFrozen(layerid, !isVisible); } AutoCad.Command.RefreshEx(); }
private bool GetPanelEdgeFlg(CeilingPanel panel) { bool result = false; var lineIds = new List <int>(); var points = new List <PointD>(); if (this.RecieverOrientation == Orientation.Horizontal) { points = new List <PointD>(); points.Add(new PointD(this.PositionBottomLeft.X, this.PositionCenter.Y - Const.CEILING_RECEIVER_MARGIN)); points.Add(new PointD(this.PositionTopRight.X, this.PositionCenter.Y - Const.CEILING_RECEIVER_MARGIN)); lineIds.Add(AutoCad.Db.Polyline.Make(points)); points = new List <PointD>(); points.Add(new PointD(this.PositionBottomLeft.X, this.PositionCenter.Y + Const.CEILING_RECEIVER_MARGIN)); points.Add(new PointD(this.PositionTopRight.X, this.PositionCenter.Y + Const.CEILING_RECEIVER_MARGIN)); lineIds.Add(AutoCad.Db.Polyline.Make(points)); } else if (this.RecieverOrientation == Orientation.Vertical) { points = new List <PointD>(); points.Add(new PointD(this.PositionCenter.X - Const.CEILING_RECEIVER_MARGIN, this.PositionTopRight.Y)); points.Add(new PointD(this.PositionCenter.X - Const.CEILING_RECEIVER_MARGIN, this.PositionBottomLeft.Y)); lineIds.Add(AutoCad.Db.Polyline.Make(points)); points = new List <PointD>(); points.Add(new PointD(this.PositionCenter.X + Const.CEILING_RECEIVER_MARGIN, this.PositionTopRight.Y)); points.Add(new PointD(this.PositionCenter.X + Const.CEILING_RECEIVER_MARGIN, this.PositionBottomLeft.Y)); lineIds.Add(AutoCad.Db.Polyline.Make(points)); } else { throw new ApplicationException("天井受けの形状が異常です。"); } //移動させた天井受けが完全にパネル外ならパネル端 foreach (var lineId in lineIds) { if (panel.IsOutsideForPolyline(lineId)) { result = true; } } //CADオブジェクトを作ったら消すべし lineIds.ForEach(p => AutoCad.Db.Polyline.Erase(p)); return(result); }
public List <Wire> GetTargetWires(CeilingPanel panel) { List <Wire> result = new List <Wire>(); foreach (var wire in this.Wires) { if (wire is MarkingWire) { result.AddRange(((MarkingWire)wire).GetTargetWires(panel)); } else if (wire.IsOn(panel)) { result.Add(wire); } } return(result); }
private List <CeilingReciever> GetCrossingCeilingReciever(CeilingPanel panel) { var result = new List <CeilingReciever>(); foreach (var ceilingReceiver in panel.CeilingReceivers) { var points = AutoCad.Db.Entity.GetIntersect2D(this.ObjectId, ceilingReceiver.ObjectId); //交点2つで1回とする int receiverCount = (int)Math.Ceiling((double)points.Count / 2); for (var i = 1; i <= receiverCount; i++) { result.Add(ceilingReceiver); } } return(result); }
/// <summary> /// 配線の端が天井パネル上にある時true /// </summary> public virtual bool IsConnected(CeilingPanel panel) { if (panel.Floor != this.Floor) { return(false); } if (panel.Contains(this.StartPoint)) { return(true); } if (panel.Contains(this.EndPoint)) { return(true); } return(false); }
/// <summary> /// 配線が天井パネル上を通る時true /// </summary> public virtual bool IsOn(CeilingPanel panel) { if (this.Floor != panel.Floor) { return(false); } if (this.IsConnected(panel)) { return(true); } if (this.IsCrossover(panel)) { return(true); } return(false); }
/// <summary> /// 配線が天井パネルの端をまたぐ時true /// </summary> public override bool IsCrossover(CeilingPanel panel) { foreach (var wire in this.Wires) { if (wire is MarkingWire) { if (((MarkingWire)wire).IsCrossover(panel)) { return(true); } } else if (wire.IsCrossover(panel)) { return(true); } } return(false); }
//線の点が全てPanelの上にあったら中にある判定 public virtual bool IsIn(CeilingPanel panel) { if (this.Floor != panel.Floor) { return(false); } var points = AutoCad.Db.Polyline.GetVertex(this.ObjectId); if (points.Count == 0) { return(false); } foreach (var point in points) { if (!point.IsIn(panel.ObjectId)) { return(false); } } return(true); }