コード例 #1
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
        void drawlineinfo(Graphics g ,xl xl) {
            string text = xl.xlValue.LineVol + "kV" + xl.xlValue.LineName + "系统图";
            Font f = new Font("宋体", 30, FontStyle.Bold);
            Size sf = g.MeasureString(text, f).ToSize();
            
            g.DrawString(text, f, Brushes.BlueViolet, mWidth/2-sf.Width/2, 20);

        }
コード例 #2
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
 void draw(Graphics g, xl xl) {
     g.Clear(Color.White);
     mOrg org= Client.ClientHelper.PlatformSqlMap.GetOne<mOrg>("where orgcode='" + xl.xlValue.OrgCode2 + "'");
     if (org != null) {
         renderbdz(g, 50, n300, org.OrgName);
     }
     strList.Clear();
     strList.Add(xl.xlValue.LineCode);
     drawgt(g, xl);
     drawlineinfo(g, xl);
 }
コード例 #3
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
 void buildChild(xl line) {
     IList<PS_gt> gtlist= Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>("where linecode='" + line.xlValue.LineCode + "' order by gtcode");
     line.addGt(gtlist);
     line.initgtsb();
    IList<PS_xl> xlList= Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>(" where  parentgt in (select gtcode from ps_gt where  linecode='" + line.xlValue.LineCode + "')");
    line.addXl(xlList);
    foreach (xl xl in line.lines) {
        if (strList.Contains(xl.xlValue.LineCode)) continue;
        strList.Add(xl.xlValue.LineCode);
        buildChild(xl);
    }
 }
コード例 #4
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
        void drawgt(Graphics g, xl xl) {
            int drawcount = 0;
            foreach (gtNode node in xl.nodes) {

                if (node.NeedDraw) drawcount++;
            }
            gtNode node0 = xl.nodes[xl.nodes.Count - 1];
            if (!node0.NeedDraw)
            drawcount += 1;
            float step= (mWidth-150) *1.0f/drawcount;
            int top = n300;

            if (drawcount < 2) step = (mWidth - 150) * 1.0f / 2;

            g.DrawLine(Pens.BlueViolet, 50, top, 50+step*drawcount, top);
            //if (!xl.nodes[0].NeedDraw) {
            //    xl.nodes[0].Location = new Point(50+(int)step, top);
            //    xl.nodes[0].render(g);
            //}
            
            if (!node0.NeedDraw) {
                node0.Location = new Point(50 +(int)( step * drawcount), top);
                node0.render(g);
            }
            int j = -1;
            int i = 0;
            Point offset = new Point(1, 1 * j);
            int nlines = 0;
            foreach (gtNode node in xl.nodes) {
                
                if (!node.NeedDraw) continue;
                i++;
                if (node.lines.Count > 0) {
                    nlines++;
                }
                node.Location = new Point( 50 + (int)(i * step),top);
                node.render(g);
                
                foreach (xl xl0 in node.lines) {
                    if (strList.Contains(xl0.xlValue.LineCode)) continue;
                    xl0.index = nlines;
                    strList.Add(xl0.xlValue.LineCode);
                    drawchildxltop(g, xl0, offset, (int)step * 2, mHeight-n300);
                    offset.Y *= -1;
                }
                
            }
        }
コード例 #5
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
        public Image GetImage(string linecode) {
            xl xl = new xl();
            Bitmap img = new Bitmap(mWidth, mHeight);
            xl.xlValue=Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>("where linecode='"+ linecode + "'");
            if (xl.xlValue == null) return null;
            IList<PS_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>(" where  parentgt in (select gtcode from ps_gt where  linecode='" + xl.xlValue.LineCode + "')");
            if (xlList.Count == 0) {

                xlList = Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>(" where parentid='" + xl.xlValue.LineID + "'");
                if (xlList.Count > 0)
                    xl.xlValue = xlList[0];
            }
            n300 = mHeight / 2;
            xlList.Clear();
            buildChild(xl);
            draw(Graphics.FromImage(img), xl);
            
            return img;
        }
コード例 #6
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
 internal void addXl(IList<PS_xl> xlList) {
     foreach (PS_xl line in xlList) {
         xl xl = new xl() { xlValue = line };
         lines.Add(xl);
         gtNode node = getNodeByCode(line.ParentGT);
         
         if (node != null) {
             xl.parentNode = node;
             node.addLine(xl);
         }
     }
 }
コード例 #7
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
 internal void addLine(xl xl) {
     lines.Add(xl);
 }
