Пример #1
0
        public virtual CBase Clone(CBase _Parent)
        {
            CBase obj = (CBase)this.MemberwiseClone();

            obj.m_Parent = _Parent;
            return(obj);
        }
Пример #2
0
        public override void AddChild(CBase Child)
        {
            if (this.Children.IndexOf(Child) < 0)
            {
                this.Children.Add(Child);
                Child.Parent = this;
                Child.Locked = false;
                //Child.LayerName = this.LayerName;
            }

            if (this.Children.Count == 0)
            {
                return;
            }
            RectangleF ChildRect = Child.GetRect();

            if (Children.Count == 1)
            {
                FRect = ChildRect;
            }
            else
            {
                FRect = RectangleF.Union(FRect, ChildRect);
            }
            DrawPen.Width = Math.Max(Child.DrawPen.Width, DrawPen.Width);
            FWidth        = FRect.Width;
            FHight        = FRect.Height;
            FDrawing      = false;
        }
Пример #3
0
        private void frmChild_MouseDown(object sender, MouseEventArgs e)//鼠标点击
        {
            int    i      = 0;
            PointF MouseP = new PointF((e.X - frmMain.iLeftD) / frmMain.iWinFoucs, (e.Y - frmMain.iTopD) / frmMain.iWinFoucs);

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                for (i = ListTuYuan.Count - 1; i > -1; i--)
                {
                    CBase obj = (CBase)ListTuYuan[i];
                    if (obj.ElementType == LCElementType.Ring)
                    {
                        if (obj.Selected(MouseP))
                        {
                            CStation     Sta  = frmMain.staComm.GetStaByStaName("NJ301");
                            CProtcolFINS SPLC = (CProtcolFINS)Sta;
                            if (SPLC.System[0] == 7)
                            {
                                return;
                            }

                            CRing nRing = (CRing)obj;

                            string sVar = "AV" + nRing.ShowText.PadLeft(3, '0');
                            SPLC.SendAODO(sVar, 0, "DO");
                            break;
                        }
                    }
                }
            }
        }
Пример #4
0
        public static CBase CreateElement(CBase Parent, Object Owner)
        {
            switch (Type)
            {
            case LCElementType.TEXT:
                return(new CText("", Parent, Owner));

            case LCElementType.LINE:
                return(new CLine("", Parent, Owner));

            case LCElementType.RECTANGLE:
                return(new CRectangle("", Parent, Owner));

            case LCElementType.ELLIPS:
                return(new CEllips("", Parent, Owner));

            case LCElementType.IMAGECONTROL:
                return(new ImageControl("", Parent, Owner));

            case LCElementType.Pipe:
                return(new CPipe());

            case LCElementType.Ring:
                return(new CRing());

            case LCElementType.KJRuler:
                return(new KJRuler());

            //case LCElementType.ROUNDRECTANGLE:
            //     return new CRoundRectangle("", Parent, Owner);
            //case LCElementType.ARC:
            //    return new CArc("", Parent, Owner);
            //case LCElementType.GROUP:
            //    return new CGroup("", Parent, Owner);
            //case LCElementType.POLYLINE:
            //    return new CPolyLine("", Parent, Owner);

            /*case LCElementType.POLYGON:
             *  return new CPolygon("", Parent, Owner);
             * case LCElementType.PRG:
             *  return new CRectPRCG("",Parent,Owner);
             * case LCElementType.KuiXianPRCG:
             *  return new CKuiXianPRCG("",Parent,Owner);
             * case LCElementType.HISCURVECHART:
             *  return new CCurveChart(LCElementType.HISCURVECHART,"",Parent,Owner);
             * case LCElementType.REALCURVECHART:
             *  return new CCurveChart(LCElementType.REALCURVECHART,"",Parent,Owner);
             * case LCElementType.CHARGECURVECHART:
             *  return new CCurveChart(LCElementType.CHARGECURVECHART,"",Parent,Owner);
             * case LCElementType.TABLECONTROL:
             *  return new CTable("",Parent,Owner);
             * //case LCElementType.PRG:
             * //	return new CRectPRCG();*/
            default:
                return(null);
            }
        }
