Exemple #1
0
        int IComparer.Compare(object A_0, object A_1)
        {
            string strA = Class594.smethod_0((string)A_0);
            string strB = Class594.smethod_0((string)A_1);

            return(string.CompareOrdinal(strA, strB));
        }
Exemple #2
0
 internal void method_0(DxfModel model)
 {
     if ((this.elementType_0 & DxfLineType.ElementType.IsShape) != DxfLineType.ElementType.None)
     {
         if (this.TextStyle == null)
         {
             return;
         }
         ShxFile shxFile = this.TextStyle.GetShxFile();
         if (shxFile == null)
         {
             return;
         }
         ShxShape shapeByIndex = shxFile.GetShapeByIndex((ushort)this.short_0);
         if (shapeByIndex == null)
         {
             return;
         }
         WW.Math.Point2D endPoint;
         this.fillableShape2D_0 = new FillableShape2D(shapeByIndex.GetGlyphShape(this.TextStyle.IsVertical, out endPoint), false);
     }
     else
     {
         if ((this.elementType_0 & DxfLineType.ElementType.IsText) == DxfLineType.ElementType.None || this.TextStyle == null)
         {
             return;
         }
         Class425        class425     = Class594.smethod_10(this.string_0, 1.0, this.TextStyle.ObliqueAngle, this.TextStyle.WidthFactor, this.TextStyle, Colors.White);
         List <Class908> class908List = new List <Class908>();
         class425.imethod_3((ICollection <Class908>)class908List, Matrix4D.Identity, (short)0);
         GeneralShape2D generalShape2D = new GeneralShape2D();
         bool           filled         = false;
         foreach (Class908 class908 in class908List)
         {
             generalShape2D.Append(class908.FontPath, false);
             if (class908.Font.Filled)
             {
                 filled = true;
             }
         }
         if (!generalShape2D.HasSegments)
         {
             return;
         }
         generalShape2D.ShrinkWrap();
         this.fillableShape2D_0 = new FillableShape2D((IShape2D) new CachedBoundsShape2D((IShape2D)generalShape2D), filled);
     }
 }
Exemple #3
0
            public Class1060(string fontFileName, bool bold, bool italic)
            {
                FontFamily fontFamily;
                FontStyle  fontStyle;

                this.bool_0 = !Class594.smethod_1(fontFileName, bold, italic, out fontFamily, out fontStyle);
                if (bold)
                {
                    fontStyle |= FontStyle.Bold;
                }
                if (italic)
                {
                    fontStyle |= FontStyle.Italic;
                }
                this.font_0 = new Font(fontFamily, 144f, fontStyle, GraphicsUnit.World);
                using (GraphicsPath graphicsPath = new GraphicsPath())
                {
                    using (StringFormat format = new StringFormat(StringFormat.GenericTypographic))
                    {
                        format.FormatFlags |= StringFormatFlags.NoWrap;
                        graphicsPath.AddString("M", this.Font.FontFamily, (int)this.Font.Style, 144f, new PointF(0.0f, 0.0f), format);
                    }
                    if (graphicsPath.PointCount > 1)
                    {
                        RectangleF bounds      = graphicsPath.GetBounds();
                        double     num         = 1.0 / (double)bounds.Height;
                        double     cellAscent  = (double)fontFamily.GetCellAscent(fontStyle);
                        double     cellDescent = (double)fontFamily.GetCellDescent(fontStyle);
                        double     lineSpacing = (double)fontFamily.GetLineSpacing(fontStyle);
                        this.double_1 = 1.0;
                        this.double_2 = cellDescent / cellAscent;
                        this.pointF_0 = new PointF(0.0f, -bounds.Bottom);
                        this.double_0 = num;
                    }
                    else
                    {
                        double emHeight    = (double)fontFamily.GetEmHeight(fontStyle);
                        double cellAscent  = (double)fontFamily.GetCellAscent(fontStyle);
                        double cellDescent = (double)fontFamily.GetCellDescent(fontStyle);
                        double num         = 144.0 * emHeight / cellAscent * 1.25 / emHeight;
                        this.double_1 = 1.0;
                        this.double_2 = cellDescent / cellAscent;
                        this.pointF_0 = new PointF(0.0f, (float)(-cellAscent * num / 1.25));
                        this.double_0 = 5.0 / 576.0;
                    }
                }
            }
