Beispiel #1
0
        public bool IsInRoomOfSiyo(List <SiyoHeya> siyoHeyas)
        {
            var roomCode = RoomObject.GetRoomCodeInSiyo(this.Symbol.Room, this.RoomName, siyoHeyas);

            return(!string.IsNullOrEmpty(roomCode));
        }
Beispiel #2
0
        public static void DrawRoomOutline(bool isPolyline, bool withJo)
        {
            WindowController2.BringAutoCadToTop();
            AutoCad.Command.Prepare();
            AutoCad.Command.SetCurrentLayoutToModel();

            if (withJo)
            {
                AutoCad.Db.LayerTableRecord.Make(Const.Layer.電気_部屋_WithJyou, CadColor.Magenta, Const.LineWeight._0_70);
                AutoCad.Command.SetCurrentLayer(Const.Layer.電気_部屋_WithJyou);
            }
            else
            {
                AutoCad.Db.LayerTableRecord.Make(Const.Layer.電気_部屋_WithoutJyou, CadColor.Green, Const.LineWeight._0_70);
                AutoCad.Command.SetCurrentLayer(Const.Layer.電気_部屋_WithoutJyou);
            }

            List <SiyoHeya> siyoHeyas;

            using (var service = new SocketPlanServiceNoTimeout())
            {
                siyoHeyas = new List <SiyoHeya>(service.GetSiyoHeyas(Static.ConstructionCode, Static.Drawing.PlanNoWithHyphen));
            }

            var drawing = Drawing.GetCurrent();

            while (true)
            {
                //部屋名を選択してもらう。
                var roomName = RoomObject.GetRoomNameText("Select Room Name:", false);
                if (string.IsNullOrEmpty(roomName))
                {
                    break; //入力をキャンセルしていたら終了
                }
                if (!withJo && UnitWiring.Masters.Rooms.Exists(p => p.Name == roomName && p.WithJyou))
                {
                    MessageDialog.ShowWarning(Messages.ShouldHaveJyou()); //警告のみで処理続行
                }
                var roomNameInSiyo = RoomObject.GetRoomNameInSiyo(roomName, siyoHeyas);
                if (string.IsNullOrEmpty(roomNameInSiyo))
                {
                    RoomSelectForm form = new RoomSelectForm(siyoHeyas, roomName);
                    var            dr   = form.ShowDialog();
                    if (dr == System.Windows.Forms.DialogResult.Cancel)
                    {
                        break;
                    }

                    roomName = form.CorrectRoomName;
                }

                var roomCode = RoomObject.GetRoomCode(roomName, drawing.Floor, siyoHeyas);

                DrawResult result;

                //線を引いてもらう。
                if (isPolyline)
                {
                    result = AutoCad.Drawer.DrawPolyline(true);
                }
                else
                {
                    result = AutoCad.Drawer.DrawRectangle("");
                }

                if (result.Status == DrawStatus.Canceled)
                {
                    break;
                }

                if (result.Status == DrawStatus.Failed)
                {
                    throw new ApplicationException(Messages.RoomNotSet());
                }

                var lineId = result.ObjectId;

                if (!AutoCad.Db.Entity.GetLayerName(lineId).Contains(Const.Layer.電気_部屋))
                {
                    throw new ApplicationException(Messages.RoomNotSet());
                }

                //線の始点と終点をくっつける
                if (!AutoCad.Db.Polyline.IsClosed(lineId))
                {
                    AutoCad.Db.Polyline.SetClose2(lineId);
                }

                //帖数を選択してもらう。
                string jo = string.Empty;
                if (withJo)
                {
                    jo = RoomObject.SelectJoIndication();

                    if (string.IsNullOrEmpty(jo))
                    {
                        AutoCad.Db.Object.Erase(lineId);
                        AutoCad.Command.Refresh();
                        break; //入力をキャンセルしていたら書いた図形を削除して終了
                    }
                }

                //引いた線に部屋名を拡張データとして持たせる。
                XData.Room.SetRoomName(lineId, roomName);
                XData.Room.SetRoomCode(lineId, roomCode);

                if (withJo)
                {
                    XData.Room.SetRoomJyou(lineId, jo);
                }

                //タレ壁情報を入力する画面を表示する
                var roomObj      = new RoomObject(lineId, 0, siyoHeyas); //階数は適当
                var roomInfoForm = new RoomInfoForm(roomObj);
                var dr2          = roomInfoForm.ShowDialog();
                if (dr2 == System.Windows.Forms.DialogResult.Cancel)
                {
                    AutoCad.Db.Object.Erase(lineId);
                    AutoCad.Command.Refresh();
                    break; //入力をキャンセルしていたら書いた図形を削除して終了
                }

                AutoCad.Status.WaitFinish();

                if (result.Status == DrawStatus.DrawnAndCanceled)
                {
                    break; //線をひいてキャンセルしていたら拡張データを設定して終了
                }
            }
        }
