/// <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> /// 从数据库中读取所有的MetaModule /// </summary> /// <param name="conn">数据库连接</param> public Meta_ModuleS(OleDbConnection conn) { //测试连接状态,并进行相应的处理 if (conn.State == ConnectionState.Closed) { try { conn.Open(); } catch (Exception e) { Console.WriteLine(e.Message); } } meta_modules = new Hashtable();//FuncName->Meta_Module string sql_string = "SELECT * FROM Meta_FCMaster"; OleDbDataAdapter Meta_FCMaster_Adapter = new OleDbDataAdapter(sql_string, conn); DataSet myDataSet = new DataSet(); Meta_FCMaster_Adapter.Fill(myDataSet, "Meta_FCMaster"); for (int i = 0; i < myDataSet.Tables["Meta_FCMaster"].Rows.Count; i++) {//对每一个Meta FCMaster #region Meta Module部分 Meta_Module meta_module_temp = new Meta_Module(); meta_module_temp.FunctionName = myDataSet.Tables["Meta_FCMaster"].Rows[i]["FunctionName"].ToString(); meta_module_temp.FunctionCode = myDataSet.Tables["Meta_FCMaster"].Rows[i]["FunctionCode"].ToString(); meta_module_temp.Description = myDataSet.Tables["Meta_FCMaster"].Rows[i]["Description"].ToString(); meta_module_temp.Function = myDataSet.Tables["Meta_FCMaster"].Rows[i]["Function"].ToString(); meta_module_temp.DIAG = myDataSet.Tables["Meta_FCMaster"].Rows[i]["DIAG"].ToString(); meta_module_temp.InputCount = myDataSet.Tables["Meta_FCMaster"].Rows[i]["InputCount"].ToString(); meta_module_temp.SpecCount = myDataSet.Tables["Meta_FCMaster"].Rows[i]["SpecCount"].ToString(); meta_module_temp.OutputCount = myDataSet.Tables["Meta_FCMaster"].Rows[i]["OutPutCount"].ToString(); meta_module_temp.InternalCount = myDataSet.Tables["Meta_FCMaster"].Rows[i]["InternalCount"].ToString(); meta_module_temp.FCLength = myDataSet.Tables["Meta_FCMaster"].Rows[i]["FCLength"].ToString(); meta_module_temp.Type = myDataSet.Tables["Meta_FCMaster"].Rows[i]["Type"].ToString(); #endregion //对每一个Meta Module寻找对应的Meta Module Pin sql_string = "SELECT * FROM Meta_FCDetail WHERE FunctionName='" + meta_module_temp.FunctionName + "'"; OleDbDataAdapter Meta_FCDetail_Adapter = new OleDbDataAdapter(sql_string, conn); Meta_FCDetail_Adapter.Fill(myDataSet, "Meta_FCDetail"); for (int m = 0; m < myDataSet.Tables["Meta_FCDetail"].Rows.Count; m++) { Meta_Module_Pin meta_module_pin_temp = new Meta_Module_Pin(); meta_module_pin_temp.FunctionName = myDataSet.Tables["Meta_FCDetail"].Rows[m]["FunctionName"].ToString(); meta_module_pin_temp.PinName = myDataSet.Tables["Meta_FCDetail"].Rows[m]["PinName"].ToString(); meta_module_pin_temp.PinIndex = myDataSet.Tables["Meta_FCDetail"].Rows[m]["PinIndex"].ToString(); meta_module_pin_temp.DataType = myDataSet.Tables["Meta_FCDetail"].Rows[m]["DataType"].ToString(); meta_module_pin_temp.Tune = (bool)myDataSet.Tables["Meta_FCDetail"].Rows[m]["Tune"]; meta_module_pin_temp.PinType = myDataSet.Tables["Meta_FCDetail"].Rows[m]["PinType"].ToString(); meta_module_pin_temp.MaxValue = myDataSet.Tables["Meta_FCDetail"].Rows[m]["MaxValue"].ToString(); meta_module_pin_temp.MinValue = myDataSet.Tables["Meta_FCDetail"].Rows[m]["MinValue"].ToString(); meta_module_pin_temp.ValidValue = myDataSet.Tables["Meta_FCDetail"].Rows[m]["ValidValue"].ToString(); meta_module_pin_temp.DefaultValue = myDataSet.Tables["Meta_FCDetail"].Rows[m]["DefaultValue"].ToString(); meta_module_pin_temp.Required = (bool)myDataSet.Tables["Meta_FCDetail"].Rows[m]["Required"]; meta_module_pin_temp.Description = myDataSet.Tables["Meta_FCDetail"].Rows[m]["Description"].ToString(); meta_module_pin_temp.Fixed = (bool)myDataSet.Tables["Meta_FCDetail"].Rows[m]["Fixed"]; meta_module_pin_temp.PinSignalType = myDataSet.Tables["Meta_FCDetail"].Rows[m]["PinSignalType"].ToString(); if (meta_module_pin_temp.PinType.Equals("Input")) { meta_module_temp.Input_Pin[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.Pins[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.PinType[meta_module_pin_temp.PinName] = "Input"; } else if (meta_module_pin_temp.PinType.Equals("Output")) { meta_module_temp.Out_Pin[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.Pins[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.PinType[meta_module_pin_temp.PinName] = "Output"; } else if (meta_module_pin_temp.PinType.Equals("Constant")) { meta_module_temp.Constant_Pin[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.Pins[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.PinType[meta_module_pin_temp.PinName] = "Constant"; } else if (meta_module_pin_temp.PinType.Equals("Internal")) { meta_module_temp.Internal_Pin[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.Pins[meta_module_pin_temp.PinName] = meta_module_pin_temp; meta_module_temp.PinType[meta_module_pin_temp.PinName] = "Internal"; } else { throw (new Exception("No such Pin type")); } } myDataSet.Tables["Meta_FCDetail"].Clear();//清空已备下次使用 meta_modules[meta_module_temp.FunctionName] = meta_module_temp; } }
}//end of method::InsertIntoTable /// <summary> /// 给定一个Meta_Module,返回其相应图标的宽度和高度的List,第一个为宽度,第二个为高度 /// </summary> /// <param name="meta_module">Meta_Module</param> /// <returns>包含宽度和高度的List,第一个为宽度,第二个为高度</returns> public static List<int> GetWidthHeight(Meta_Module meta_module) { List<int> result = new List<int>(); //设置模块的宽度,根据模块上显示的文字的大小以及模块的最小宽度 //Font font = null; //string text = meta_module.FunctionName;//模块上显示的文字 //int expected_width; //try //{ // //expected_width = (int)(text.Length * font.Size); // expected_width = (int)(text.Length * 15); //} //catch (Exception) { // expected_width = 0; //} //if (expected_width > 50){//最小宽度设置为50 // result.Add(expected_width); //} //else { // result.Add(50); //} result.Add(60);//模块的宽度固定为60 //设置模块的高度 int minimumHeight = 45;//最小高度 int pin_interval = 15;//Pin之间的间隔 int module_input_count = Int32.Parse(meta_module.InputCount);//模块输入Pin的个数 int module_output_count = Int32.Parse(meta_module.OutputCount);//模块输出Pin的个数 int height = ((module_input_count > module_output_count) ? module_input_count : module_output_count) * pin_interval - pin_interval; height = height + 45;//加上 上下边距(分别22.5) if (height < minimumHeight) { height = minimumHeight; } result.Add(height);//模块的高度 return result; }//end of method:: GetWidthHeight
/// <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> /// 生成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; }