Пример #5
0
        public CTuYuan(String _Name, CBase _Parent, Object _Owner) : base(_Name, _Parent, _Owner)    //,m_isAddWidth(false)
        {
            m_RotateAngle = 0;
            Copy_Matrix   = new Matrix();

            m_FillOptions = new CFillOptions();
            //m_FillOptions.OnFillOptionChange = new FillOptionChangeEventHandler(this, CTuYuan.OnFillOptionChange);

            m_SolidBrush = (SolidBrush)(Brushes.Transparent.Clone());
            CartoonBrush = (SolidBrush)(Brushes.Transparent.Clone());
            m_HatchBrush = new HatchBrush(FillOptions.Hatch, FillOptions.ForeColor, FillOptions.BackColor);
        }
Пример #6
0
        public CBase(String _Name, CBase _Parent, Object _Owner)
        {
            //isflash = false;
            Name = _Name;
            if (Name == null)
            {
                Name = "";
            }
            Parent  = _Parent;
            m_Owner = _Owner;
            Locked  = false;
            Visible = true;
            Enabled = true;

            if (Parent != null)
            {
                m_Path = Parent.Path + "/" + Name;
            }

            //m_CartoonData = new CCartoonData;
            m_ElementType = LCElementType.POINTER;
            DrawPen       = (Pen)(Pens.DeepSkyBlue.Clone());

            m_fAngleAtPosition = 0;

            //FOnClick = new CProgram();
            ////FOnDoubleClick = new CProgram();
            //FOnMouseMoving = new CProgram();

            //m_Layer =  ((DrawChild )Owner).GetActiveLayer();
            //m_LayerName = "";
            Children           = new ArrayList();
            ReDians            = new ArrayList();
            FocusList          = new ArrayList();
            Points             = new ArrayList();
            fg                 = null;
            FDrawing           = true;
            EditingReDian      = false;
            myPathMatrix       = new Matrix();
            myGraphicsPath     = new GraphicsPath();
            SelectedDisWMargin = DISMARGIN;
            SelectedDisHMargin = DISMARGIN;
            //OnChangeName = null;
            //OnTransform = null;
            ObjectUndolst = new ArrayList();
            UndoPointer   = 0;
            FisLive       = false;
            //FTimer = null;
        }
Пример #7
0
        public CGroup(String _Name, CBase _Parent, Object _Owner)
            : base(_Name, _Parent, _Owner)
        {
            m_ElementType = LCElementType.GROUP;

            Children = new ArrayList();
            //SaveToIconLibItem = new ToolStripMenuItem();
            //SaveToIconLibItem.Image = (cli.safe_cast<System.Drawing.Image  >(resources.GetObject(L"tsmiGroup.Image")));
            //SaveToIconLibItem.Name = L"SaveToIconLibItem";
            //SaveToIconLibItem.Size = System.Drawing.Size(152, 22);
            //SaveToIconLibItem.Text = L"存入图形库";
            //SaveToIconLibItem.Click += new System.EventHandler(this, &CGroup.OnSaveToIconLib);
            SelectedDisWMargin = CBase.DISMARGIN;
            SelectedDisHMargin = CBase.DISMARGIN;
        }