Beispiel #3
0
 public void AddInfo(RoomObject room)
 {
     this.infoPanel.Controls.Add(new RoomInfoPanel(room));
 }
Beispiel #4
0
        public static DrawResult DrawRoomOutline0Jyou(int floor)
        {
            WindowController2.BringAutoCadToTop();
            AutoCad.Command.Prepare();
            AutoCad.Command.SetCurrentLayoutToModel();

            AutoCad.Db.LayerTableRecord.Make(Const.Layer.電気_部屋_WithoutJyou, CadColor.Green, Const.LineWeight._0_70);
            AutoCad.Command.SetCurrentLayer(Const.Layer.電気_部屋_WithoutJyou);

            List <SiyoHeya> siyoHeyas;

            using (var service = new SocketPlanServiceNoTimeout())
            {
                siyoHeyas = new List <SiyoHeya>(service.GetSiyoHeyas(Static.ConstructionCode, Static.Drawing.PlanNoWithHyphen));
            }

            //先に線を引いてもらう
            var result = AutoCad.Drawer.DrawPolyline(true);

            if (result.Status == DrawStatus.Canceled)
            {
                return(result);
            }

            if (result.Status == DrawStatus.Failed)
            {
                throw new ApplicationException("Failed to get line info.\nPlease draw line again.");
            }

            var lineId = result.ObjectId;

            if (!AutoCad.Db.Entity.GetLayerName(lineId).Contains(Const.Layer.電気_部屋))
            {
                throw new ApplicationException("Invalid layer.\nPlease draw line again.");
            }

            //線の始点と終点をくっつける
            if (!AutoCad.Db.Polyline.IsClosed(lineId))
            {
                AutoCad.Db.Polyline.SetClose2(lineId);
            }

            //部屋を選んでもらう
            var roomName = RoomObject.GetRoomNameText("Select Room Name:", true);

            if (roomName == null)
            {
                result.Status = DrawStatus.Canceled;
                AutoCad.Db.Polyline.Erase(lineId);
                return(result);
            }
            else if (roomName == string.Empty)
            {
                roomName = "外部";
            }

            var roomNameInSiyo = RoomObject.GetRoomNameInSiyo(roomName, siyoHeyas);
            var roomCode       = RoomObject.GetRoomCode(roomName, floor, siyoHeyas);

            if (string.IsNullOrEmpty(roomNameInSiyo))
            {
                RoomSelectForm form = new RoomSelectForm(siyoHeyas, roomName);
                var            dr   = form.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.Cancel)
                {
                    result.Status = DrawStatus.Canceled;
                    AutoCad.Db.Polyline.Erase(lineId);
                    return(result);
                }

                roomName = form.CorrectRoomName;
                roomCode = form.CorrectRoomCode;
            }

            XData.Room.SetRoomName(lineId, roomName);
            XData.Room.SetRoomJyou(lineId, "0");
            XData.Room.SetRoomTarekabeJyou(lineId, "0");
            XData.Room.SetRoomCode(lineId, roomCode);

            return(result);
        }
Beispiel #5
0
 public RoomInfoForm(RoomObject roomObj) : this()
 {
     this.roomObj           = roomObj;
     this.roomNameText.Text = roomObj.Name;
     this.roomJyouText.Text = roomObj.GetJyou().ToString();
 }