Example #1
0
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfHatchScaleContextData scaleContextData = (DxfHatchScaleContextData)from;

            foreach (DxfHatch.BoundaryPath boundaryPath in scaleContextData.list_0)
            {
                this.list_0.Add(boundaryPath.Clone(cloneContext));
            }
            this.dxfPattern_0 = scaleContextData.dxfPattern_0 == null ? (DxfPattern)null : scaleContextData.dxfPattern_0.Clone();
            this.double_0     = scaleContextData.double_0;
            this.vector3D_0   = scaleContextData.vector3D_0;
        }
Example #2
0
        internal override void Read(Class434 or, Class259 ob)
        {
            base.Read(or, ob);
            Interface30 objectBitStream = or.ObjectBitStream;

            this.dxfPattern_0 = new DxfPattern();
            this.dxfPattern_0.Read(objectBitStream);
            this.double_0   = objectBitStream.imethod_8();
            this.vector3D_0 = objectBitStream.imethod_51();
            int num = objectBitStream.imethod_11();

            for (int index = 0; index < num; ++index)
            {
                DxfHatch.BoundaryPath boundaryPath = new DxfHatch.BoundaryPath();
                boundaryPath.Read(or, false);
                this.list_0.Add(boundaryPath);
            }
        }
Example #3
0
 public DxfHatchScaleContextData(DxfHatch hatch, DxfScale scale)
     : base(scale)
 {
     this.dxfPattern_0 = hatch.Pattern == null ? (DxfPattern)null : hatch.Pattern.Clone();
     this.double_0     = scale.ScaleFactor;
 }
Example #4
0
        internal override void Read(DxfReader r, Class259 objectBuilder)
        {
            base.Read(r, objectBuilder);
            if (r.CurrentGroup.Code != 100 || (string)r.CurrentGroup.Value != "AcDbHatchObjectContextData")
            {
                throw new DxfException("Expected subclass marker.");
            }
            r.method_85();
            bool             flag1 = true;
            BoundaryPathType type  = BoundaryPathType.None;
            bool             flag2 = true;

            while (!r.method_92("AcDbHatchScaleContextData"))
            {
                switch (r.CurrentGroup.Code)
                {
                case 10:
                    this.vector3D_0.X = (double)r.CurrentGroup.Value;
                    break;

                case 20:
                    this.vector3D_0.Y = (double)r.CurrentGroup.Value;
                    break;

                case 30:
                    this.vector3D_0.Z = (double)r.CurrentGroup.Value;
                    break;

                case 40:
                    this.double_0 = (double)r.CurrentGroup.Value;
                    break;

                case 78:
                    short num = (short)r.CurrentGroup.Value;
                    if (num > (short)0)
                    {
                        r.method_85();
                        this.dxfPattern_0 = new DxfPattern();
                        this.dxfPattern_0.Read(r, (int)num);
                        flag2 = false;
                        break;
                    }
                    break;

                case 90:
                    if (flag1)
                    {
                        flag1 = false;
                        break;
                    }
                    type = (BoundaryPathType)r.CurrentGroup.Value;
                    break;

                case 290:
                    if (!(bool)r.CurrentGroup.Value)
                    {
                        DxfHatch.BoundaryPath boundaryPath = new DxfHatch.BoundaryPath(type);
                        if ((boundaryPath.Type & BoundaryPathType.IsAnnotative) != BoundaryPathType.None && boundaryPath.IsPolyline)
                        {
                            boundaryPath.PolylineData = new DxfHatch.BoundaryPath.Polyline();
                            r.method_85();
                            boundaryPath.PolylineData.Read(r);
                        }
                        else if (!boundaryPath.IsPolyline)
                        {
                            r.method_85();
                            int nrOfEdges = (int)r.CurrentGroup.Value;
                            r.method_85();
                            boundaryPath.method_0(nrOfEdges, r);
                        }
                        this.list_0.Add(boundaryPath);
                        flag2 = false;
                        break;
                    }
                    break;
                }
                if (flag2)
                {
                    r.method_85();
                }
                else
                {
                    flag2 = true;
                }
            }
        }
Example #5
0
        public static DxfPattern[] ReadPatterns(TextReader reader)
        {
            int num1 = 0;
            List <DxfPattern> dxfPatternList = new List <DxfPattern>();
            DxfPattern        dxfPattern     = (DxfPattern)null;

            try
            {
                while (true)
                {
                    string str1;
                    do
                    {
                        do
                        {
                            string str2 = reader.ReadLine();
                            ++num1;
                            if (str2 != null)
                            {
                                str1 = str2.Trim('\x001A');
                            }
                            else
                            {
                                goto label_14;
                            }
                        }while (string.IsNullOrEmpty(str1) || str1.StartsWith(";"));
                        if (str1.StartsWith("*"))
                        {
                            int    num2 = str1.IndexOf(',');
                            string name;
                            string str2;
                            if (num2 < 0)
                            {
                                name = str1.Substring(1);
                                str2 = (string)null;
                            }
                            else
                            {
                                name = str1.Substring(1, num2 - 1);
                                str2 = str1.Substring(num2 + 1);
                            }
                            dxfPattern             = new DxfPattern(name);
                            dxfPattern.Description = str2;
                            dxfPatternList.Add(dxfPattern);
                        }
                    }while (dxfPattern == null);
                    DxfPattern.Line line     = new DxfPattern.Line();
                    string[]        strArray = str1.Split(',');
                    line.Angle     = System.Math.PI / 180.0 * double.Parse(strArray[0], (IFormatProvider)CultureInfo.InvariantCulture);
                    line.BasePoint = new Point2D(double.Parse(strArray[1], (IFormatProvider)CultureInfo.InvariantCulture), double.Parse(strArray[2], (IFormatProvider)CultureInfo.InvariantCulture));
                    Vector2D vector2D = new Vector2D(double.Parse(strArray[3], (IFormatProvider)CultureInfo.InvariantCulture), double.Parse(strArray[4], (IFormatProvider)CultureInfo.InvariantCulture));
                    double   num3     = System.Math.Cos(line.Angle);
                    double   num4     = System.Math.Sin(line.Angle);
                    line.Offset = new Vector2D(vector2D.X * num3 - vector2D.Y * num4, vector2D.X * num4 + vector2D.Y * num3);
                    for (int index = 5; index < strArray.Length; ++index)
                    {
                        line.DashLengths.Add(double.Parse(strArray[index], (IFormatProvider)CultureInfo.InvariantCulture));
                    }
                    dxfPattern.Lines.Add(line);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Parse error at line {0}: ", (object)num1), ex);
            }
label_14:
            return(dxfPatternList.ToArray());
        }