Пример #8
0
        public static CBase CreateElement(String Name, LCElementType Type, CBase Parent, Object Owner)
        {
            //根据类型生成相应的元素对象
            switch (Type)
            {
            case LCElementType.TEXT:
                return(new CText(Name, Parent, Owner));

            case LCElementType.LINE:
                return(new CLine(Name, Parent, Owner));

            case LCElementType.RECTANGLE:
                return(new CRectangle(Name, Parent, Owner));

            case LCElementType.ELLIPS:
                return(new CEllips(Name, Parent, Owner));

            case LCElementType.IMAGECONTROL:
                return(new ImageControl(Name, Parent, Owner));

            //case LCElementType.ROUNDRECTANGLE:
            //    return new CRoundRectangle(Name, Parent, Owner);
            //case LCElementType.ARC:
            //    return new CArc(Name, Parent, Owner);
            //case LCElementType.GROUP:
            //    return new CGroup(Name, Parent, Owner);
            //case LCElementType.POLYLINE:
            //    return new CPolyLine(Name, Parent, Owner);

            /*case LCElementType.POLYGON:
             *  return new CPolygon(Name,Parent,Owner);
             * case LCElementType.ARC:
             *  return new CArc(Name,Parent,Owner);
             * case LCElementType.HISCURVECHART:
             *  return new CCurveChart(LCElementType.HISCURVECHART,Name,Parent,Owner);
             * case LCElementType.REALCURVECHART:
             *  return new CCurveChart(LCElementType.REALCURVECHART,Name,Parent,Owner);
             * case LCElementType.CHARGECURVECHART:
             *  return new CCurveChart(LCElementType.CHARGECURVECHART,Name,Parent,Owner);
             * case LCElementType.TABLECONTROL:
             *  return new CTable(Name,Parent,Owner);
             * //case LCElementType.PRG:
             * //	return new CRectPRCG();*/
            default:
                return(null);
            }
        }
Пример #9
0
 public CText(String _Name, CBase _Parent, Object _Owner) : base(_Name, _Parent, _Owner)
 {
     m_ElementType = LCElementType.TEXT;
     m_Background  = false;
     DrawFont      = new System.Drawing.Font("宋体", 16, GraphicsUnit.World);
     Text          = "文本";
     FontBrush     = new SolidBrush(System.Drawing.Color.DeepSkyBlue);
     //FontBrush =
     FExpression   = new CExpression();
     Updated       = false;
     TextFormat    = new StringFormat(StringFormat.GenericDefault);
     HorizonAlign  = StringAlignment.Near;
     VerticalAlign = StringAlignment.Center;
     AutoFit       = true;
     AutoWrap      = false;
     ValueFormat   = "General";
 }
Пример #10
0
        private void frmChild_MouseMove(object sender, MouseEventArgs e)//鼠标移动
        {
            PointF MouseP = new PointF((e.X - frmMain.iLeftD) / frmMain.iWinFoucs, (e.Y - frmMain.iTopD) / frmMain.iWinFoucs);

            for (int i = ListTuYuan.Count - 1; i > -1; i--)
            {
                CBase obj = (CBase)ListTuYuan[i];

                if (obj.ElementType == LCElementType.Ring)
                {
                    if (obj.Selected(MouseP))
                    {
                        this.Cursor = Cursors.Hand;
                        return;
                    }
                }
            }
            this.Cursor = Cursors.Default;
        }
Пример #11
0
 public ImageControl(String Name, CBase Parent, Object Owner)
 {
     this.m_ElementType               = LCElementType.IMAGECONTROL;
     m_RotateAngle                    = 0;
     this.m_Height                    = 50;
     this.m_Width                     = 50;
     m_ImageInfo                      = new ImageControlInfo();
     m_ImageInfo.m_DefaultImg         = new ImageInfo();
     m_ImageInfo.m_DefaultImg.m_iName = "defImg";
     m_ImageInfo.m_DefaultImg.m_iType = "png";
     m_ImageInfo.m_ImgList            = new ArrayList();
     m_gifActive                      = false;
     currentlyAnimating               = false;
     giftime = new Timer();
     giftime.Stop();
     //giftime.Tick += new EventHandler(this,&ImageControl.GifTimerProc);
     giftime.Interval = 80;
     LastUpdateIndex  = -1;
 }
Пример #12
0
 public virtual void Draw(Graphics g)
 {
     if (IconName == "断路器1分闸")
     {
         Name = IconName;
     }
     if (!Visible)
     {
         CBase parentbase = this;
         while (parentbase.Parent != null)
         {
             parentbase = parentbase.Parent;
         }
     }
     if (Children != null)
     {
         foreach (CBase Object in Children)
         {
             Object.Draw(g);
         }
     }
     DrawPoints(g);
 }
Пример #13
0
 public virtual void AddChild(CBase Child)
 {
 }
