Exemplo n.º 1
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount  = pageArrayBin.pageCount;
            UInt32 curveCount = pageArrayBin.pageArray[pageCount].trendChartNum++;

            if (pageArrayBin.pageArray[pageCount].m_trendChart == null)
            {
                pageArrayBin.pageArray[pageCount].m_trendChart = new TrendChartBin[SVLimit.PAGE_TCHART_MAXNUM];
            }

            TrendChartBin curveBin = pageArrayBin.pageArray[pageCount].m_trendChart[curveCount];

            curveBin.lineClr    = new UInt32[4];
            curveBin.lineWidth  = new Byte[4];
            curveBin.addrOffset = new UInt32[4];
            curveBin.varType    = new Byte[4];
            curveBin.keyOffset  = new UInt32[3];

            curveBin.id      = ID;
            curveBin.rect.sX = (UInt16)Rect.X;
            curveBin.rect.sY = (UInt16)Rect.Y;
            curveBin.rect.eX = (UInt16)(Rect.Width + curveBin.rect.sX);
            curveBin.rect.eY = (UInt16)(Rect.Height + curveBin.rect.sY);

            //字体颜色
            curveBin.scaleClr = (UInt32)FrontColor.ToArgb();
            //背景颜色
            curveBin.bgClr = (UInt32)BackgdColor.ToArgb();

            curveBin.yMin     = Min;
            curveBin.yMax     = Max;
            curveBin.maxTime  = Interval;
            curveBin.font     = (Byte)_font.Size;
            curveBin.stepTime = Step;

            var varInstance = SVVaribleType.instance();

            curveBin.keyOffset[0] = varInstance.strToAddress(ForwardControl.VarName, ForwardControl.VarBlockType);
            curveBin.keyOffset[1] = varInstance.strToAddress(CurControl.VarName, CurControl.VarBlockType);
            curveBin.keyOffset[2] = varInstance.strToAddress(BackwardControl.VarName, BackwardControl.VarBlockType);

            ///编译变量、颜色及使能标志
            Int32 nCount = _variable.Count;

            for (Int32 i = 0; i < nCount; i++)
            {
                String name = _variable[i].Var.VarName;
                Byte   type = _variable[i].Var.VarBlockType;

                curveBin.addrOffset[i] = varInstance.strToAddress(name, type);
                curveBin.varType[i]    = (Byte)varInstance.strToType(name, type);
                curveBin.lineClr[i]    = (UInt32)_variable[i].Color.ToArgb();
                curveBin.lineWidth[i]  = _variable[i].Enabled ? (Byte)1 : (Byte)0;
            }

            ///"SHORT_INT", "SHORTINT_VAR", "INT", "INT_VAR", "REAL", "REAL_VAR"
            pageArrayBin.pageArray[pageCount].m_trendChart[curveCount] = curveBin;
        }
Exemplo n.º 2
0
        public void fromBin(TrendChartBin bin)
        {
            this.Location = new Point(bin.rect.sX, bin.rect.sY);
            this.Width    = bin.rect.eX - bin.rect.sX;
            this.Height   = bin.rect.eY - bin.rect.sY;

            Attrib.Rect = new Rectangle(this.Location, new Size(this.Width, this.Height));

            this.BackColor     = Color.FromArgb((Int32)bin.bgClr);
            this.ForeColor     = Color.FromArgb((Int32)bin.scaleClr);
            Attrib.Interval    = bin.maxTime;
            Attrib.Min         = bin.yMin;
            Attrib.Max         = bin.yMax;
            Attrib.BackgdColor = this.BackColor;
            Attrib.FrontColor  = this.ForeColor;

            Dictionary <Byte, Font> FontConfig = new Dictionary <Byte, Font>();

            FontConfig.Add(8, new Font("华文细黑", 8));
            FontConfig.Add(12, new Font("华文细黑", 12));
            FontConfig.Add(16, new Font("华文细黑", 16));
            Attrib.Font = FontConfig[bin.font];
        }