Пример #1
0
        public DXFShape(Header _Header, Classes _Classes, Tables _Tables, Blocks _Blocks, Entities _Entities, Objects _Objects)
        {
            header   = _Header;
            classes  = _Classes;
            tables   = _Tables;
            blocks   = _Blocks;
            entities = _Entities;
            objects  = _Objects;

            if (header.variableList.ContainsKey("$INSUNITS"))
            {
                switch (int.Parse(header.variableList["$INSUNITS"].Get(70).First()))
                {
                //Inch
                case 1:
                    unitLength = 25.4f;
                    break;

                //Foot
                case 2:
                    unitLength = 304.8f;
                    break;

                //Mile
                case 3:
                    unitLength = 1.609e+6f;
                    break;

                //CM
                case 5:
                    unitLength = 10;
                    break;

                //M
                case 6:
                    unitLength = 100;
                    break;

                //KM
                case 7:
                    unitLength = 1000;
                    break;

                //Microinches
                case 8:
                    unitLength = 0.00002539998f;
                    break;

                //Mils
                case 9:
                    unitLength = 0.0254f;
                    break;

                //Yards
                case 10:
                    unitLength = 914.4f;
                    break;

                //Angstroms
                case 11:
                    unitLength = 1e-7f;
                    break;

                //Nanometers
                case 12:
                    unitLength = 1e-6f;
                    break;

                //Microns
                case 13:
                    unitLength = 0.001f;
                    break;

                //Decimeters
                case 14:
                    unitLength = 100;
                    break;

                //Hectometers
                case 16:
                    unitLength = 100000;
                    break;

                //Gigameters
                case 17:
                    unitLength = 1e+12f;
                    break;

                //Astronomical units
                case 18:
                    unitLength = 1.495978707e+14f;
                    break;

                //Light years
                case 19:
                    unitLength = 9.461e+18f;
                    break;

                //Parsecs
                case 20:
                    unitLength = 3.086e+19f;
                    break;
                }
            }
            maxVert = new PointF(float.Parse(header.variableList["$EXTMAX"].Get(10).First()),
                                 float.Parse(header.variableList["$EXTMAX"].Get(20).First()));

            minVert = new PointF(float.Parse(header.variableList["$EXTMIN"].Get(10).First()),
                                 float.Parse(header.variableList["$EXTMIN"].Get(20).First()));

            SetRenderData();
        }