コード例 #8
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
        void drawchildxlright(Graphics g, xl xl, Point offset, int width, int height) {
            int drawcount = 0;
            foreach (gtNode node in xl.nodes) {

                if (node.NeedDraw) drawcount++;
            }
            gtNode node0 = xl.nodes[xl.nodes.Count - 1];
            if (!node0.NeedDraw)
                drawcount += 1;
            float step = width / drawcount;
            if (drawcount == 1) step /= 2;
            
            step = Math.Min(mMinDJ, step);
            step = Math.Max(1, step);
            while (step < 30) step *= 2;
            width = (int)(step * drawcount);
            step *= offset.X;
            int left = xl.parentNode.Location.X;
            int bottom = xl.parentNode.Location.Y;
            int right = left + offset.X * width;

            int offx = xl.getOffx() * offset.X;
            right += offx;

            g.DrawLine(Pens.BlueViolet, left, bottom, right, bottom);
            //if (!xl.nodes[0].NeedDraw) {
            //    xl.nodes[0].Location = new Point(left,(int)step);
            //    xl.nodes[0].render(g);
            //}

            if (!node0.NeedDraw) {
                node0.Location = new Point(right, bottom);
                node0.render(g);
            }
            int j = -1;
            int i = 0;
            //Point offset = new Point(0, 50 * j);
            int nlines = 0;
            foreach (gtNode node in xl.nodes) {

                if (!node.NeedDraw) continue;
                i++;
                if (node.lines.Count > 0) {
                    nlines++;
                }
                node.Location = new Point(offx+ left + (int)(i * step),bottom);
                node.render(g);
                foreach (xl xl0 in node.lines) {
                    if (strList.Contains(xl0.xlValue.LineCode)) continue;
                    xl0.index = nlines;
                    strList.Add(xl0.xlValue.LineCode);
                    drawchildxltop(g, xl0, offset, (int)step * 3/2, height);
                }
                offset.Y *= -1;
            }
        }
コード例 #9
0
ファイル: DrawingDxt2.cs プロジェクト: s7loves/mypowerscgl
        void drawchildxltop(Graphics g,xl xl, Point offset, int width,int height) {
            int drawcount = 0;
            foreach (gtNode node in xl.nodes) {

                if (node.NeedDraw) drawcount++;
            }
            gtNode node0 = xl.nodes[xl.nodes.Count - 1];
            if (!node0.NeedDraw)
            drawcount += 1;

            float step = height / drawcount;
            if (drawcount == 1) step /= 2;
            step = Math.Min(mMinDJ, step);
            height =(int) (step * drawcount);
            step *= offset.Y;
            int left = xl.parentNode.Location.X;
            int bottom = xl.parentNode.Location.Y;
            int top = bottom + offset.Y* height;
            int offx = xl.getOffx()*offset.Y;
            top += offx;
            g.DrawLine(Pens.BlueViolet, left, bottom, left, top);
            //if (!xl.nodes[0].NeedDraw) {
            //    xl.nodes[0].Location = new Point(left,(int)step);
            //    xl.nodes[0].render(g);
            //}
            
            if (!node0.NeedDraw) {
                node0.Location = new Point(left, top);
                node0.render(g);
            }
            int j = -1;
            int i = 0;
            int nlines = 0;
            //Point offset = new Point(0, 50 * j);
            foreach (gtNode node in xl.nodes) {

                if (!node.NeedDraw) continue;
                i++;

                if (node.lines.Count > 0) {
                    nlines++;
                }

                node.Location = new Point(left, offx+bottom + (int)(i * step));
                
                node.render(g);

                foreach (xl xl0 in node.lines) {
                    if (strList.Contains(xl0.xlValue.LineCode)) continue;
                    xl0.index = nlines;
                    xl0.isV = true;
                    strList.Add(xl0.xlValue.LineCode);

                    drawchildxlright(g, xl0, offset, width,(int)Math.Abs(step)*3/2);
                    offset.X *= -1;
                }
                
            }
        }
コード例 #10
0
ファイル: UCGraph.Ex.cs プロジェクト: s7loves/mypowerscgl
 void createxl(xl xl,int level) {
     Point offset = Point.Empty;
     BaseShape preshape = null;
     int stepx = 0;
     int stepy = 30;
     if (level == 0) {
         offset = new Point(graphControl1.Width / 2, graphControl1.Height/2);
     } else if(xl.parentNode!=null) {
         preshape = shapdic[xl.parentNode.owner.gtID];
         offset=xl.parentNode.Location;
         stepx = 30; stepy = 0;
     }
     int i=0;
     newShape("text", xl.owner.LineCode, xl.owner.LineName, level).Location=offset;
     foreach (pnode node in xl.nodes) {
         node.Location = new Point(offset.X+stepx*i, offset.Y+stepy * i);
         i++;
     }
     
     for (i = 0; i < xl.nodes.Count; i++) {
         BaseShape shape = creategt(xl.nodes[i]);
         if (preshape != null) {
             createconnect(preshape, shape,level);
         }
         preshape = shape;
         
     }
     foreach(pnode node in xl.nodes){
         foreach(xl line in xl.Lines){
             createxl(xl, level + 1);
         }
     }
 }
コード例 #11
0
ファイル: UCGraph.Ex.cs プロジェクト: s7loves/mypowerscgl
 private void aa() {
     string tqcode = pid;
     IList<PS_xl> list = Ebada.Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>("where linecode like '" + tqcode + "%' and linevol='0.4' order by linecode");
     DataTable xltable = Ebada.Core.ConvertHelper.ToDataTable((IList)list,typeof(PS_xl));
     List<xl> xllist = new List<xl>();
     foreach (PS_xl line in list) {
         xl xl = new xl(line);
         xl.initgtsb();
         xllist.Add(xl);
     }
     if (xllist.Count > 0)
         createxl(xllist[0],0);
 }