示例#1
0
        private static LayerStateProperties ReadLayerProperties(TextCodeValueReader chunk)
        {
            LayerPropertiesFlags flags = LayerPropertiesFlags.Plot;
            string lineType            = String.Empty;
            //string plotStyle = string.Empty;
            AciColor     color        = AciColor.Default;
            Lineweight   lineweight   = Lineweight.Default;
            Transparency transparency = new Transparency(0);

            string name = chunk.ReadString();

            chunk.Next();

            while (chunk.Code != 8 && chunk.Code != 0)
            {
                switch (chunk.Code)
                {
                case 90:
                    flags = (LayerPropertiesFlags)chunk.ReadInt();
                    chunk.Next();
                    break;

                case 62:
                    color = AciColor.FromCadIndex(chunk.ReadShort());
                    chunk.Next();
                    break;

                case 370:
                    lineweight = (Lineweight)chunk.ReadShort();
                    chunk.Next();
                    break;

                case 6:
                    lineType = chunk.ReadString();
                    chunk.Next();
                    break;

                case 2:
                    //plotStyle = chunk.ReadString();
                    chunk.Next();
                    break;

                case 440:
                    int alpha = chunk.ReadInt();
                    transparency = alpha == 0 ? new Transparency(0) : Transparency.FromAlphaValue(alpha);
                    chunk.Next();
                    break;

                case 92:
                    color = AciColor.FromTrueColor(chunk.ReadInt());
                    chunk.Next();
                    break;

                default:
                    chunk.Next();
                    break;
                }
            }

            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            LayerStateProperties properties = new LayerStateProperties(name)
            {
                Flags        = flags,
                Color        = color,
                Lineweight   = lineweight,
                LinetypeName = lineType,
                //PlotStyleName = plotStyle,
                Transparency = transparency
            };

            return(properties);
        }