示例#1
0
        protected override void Edit()
        {
            TreeListNode node = treeList1.FocusedNode;

            if (node != null)
            {
                string         id = node["ID"].ToString();
                PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                pd.ID        = id;
                pd.Name      = node["Name"].ToString();
                pd.Class     = node["Class"].ToString();
                pd.FileType  = node["FileType"].ToString();
                pd.ProjectID = node["ProjectID"].ToString();
                frmNewProject frmprojectDLG = new frmNewProject();
                frmprojectDLG.Name     = pd.Name;
                frmprojectDLG.FileType = pd.FileType;
                if (frmprojectDLG.ShowDialog() == DialogResult.OK)
                {
                    node["Name"] = frmprojectDLG.Name;
                    pd.Name      = frmprojectDLG.Name;
                    pd.FileType  = frmprojectDLG.FileType;
                    UCDeviceBase.DataService.Update("UpdatePSP_ELCPROJECT", pd);
                    SVGFILE svgFile = new SVGFILE();
                    svgFile.SUID = pd.ID;
                    svgFile      = (SVGFILE)Services.BaseService.GetObject("SelectSVGFILEByKey", svgFile);
                    if (svgFile != null)
                    {
                        svgFile.FILENAME = pd.Name;
                        UCDeviceBase.DataService.Update <SVGFILE>(svgFile);
                    }

                    treeList1.Refresh();
                }
            }
        }
示例#2
0
 protected override void Add()
 {
     frmNewProject frmprojectDLG = new frmNewProject();
     frmprojectDLG.Name = "";
     if (frmprojectDLG.ShowDialog() == DialogResult.OK) {
         PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
         pd.Name = frmprojectDLG.Name;
         pd.FileType = frmprojectDLG.FileType;
         pd.Class = System.DateTime.Now.ToString();
         pd.ProjectID = Itop.Client.MIS.ProgUID;
         UCDeviceBase.DataService.Create<PSP_ELCPROJECT>(pd);
         DataRow row = datatable.NewRow();
         Itop.Common.DataConverter.ObjectToRow(pd, row);
         datatable.Rows.Add(row);
     }
 }
示例#3
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow node = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (node != null)
            {
                string         id = node["ID"].ToString();
                PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                pd.ID         = id;
                pd.Name       = node["Name"].ToString();
                pd.Class      = node["Class"].ToString();
                pd.FileType   = node["FileType"].ToString();
                pd.BelongYear = node["BelongYear"].ToString();
                pd.ProjectID  = node["ProjectID"].ToString();
                frmNewProject frmprojectDLG = new frmNewProject();
                if (pd.FileType == "潮流")
                {
                    frmprojectDLG.flag = false;
                }
                else
                {
                    frmprojectDLG.flag = true;
                }

                frmprojectDLG.Name       = pd.Name;
                frmprojectDLG.FileType   = pd.FileType;
                frmprojectDLG.BelongYear = pd.BelongYear;
                frmprojectDLG.init();
                if (frmprojectDLG.ShowDialog() == DialogResult.OK)
                {
                    node["Name"]       = frmprojectDLG.Name;
                    pd.Name            = frmprojectDLG.Name;
                    pd.FileType        = frmprojectDLG.FileType;
                    pd.BelongYear      = frmprojectDLG.BelongYear;
                    node["BelongYear"] = frmprojectDLG.BelongYear;
                    UCDeviceBase.DataService.Update("UpdatePSP_ELCPROJECT", pd);
                    SVGFILE svgFile = new SVGFILE();
                    svgFile.SUID = pd.ID;
                    svgFile      = (SVGFILE)Services.BaseService.GetObject("SelectSVGFILEByKey", svgFile);
                    if (svgFile != null)
                    {
                        svgFile.FILENAME = pd.Name;
                        UCDeviceBase.DataService.Update <SVGFILE>(svgFile);
                    }
                }
            }
        }