Exemple #4
0
        internal static IList <Class908> smethod_1(
            string text,
            double width,
            double height,
            AttachmentPoint attachmentPoint,
            double lineSpacingFactor,
            LineSpacingStyle lineSpacingStyle,
            DxfTextStyle style,
            double widthFactor,
            Color color,
            DrawingDirection drawingDirection,
            short lineWeight,
            Matrix4D insertionTransformation,
            Class985 resultLayoutInfo,
            Enum24 whiteSpaceHandlingFlags)
        {
            Class1023[]      class1023Array = Class594.smethod_12(text, width, height, attachmentPoint, lineSpacingFactor, lineSpacingStyle, style, widthFactor, color, drawingDirection);
            Vector2D         zero           = Vector2D.Zero;
            IList <Class908> class908List   = (IList <Class908>) new List <Class908>();
            Bounds2D         bounds         = new Bounds2D();

            foreach (Class1023 class1023 in class1023Array)
            {
                class1023.imethod_0(ref zero, class1023.Settings.Height, whiteSpaceHandlingFlags);
                bounds.Update(class1023.GetBounds(whiteSpaceHandlingFlags, resultLayoutInfo));
            }
            double num1 = 0.0;
            double num2 = 0.0;

            if (bounds.Initialized)
            {
                switch (attachmentPoint)
                {
                case AttachmentPoint.TopLeft:
                    num1 = -bounds.Corner1.X;
                    num2 = -bounds.Corner2.Y;
                    break;

                case AttachmentPoint.TopCenter:
                    num1 = -bounds.Center.X;
                    num2 = -bounds.Corner2.Y;
                    break;

                case AttachmentPoint.TopRight:
                    num1 = -bounds.Corner2.X;
                    num2 = -bounds.Corner2.Y;
                    break;

                case AttachmentPoint.MiddleLeft:
                    num1 = -bounds.Corner1.X;
                    num2 = -bounds.Center.Y;
                    break;

                case AttachmentPoint.MiddleCenter:
                    num1 = -bounds.Center.X;
                    num2 = -bounds.Center.Y;
                    break;

                case AttachmentPoint.MiddleRight:
                    num1 = -bounds.Corner2.X;
                    num2 = -bounds.Center.Y;
                    break;

                case AttachmentPoint.BottomLeft:
                    num1 = -bounds.Corner1.X;
                    num2 = -bounds.Corner1.Y;
                    break;

                case AttachmentPoint.BottomCenter:
                    num1 = -bounds.Center.X;
                    num2 = -bounds.Corner1.Y;
                    break;

                case AttachmentPoint.BottomRight:
                    num1 = -bounds.Corner2.X;
                    num2 = -bounds.Corner1.Y;
                    break;
                }
            }
            if (width == 0.0)
            {
                num1 = 0.0;
            }
            Vector2D vector2D = new Vector2D(num1, num2);

            foreach (Class1023 class1023 in class1023Array)
            {
                class1023.Offset += vector2D;
                class1023.imethod_3((ICollection <Class908>)class908List, insertionTransformation, lineWeight);
            }
            if (resultLayoutInfo != null)
            {
                bounds.Move(num1, num2);
                resultLayoutInfo.Bounds.Update(bounds);
                if (resultLayoutInfo.FirstLineBounds != null)
                {
                    resultLayoutInfo.FirstLineBounds.Move(num1, num2);
                }
                if (resultLayoutInfo.LastLineBounds != null && resultLayoutInfo.LastLineBounds != resultLayoutInfo.FirstLineBounds)
                {
                    resultLayoutInfo.LastLineBounds.Move(num1, num2);
                }
            }
            return(class908List);
        }
