/// <summary> /// 生成XNetAO和XNetAI的图标信息 /// </summary> /// <param name="id">图标的ID</param> /// <param name="width">图标的宽度</param> /// <param name="height">图标的高度</param> /// <param name="text">图标显示的文本</param> /// <param name="isAO">是:XNetAO,否:XNetAI</param> /// <returns></returns> public List<Meta_SymbolMaster> Create_XNetAOI(string id, double width, double height, string text, bool isAO, Meta_Module meta_module) { List<Meta_SymbolMaster> result = new List<Meta_SymbolMaster>(); //BODY Meta_SymbolMaster meta_symbolmaster; meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XNetAO"; meta_symbolmaster.Code = 0; //body detail Meta_SymbolDetail meta_symboldetail; meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (height / 2) + "_" + (0) + "||" + (width - height / 2) + "_" + (0); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (width - height / 2) + "_" + (height) + "||" + (height / 2) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Arc"; meta_symboldetail.ElementData = "255_255_255||" + (height / 2) + "_" + (height / 2) + "||" + (height / 2) + "_" + (height) + "||" + (height / 2) + "_" + (0); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Arc"; meta_symboldetail.ElementData = "255_255_255||" + (width - height / 2) + "_" + (height / 2) + "||" + (width - height / 2) + "_" + (0) + "||" + (width - height / 2) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); result.Add(meta_symbolmaster); //主要部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = id; meta_symbolmaster.SymbolName = id; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; if (isAO) { meta_symbolmaster.FunctionName = "XNetAO"; } else { meta_symbolmaster.FunctionName = "XNetAI"; } meta_symbolmaster.Code = 0; //主要部分的Detail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); { //动态Text meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text";//TextDispFun(AbbBlankRule,GID.Name)$$ ||左下||62.37_203.61||0||"Courier New"||12||255_255_255 meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,GID.Address)$$ ||左下||" + (0.4 * width) + "_" + (0.8 * height) + "||0||\"Courier New\"||8||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); } if (isAO) { meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (-12) + "_" + (height / 2) + "," + (0) + "_" + (height / 2) + "||X||Input"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Input_Pin["X"]; Point point_temp = new Point(); point_temp.x = -12; point_temp.y = height / 2; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Inpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "X"); } else { meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (width + 12) + "_" + (height / 2) + "," + (width) + "_" + (height / 2) + "||Y||Output"; Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Out_Pin["Y"]; Point point_temp = new Point(); point_temp.x = width + 12; point_temp.y = height / 2; point_temp.is_valid = true; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; //增加引脚数据值的显示 meta_symboldetail = Outpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "Y"); } result.Add(meta_symbolmaster); return result; }
/// <summary> /// 生成XPgDO,正六边形 /// </summary> /// <param name="edge_length">边长</param> /// <param name="id">图标ID</param> /// <param name="FunctionName">Function Name</param> /// <param name="text">图标显示的文字</param> /// <returns></returns> public List<Meta_SymbolMaster> Create_XPgDO(double edge_length, string id, string FunctionName, string text, Meta_Module meta_module) { List<Meta_SymbolMaster> result = new List<Meta_SymbolMaster>(); //body部分 Meta_SymbolMaster meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + id; meta_symbolmaster.SymbolName = "BODY_" + id; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = FunctionName; meta_symbolmaster.Code = 0; //body的Detail for (int i = 0; i < 6; i++) {//六条边的添加 Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = Get_Hexagon_Line_Data(edge_length, i); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); } result.Add(meta_symbolmaster); //主要部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = id; meta_symbolmaster.SymbolName = id; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = FunctionName; meta_symbolmaster.Code = 0; {//Detail部分 Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); { //中心动态文字的添加 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,BlockMe.ALG_NAME)$$ " + "||" + "左下||" + (edge_length * 0.5) + "_" + (edge_length * 1.0) + "||0||MONOTEXT||5||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); } meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (-12) + "_" + 0.87 * edge_length + "," + (0) + "_" + (0.87 * edge_length) + "||Z||Input"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Input_Pin["Z"]; Point point_temp = new Point(); point_temp.x = -12; point_temp.y = 0.87 * edge_length; point_temp.is_valid = true; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Inpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "Z"); } result.Add(meta_symbolmaster); return result; }
/// <summary> /// 构造函数,根据给定的Meta_ModuleS,构造Meta_symbols /// </summary> /// <param name="meta_modules">给定的Meta_Modules</param> public Meta_SymbolS(Meta_ModuleS meta_modules) { // 数据成员的初始化 meta_symbols = new Hashtable(); //对每一个Meta_Module构造相应的Meta_Symbol foreach (Meta_Module meta_module in meta_modules.meta_modules.Values) { #region 特殊模块图标的构造 if (meta_module.FunctionName.Equals("XPgDO")) { List<Meta_SymbolMaster> temp = Create_XPgDO(17.5, "XPgDO", "XPgDO", "60", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XPgAO")) { List<Meta_SymbolMaster> temp = Create_XPgAO("XPgAO", 15, "te", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XPgDI")) { List<Meta_SymbolMaster> temp = Create_XPgDI("XPgDI", 17.5, "w", "w", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XPgAI")) { List<Meta_SymbolMaster> temp = Create_XPgAI("XPgAI", 15, "w", "w", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XPI")) { List<Meta_SymbolMaster> temp = Create_XPI("XPI", 75, 15, "null", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XDO")) { List<Meta_SymbolMaster> temp = Create_XDO("XDO", 75, 15, "null", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XAI")) { List<Meta_SymbolMaster> temp = Create_XAI("XAI", 75, 15, "null", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XAO")) { List<Meta_SymbolMaster> temp = Create_XAO("XAO", 75, 15, "null", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XDI")) { List<Meta_SymbolMaster> temp = Create_XDI("XDI", 75, 15, "null", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XAI")) { List<Meta_SymbolMaster> temp = Create_XAI("XAI", 75, 15, "null", meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XNetDO")) { List<Meta_SymbolMaster> temp = Create_XNetDOI("XNetDO", 75, 15, "null", true, meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XNetDI")) { List<Meta_SymbolMaster> temp = Create_XNetDOI("XNetDI", 75, 15, "null", false, meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XNetAO")) { List<Meta_SymbolMaster> temp = Create_XNetAOI("XNetAO", 75, 15, "null", true, meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } else if (meta_module.FunctionName.Equals("XNetAI")) { List<Meta_SymbolMaster> temp = Create_XNetAOI("XNetAI", 75, 15, "null", false, meta_module); foreach (Meta_SymbolMaster meta_sym_master in temp) { meta_symbols[meta_sym_master.SymbolID] = meta_sym_master; } continue; } #endregion //一般模块图标的构造 //构造Master的整体 Meta_SymbolMaster meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = meta_module.FunctionName; string symbolid = meta_module.FunctionName; meta_symbolmaster.SymbolName = meta_module.FunctionName; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = meta_module.FunctionName; string functionname = meta_symbolmaster.FunctionName; meta_symbolmaster.Code = 0; List<int> width_height = GetWidthHeight(meta_module); //模块中输入引脚的个数 int module_input_count = Int32.Parse(meta_module.InputCount); //模块中输出引脚的个数 int module_output_count = Int32.Parse(meta_module.OutputCount); //记录模块图标的高度和宽度,以方便后边的使用 meta_symbolmaster.Height = width_height[1]; meta_symbolmaster.Width = width_height[0]; meta_symbols[meta_symbolmaster.SymbolID] = meta_symbolmaster; //构造Details部分 //对Input_Pin按Index的大小进行排序,其实可以采用实现比较接口的办法来实现 List<Meta_Module_Pin> in_mmp_temp = new List<Meta_Module_Pin>(); Hashtable index_2_Pin = new Hashtable(); foreach (Meta_Module_Pin mmp in meta_module.Input_Pin.Values) { index_2_Pin[Int32.Parse(mmp.PinIndex)] = mmp; } List<int> pin_index_list = new List<int>(); foreach (int pinindex in index_2_Pin.Keys) { pin_index_list.Add(pinindex); } pin_index_list.Sort(); foreach (int i in pin_index_list) { in_mmp_temp.Add((Meta_Module_Pin)index_2_Pin[i]); } //排序结束 //对Out_Pin按Index的大小进行排序,其实可以采用实现比较接口的办法来实现 List<Meta_Module_Pin> out_mmp_temp = new List<Meta_Module_Pin>(); index_2_Pin = new Hashtable(); foreach (Meta_Module_Pin mmp in meta_module.Out_Pin.Values) { index_2_Pin[Int32.Parse(mmp.PinIndex)] = mmp; } pin_index_list = new List<int>(); foreach (int pinindex in index_2_Pin.Keys) { pin_index_list.Add(pinindex); } pin_index_list.Sort(); foreach (int i in pin_index_list) { out_mmp_temp.Add((Meta_Module_Pin)index_2_Pin[i]); } //排序结束 #region 输入引脚的插入 List<double> Pin_y_pos = Get_Pin_Y_Pos(width_height[1], module_input_count); int index = 1; foreach (Meta_Module_Pin inputpin in in_mmp_temp) { //输入引脚 Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); Point point_temp = new Point();//存储Pin的相对位置 meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = Get_Pin_Data(width_height[0], 5, true, index, ref point_temp, inputpin.PinName, Pin_y_pos); meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); index++; //增加Pin的相对位置 meta_symbolmaster.Pin_Relative_Pos[inputpin] = point_temp; //增加引脚数据值的显示 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; string PinName = ""; string text_pos = ""; PinName = inputpin.PinName; text_pos = (point_temp.x + 16) + "_" + (point_temp.y - 2); meta_symboldetail.ElementData = "TextDispFun(AbbPinValueDisplayRule," + PinName + ".Value$$w||右下||" + text_pos + "||0||\"Courier New\"||8||255_255_255"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); } #endregion #region 输出引脚的插入 Pin_y_pos = Get_Pin_Y_Pos(width_height[1], module_output_count); index = 1; foreach (Meta_Module_Pin outputpin in out_mmp_temp) { //输出引脚 Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); Point point_temp = new Point(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = Get_Pin_Data(width_height[0], 5, false, index, ref point_temp, outputpin.PinName, Pin_y_pos); meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); index++; //增加Pin的相对位置 meta_symbolmaster.Pin_Relative_Pos[outputpin] = point_temp; //增加引脚数据值的显示 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; string PinName = ""; string text_pos = ""; PinName = outputpin.PinName; text_pos = (point_temp.x - 13) + "_" + (point_temp.y - 2); meta_symboldetail.ElementData = "TextDispFun(AbbPinValueDisplayRule," + PinName + ".Value$$w||左下||" + text_pos + "||0||\"\"Courier New\"\"||8||255_255_255"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); } #endregion {//DocShape Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); } {//动态文字的添加 //功能名字 Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text";//TextDispFun(OwtBlankRule,BlockMe.FUNC_NAME)$$ ||左下||62.37_203.61||0||"Courier New"||12||255_255_255 //meta_symboldetail.ElementData = Get_Text_Data(meta_symbolmaster.FunctionName, width_height[0], width_height[1]); meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,BlockMe.FUNC_NAME)$$ ||正中||" + (0.5 * meta_symbolmaster.Width) + "_" + (0.2 * meta_symbolmaster.Height) + "||0||\"Courier New\"||8||255_255_255"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); //alg_name meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text";//TextDispFun(OwtBlankRule,BlockMe.ALG_NAME)$$ ||左下||62.37_188.61||0||"Courier New"||12||255_255_255 meta_symboldetail.ElementData = "TextDispFun(XinhuaBlockNameAndOrderRule,BlockMe.ALG_NAME,BlockMe.Order)$$ ||正中||" + (0.5 * meta_symbolmaster.Width) + "_" + (0.8 * meta_symbolmaster.Height) + "||0||\"Courier New\"||7||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); } Meta_SymbolMaster master_symbol = meta_symbolmaster; //body部分(里边的内容都为静态) { #region 构造Body部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + symbolid; meta_symbolmaster.SymbolName = "BODY_" + symbolid; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = functionname; meta_symbolmaster.Code = 0; meta_symbolmaster.Height = width_height[1];//模块的高度 meta_symbolmaster.Width = width_height[0];//模块的宽度 meta_symbols["BODY" + symbolid] = meta_symbolmaster; //构造Body的Detail部分 { Meta_SymbolDetail meta_symboldetail; //输入Pin Name的显示 foreach (Meta_Module_Pin inpin in in_mmp_temp) { meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; Point body_pin = (Point)master_symbol.Pin_Relative_Pos[inpin]; meta_symboldetail.ElementData = inpin.PinName + "||左下||" + 0 + "_" + (body_pin.y + 4) + "||0||MONOTEXT||6||255_255_255"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); } //输出Pin Name的显示 foreach (Meta_Module_Pin outpin in out_mmp_temp) { meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; Point body_pin = (Point)master_symbol.Pin_Relative_Pos[outpin]; meta_symboldetail.ElementData = outpin.PinName + "||右下||" + (master_symbol.Width) + "_" + (body_pin.y + 4) + "||0||MONOTEXT||6||255_255_255"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); } //Line for (int i = 0; i < 4; i++) { //four lines meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = Get_Line_Data(width_height[0], width_height[1], i); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); } } #endregion } } }
/// <summary> /// 生成XPgAI,圆形 /// </summary> /// <param name="id">图标的ID</param> /// <param name="radius">圆的半径</param> /// <param name="text1">显示在上方的文字</param> /// <param name="text2">显示在下方的文字</param> /// <returns></returns> public List<Meta_SymbolMaster> Create_XPgAI(string id, double radius, string text1, string text2, Meta_Module meta_module) { List<Meta_SymbolMaster> result = new List<Meta_SymbolMaster>(); Meta_SymbolMaster meta_symbolmaster; //body部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPgAI"; meta_symbolmaster.Code = 0; //Detail //circle Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Circle"; meta_symboldetail.ElementData = "255_255_255||" + radius + "||0_0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); //line meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (-radius) + "_0" + "||" + (radius) + "_0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); result.Add(meta_symbolmaster); //主要部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPgAI"; meta_symbolmaster.Code = 0; //Detail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); { //动态text1 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,Page.Value)$$ " + "||左下||" + (-0.25 * radius) + "_" + (-0.25 * radius) + "||0||MONOTEXT||5||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); //动态text2 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,Block.Value)$$ " + "||左下||" + (-0.25 * radius) + "_" + (0.5 * radius) + "||0||MONOTEXT||5||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); } meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (12 + radius) + "_" + (0) + "," + (radius) + "_" + (0) + "||Y||Output"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Out_Pin["Y"]; Point point_temp = new Point(); point_temp.x = 12 + radius; point_temp.y = 0; point_temp.is_valid = true; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Outpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "Y"); result.Add(meta_symbolmaster); return result; }
/// <summary> /// 生成XPgDI图标,正六边形 /// </summary> /// <param name="id">图标的ID</param> /// <param name="edge_length">正六边形的边长</param> /// <param name="text1">显示在上方的文字</param> /// <param name="text2">显示在下方的文字</param> /// <returns></returns> public List<Meta_SymbolMaster> Create_XPgDI(string id, double edge_length, string text1, string text2, Meta_Module meta_module) { List<Meta_SymbolMaster> result = new List<Meta_SymbolMaster>(); //body部分 Meta_SymbolMaster meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + id; meta_symbolmaster.SymbolName = "BODY_" + id; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPgDI"; meta_symbolmaster.Code = 0; //body的Detail部分 Meta_SymbolDetail meta_symboldetail; for (int i = 0; i < 6; i++) {//六条边的添加 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = Get_Hexagon_Line_Data(edge_length, i); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); } meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (0) + "_" + (0.87 * edge_length) + "||" + (2 * edge_length) + "_" + (0.87 * edge_length); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); result.Add(meta_symbolmaster); //主要部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPgDI"; meta_symbolmaster.Code = 0; //Detail部分 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); { //动态text(2 个) meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,Page.Value)$$ " + "||左下||" + (0.4 * edge_length) + "_" + (0.8 * edge_length) + "||0||MONOTEXT||5||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,Block.Value)$$ " + "||左下||" + (0.4 * edge_length) + "_" + (1.5 * edge_length) + "||0||MONOTEXT||5||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); } meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (12 + 2 * edge_length) + "_" + 0.87 * edge_length + "," + (2 * edge_length) + "_" + (0.87 * edge_length) + "||D||Output"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Out_Pin["D"]; Point point_temp = new Point(); point_temp.x = 12 + 2 * edge_length; point_temp.y = 0.87 * edge_length; point_temp.is_valid = true; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Outpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "D"); result.Add(meta_symbolmaster); return result; }
/// <summary> /// 生成XPI图标 /// </summary> /// <param name="id">图标的ID</param> /// <param name="width">图标的宽度</param> /// <param name="height">图标的高度</param> /// <param name="text">图标显示的文本</param> /// <returns></returns> public List<Meta_SymbolMaster> Create_XPI(string id, double width, double height, string text, Meta_Module meta_module) { List<Meta_SymbolMaster> result = new List<Meta_SymbolMaster>(); Meta_SymbolMaster meta_symbolmaster; //BODY meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPI"; meta_symbolmaster.Code = 0; //Detail of Body Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||0_0||" + (width - height / 2) + "_" + (0); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (width - height / 2) + "_" + (0) + "||" + (width - height / 2) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (width - height / 2) + "_" + (height) + "||" + (0) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (0) + "_" + (height) + "||0_0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Arc"; meta_symboldetail.ElementData = "255_255_255||" + (width - height / 2) + "_" + (height / 2) + "||" + (width - height / 2) + "_" + (0) + "||" + (width - height / 2) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; meta_symboldetail.ElementData = text + "||左下||" + (0.4 * width) + "_" + (height * 0.65) + "||0||MONOTEXT||8||255_255_255"; meta_symbolmaster.Details.Add(meta_symboldetail); result.Add(meta_symbolmaster); //主要部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPI"; meta_symbolmaster.Code = 0; //Detail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (width + 12) + "_" + (height / 2) + "," + (width) + "_" + (height / 2) + "||Y||Output"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Out_Pin["Y"]; Point point_temp = new Point(); point_temp.x = width + 12; point_temp.y = height / 2; point_temp.is_valid = true; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Outpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "Y"); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (-12) + "_" + (height / 2) + "," + (0) + "_" + (height / 2) + "||Rst||Input"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); meta_module_pin = (Meta_Module_Pin)meta_module.Input_Pin["Rst"]; point_temp = new Point(); point_temp.x = -12; point_temp.y = height / 2; point_temp.is_valid = true; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Inpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "Rst"); result.Add(meta_symbolmaster); return result; }
/// <summary> /// 生成XAO图标 /// </summary> /// <param name="id">图标的ID</param> /// <param name="width">图标的宽度</param> /// <param name="height">图标的高度</param> /// <param name="text">图标显示的文本</param> /// <returns></returns> public List<Meta_SymbolMaster> Create_XAO(string id, double width, double height, string text, Meta_Module meta_module) { List<Meta_SymbolMaster> result = new List<Meta_SymbolMaster>(); Meta_SymbolMaster meta_symbolmaster; //BODY meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = "BODY_" + id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "DocumentShape"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XPI"; meta_symbolmaster.Code = 0; //Detail of Body Meta_SymbolDetail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||0_0||" + (width - height / 2) + "_" + (0); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (width - height / 2) + "_" + (0) + "||" + (width - height / 2) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (width - height / 2) + "_" + (height) + "||" + (0) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Line"; meta_symboldetail.ElementData = "0||255_255_255||" + (0) + "_" + (height) + "||0_0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Arc"; meta_symboldetail.ElementData = "255_255_255||" + (width - height / 2) + "_" + (height / 2) + "||" + (width - height / 2) + "_" + (0) + "||" + (width - height / 2) + "_" + (height); meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); result.Add(meta_symbolmaster); //主要部分 meta_symbolmaster = new Meta_SymbolMaster(); meta_symbolmaster.SymbolID = id; meta_symbolmaster.SymbolName = meta_symbolmaster.SymbolID; meta_symbolmaster.SymbolType = "FunctionCode"; meta_symbolmaster.OringinPoint = "0.00_0.00"; meta_symbolmaster.ReadOnly = false; meta_symbolmaster.FunctionName = "XAO"; meta_symbolmaster.Code = 0; //Detail meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "DocShape"; meta_symboldetail.ElementData = "BODY_" + meta_symbolmaster.SymbolID + "||0_0||0"; meta_symboldetail.DynamicType = 0; meta_symbolmaster.Details.Add(meta_symboldetail); { //动态Text meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text";//TextDispFun(AbbBlankRule,GID.Name)$$ ||左下||62.37_188.61||0||"Courier New"||12||255_255_255 meta_symboldetail.ElementData = "TextDispFun(XinhuaBlankRule,GID.Address)$$ ||左下||" + (0.2 * width) + "_" + (height) + "||0||\"Courier New\"||8||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); //address meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text";//TextDispFun(AbbBlankRule,Addr.Name)$$ ||左下||62.37_203.61||0||"Courier New"||12||255_255_255 meta_symboldetail.ElementData = "TextDispFun(XinhuaIOAddrRule,Addr.Address)$$ ||左下||" + (0.2 * width) + "_" + (height * 2.2) + "||0||\"Courier New\"||8||255_255_255"; meta_symboldetail.DynamicType = 2; meta_symbolmaster.Details.Add(meta_symboldetail); } meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Pin"; meta_symboldetail.ElementData = (-12) + "_" + (height / 2) + "," + (0) + "_" + (height / 2) + "||X||Input"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); Meta_Module_Pin meta_module_pin = (Meta_Module_Pin)meta_module.Input_Pin["X"]; if (meta_module_pin == null) { throw (new Exception(meta_module.FunctionName + ",No such Pin: X")); } Point point_temp = new Point(); point_temp.x = -12; point_temp.y = height / 2; point_temp.is_valid = true; ; ; ; meta_symbolmaster.Pin_Relative_Pos[meta_module_pin] = point_temp; ////增加引脚数据值的显示 meta_symboldetail = Inpin_Add_Dynamic_Text(meta_symbolmaster, meta_symboldetail, point_temp, "X"); result.Add(meta_symbolmaster); return result; }
private static Meta_SymbolDetail Outpin_Add_Dynamic_Text(Meta_SymbolMaster meta_symbolmaster, Meta_SymbolDetail meta_symboldetail, Point point_temp, string pinname) { //增加引脚数据值的显示 meta_symboldetail = new Meta_SymbolDetail(); meta_symboldetail.SymbolID = meta_symbolmaster.SymbolID; meta_symboldetail.ElementType = "Text"; string PinName = ""; string text_pos = ""; PinName = pinname; text_pos = (point_temp.x - 13) + "_" + (point_temp.y - 2); meta_symboldetail.ElementData = "TextDispFun(AbbPinValueDisplayRule," + PinName + ".Value$$w||左下||" + text_pos + "||0||\"\"Courier New\"\"||8||255_255_255"; meta_symboldetail.DynamicType = 1; meta_symbolmaster.Details.Add(meta_symboldetail); return meta_symboldetail; }