public static AddTextItem CreateAddTextItemToFigureInstance(TxtItemStyle txtItemStyle) { if (txtItemStyle.Equals(TxtItemStyle.YsStyle)) { return(new AddYSTextItemToFigure()); } else if (txtItemStyle.Equals(TxtItemStyle.NumberStyle)) { return(new AddNumberTextItemToFigure()); } else { return(new AddNormalTextItemToFigure()); } }
public TxtItemClass(TextItemModel txtItemModel) { if (null != txtItemModel) { _iD = txtItemModel.ID.Trim(); _txtItemName = txtItemModel.TxtItemName.Trim(); _FromFieldName = txtItemModel.TxtItemField.Trim(); _TxtItemTitleSpace = StrUtil.StrToDouble(txtItemModel.TxtItemTitleSpace, 0, "文本项标题的纵向距离为非数值型"); //MyNormalOper.GetDoubleValue(ht["TxtItemTitleSpace"].ToString().Trim(), 0, "文本项标题的纵向具体为非数值型"); _TxtPaiLie = EnumUtil.GetEnumByStr(txtItemModel.TxtPaiLie, TxtArrangeStyle.TxtHorArrange); _TxtPosition = EnumUtil.GetEnumByStr(txtItemModel.TxtPosition, AttachmentPoint.BottomCenter); // PositionUtil.GetTxtPositionForCAD(txtItemModel.TxtPosition); _TxtDistribution = EnumUtil.GetEnumByStr(txtItemModel.TxtLayOut.Trim(), Txtdistribution.Txtfocus); // ht["TxtLayOut"].ToString());//分散或集中; _TxtJDTop = txtItemModel.TxtJDTop.Trim(); // ht["TxtJDTop"].ToString().Trim(); _TxtJDHeigh = txtItemModel.TxtJDHeigh.Trim(); // ht["TxtJDHeigh"].ToString().Trim(); _TxtJDBottom = txtItemModel.TxtJDBottom.Trim(); // ht["TxtJDBottom"].ToString().Trim(); _TxtColor = StrUtil.StrToInt(txtItemModel.TxtColor, Color.Black.ToArgb(), "文本项颜色为非数值型"); // AutoCADColor.FromColor(SysColor.FromArgb(MyNormalOper.GetIntValue(ht["TxtColor"].ToString(), 0, "文本项颜色为非数值型"))); _TxtItemFromTableName = txtItemModel.TxtItemFromTbName.Trim(); // ht["TxtItemFromTbName"].ToString().Trim(); _TxtHeaderStartheigh = StrUtil.StrToDouble(txtItemModel.TxtHeaderStartheigh.Trim(), 8, "文本项的起始位置为非数值型"); _TxtSize = StrUtil.StrToDouble(txtItemModel.TxtSize.Trim(), 1.5, "文本项的字高为非数值型"); _TextOutFrame = EnumUtil.GetEnumByStr(txtItemModel.TextOutFrame, TxtItemOutFrame.NoFrame); //PositionUtil.GetTxtItemOutFrameStyle(txtItemModel.TextOutFrame.Trim()); _TxtOutFrameWidth = StrUtil.StrToDouble(txtItemModel.TxtOutFrameWidth, -1, "文本项平行纵向外框的宽度为非数值型"); _TxtOutFrameVerDivPos = EnumUtil.GetEnumByStr(txtItemModel.TxtOutFrameVerDivPos, VerDivPos.LeftPos); //PositionUtil.GetTxtItemOutFrameVerDivPos(txtItemModel.TxtOutFrameVerDivPos); _TIOffset = StrUtil.StrToDouble(txtItemModel.TIOffset, 0, "文本项的相对平移距离为非数值型"); _TiStyle = EnumUtil.GetEnumByStr(txtItemModel.TxtItemStyle, TxtItemStyle.TxtStyle); //GetTxtStyle(txtItemModel.TxtItemStyle); _ThinBZPosStyle = EnumUtil.GetEnumByStr(txtItemModel.ThinBZpos, ThinBZPosStyle.TopPos); //PositionUtil.GetThinBZPosStyle(txtItemModel.ThinBZpos); _txtItemTitlePos = EnumUtil.GetEnumByStr(txtItemModel.TxtItemTitleHorPos, ItemTitlePos.Mid); //ItemOper.GetDrawingItemTitlePos(txtItemModel.TxtItemTitleHorPos); _depthstyle = ZuoBiaoOper.GetDepthFieldStyle(_TxtJDTop, _TxtJDBottom, _TxtJDHeigh); _TxtDiSubStyle = txtItemModel.TxtDiSubStyle.Trim(); // ht["TxtDiSubStyle"].ToString().Trim(); if (string.IsNullOrEmpty(txtItemModel.TxtFont.Trim())) { _TxtStrFont = txtItemModel.TxtFont.Trim();// ht["TxtFont"].ToString().Trim(); } else { _TxtStrFont = "宋体"; } } }