Beispiel #1
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount = pageArrayBin.pageCount;
            UInt32 areaCount = pageArrayBin.pageArray[pageCount].areaNum++;

            if (pageArrayBin.pageArray[pageCount].m_area == null)
            {
                pageArrayBin.pageArray[pageCount].m_area = new AreaBin[SVLimit.PAGE_AREA_MAXNUM];
            }

            AreaBin areaBin = pageArrayBin.pageArray[pageCount].m_area[areaCount];

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

            areaBin.fontClr = (UInt32)FrontColorground.ToArgb();
            areaBin.bgClr   = (UInt32)BackColorground.ToArgb();

            areaBin.text = new Byte[SVLimit.TEXT_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(Text), areaBin.text);

            areaBin.font        = (Byte)_font.Size;
            areaBin.align       = Align;
            areaBin.transparent = Transparent ? (Byte)1 : (Byte)0;

            pageArrayBin.pageArray[pageCount].m_area[areaCount] = areaBin;
        }
Beispiel #2
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount  = pageArrayBin.pageCount;
            UInt32 curveCount = pageArrayBin.pageArray[pageCount].iconNum++;

            if (pageArrayBin.pageArray[pageCount].m_icon == null)
            {
                pageArrayBin.pageArray[pageCount].m_icon = new IconBin[SVLimit.PAGE_ICON_MAXNUM];
            }

            IconBin iconBin = pageArrayBin.pageArray[pageCount].m_icon[curveCount];

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

            var address = PicIconData.bitmap8Data(Rect.Width, Rect.Height);

            if (address != null)
            {
                //图标位置
                iconBin.imageOffset = (UInt32)serialize.ToArray().Length;
                serialize.pack(address);
            }

            pageArrayBin.pageArray[pageCount].m_icon[curveCount] = iconBin;
        }
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount  = pageArrayBin.pageCount;
            UInt32 heartCount = pageArrayBin.pageArray[pageCount].tickNum++;

            if (pageArrayBin.pageArray[pageCount].m_tick == null)
            {
                pageArrayBin.pageArray[pageCount].m_tick = new TickBin[SVLimit.PAGE_TICKGIF_MAXNUM];
            }


            TickBin tickBin = pageArrayBin.pageArray[pageCount].m_tick[heartCount];

            tickBin.imageOffsetList = new UInt32[8];

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

            ///保存所有图片数据
            List <SVBitmap> list = _bitMapArray.imageArray();

            tickBin.count = (Byte)list.Count;

            for (int i = 0; i < list.Count; i++)
            {
                var offset = list[i];
                tickBin.imageOffsetList[i] = (UInt32)serialize.ToArray().Length;
                serialize.pack(offset.bitmap8Data(Rect.Width, Rect.Height));
            }

            pageArrayBin.pageArray[pageCount].m_tick[heartCount] = tickBin;
        }
Beispiel #4
0
        /// <summary>
        /// 从下装文件中加载数据
        /// </summary>
        /// <param Name="File">工程生成的下装文件</param>
        public void load(String file)
        {
            //从下装文件中读取实际数据
            SVBuildFile buildFile = new SVBuildFile(file);

            ///执行具体的读取过程
            buildFile.read();
            ///获取除去头部字节的实际数据
            byte[] fileBuffer = buildFile.getDataByteArray();

            PageArrayBin result = new PageArrayBin();

            SVBinData.byteArrayToStruct(fileBuffer, ref result);

            picBuffer = new byte[buildFile.getImageLength()];
            Array.Copy(fileBuffer, buildFile.getIamgePos() - 64, picBuffer, 0, buildFile.getImageLength());

            ///循环处理每一个页面
            for (int i = 0; i < result.pageCount; i++)
            {
                if (i == 0)
                {
                    fromPageBin(result.pageArray[i], true);
                }
                else
                {
                    fromPageBin(result.pageArray[i], false);
                }
            }
        }