Пример #14
0
        public bool LoadFromXML()
        {
            XmlDocument myxmldoc = new XmlDocument();
            string      sPath    = CProject.sPrjPath + "\\IconLib\\" + IconName + ".yic";

            if (File.Exists(sPath))
            {
                myxmldoc.Load(sPath);
                //取图元
                string     xpath     = "Root/Misc";
                XmlElement childNode = (XmlElement)myxmldoc.SelectSingleNode(xpath);
                int        i         = 0;
                foreach (XmlElement item in childNode.ChildNodes)
                {
                    string sNodeName = item.Name;
                    string str1      = sNodeName.Substring(0, 2);
                    if ((sNodeName.Substring(0, 2) == "TY" || sNodeName.Substring(0, 2) == "KJ") && item.ChildNodes.Count > 0)
                    {
                        foreach (XmlElement TYNode in item.ChildNodes)
                        {
                            switch (TYNode.Name)
                            {
                            case "TYLine":
                                CElementFactory.SetClassIndex(LCElementType.LINE);
                                break;

                            case "TYText":
                                CElementFactory.SetClassIndex(LCElementType.TEXT);
                                break;

                            case "TYRect":
                                CElementFactory.SetClassIndex(LCElementType.RECTANGLE);
                                break;

                            case "TYEllipse":
                                CElementFactory.SetClassIndex(LCElementType.ELLIPS);
                                break;

                            case "TYRndRect":
                                CElementFactory.SetClassIndex(LCElementType.ROUNDRECTANGLE);
                                break;

                            case "TYArc":
                                CElementFactory.SetClassIndex(LCElementType.ARC);
                                break;

                            case "KJHotImage":
                                CElementFactory.SetClassIndex(LCElementType.IMAGECONTROL);
                                break;

                            case "KJIcon":
                                CElementFactory.SetClassIndex(LCElementType.GROUP);
                                break;

                            default:
                                continue;
                                //break;
                            }

                            CBase NewOb = CElementFactory.CreateElement(null, this);
                            if (NewOb == null)
                            {
                                continue;
                            }
                            NewOb.LoadFromXML(TYNode);
                            for (i = ListTuYuan.Count - 1; i > -1; i--)
                            {
                                Object Ob  = ListTuYuan[i];
                                Int32  iEO = ((CBase)Ob).iElementOrder;
                                if (NewOb.iElementOrder >= iEO)
                                {
                                    ListTuYuan.Insert(i + 1, NewOb);
                                    break;
                                }
                            }
                            if (i == -1)
                            {
                                ListTuYuan.Insert(0, NewOb);
                            }
                        }
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #15
0
        public void LoadWins()//读取Wins文件
        {
            /// 创建XmlDocument类的实例
            XmlDocument myxmldoc = new XmlDocument();

            myxmldoc.Load(cForm.sPath);

            string     xpath     = "FormWindow";
            XmlElement childNode = (XmlElement)myxmldoc.SelectSingleNode(xpath);

            cForm.LoadFromXML(childNode);

            //取图元
            xpath     = "FormWindow/Misc";
            childNode = (XmlElement)myxmldoc.SelectSingleNode(xpath);
            int i = 0;

            foreach (XmlElement item in childNode.ChildNodes)
            {
                string sNodeName = item.Name;
                string str1      = sNodeName.Substring(0, 2);
                if ((sNodeName.Substring(0, 2) == "TY" || sNodeName.Substring(0, 2) == "KJ") && item.ChildNodes.Count > 0)
                {
                    foreach (XmlElement TYNode in item.ChildNodes)
                    {
                        switch (TYNode.Name)
                        {
                        case "TYLine":
                            CElementFactory.SetClassIndex(LCElementType.LINE);
                            break;

                        case "TYText":
                            CElementFactory.SetClassIndex(LCElementType.TEXT);
                            break;

                        case "TYRect":
                            CElementFactory.SetClassIndex(LCElementType.RECTANGLE);
                            break;

                        case "TYEllipse":
                            CElementFactory.SetClassIndex(LCElementType.ELLIPS);
                            break;

                        case "TYRndRect":
                            CElementFactory.SetClassIndex(LCElementType.ROUNDRECTANGLE);
                            break;

                        case "TYZLine":
                            CElementFactory.SetClassIndex(LCElementType.POLYLINE);
                            break;

                        case "TYArc":
                            CElementFactory.SetClassIndex(LCElementType.ARC);
                            break;

                        case "KJHotImage":
                            CElementFactory.SetClassIndex(LCElementType.IMAGECONTROL);
                            break;

                        case "KJIcon":
                            CElementFactory.SetClassIndex(LCElementType.GROUP);
                            break;

                        case "TYRing":
                            CElementFactory.SetClassIndex(LCElementType.Ring);
                            break;

                        case "TYPipe":
                            CElementFactory.SetClassIndex(LCElementType.Pipe);
                            break;

                        default:
                            continue;
                            //break;
                        }

                        CBase NewOb = CElementFactory.CreateElement(null, this);
                        if (NewOb == null)
                        {
                            continue;
                        }
                        NewOb.LoadFromXML(TYNode);

                        if (NewOb.ElementType == LCElementType.Pipe)
                        {
                            CPipe CNum = (CPipe)NewOb;
                            if (CNum.bShowSet)
                            {
                                NumericUpDown nNumUD = new NumericUpDown();
                                CNumUpDown    cNumUD = new CNumUpDown(CNum.ValPF, CNum.SetWidth, 20, 13);
                                nNumUD.Font     = new Font("宋体", 13, GraphicsUnit.World);
                                nNumUD.Location = CNum.ValPF;
                                nNumUD.Maximum  = new decimal(new int[] { 65535, 0, 0, 0 });
                                nNumUD.Name     = CNum.Name;
                                nNumUD.Size     = new Size((int)CNum.SetWidth, 20);

                                nNumUD.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))));

                                nNumUD.UpDownAlign = LeftRightAlignment.Left;
                                nNumUD.TextAlign   = HorizontalAlignment.Right;
                                CVar nVar = frmMain.staComm.GetVarByStaNameVarName("NJ301", nNumUD.Name);
                                if (nVar != null)
                                {
                                    nNumUD.Value = new decimal(new int[] { (int)nVar.PLCValue[2], 0, 0, 0 });
                                }
                                else
                                {
                                    nNumUD.Value = new decimal(new int[] { 0, 0, 0, 0 });
                                }
                                nNumUD.ValueChanged += new EventHandler(nCon_ValueChanged);
                                cNumUD.nNumUD        = nNumUD;
                                ListNumericUpDown.Add(cNumUD);
                                this.Controls.Add(nNumUD);
                            }
                        }

                        for (i = ListTuYuan.Count - 1; i > -1; i--)
                        {
                            CBase Ob = (CBase)ListTuYuan[i];

                            Int32 iEO = Ob.iElementOrder;
                            if (NewOb.iElementOrder >= iEO)
                            {
                                ListTuYuan.Insert(i + 1, NewOb);
                                break;
                            }
                        }
                        if (i == -1)
                        {
                            ListTuYuan.Insert(0, NewOb);
                        }
                    }
                } //if ((sNodeName.Substring(0, 2) == "TY
            }     //foreach (XmlElement item in childNode.ChildNodes)

            //对应图元
            foreach (CBase nTY in ListTuYuan)
            {
                if (nTY.ElementType == LCElementType.GROUP && nTY.KJIconType == 2)
                {
                    foreach (KJIcon nIcon in KJIconList.ListKJIcon)
                    {
                        if (nIcon.IconName == nTY.IconName)
                        {
                            ((CGroup)nTY).BaseKJIcon = nIcon;
                        }
                    }
                    foreach (SwitchPic nSP in ((CGroup)nTY).ListSwitchPic)
                    {
                        foreach (KJIcon nIcon in KJIconList.ListKJIcon)
                        {
                            if (nIcon.IconName == nSP.PicName)
                            {
                                ((SwitchPic)nSP).BaseKJIcon = nIcon;
                            }
                        }
                    }
                }
            }
        }
