//矩形绘制按钮
        public void drawRectBtn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            //CommandManager.Register();
            if(!HeatSourceLayoutApp.CommandManager.RequireLock())
            {
                HeatSourceLayoutApp.CommandManager.AddCommand(CommandManager.ToolCommand.DrawBuildingRect);
                Application.DocumentManager.MdiActiveDocument.SendStringToExecute("\x1B", true, false, false);

                return;
            }
            else
            {
                changeBtnStyle(2);
            }
            Utility.SetOrthoMode(false);
            HeatSourceLayoutApp.solutionPanel.SelectOutLineLayer();
            using(DocumentLock docLock = Application.DocumentManager.MdiActiveDocument.LockDocument())
            {
                Database db = HostApplicationServices.WorkingDatabase;
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                while (true)
                {
                    PromptPointOptions optPoint = new PromptPointOptions
                        ("\n请指定矩形的一个角点");
                    PromptPointResult resPoint = ed.GetPoint(optPoint);
                    if(HeatSourceLayoutApp.CommandManager.Status())
                    {
                        HeatSourceLayoutApp.CommandManager.ReleaseLock();
                        HeatSourceLayoutApp.CommandManager.TriggerCommand();
                        return;
                    }
                    if (resPoint.Status != PromptStatus.OK)
                    {
                        HeatSourceLayoutApp.CommandManager.ReleaseLock();
                        return;
                    }
                    Point3d pt1 = resPoint.Value;

                    Polyline polyLine2 = new Polyline();
                    for (int i = 0; i < 4; i++)
                    {
                        polyLine2.AddVertexAt(i, new Point2d(0, 0), 0, 0, 0);
                    }
                    polyLine2.Closed = true;

                    polyLine2.Color = Color.FromRgb(255, 0, 0);

                    RecJig elRecJig = new RecJig(pt1, polyLine2);

                    PromptResult resJig = ed.Drag(elRecJig);
                    if (resJig.Status == PromptStatus.OK)
                    {
                        if (elRecJig.m_PolyLine2.Area >= 1e-10)
                        {
                            ObjectId objid = AppendEntity(elRecJig.m_PolyLine2);
                            Building b = new Building(true);
                            b.BaseObjectId = objid;
                            HeatSource.HeatSourceLayoutApp.buildings.Add(objid, b);
                            //b.AddBuildingNumber();
                            b.Save();
                        }
                    }
                }
            }
        }
        //矩形绘制按钮
        public void drawRectBtn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            //CommandManager.Register();
            if (!HeatSourceLayoutApp.CommandManager.RequireLock())
            {
                HeatSourceLayoutApp.CommandManager.AddCommand(CommandManager.ToolCommand.DrawBuildingRect);
                Application.DocumentManager.MdiActiveDocument.SendStringToExecute("\x1B", true, false, false);

                return;
            }
            else
            {
                changeBtnStyle(2);
            }
            Utility.SetOrthoMode(false);
            HeatSourceLayoutApp.solutionPanel.SelectOutLineLayer();
            using (DocumentLock docLock = Application.DocumentManager.MdiActiveDocument.LockDocument())
            {
                Database db = HostApplicationServices.WorkingDatabase;
                Editor   ed = Application.DocumentManager.MdiActiveDocument.Editor;
                while (true)
                {
                    PromptPointOptions optPoint = new PromptPointOptions
                                                      ("\n请指定矩形的一个角点");
                    PromptPointResult resPoint = ed.GetPoint(optPoint);
                    if (HeatSourceLayoutApp.CommandManager.Status())
                    {
                        HeatSourceLayoutApp.CommandManager.ReleaseLock();
                        HeatSourceLayoutApp.CommandManager.TriggerCommand();
                        return;
                    }
                    if (resPoint.Status != PromptStatus.OK)
                    {
                        HeatSourceLayoutApp.CommandManager.ReleaseLock();
                        return;
                    }
                    Point3d pt1 = resPoint.Value;


                    Polyline polyLine2 = new Polyline();
                    for (int i = 0; i < 4; i++)
                    {
                        polyLine2.AddVertexAt(i, new Point2d(0, 0), 0, 0, 0);
                    }
                    polyLine2.Closed = true;

                    polyLine2.Color = Color.FromRgb(255, 0, 0);

                    RecJig elRecJig = new RecJig(pt1, polyLine2);

                    PromptResult resJig = ed.Drag(elRecJig);
                    if (resJig.Status == PromptStatus.OK)
                    {
                        if (elRecJig.m_PolyLine2.Area >= 1e-10)
                        {
                            ObjectId objid = AppendEntity(elRecJig.m_PolyLine2);
                            Building b     = new Building(true);
                            b.BaseObjectId = objid;
                            HeatSource.HeatSourceLayoutApp.buildings.Add(objid, b);
                            //b.AddBuildingNumber();
                            b.Save();
                        }
                    }
                }
            }
        }