Beispiel #5
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageNum = pageArrayBin.pageCount;
            UInt32 lineNum = pageArrayBin.pageArray[pageNum].lineNum++;

            if (pageArrayBin.pageArray[pageNum].m_line == null)
            {
                pageArrayBin.pageArray[pageNum].m_line = new LineBin[SVLimit.PAGE_LINE_MAXNUM];
            }

            LineBin lineBtn = pageArrayBin.pageArray[pageNum].m_line[lineNum];

            lineBtn.id    = ID;
            lineBtn.color = (UInt32)LineColor.ToArgb();
            lineBtn.width = LineWidth;

            ///起始坐标
            lineBtn.x1 = (UInt16)_startPos.X;
            lineBtn.y1 = (UInt16)_startPos.Y;

            ///结束坐标
            if (ShowType)
            {
                lineBtn.x2 = (UInt16)(lineBtn.x1 + LineLength - 1);
                lineBtn.y2 = lineBtn.y1;
            }
            else
            {
                lineBtn.x2 = lineBtn.x1;
                lineBtn.y2 = (UInt16)(lineBtn.y1 + LineLength - 1);
            }

            pageArrayBin.pageArray[pageNum].m_line[lineNum] = lineBtn;
        }
Beispiel #6
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;
        }
Beispiel #7
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount = pageArrayBin.pageCount;
            UInt32 gifCount  = pageArrayBin.pageArray[pageCount].gif_num++;

            if (pageArrayBin.pageArray[pageCount].m_gif == null)
            {
                pageArrayBin.pageArray[pageCount].m_gif = new GifBin[SVLimit.PAGE_GIF_MAXNUM];
            }

            GifBin gifBin = pageArrayBin.pageArray[pageCount].m_gif[gifCount];

            gifBin.addOffset = new UInt32[8];
            gifBin.varType   = new Byte[8];

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

            ///图片数组地址
            gifBin.imageOffset = new UInt32[8];

            ///保存所有图片数据
            List <SVBitmap> list = _pic.imageArray();

            for (int i = 0; i < list.Count; i++)
            {
                var address = list[i];
                gifBin.imageOffset[i] = (UInt32)serialize.ToArray().Length;
                serialize.pack(address.bitmap8Data(Rect.Width, Rect.Height));
            }

            ///写入当前错误图片数据
            var errorAddress = PicError.bitmap8Data(Rect.Width, Rect.Height);

            if (errorAddress != null)
            {
                gifBin.iamgeOffsetErr = (UInt32)serialize.ToArray().Length;
                serialize.pack(errorAddress);
            }

            ///根据名称来获取地址
            var varInstance = SVVaribleType.instance();

            for (int i = 0; i < _var.Count; i++)
            {
                gifBin.addOffset[i] = varInstance.strToAddress(_var[i], _varType[i]);
                gifBin.varType[i]   = (Byte)varInstance.strToType(_var[i], _varType[i]);
            }

            ///变量个数
            gifBin.type = Convert.ToByte(_var.Count);

            pageArrayBin.pageArray[pageCount].m_gif[gifCount] = gifBin;
        }
Beispiel #8
0
        public void buildControlToBin(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            if (pageArrayBin.pageArray == null)
            {
                pageArrayBin.pageArray = new PageBin[SVLimit.MAX_PAGE_NUMBER];
            }

            UInt32  nCount  = pageArrayBin.pageCount;
            PageBin pageBin = pageArrayBin.pageArray[nCount];

            pageBin.id    = _attrib.id;
            pageBin.bgSet = _attrib.BackGroundType;

            pageBin.bgClr      = (UInt32)_attrib.BackColor.ToArgb();
            pageBin.index      = (UInt16)pageArrayBin.pageCount;
            pageBin.pointAlign = _attrib.IsAlignment;

            if (pageBin.bgSet == 1)
            {
                var address = _attrib.PicIconData.bitmap24Data(this.Width, this.Height);
                if (address != null)
                {
                    //背景图标位置
                    if (_backGroundPicData.ContainsKey(_attrib.PicIconData.ShowName))
                    {
                        pageBin.bgClr = _backGroundPicData[_attrib.PicIconData.ShowName];
                    }
                    else
                    {
                        pageBin.bgClr = (UInt32)serialize.ToArray().Length;
                        _backGroundPicData.Add(_attrib.PicIconData.ShowName, pageBin.bgClr);
                        serialize.pack(address);
                    }
                }
            }

            pageArrayBin.pageArray[nCount] = pageBin;
            //遍历所有子控件
            foreach (Control ctrl in this.Controls)
            {
                SVInterfaceBuild bin = ctrl as SVInterfaceBuild;
                if (bin == null)
                {
                    continue;
                }
                bin.buildControlToBin(ref pageArrayBin, ref serialize);
            }

            pageArrayBin.pageCount++;
        }
