示例#1
0
文件: DxfMText.cs 项目: 15831944/WW
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfMText dxfMtext = (DxfMText)from;

            this.string_1              = dxfMtext.string_1;
            this.Style                 = Class906.GetTextStyle(cloneContext, dxfMtext.Style);
            this.point3D_0             = dxfMtext.point3D_0;
            this.double_1              = dxfMtext.double_1;
            this.double_2              = dxfMtext.double_2;
            this.double_3              = dxfMtext.double_3;
            this.attachmentPoint_0     = dxfMtext.attachmentPoint_0;
            this.drawingDirection_0    = dxfMtext.drawingDirection_0;
            this.vector3D_0            = dxfMtext.vector3D_0;
            this.vector3D_1            = dxfMtext.vector3D_1;
            this.lineSpacingStyle_0    = dxfMtext.lineSpacingStyle_0;
            this.double_4              = dxfMtext.double_4;
            this.backgroundFillFlags_0 = dxfMtext.backgroundFillFlags_0;
            if (dxfMtext.backgroundFillInfo_0 == null)
            {
                this.backgroundFillInfo_0 = (BackgroundFillInfo)null;
            }
            else
            {
                this.backgroundFillInfo_0 = dxfMtext.backgroundFillInfo_0.Clone(cloneContext);
            }
        }
示例#2
0
            public void CreateMText(DxfMText text, DrawContext.Wireframe drawContext)
            {
                if (text.Text == null || text.Text.Trim() == string.Empty)
                {
                    return;
                }
                Bounds2D            collectBounds       = new Bounds2D();
                IList <Class908>    chunks              = Class666.smethod_4(text, text.Color.ToColor(), drawContext.GetLineWeight((DxfEntity)text), drawContext.GetTransformer().Matrix, collectBounds);
                BackgroundFillFlags backgroundFillFlags = text.BackgroundFillFlags;
                BackgroundFillInfo  backgroundFillInfo  = text.BackgroundFillInfo;

                if (backgroundFillFlags == BackgroundFillFlags.UseBackgroundFillColor && backgroundFillInfo != null)
                {
                    System.Drawing.Color color = (System.Drawing.Color)DxfEntity.GetColor(this.graphicsConfig_0.IndexedColors, backgroundFillInfo.Color, drawContext.ByBlockColor, drawContext.ByBlockDxfColor, text.GetLayer((DrawContext)drawContext));
                    double num1  = text.Height * (backgroundFillInfo.BorderOffsetFactor - 1.0);
                    double x1    = collectBounds.Center.X;
                    double y1    = collectBounds.Center.Y;
                    double width = text.Width;
                    double y2    = collectBounds.Delta.Y;
                    double num2;
                    double num3;
                    switch (text.AttachmentPoint)
                    {
                    case AttachmentPoint.TopLeft:
                        num2 = collectBounds.Corner1.X + 0.5 * width;
                        num3 = collectBounds.Corner2.Y - 0.5 * y2;
                        break;

                    case AttachmentPoint.TopCenter:
                        num2 = collectBounds.Center.X;
                        num3 = collectBounds.Corner2.Y - 0.5 * y2;
                        break;

                    case AttachmentPoint.TopRight:
                        num2 = collectBounds.Corner2.X - 0.5 * width;
                        num3 = collectBounds.Corner2.Y - 0.5 * y2;
                        break;

                    case AttachmentPoint.MiddleLeft:
                        num2 = collectBounds.Corner1.X + 0.5 * width;
                        num3 = collectBounds.Center.Y;
                        break;

                    case AttachmentPoint.MiddleCenter:
                        num2 = collectBounds.Center.X;
                        num3 = collectBounds.Center.Y;
                        break;

                    case AttachmentPoint.MiddleRight:
                        num2 = collectBounds.Corner2.X - 0.5 * width;
                        num3 = collectBounds.Center.Y;
                        break;

                    case AttachmentPoint.BottomLeft:
                        num2 = collectBounds.Corner1.X + 0.5 * width;
                        num3 = collectBounds.Corner1.Y + 0.5 * y2;
                        break;

                    case AttachmentPoint.BottomCenter:
                        num2 = collectBounds.Center.X;
                        num3 = collectBounds.Corner1.Y + 0.5 * y2;
                        break;

                    case AttachmentPoint.BottomRight:
                        num2 = collectBounds.Corner2.X - 0.5 * width;
                        num3 = collectBounds.Corner1.Y + 0.5 * y2;
                        break;

                    default:
                        num2 = collectBounds.Center.X;
                        num3 = collectBounds.Center.Y;
                        break;
                    }
                    short           lineWeight = drawContext.GetLineWeight((DxfEntity)text);
                    Matrix4D        matrix4D   = drawContext.GetTransformer().Matrix *text.Transform;
                    WW.Math.Point2D point      = new WW.Math.Point2D(num2 - 0.5 * width - num1, num3 - 0.5 * y2 - num1);
                    double          x2         = width + 2.0 * num1;
                    double          y3         = y2 + 2.0 * num1;
                    this.method_4(false, (Interface12) new Class341((ArgbColor)color, (Interface23) new Class535(true, new Vector4D[4]
                    {
                        matrix4D.TransformTo4D(point),
                        matrix4D.TransformTo4D(point + new Vector2D(x2, 0.0)),
                        matrix4D.TransformTo4D(point + new Vector2D(x2, y3)),
                        matrix4D.TransformTo4D(point + new Vector2D(0.0, y3))
                    }), true, lineWeight));
                }
                this.method_3(chunks, (DxfEntity)text, drawContext);
            }