Пример #16
0
 public CLine(String _Name, CBase _Parent, Object _Owner)
     : base(_Name, _Parent, _Owner)
 {
     m_ElementType = LCElementType.LINE;
 }
Пример #17
0
        //virtual void RemoveChild(CBase Child) override;
        //virtual ArrayList ChaifengChild() override;
        //virtual void RemoveAllChild() override;
        //virtual CBase CreateReDianAt(float x,float y,ConPointType Type) override;
        //virtual void MoveReDian(float x,float y)override;

        //virtual CBase Clone() override;
        //virtual CBase CopyTo(CBaseDesObject)override;
        //virtual void SaveToXML(XmlElement Node) override;
        public override void LoadFromXML(XmlElement Node)
        {
            base.LoadFromXML(Node);
            XmlElement CGroupNode = (XmlElement)(Node.SelectSingleNode("Misc"));

            IconName = CGroupNode.GetAttribute("IconName");
            Name     = CGroupNode.GetAttribute("Name");
            if (IconName == "GrpIcon36")
            {
                Name = "成组图标3";
            }
            if (CGroupNode.HasAttribute("iType"))//成组图标
            {
                KJIconType = 1;
                foreach (XmlElement item in CGroupNode.ChildNodes)
                {
                    string sNodeName = item.Name;
                    string str1      = sNodeName.Substring(0, 2);
                    if ((sNodeName.Substring(0, 2) == "TY" || sNodeName.Substring(0, 2) == "KJ") && item.ChildNodes.Count > 0)
                    {
                        foreach (XmlElement TYNode in item.ChildNodes)
                        {
                            switch (TYNode.Name)
                            {
                            case "TYLine":
                                CElementFactory.SetClassIndex(LCElementType.LINE);
                                break;

                            case "TYText":
                                CElementFactory.SetClassIndex(LCElementType.TEXT);
                                break;

                            case "TYRect":
                                CElementFactory.SetClassIndex(LCElementType.RECTANGLE);
                                break;

                            case "TYEllipse":
                                CElementFactory.SetClassIndex(LCElementType.ELLIPS);
                                break;

                            case "TYRndRect":
                                CElementFactory.SetClassIndex(LCElementType.ROUNDRECTANGLE);
                                break;

                            case "TYArc":
                                CElementFactory.SetClassIndex(LCElementType.ARC);
                                break;

                            case "KJIcon":
                                CElementFactory.SetClassIndex(LCElementType.GROUP);
                                break;

                            default:
                                continue;
                                break;
                            }

                            CBase NewOb = CElementFactory.CreateElement(this, this);
                            if (NewOb == null)
                            {
                                return;
                            }
                            NewOb.LoadFromXML(TYNode);
                            AddChild(NewOb);
                        }
                    }
                }
            }
            else//固定图标
            {
                KJIconType = 2;

                KJIconList.AddKJIcon(IconName);
                XmlElement LayoutNode = (XmlElement)(Node.SelectSingleNode("Layout"));
                fRatio = float.Parse(LayoutNode.GetAttribute("fRatio"));
                if (LayoutNode.HasAttribute("iIconDir"))
                {
                    iIconDir   = int.Parse(LayoutNode.GetAttribute("iIconDir"));
                    LayoutNode = (XmlElement)(Node.SelectSingleNode("Behavior/SwitchPics"));
                    foreach (XmlElement item in LayoutNode.ChildNodes)
                    {
                        string    PicName   = item.GetAttribute("PicName");
                        string    Condition = item.GetAttribute("Condition");
                        SwitchPic nSw       = new SwitchPic(PicName, Condition);
                        ListSwitchPic.Add(nSw);
                        KJIconList.AddKJIcon(nSw.PicName);
                    }
                }
            }
            return;
        }
Пример #18
0
 public CEllips(String _Name, CBase _Parent, Object _Owner)
 {
     m_ElementType = LCElementType.ELLIPS;
 }
Пример #19
0
 public CRectangle(String _Name, CBase _Parent, Object _Owner)
     : base(_Name, _Parent, _Owner)
 {
     m_ElementType = LCElementType.RECTANGLE;
 }