Beispiel #9
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount   = pageArrayBin.pageCount;
            UInt32 analogCount = pageArrayBin.pageArray[pageCount].analog_num++;

            if (pageArrayBin.pageArray[pageCount].m_analog == null)
            {
                pageArrayBin.pageArray[pageCount].m_analog = new AnalogBin[SVLimit.PAGE_ANA_MAXNUM];
            }

            AnalogBin analogBin = pageArrayBin.pageArray[pageCount].m_analog[analogCount];

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

            analogBin.normalClr      = (UInt32)NormalColor.ToArgb();
            analogBin.normalBgClr    = (UInt32)NormalBgColor.ToArgb();
            analogBin.overMaxClr     = (UInt32)OverMaxColor.ToArgb();
            analogBin.overMinClr     = (UInt32)OverMinColor.ToArgb();
            analogBin.overMaxBgClr   = (UInt32)OverMaxBgColor.ToArgb();
            analogBin.overMinBgClr   = (UInt32)OverMinBgColor.ToArgb();
            analogBin.vinfoInvalid   = (UInt32)ExceptionColor.ToArgb();
            analogBin.vinfoInvalidBg = (UInt32)ExceptionBgColor.ToArgb();

            analogBin.vMax = Max;
            analogBin.vMin = Min;

            analogBin.font        = (Byte)_font.Size;
            analogBin.nDecimalNum = DecNum;
            analogBin.enExponent  = _isExponent ? (Byte)1 : (Byte)0;

            ///根据名称来获取地址
            var varInstance = SVVaribleType.instance();

            analogBin.addrOffset = varInstance.strToAddress(Variable.VarName, Variable.VarBlockType);
            analogBin.varType    = (Byte)varInstance.strToType(Variable.VarName, Variable.VarBlockType);

            pageArrayBin.pageArray[pageCount].m_analog[analogCount] = analogBin;
        }
Beispiel #10
0
 /// <summary>
 /// 执行当前对象的编译过程
 /// </summary>
 /// <param Name="pageArrayBin"></param>
 /// <param Name="serialize"></param>
 public void buildControlToBin(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
 {
     _attrib.make(ref pageArrayBin, ref serialize);
 }
Beispiel #11
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageNum = pageArrayBin.pageCount;
            UInt32 btnNum  = pageArrayBin.pageArray[pageNum].btnNum++;

            if (pageArrayBin.pageArray[pageNum].m_btn == null)
            {
                pageArrayBin.pageArray[pageNum].m_btn = new ButtonBin[SVLimit.PAGE_BTN_MAXNUM];
            }

            ButtonBin btnBin = pageArrayBin.pageArray[pageNum].m_btn[btnNum];

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

            btnBin.fontClr = (UInt32)FrontColorground.ToArgb();

            ///为真的文本
            btnBin.text = new Byte[SVLimit.BTN_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(Text), btnBin.text);
            ///为假的文本
            btnBin.fText = new Byte[SVLimit.BTN_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(FText), btnBin.fText);
            ///备注信息
            btnBin.fMemo = new Byte[SVLimit.BTN_MAX_LEN];
            copyDestByteArray(Encoding.Unicode.GetBytes(FMemo), btnBin.fMemo);

            btnBin.font = (Byte)_font.Size;
            //是否有确认窗口
            btnBin.confirm = Comfirm ? (byte)1 : (byte)0;
            //按钮的类型
            if (_buttonType == 0)
            {
                btnBin.type         = 0;
                btnBin.param.pageId = _btnType.PageID;
            }
            else
            {
                var varInstance = SVVaribleType.instance();

                btnBin.param.addrOffset = varInstance.strToAddress(_btnVarText.VarName, _btnVarText.VarBlockType);
                btnBin.varTypeBtn       = (Byte)varInstance.strToType(_btnVarText.VarName, _btnVarText.VarBlockType);
                btnBin.type             = _buttonType;
                btnBin.enable           = Convert.ToByte(_btnEnable);
                btnBin.enableAddrOffset = varInstance.strToAddress(_enVarText.VarName, _enVarText.VarBlockType);
                btnBin.varTypeEn        = (Byte)varInstance.strToType(_enVarText.VarName, _enVarText.VarBlockType);
            }

            ///显示背景图片或者显示背景颜色
            if (!IsShowPic)
            {
                btnBin.bgUpFlag    = 0;
                btnBin.bgDownFlag  = 0;
                btnBin.bgUpColor   = (UInt32)BackColorground.ToArgb();
                btnBin.bgDownColor = (UInt32)BackColorgroundDown.ToArgb();
            }
            else
            {
                btnBin.bgUpFlag   = 1;
                btnBin.bgDownFlag = 1;

                //设置弹起图片

                var upAddress = BtnUpPic.bitmap8Data(Rect.Width, Rect.Height);
                if (upAddress != null)
                {
                    btnBin.bgUpColor = (UInt32)serialize.ToArray().Length;
                    serialize.pack(upAddress);
                }

                //设置按下图片
                var downAddress = BtnDownPic.bitmap8Data(Rect.Width, Rect.Height);
                if (downAddress != null)
                {
                    btnBin.bgDownColor = (UInt32)serialize.ToArray().Length;
                    serialize.pack(downAddress);
                }
            }

            pageArrayBin.pageArray[pageNum].m_btn[btnNum] = btnBin;
        }