Exemple #5
0
        internal static IList <Class908> smethod_6(
            DxfText text,
            Color color,
            short lineWeight,
            Matrix4D insertionTransformation,
            Bounds2D collectBounds,
            out Vector2D alignmentTranslation,
            out Vector2D alignmentScaling)
        {
            Class425 class425 = Class594.smethod_10(text.DisplayString, text.Height, text.ObliqueAngle, text.WidthFactor, text.Style, color);
            Vector2D zero     = Vector2D.Zero;

            class425.imethod_0(ref zero, text.Height, Enum24.flag_3);
            alignmentTranslation = Vector2D.Zero;
            Bounds2D bounds = class425.GetBounds(Enum24.flag_0, (Class985)null);

            if (zero != Vector2D.Zero)
            {
                bounds.Update(0.0, 0.0);
                bounds.Update(zero.X, zero.Y);
            }
            double x = 1.0;
            double y = 1.0;

            if (bounds.Initialized && text.AlignmentPoint2.HasValue)
            {
                if (text.VerticalAlignment != TextVerticalAlignment.Baseline)
                {
                    switch (text.VerticalAlignment)
                    {
                    case TextVerticalAlignment.Bottom:
                        alignmentTranslation.Y = class425.Blocks.Count > 0 ? class425.Blocks.First.Value.Settings.Font.Metrics.Descent : -bounds.Min.Y;
                        break;

                    case TextVerticalAlignment.Middle:
                        alignmentTranslation.Y = -0.5 * text.Height;
                        break;

                    case TextVerticalAlignment.Top:
                        alignmentTranslation.Y = -text.Height;
                        break;
                    }
                }
                switch (text.HorizontalAlignment)
                {
                case TextHorizontalAlignment.Left:
                    alignmentTranslation.X = -bounds.Corner1.X;
                    break;

                case TextHorizontalAlignment.Center:
                    alignmentTranslation.X = -bounds.Center.X;
                    break;

                case TextHorizontalAlignment.Right:
                    alignmentTranslation.X = -bounds.Corner2.X;
                    break;

                case TextHorizontalAlignment.Aligned:
                    x      = (text.AlignmentPoint2.Value - text.AlignmentPoint1).GetLength() / bounds.Delta.X;
                    y      = x;
                    bounds = new Bounds2D(new WW.Math.Point2D(bounds.Corner1.X, y * bounds.Corner1.Y), new WW.Math.Point2D(bounds.Corner1.X + x * bounds.Delta.X, y * bounds.Corner2.Y));
                    alignmentTranslation.X = -bounds.Corner2.X;
                    break;

                case TextHorizontalAlignment.Middle:
                    alignmentTranslation.Y = -bounds.Center.Y;
                    alignmentTranslation.X = -bounds.Center.X;
                    break;

                case TextHorizontalAlignment.Fit:
                    x      = (text.AlignmentPoint2.Value - text.AlignmentPoint1).GetLength() / bounds.Delta.X;
                    bounds = new Bounds2D(bounds.Corner1, new WW.Math.Point2D(bounds.Corner1.X + x * bounds.Delta.X, bounds.Corner2.Y));
                    alignmentTranslation.X = -bounds.Corner2.X;
                    break;
                }
            }
            IList <Class908> class908List = (IList <Class908>) new List <Class908>();

            class425.imethod_3((ICollection <Class908>)class908List, insertionTransformation * Transformation4D.Translation(alignmentTranslation.X, alignmentTranslation.Y, 0.0) * Transformation4D.Scaling(x, y, 1.0), lineWeight);
            if (collectBounds != null)
            {
                bounds.Move(alignmentTranslation.X, alignmentTranslation.Y);
                collectBounds.Update(bounds);
            }
            alignmentScaling = new Vector2D(x, y);
            return(class908List);
        }