示例#4
0
        protected override void Add()
        {
            frmNewProject frmprojectDLG = new frmNewProject();

            frmprojectDLG.Name = "";
            if (frmprojectDLG.ShowDialog() == DialogResult.OK)
            {
                PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                pd.Name      = frmprojectDLG.Name;
                pd.FileType  = frmprojectDLG.FileType;
                pd.Class     = System.DateTime.Now.ToString();
                pd.ProjectID = Itop.Client.MIS.ProgUID;
                UCDeviceBase.DataService.Create <PSP_ELCPROJECT>(pd);
                DataRow row = datatable.NewRow();
                Itop.Common.DataConverter.ObjectToRow(pd, row);
                datatable.Rows.Add(row);
            }
        }
示例#5
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmNewProject frmprojectDLG = new frmNewProject();

            frmprojectDLG.flag = pspflag;
            frmprojectDLG.init();
            frmprojectDLG.Name = "";
            if (frmprojectDLG.ShowDialog() == DialogResult.OK)
            {
                PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                pd.Name       = frmprojectDLG.Name;
                pd.FileType   = frmprojectDLG.FileType;
                pd.Class      = System.DateTime.Now.ToString();
                pd.BelongYear = frmprojectDLG.BelongYear;
                pd.ProjectID  = Itop.Client.MIS.ProgUID;
                UCDeviceBase.DataService.Create <PSP_ELCPROJECT>(pd);
                DataRow row = dataSvg.NewRow();
                Itop.Common.DataConverter.ObjectToRow(pd, row);
                dataSvg.Rows.Add(row);
            }
        }
示例#6
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow node =gridView1.GetDataRow(gridView1.FocusedRowHandle);
            if (node != null)
            {
                string id = node["ID"].ToString();
                PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                pd.ID = id;
                pd.Name = node["Name"].ToString();
                pd.Class = node["Class"].ToString();
                pd.FileType = node["FileType"].ToString();
                pd.BelongYear = node["BelongYear"].ToString();
                pd.ProjectID = node["ProjectID"].ToString();
                frmNewProject frmprojectDLG = new frmNewProject();
                if (pd.FileType == "潮流")
                {
                    frmprojectDLG.flag = false;
                }
                else
                {
                    frmprojectDLG.flag = true;
                }

                frmprojectDLG.Name = pd.Name;
                frmprojectDLG.FileType = pd.FileType;
                frmprojectDLG.BelongYear = pd.BelongYear;
                frmprojectDLG.init();
                if (frmprojectDLG.ShowDialog() == DialogResult.OK)
                {
                    node["Name"] = frmprojectDLG.Name;
                    pd.Name = frmprojectDLG.Name;
                    pd.FileType = frmprojectDLG.FileType;
                    pd.BelongYear = frmprojectDLG.BelongYear;
                    node["BelongYear"] = frmprojectDLG.BelongYear;
                    UCDeviceBase.DataService.Update("UpdatePSP_ELCPROJECT", pd);
                    SVGFILE svgFile = new SVGFILE();
                    svgFile.SUID = pd.ID;
                    svgFile = (SVGFILE)Services.BaseService.GetObject("SelectSVGFILEByKey", svgFile);
                    if (svgFile != null)
                    {
                        svgFile.FILENAME = pd.Name;
                        UCDeviceBase.DataService.Update<SVGFILE>(svgFile);

                    }

                }
            }
        }
示例#7
0
 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     frmNewProject frmprojectDLG = new frmNewProject();
     frmprojectDLG.flag = pspflag;
     frmprojectDLG.init();
     frmprojectDLG.Name = "";
     if (frmprojectDLG.ShowDialog() == DialogResult.OK)
     {
         PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
         pd.Name = frmprojectDLG.Name;
         pd.FileType = frmprojectDLG.FileType;
         pd.Class = System.DateTime.Now.ToString();
         pd.BelongYear = frmprojectDLG.BelongYear;
         pd.ProjectID = Itop.Client.MIS.ProgUID;
         UCDeviceBase.DataService.Create<PSP_ELCPROJECT>(pd);
         DataRow row = dataSvg.NewRow();
         Itop.Common.DataConverter.ObjectToRow(pd, row);
         dataSvg.Rows.Add(row);
     }
 }
        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
                }
            }
        }