Beispiel #12
0
        /// <summary>
        /// 生成下装文件
        /// </summary>
        /// <param oldName="pageArrayBin">下装配置文件</param>
        /// <param oldName="serialize">序列化对象</param>
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount   = pageArrayBin.pageCount;
            UInt32 binaryCount = pageArrayBin.pageArray[pageCount].binaryNum++;

            if (pageArrayBin.pageArray[pageCount].m_binary == null)
            {
                pageArrayBin.pageArray[pageCount].m_binary = new BinaryBin[SVLimit.PAGE_BOOL_MAXNUM];
            }

            BinaryBin binaryBin = pageArrayBin.pageArray[pageCount].m_binary[binaryCount];

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

            binaryBin.font = (Byte)_font.Size;
            binaryBin.type = _type;

            ///存放字符串相关的属性和文本信息
            if (_type == 0)
            {
                binaryBin.trueClr        = (UInt32)TrueColor.ToArgb();
                binaryBin.trueBgClr      = (UInt32)TrueBgColor.ToArgb();
                binaryBin.falseClr       = (UInt32)FalseColor.ToArgb();
                binaryBin.falseBgClr     = (UInt32)FalseBgColor.ToArgb();
                binaryBin.vinfoInvalid   = (UInt32)ExceptionColor.ToArgb();
                binaryBin.vinfoInvalidBg = (UInt32)ExceptionBgColor.ToArgb();

                binaryBin.trueText = new Byte[SVLimit.BINARY_MAX_LEN];
                if (CustomTrueText != null)
                {
                    copyDestByteArray(Encoding.Unicode.GetBytes(CustomTrueText), binaryBin.trueText);
                }

                binaryBin.falseText = new Byte[SVLimit.BINARY_MAX_LEN];
                if (CustomFlaseText != null)
                {
                    copyDestByteArray(Encoding.Unicode.GetBytes(CustomFlaseText), binaryBin.falseText);
                }
            }
            else ///存放与背景图片有关的信息
            {
                ///为真的图片地址
                var trueAddress = this.TruePicture.bitmap8Data(Rect.Width, Rect.Height);
                if (trueAddress != null)
                {
                    binaryBin.trueClr = (UInt32)serialize.ToArray().Length;
                    serialize.pack(trueAddress);
                }

                ///为假的图片地址
                var falseAddress = this.FlasePicture.bitmap8Data(Rect.Width, Rect.Height);
                if (falseAddress != null)
                {
                    binaryBin.falseClr = (UInt32)serialize.ToArray().Length;
                    serialize.pack(falseAddress);
                }

                ///异常的图片地址
                var exAddress = this.ExPicture.bitmap8Data(Rect.Width, Rect.Height);
                if (exAddress != null)
                {
                    binaryBin.vinfoInvalid = (UInt32)serialize.ToArray().Length;
                    serialize.pack(exAddress);
                }
            }

            ///根据名称来获取地址
            var varInstance = SVVaribleType.instance();

            binaryBin.addrOffset = varInstance.strToAddress(_var.VarName, _var.VarBlockType);
            binaryBin.varType    = (Byte)varInstance.strToType(_var.VarName, _var.VarBlockType);

            pageArrayBin.pageArray[pageCount].m_binary[binaryCount] = binaryBin;
        }