Esempio n. 1
0
        private ShxFile(string filename, byte[] data)
        {
            this.string_1     = filename;
            this.dictionary_3 = new Dictionary <ushort, ShxShape>();
            this.dictionary_4 = new Dictionary <char, ShxShape>();
            using (Stream input = data == null ? (Stream)File.OpenRead(filename) : (Stream) new MemoryStream(data))
            {
                using (this.binaryReader_0 = new BinaryReader(input))
                {
                    this.shxFormat_0 = this.method_9();
                    Class2 class2;
                    switch (this.shxFormat_0)
                    {
                    case ShxFormat.shx1_0:
                        CharRemapDelegate charRemapper1;
                        ShxFile.dictionary_2.TryGetValue(ShxFile.smethod_4(filename), out charRemapper1);
                        class2 = new Class2(this.binaryReader_0, ShxFile.smethod_1(filename, DrawingCodePage.Dos437), charRemapper1, this);
                        break;

                    case ShxFormat.shx1_1:
                        CharRemapDelegate charRemapper2;
                        ShxFile.dictionary_2.TryGetValue(ShxFile.smethod_4(filename), out charRemapper2);
                        class2 = new Class2(this.binaryReader_0, ShxFile.smethod_1(filename, DrawingCodePage.Ansi1252), charRemapper2, this);
                        break;

                    case ShxFormat.shxBigFont1_0:
                        this.encoding_0 = ShxFile.smethod_0(filename);
                        if (this.encoding_0 == null)
                        {
                            throw new ShxFile.ShxUnknownEncodingException("Encoding of bigfont SHX file " + filename + " is unknown!");
                        }
                        class2 = (Class2) new Class5(this.binaryReader_0, this.encoding_0, this);
                        break;

                    case ShxFormat.shxUnicode1_0:
                        class2 = (Class2) new Class3(this.binaryReader_0, Encoding.UTF8, this);
                        break;

                    default:
                        throw new InternalException("Unknown SHX file format!");
                    }
                    class2.Read();
                }
            }
            if (this.int_3 == 0)
            {
                this.int_3 = this.int_1 + this.int_0;
            }
            ShxShape shape = this.GetShape('\n');

            if (shape == null)
            {
                return;
            }
            WW.Math.Point2D endPoint;
            shape.GetGlyphShape(false, out endPoint);
            this.double_1 = endPoint.Y;
            shape.GetGlyphShape(true, out endPoint);
            this.double_0 = endPoint.X;
        }
Esempio n. 2
0
 internal static char smethod_16(Encoding encoding, ushort id)
 {
     byte[] buffer = new byte[2] {
         (byte)((int)id >> 8 & (int)byte.MaxValue), (byte)((uint)id & (uint)byte.MaxValue)
     };
     return(ShxShape.smethod_17(encoding, buffer, 0, 2));
 }
Esempio n. 3
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            DxfTextStyle textStyle = this.TextStyle;

            if (textStyle == null)
            {
                return;
            }
            ShxFile shxFile = textStyle.GetShxFile();

            if (shxFile == null)
            {
                return;
            }
            ShxShape shapeByIndex = shxFile.GetShapeByIndex(this.ushort_0);

            if (shapeByIndex == null)
            {
                return;
            }
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            WW.Math.Point2D endPoint;
            new Class355((DxfEntity)this, context, graphics, parentGraphicElementBlock).DrawPath(shapeByIndex.GetGlyphShape(false, out endPoint), this.Transform, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), false, false, this.double_1);
        }
Esempio n. 4
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory)
        {
            DxfTextStyle textStyle = this.TextStyle;

            if (textStyle == null)
            {
                return;
            }
            ShxFile shxFile = textStyle.GetShxFile();

            if (shxFile == null)
            {
                return;
            }
            ShxShape shapeByIndex = shxFile.GetShapeByIndex(this.ushort_0);

            if (shapeByIndex == null)
            {
                return;
            }
            WW.Math.Point2D endPoint;
            new Class473((DxfEntity)this, context, graphicsFactory).DrawPath(shapeByIndex.GetGlyphShape(false, out endPoint), this.Transform, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), false, false, this.double_1);
        }
Esempio n. 5
0
        private static int smethod_7(ShxShape.Class466 plotter, byte[] geometry, int offset)
        {
            plotter.method_1();
            ShxFile shxFile = plotter.ShxFile;
            int     num1;

            if (shxFile.ShxFormat == ShxFormat.shxUnicode1_0)
            {
                char     ch           = Convert.ToChar(((int)geometry[offset + 1] << 8) + (int)geometry[offset + 2]);
                ShxShape shapeByIndex = shxFile.GetShapeByIndex((ushort)ch);
                if (shapeByIndex == null)
                {
                    throw new Exception("No shape found with id " + (object)ch + " in shx file " + shxFile.FileName + ".");
                }
                if (plotter.method_0())
                {
                    shapeByIndex.method_1(plotter);
                }
                num1 = 3;
            }
            else if (geometry[offset + 1] != (byte)0)
            {
                char     ch           = Convert.ToChar(geometry[offset + 1]);
                ShxShape shapeByIndex = shxFile.GetShapeByIndex((ushort)ch);
                if (shapeByIndex == null)
                {
                    throw new Exception("No shape found with id " + (object)ch + " in shx file " + shxFile.FileName + ".");
                }
                if (plotter.method_0())
                {
                    shapeByIndex.method_1(plotter);
                }
                num1 = 2;
            }
            else
            {
                ushort   index        = (ushort)((uint)geometry[offset + 2] << 8 | (uint)geometry[offset + 3]);
                ShxShape shapeByIndex = shxFile.GetShapeByIndex(index);
                if (shapeByIndex == null)
                {
                    throw new Exception("No shape found with id " + (object)index + " in shx file " + shxFile.FileName + ".");
                }
                if (plotter.method_0())
                {
                    ShxShape.Class466 class466       = shapeByIndex.method_0(false);
                    float             num2           = (float)geometry[offset + 4];
                    float             num3           = (float)geometry[offset + 5];
                    float             num4           = (float)geometry[offset + 6] / (float)shxFile.Width;
                    float             num5           = (float)geometry[offset + 7] / (float)shxFile.Height;
                    Matrix3D          transformation = new Matrix3D((double)num4, 0.0, (double)num2, 0.0, (double)num5, (double)num3, 0.0, 0.0, 1.0);
                    class466.Shape.TransformBy(transformation);
                    plotter.method_10((IShape2D)class466.Shape, false);
                }
                num1 = 8;
            }
            plotter.method_2();
            return(num1);
        }
Esempio n. 6
0
 private void method_13(ShxFile shxFile)
 {
     if (shxFile != null)
     {
         ShxShape shapeByIndex = shxFile.GetShapeByIndex(this.ushort_0);
         if (shapeByIndex != null)
         {
             this.string_0 = shapeByIndex.Description;
         }
         else
         {
             this.string_0 = string.Empty;
         }
     }
     else
     {
         this.string_0 = string.Empty;
     }
 }
Esempio n. 7
0
 internal void method_0(ShxShape shape)
 {
     this.dictionary_3[shape.Index]            = shape;
     this.dictionary_4[shape.UnicodeCharIndex] = shape;
 }