示例#9
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":
                        frmNewProject frmprojectDLG = new frmNewProject();
                        frmprojectDLG.Name = "";
                        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);
                                //if (this.Text.Contains())
                                //{
                                //}
                                this.Text = frmname + "-" + pd.Name;
                            }
                            this.Show();
                            jxtbar(1);
                            LoadShape("symbol20.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(false);
                        if (op.ShowDialog() == DialogResult.OK) {
                            if (op.FileSUID != null) {
                                Open(op.FileSUID);
                                intdata(op.FileSUID);
                                //if (this.Text.Contains())
                                //{
                                //}
                                this.Text = frmname + "-" + op.FileName;
                            }
                            this.Show();
                            jxtbar(1);
                            LoadShape("symbol20.xml");

                        }
                        break;
                    case "barDeviceData":
                        frmProjectManager frmPdlg = new frmProjectManager();
                        frmPdlg.SetMode(tlVectorControl1.SVGDocument.SvgdataUid);
                        frmPdlg.ShowDialog();
                        break;
                    case "btExSymbol":
                        tlVectorControl1.ExportSymbol();
                        break;
                    case "mjxt"://导入接线图
                        ImportJxt2 jxt = new ImportJxt2(tlVectorControl1);
                        jxt.Import();
                        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 "mSaveAs":
                        tlVectorControl1.SaveAs();
                        break;
                    case "mExit":
                        this.Close();
                        break;
                    case "bt1":
                        //InitTK();
                        break;
                    case "bt2":
                        break;
                    case "mPriSet":
                        this.tlVectorControl1.Operation = ToolOperation.InterEnclosurePrint;
                        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 "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 "butRef":
                        Ref();
                        break;
                    case "mPolyline":
                        tlVectorControl1.Operation = ToolOperation.PolyLine;

                        break;
                    case "mConnectLine":
                        tlVectorControl1.Operation = ToolOperation.ConnectLine;
                        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 "DFSResult":
                        frmSetPower frmSPR = new frmSetPower();
                        frmSPR.ProjectID = this.tlVectorControl1.SVGDocument.SvgdataUid;
                        if (frmSPR.ShowDialog() == DialogResult.OK) {
                            ElectricLoadCal elcDFS = new ElectricLoadCal();
                            //string strCon1 = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "'";
                            //string strCon2 = null;
                            //string strCon = null;
                            //strCon2 = " AND Type = '05'";
                            //strCon = strCon1 + strCon2;
                            //IList listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                            //strCon2 = " AND Type = '01'";
                            //strCon = strCon1 + strCon2;
                            //IList listMX = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                            IList branchList = new List<PSPDEV>();
                            IList busList = new List<PSPDEV>();
                            //foreach (PSPDEV dev in listXL)
                            //{
                            //    if (dev.Number>=14)
                            //    {
                            //        branchList.Add(dev);
                            //    }
                            //}
                            //foreach (PSPDEV dev in listMX)
                            //{
                            //    if (dev.Number<=3)
                            //    {
                            //        busList.Add(dev);
                            //    }
                            //}
                            busList = frmSPR.ListPower;
                            branchList = frmSPR.ListBranch;
                            if (busList != null) {
                                elcDFS.DFSER(branchList, busList, tlVectorControl1.SVGDocument.SvgdataUid, 100, 1);
                            }
                        }
                        break;
                    case "DFS":
                        frmSetPower frmSP = new frmSetPower();
                        frmSP.ProjectID = this.tlVectorControl1.SVGDocument.SvgdataUid;
                        if (frmSP.ShowDialog() == DialogResult.OK) {
                            ElectricLoadCal elcDFS = new ElectricLoadCal();
                            //string strCon1 = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "'";
                            //string strCon2 = null;
                            //string strCon = null;
                            //strCon2 = " AND Type = '05'";
                            //strCon = strCon1 + strCon2;
                            //IList listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                            //strCon2 = " AND Type = '01'";
                            //strCon = strCon1 + strCon2;
                            //IList listMX = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                            IList branchList = new List<PSPDEV>();
                            IList busList = new List<PSPDEV>();
                            //foreach (PSPDEV dev in listXL)
                            //{
                            //    if (dev.Number>=14)
                            //    {
                            //        branchList.Add(dev);
                            //    }
                            //}
                            //foreach (PSPDEV dev in listMX)
                            //{
                            //    if (dev.Number<=3)
                            //    {
                            //        busList.Add(dev);
                            //    }
                            //}
                            busList = frmSP.ListPower;
                            branchList = frmSP.ListBranch;
                            if (busList != null) {
                                elcDFS.DFS(branchList, busList, tlVectorControl1.SVGDocument.SvgdataUid, 100);
                                ShowResult(0);
                            }
                        }

                        break;
                    case "niula":
                        frnReport wFrom = new frnReport();
                        wFrom.Owner = this;
                        wFrom.Show();
                        wFrom.Text = this.Text + "—牛拉法潮流计算";
                        wFrom.ShowText += "正在收集信息\t" + System.DateTime.Now.ToString();
                        ElectricLoadCal elc = new ElectricLoadCal();
                        elc.LFC(tlVectorControl1.SVGDocument.SvgdataUid, 1, 100, wFrom);
                        ShowResult(0, wFrom);
                        break;
                    case "pq":
                        frnReport wFromPQ = new frnReport();
                        wFromPQ.Owner = this;
                        wFromPQ.Show();
                        wFromPQ.Text = this.Text + "—PQ分解法潮流计算";
                        wFromPQ.ShowText += "正在收集信息\t" + System.DateTime.Now.ToString();
                        ElectricLoadCal elcPQ = new ElectricLoadCal();
                        elcPQ.LFC(tlVectorControl1.SVGDocument.SvgdataUid, 2, 100, wFromPQ);
                        ShowResult(1, wFromPQ);
                        break;

                    case "GaussSeidel":
                        frnReport wFromGS = new frnReport();
                        wFromGS.Owner = this;
                        wFromGS.Show();
                        wFromGS.Text = this.Text + "—高斯赛德尔迭代法潮流计算";
                        wFromGS.ShowText += "正在收集信息\t" + System.DateTime.Now.ToString();
                        ElectricLoadCal elcGS = new ElectricLoadCal();
                        elcGS.LFC(tlVectorControl1.SVGDocument.SvgdataUid, 3, 100, wFromGS);
                        ShowResult(2, wFromGS);
                        break;
                    case "N_RZYz":
                        frnReport wFromZYZ = new frnReport();
                        wFromZYZ.Owner = this;
                        wFromZYZ.Show();
                        wFromZYZ.Text = this.Text + "—最有乘子法潮流计算";
                        wFromZYZ.ShowText += "正在收集信息\t" + System.DateTime.Now.ToString();
                        ElectricLoadCal elcN_RZYz = new ElectricLoadCal();
                        elcN_RZYz.LFC(tlVectorControl1.SVGDocument.SvgdataUid, 4, 100, wFromZYZ);
                        ShowResult(3, wFromZYZ);
                        break;
                    case "niulaNfh":
                        elc = new ElectricLoadCal();
                        elc.LFCS(tlVectorControl1.SVGDocument.SvgdataUid, 4, 100);
                        ShowResult(3);
                        break;
                    case "WebRela":                        //进行网络N-1检验

                        ElectricRelcheck elcRela = new ElectricRelcheck();
                        elcRela.WebCalAndPrint(tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID, 100);
                        break;
                    case "TransRela":                       //进行变压器N-1检验

                        break;
                    case "Shortibut":

                        break;
                    case "dd":
                        //SubPrint = true;
                        tlVectorControl1.Operation = ToolOperation.InterEnclosurePrint;
                        break;

                    case "NiulaResult":
                        ElectricLoadCal elcResult = new ElectricLoadCal();
                        elcResult.LFCER(tlVectorControl1.SVGDocument.SvgdataUid, 1, 100);
                        break;
                    case "PQResult":
                        ElectricLoadCal elcPQResult = new ElectricLoadCal();
                        elcPQResult.LFCER(tlVectorControl1.SVGDocument.SvgdataUid, 2, 100);
                        break;
                    case "GaussSeidelResult":
                        ElectricLoadCal elcGSResult = new ElectricLoadCal();
                        elcGSResult.LFCER(tlVectorControl1.SVGDocument.SvgdataUid, 3, 100);
                        break;
                    case "N_RZYzResult":
                        ElectricLoadCal elcNZResult = new ElectricLoadCal();
                        elcNZResult.LFCER(tlVectorControl1.SVGDocument.SvgdataUid, 4, 100);
                        break;
                    case "NLnFHresult":
                        elc = new ElectricLoadCal();
                        elc.LFCERS(tlVectorControl1.SVGDocument.SvgdataUid, 4, 100);
                        break;
                    case "VoltEvaluation":
                        ElectricLoadCal elcVE = new ElectricLoadCal();
                        elcVE.VE(tlVectorControl1.SVGDocument.SvgdataUid, 100);
                        break;
                    case "PowerLossCal":
                        ElectricLoadCal elcPLResult = new ElectricLoadCal();
                        elcPLResult.PLE(tlVectorControl1.SVGDocument.SvgdataUid, 2, 100);
                        ShowPowerLoss();
                        break;
                    case "PowerLoss":
                        ElectricLoadCal elcPLE = new ElectricLoadCal();
                        elcPLE.PLE(tlVectorControl1.SVGDocument.SvgdataUid, 2, 100);
                        break;
                    case "ZLPResult1":

                        break;

                    case "mDLR":

                        break;
                    case "clearResult":
                        try {
                            XmlNodeList list = tlVectorControl1.SVGDocument.SelectNodes("svg/*[@flag='" + "1" + "']");

                            foreach (XmlNode node in list) {
                                SvgElement element = node as SvgElement;

                                tlVectorControl1.SVGDocument.CurrentElement = element;
                                tlVectorControl1.Delete();

                            }
                        } catch (System.Exception ex) {

                        }
                        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) {
                                    if (element is Text) {
                                        PSP_ElcDevice elcDEV = new PSP_ElcDevice();
                                        elcDEV.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                                        elcDEV.DeviceSUID = element.GetAttribute("Deviceid");
                                        Services.BaseService.Delete<PSP_ElcDevice>(elcDEV);
                                    }
                                }
                                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":
                        ElectricLoadCal elcORP = new ElectricLoadCal();
                        elcORP.ORP(tlVectorControl1.SVGDocument.SvgdataUid, 100);
                        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
                }
            }
        }
