예제 #1
0
        private void dotNetBarManager1_ItemClick(object sender, EventArgs e)
        {
            DevComponents.DotNetBar.ButtonItem btItem = sender as DevComponents.DotNetBar.ButtonItem;
            //Layer layer1 = (Layer)LayerBox.ComboBoxEx.SelectedItem;
            if (btItem != null)
            {
                switch (btItem.Name)
                {
                    #region 文件操作
                    case "mNew":

                        //NewFile(fileType, this.Text);
                        frmNewProject frmprojectDLG = new frmNewProject();
                        frmprojectDLG.Name = "";
                        frmprojectDLG.FileType = "短路";
                        if (frmprojectDLG.ShowDialog() == DialogResult.OK)
                        {
                            tlVectorControl1.NewFile();
                            PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                            pd.Name = frmprojectDLG.Name;
                            pd.FileType = frmprojectDLG.FileType;
                            pd.Class = System.DateTime.Now.ToString();
                            pd.ProjectID = this.ProjectUID;
                            tlVectorControl1.SVGDocument.SvgdataUid = pd.ID;
                            SvgDocument.currentLayer = Layer.CreateNew("默认层", tlVectorControl1.SVGDocument).ID;
                            Layer la = tlVectorControl1.SVGDocument.GetLayerByID(SvgDocument.currentLayer);
                            la.SetAttribute("layerType", "电网规划层");
                            Services.BaseService.Create<PSP_ELCPROJECT>(pd);
                            if (pd.ID != null)
                            {
                                Open(pd.ID);
                                intdata(pd.ID);
                                this.Text = frmname + "-" + pd.Name;
                            }
                            this.Show();
                            jxtbar2(2);
                            LoadShape("symbol23.xml");
                        }
                        break;
                    case "mOpen":
                        if (tlVectorControl1.IsModified == true)
                        {
                            DialogResult a;
                            a = MessageBox.Show("图形已修改,是否保存?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);

                            if (a == DialogResult.Yes)
                            {
                                Save();
                            }
                            else if (a == DialogResult.No)
                            {
                            }
                            else if (a == DialogResult.Cancel)
                            {
                                return;
                            }

                        }
                        OpenProject op = new OpenProject();
                        op.ProjectID = this.ProjectUID;
                        op.Initdata(true);
                        if (op.ShowDialog() == DialogResult.OK)
                        {
                            if (op.FileSUID != null)
                            {
                                Open(op.FileSUID);
                                intdata(op.FileSUID);
                                this.Text = frmname + "-" + op.FileName;
                            }
                            this.Show();
                            jxtbar2(2);
                            LoadShape("symbol23.xml");
                        }
                        break;
                    case "btExSymbol":
                        tlVectorControl1.ExportSymbol();
                        break;
                    case "mjxt"://导入接线图

                        break;
                    case "mSave":
                        Save();
                        //tlVectorControl1.Save();
                        //frmElementName dlg = new frmElementName();
                        //dlg.TextInput = tlVectorControl1.SVGDocument.FileName;
                        //if (dlg.ShowDialog() == DialogResult.OK)
                        //{
                        //    tlVectorControl1.SVGDocument.FileName = dlg.TextInput;
                        //    Save();
                        //}
                        break;
                    case "mExit":
                        this.Close();
                        break;
                    case "bt1":
                        //InitTK();
                        break;
                    case "bt2":
                        break;
                    case "mPriSet":
                        this.tlVectorControl1.Operation = ToolOperation.InterEnclosurePrint;
                        printToolStripMenuItem.Visible = true;
                        break;
                    case "mPrint":
                        tlVectorControl1.Print();

                        break;
                    case "mImport":
                        ExportImage();
                        break;
                    case "mView":
                        //frmSvgView fView = new frmSvgView();
                        //fView.Open(tlVectorControl1.SVGDocument.SvgdataUid);
                        //fView.Show();

                        break;

                    case "deviceparam":
                        frmProjectManager frmPdlg = new frmProjectManager();
                        frmPdlg.SetMode(tlVectorControl1.SVGDocument.SvgdataUid);
                        frmPdlg.ShowDialog();
                        break;
                    //case "mIncreaseView":
                    //    tlVectorControl1.Operation = ToolOperation.IncreaseView;
                    //    break;
                    case "mRzb":
                        frmRatio fRat = new frmRatio();
                        string viewRat = tlVectorControl1.SVGDocument.getRZBRatio();
                        if (viewRat != "")
                        {
                            fRat.InitData(viewRat);
                        }
                        if (fRat.ShowDialog() == DialogResult.OK)
                        {
                            viewRat = fRat.ViewScale;
                            tlVectorControl1.SVGDocument.setRZBRatio(viewRat);
                        }
                        break;

                    case "mAbout":

                        frmAbout frma = new frmAbout();
                        frma.ShowDialog();
                        break;

                    case "ButtonItem10":

                        break;
                    case "Dlqibutt":
                        break;
                    //MessageBox.Show("请选中母线点,然后点击右键输入断路器属性" "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //duluqiflag=true;
                    //基础操作
                    case "mFreeTransform":
                        tlVectorControl1.Operation = ToolOperation.FreeTransform;

                        break;
                    case "mCJ":
                        tlVectorControl1.Operation = ToolOperation.PolyLine;
                        csOperation = CustomOperation.OP_MeasureDistance;
                        break;
                    //case "ButtonItem2":
                    //    break;
                    #endregion
                    #region 无功优化参数维护
                    case "VoltLimit":
                        break;
                    case "GeneratorLimit":
                        break;
                    case "TransformLimit":
                        break;
                    case "SVC":
                        break;
                    #endregion
                    #region 基础图元
                    case "mLayer":
                        tlVectorControl1.LayerManager();
                        break;
                    case "mDecreaseView":
                        tlVectorControl1.Operation = ToolOperation.DecreaseView;

                        break;
                    case "mIncreaseView":

                        tlVectorControl1.Operation = ToolOperation.IncreaseView;
                        break;
                    case "mRoam":
                        tlVectorControl1.Operation = ToolOperation.Roam;

                        break;
                    case "mSelect":
                        tlVectorControl1.Operation = ToolOperation.Select;
                        break;
                    case "mSel":

                        tlVectorControl1.Operation = ToolOperation.FreeTransform;
                        break;
                    //case "mFreeTransform":
                    //    tlVectorControl1.Operation = ToolOperation.FreeTransform;

                    //    break;
                    case "mFreeLines"://锁套
                        tlVectorControl1.Operation = ToolOperation.FreeLines;

                        break;
                    case "mFreePath":
                        tlVectorControl1.Operation = ToolOperation.FreePath;

                        break;
                    case "mShapeTransform":
                        tlVectorControl1.Operation = ToolOperation.ShapeTransform;

                        break;
                    case "mAngleRectangle":
                        tlVectorControl1.Operation = ToolOperation.AngleRectangle;

                        break;
                    case "mEllipse":
                        tlVectorControl1.Operation = ToolOperation.Ellipse;

                        break;
                    case "mLine":
                        tlVectorControl1.Operation = ToolOperation.ConnectLine_Polyline;

                        break;
                    case "mPolyline":
                        tlVectorControl1.Operation = ToolOperation.PolyLine;

                        break;
                    case "mConnectLine":
                      tlVectorControl1.Operation = ToolOperation.ConnectLine;
                        //tlVectorControl1.Operation = ToolOperation.ConnectLine_Polyline;
                        break;

                    case "mPolygon":
                        tlVectorControl1.Operation = ToolOperation.Polygon;

                        break;
                    case "mImage":
                        tlVectorControl1.Operation = ToolOperation.Image;
                        break;
                    case "mText":
                        tlVectorControl1.Operation = ToolOperation.Text;
                        break;
                    case "mBezier":
                        tlVectorControl1.Operation = ToolOperation.Bezier;

                        break;
                    case "ButtonItem2":

                        break;
                    case "ButtonItem8":

                        break;
                    case "mCheck":
                        break;
                    case "niula":
                        break;
                    case "pq":

                        break;

                    case "GaussSeidel":

                        break;
                    case "PowerLossCal":

                        break;
                    case "N_RZYz":

                        break;
                    case "WebRela":                        //进行网络N-1检验

                        break;
                    case "TransRela":                       //进行变压器N-1检验

                        break;
                    case "Shortibut":
                        if (!addcheck())  //检验是不是还有元件需要添加

                            return;
                        ElectricShorti elc = new ElectricShorti();
                       string strID =tlVectorControl1.SVGDocument.SvgdataUid;
                        //elc.CheckDL(strID, 100);
                        int n3 = 0;
                        ShortTform shorttype = new ShortTform();
                        frnReport wduanlu = new frnReport();
                        wduanlu.Owner = this;
                        wduanlu.Text = this.Text;
                        wduanlu.Show();
                        wduanlu.ShowText += "进行相关设置\t" + System.DateTime.Now.ToString();
                        shorttype.ShowDialog();
                        if (shorttype.DialogResult == DialogResult.OK)
                        {
                            switch (shorttype.DuanluType)
                            {
                                case "单相接地":
                                    n3 = 1;
                                    break;

                                case "两相接地":
                                    n3 = 3;
                                    break;
                                case "两相故障":
                                    n3 = 2;
                                    break;
                                case "三相故障":
                                    n3 = 0;
                                    break;

                            }
                            elc.OutType = shorttype.Mathindex;
                        }
                        //elc.P1 = strID; elc.P2 = this.ProjectUID; elc.P3 = n3; elc.P4 = 100;
                        //Thread wait = new Thread(new ThreadStart(elc.temp));
                        //wait.Start();
                       // WaitDialogForm wait = null;
                        try
                        {
                            //wait = new WaitDialogForm("", "正在处理数据, 请稍候...");
                            elc.AllShort(strID, this.ProjectUID, n3, 100,wduanlu);
                           // wait.Close();
                        }
                        catch (Exception exc)
                        {
                            Debug.Fail(exc.Message);
                            HandleException.TryCatch(exc);
                            //wait.Close();
                            wduanlu.ShowText += "\r\n短路计算失败" + System.DateTime.Now.ToString();
                            return;
                        }

                        break;
                    case "ZLcheck":

                       elc = new ElectricShorti();

                        strID = tlVectorControl1.SVGDocument.SvgdataUid;
                        WaitDialogForm wait = null;
                        try
                        {
                            wait = new WaitDialogForm("", "正在处理数据, 请稍候...");
                            wait.Close();
                            elc.Allshortcheck(strID, this.ProjectUID, 100, 3);

                        }
                        catch (Exception exc)
                        {
                            Debug.Fail(exc.Message);
                            Itop.Client.Common.HandleException.TryCatch(exc);
                            wait.Close();
                            return;
                        }

                       // Allshortcheck(3);
                        dotNetBarManager1.Bars["bar2"].GetItem("ZLcheck").Enabled = false;
                        dotNetBarManager1.Bars["bar2"].GetItem("Jiaoliucheck").Enabled = true;
                        //dotNetBarManager1.Bars["bar2"].GetItem("DLqiOutResult").Enabled =true;
                        break;
                    case "Jiaoliucheck":
                       elc = new ElectricShorti();

                        strID = tlVectorControl1.SVGDocument.SvgdataUid;
                     wait = null;
                        try
                        {
                            wait = new WaitDialogForm("", "正在处理数据, 请稍候...");
                            wait.Close();
                            elc.Allshortcheck(strID, this.ProjectUID, 100, 2);

                        }
                        catch (Exception exc)
                        {
                            Debug.Fail(exc.Message);
                            Itop.Client.Common.HandleException.TryCatch(exc);
                            wait.Close();
                            return;

                        }
                       // Allshortcheck(2);
                        dotNetBarManager1.Bars["bar2"].GetItem("Jiaoliucheck").Enabled = false;
                        dotNetBarManager1.Bars["bar2"].GetItem("ZLcheck").Enabled = true;
                        break;
                    case "dd":
                        //SubPrint = true;
                        tlVectorControl1.Operation = ToolOperation.InterEnclosurePrint;
                        break;

                    case "NiulaResult":

                        break;
                    case "GaussSeidelResult":

                        break;
                    case "N_RZYzResult":

                        break;
                    case "VoltEvaluation":
                        break;
                    case "PowerLoss":

                        break;
                    case "ZLPResult1":

                        break;

                    case "mDLR":

                        break;

                    case "mEnclosure":
                        tlVectorControl1.Operation = ToolOperation.Enclosure;

                        break;

                    case "mGroup":
                        tlVectorControl1.Group();
                        break;
                    case "mUnGroup":
                        tlVectorControl1.UnGroup();
                        break;
                    case "mlinelx":
                        tlVectorControl1.Operation = ToolOperation.ConnectLine_Line;
                        break;
                    case "mzxlx":
                        tlVectorControl1.Operation = ToolOperation.ConnectLine_Rightangle;
                        break;
                    case "mqxlx":
                        tlVectorControl1.Operation = ToolOperation.ConnectLine_Spline;
                        break;
                    case "mqzlx":
                        tlVectorControl1.Operation = ToolOperation.ConnectLine_Polyline;
                        break;
                    case "mCJ1":
                        tlVectorControl1.Operation = ToolOperation.PolyLine;
                        csOperation = CustomOperation.OP_MeasureDistance;
                        break;
                    case "powerFactor":

                        break;
                    #endregion

                    #region 视图
                    case "mOption":
                        tlVectorControl1.SetOption();
                        break;
                    case "mAirscape":
                        frmAirscape fAir = new frmAirscape();
                        fAir.InitData(tlVectorControl1);
                        fAir.Owner = this;
                        fAir.ShowInTaskbar = false;
                        fAir.Top = Screen.PrimaryScreen.WorkingArea.Height - 250;
                        fAir.Left = Screen.PrimaryScreen.WorkingArea.Width - 300;
                        fAir.Show();
                        break;
                    case "btTL":
                        frmGlebeTypeList fgle = new frmGlebeTypeList();
                        fgle.Show();
                        break;
                    #endregion

                    #region 布局,对齐,顺序
                    case "mRotate":
                        if (btItem.Tag is ButtonItem)
                        {
                            btItem = btItem.Tag as ButtonItem;
                            tlVectorControl1.FlipX();

                        }
                        else
                        {
                            tlVectorControl1.FlipX();
                        }
                        break;
                    case "mToH":

                        tlVectorControl1.FlipX();
                        //this.rotateButton.Tag = btItem;
                        //this.rotateButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mToV":
                        tlVectorControl1.FlipY();
                        //this.rotateButton.Tag = btItem;
                        //this.rotateButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mToLeft":
                        tlVectorControl1.RotateSelection(-90f);
                        ////this.rotateButton.Tag = btItem;
                        ////this.rotateButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mToRight":
                        tlVectorControl1.RotateSelection(90f);
                        //this.rotateButton.Tag = btItem;
                        //this.rotateButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mAlign":
                        if (btItem.Tag is ButtonItem)
                        {
                            btItem = btItem.Tag as ButtonItem;
                            tlVectorControl1.Align(AlignType.Left);

                        }
                        else
                        {
                            tlVectorControl1.Align(AlignType.Left);

                        }
                        tlVectorControl1.Refresh();
                        break;
                    case "mAlignLeft":
                        tlVectorControl1.Align(AlignType.Left);
                        this.alignButton.ImageIndex = btItem.ImageIndex;
                        this.alignButton.Tag = btItem;
                        tlVectorControl1.Refresh();
                        break;
                    case "mAlignRight":
                        tlVectorControl1.Align(AlignType.Right);
                        this.alignButton.ImageIndex = btItem.ImageIndex;
                        this.alignButton.Tag = btItem;
                        tlVectorControl1.Refresh();
                        break;
                    case "mAlignTop":
                        tlVectorControl1.Align(AlignType.Top);
                        this.alignButton.ImageIndex = btItem.ImageIndex;
                        this.alignButton.Tag = btItem;
                        tlVectorControl1.Refresh();
                        break;
                    case "mAlignBottom":
                        tlVectorControl1.Align(AlignType.Bottom);
                        this.alignButton.ImageIndex = btItem.ImageIndex;
                        this.alignButton.Tag = btItem;
                        tlVectorControl1.Refresh();
                        break;
                    case "mAlignHorizontalCenter":
                        tlVectorControl1.Align(AlignType.HorizontalCenter);
                        this.alignButton.ImageIndex = btItem.ImageIndex;
                        this.alignButton.Tag = btItem;
                        tlVectorControl1.Refresh();
                        break;
                    case "mAlignVerticalCenter":
                        tlVectorControl1.Align(AlignType.VerticalCenter);
                        this.alignButton.ImageIndex = btItem.ImageIndex;
                        this.alignButton.Tag = btItem;
                        tlVectorControl1.Refresh();
                        break;
                    case "mOrder":
                        if (btItem.Tag is ButtonItem)
                        {
                            btItem = btItem.Tag as ButtonItem;
                            tlVectorControl1.ChangeLevel(LevelType.Top);

                        }
                        else
                        {
                            tlVectorControl1.ChangeLevel(LevelType.Top);
                        }

                        break;
                    case "mGoTop":
                        tlVectorControl1.ChangeLevel(LevelType.Top);
                        this.orderButton.Tag = btItem;
                        this.orderButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mGoUp":
                        tlVectorControl1.ChangeLevel(LevelType.Up);
                        this.orderButton.Tag = btItem;
                        this.orderButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mGoDown":
                        tlVectorControl1.ChangeLevel(LevelType.Down);
                        this.orderButton.Tag = btItem;
                        this.orderButton.ImageIndex = btItem.ImageIndex;
                        break;
                    case "mGoBottom":
                        tlVectorControl1.ChangeLevel(LevelType.Bottom);
                        this.orderButton.Tag = btItem;
                        this.orderButton.ImageIndex = btItem.ImageIndex;
                        break;
                    #endregion
                    #region 图元操作
                    case "mCopy":
                        tlVectorControl1.Copy();
                        break;
                    case "mCut":
                        tlVectorControl1.Cut();
                        break;
                    case "mPaste":
                        tlVectorControl1.Paste();
                        break;
                    case "mDelete":
                        if (tlVectorControl1.SVGDocument.CurrentElement is SVG)
                        {
                        }
                        else
                        {
                            if (MessageBox.Show("确定要删除么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                SvgElementCollection collection = tlVectorControl1.SVGDocument.SelectCollection;
                                foreach (XmlElement element in collection)
                                {
                                    PSPDEV pspDev = new PSPDEV();
                                    pspDev.EleID = element.GetAttribute("id");
                                    pspDev.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                                    pspDev = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVBySvgUIDandEleID", pspDev);
                                    Services.BaseService.Delete<PSPDEV>(pspDev);
                                }
                                tlVectorControl1.Delete();
                            }

                        }
                        break;
                    case "mUodo":
                        tlVectorControl1.Undo();
                        break;
                    case "mRedo":
                        tlVectorControl1.Redo();
                        break;
                    #endregion
                    #region 业务操作

                    case "mXLine":
                        tlVectorControl1.Operation = ToolOperation.Select;
                        tlVectorControl1.Operation = ToolOperation.XPolyLine;
                        break;
                    case "mYLine":
                        tlVectorControl1.Operation = ToolOperation.Select;
                        tlVectorControl1.Operation = ToolOperation.YPolyLine;
                        break;

                    case "mSaveGroup":
                        if (tlVectorControl1.SVGDocument.SelectCollection.Count > 1)
                        {
                            string content = "<svg>";
                            SvgElementCollection col = tlVectorControl1.SVGDocument.SelectCollection;
                            for (int i = 0; i < col.Count; i++)
                            {
                                SvgElement _e = (SvgElement)col[i];
                                if (_e.ID != "svg")
                                {
                                    content = content + _e.OuterXml;
                                }
                            }
                            RectangleF rect = tlVectorControl1.DrawArea.viewer.SelectedViewRectangle;

                            content = content + "</svg>";
                            frmSaveGroup fm = new frmSaveGroup();
                            fm.rect = rect;
                            fm.Content = content;
                            fm.ShowDialog();
                        }
                        else
                        {
                            MessageBox.Show("请至少选择2个图元。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        break;

                    case "mInsert":
                        frmUseGroup fg = new frmUseGroup();
                        if (fg.ShowDialog() == DialogResult.OK)
                        {
                            UseGroup u = fg.SelectedUseGroup;
                            if (u != null)
                            {
                                frmXY xy = new frmXY();
                                if (xy.ShowDialog() == DialogResult.OK)
                                {
                                    decimal x = xy.GetX();
                                    decimal y = xy.GetY();
                                    string content = u.Content;
                                    XmlDocument doc = new XmlDocument();
                                    doc.LoadXml(u.Content);
                                    XmlNodeList list = doc.ChildNodes;
                                    XmlNode _node = list[0];
                                    XmlNodeList sonlist = _node.ChildNodes;
                                    XmlElement ele = tlVectorControl1.SVGDocument.CreateElement("g");
                                    ele.SetAttribute("layer", SvgDocument.currentLayer);
                                    for (int i = 0; i < sonlist.Count; i++)
                                    {
                                        XmlNode _sonnode = sonlist[i];
                                        //string str = _sonnode.OuterXml;
                                        if (_sonnode.Name == "use")
                                        {
                                            string sid = ((XmlElement)_sonnode).GetAttribute("xlink:href");
                                            XmlNode _snode = symbolSelector.SymbolDoc.SelectSingleNode("//*[@id='" + sid.Substring(1) + "']");
                                            tlVectorControl1.SVGDocument.AddDefsElement((SvgElement)_snode);
                                        }
                                        ele.AppendChild(_sonnode);
                                        string ss = ele.OuterXml;
                                    }
                                    //RectangleF r=((Group)ele).GetBounds();
                                    string tr = "matrix(1,0,0,1,";

                                    tr = tr + Convert.ToString(x - Convert.ToDecimal(u.X)) + ",";
                                    tr = tr + Convert.ToString(y - Convert.ToDecimal(u.Y)) + ")";

                                    ele.SetAttribute("transform", tr);
                                    // transform="matrix(1,0,0,1,2558.82,-352.94)"
                                    tlVectorControl1.SVGDocument.RootElement.AppendChild(ele);
                                    tlVectorControl1.SVGDocument.SelectCollection.Clear();
                                    tlVectorControl1.SVGDocument.SelectCollection.Add((SvgElement)ele);
                                    tlVectorControl1.UnGroup();
                                    // tlVectorControl1.Refresh();
                                }
                            }
                        }
                        break;
                    case "PSPIdleOptimize":
                        break;
                    #endregion
                    #region 参数维护
                    case "mNodeParam":

                        break;
                    case "mLineParam":

                        break;
                    case "mWire":

                        break;
                    case "nTransformLineParam":

                        break;
                    case "nGNDLineParam":

                        break;
                    case "mLineDL":

                        break;
                    case "mFadianDL":

                        break;
                    case "mConvert":

                        break;

                    #endregion
                }
            }
        }
예제 #2
0
        private void ZLcheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ElectricShorti elc = new ElectricShorti();
            //TreeListNode node = treeList1.FocusedNode;
            if (string.IsNullOrEmpty(strID))
            {
                MessageBox.Show("����ѡ��������㷽����", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
               // strID = node["ID"].ToString();
            WaitDialogForm wait = null;
            try {
                wait = new WaitDialogForm("", "���ڴ�������, ���Ժ�...");
                wait.Close();
                elc.Allshortcheck(strID, this.ProjectUID, 100, 3);

            } catch (Exception exc) {
                Debug.Fail(exc.Message);
                Itop.Client.Common.HandleException.TryCatch(exc);
                wait.Close();
                return;
            }
        }