示例#10
0
        protected override void Edit()
        {
            TreeListNode node = treeList1.FocusedNode;
            if (node != null) {
                string id = node["ID"].ToString();
                PSP_ELCPROJECT pd = new PSP_ELCPROJECT();
                pd.ID = id;
                pd.Name = node["Name"].ToString();
                pd.Class = node["Class"].ToString();
                pd.FileType = node["FileType"].ToString();
                pd.ProjectID = node["ProjectID"].ToString();
                frmNewProject frmprojectDLG = new frmNewProject();
                frmprojectDLG.Name = pd.Name;
                frmprojectDLG.FileType = pd.FileType;
                if (frmprojectDLG.ShowDialog() == DialogResult.OK) {
                    node["Name"] = frmprojectDLG.Name;
                    pd.Name = frmprojectDLG.Name;
                    pd.FileType = frmprojectDLG.FileType;
                    UCDeviceBase.DataService.Update("UpdatePSP_ELCPROJECT", pd);
                    SVGFILE svgFile = new SVGFILE();
                    svgFile.SUID =pd.ID;
                    svgFile= (SVGFILE)Services.BaseService.GetObject("SelectSVGFILEByKey", svgFile);
                    if (svgFile!=null)
                    {
                        svgFile.FILENAME = pd.Name;
                        UCDeviceBase.DataService.Update<SVGFILE>(svgFile);

                    }

                    treeList1.Refresh();
                }
            }
        }