Beispiel #1
0
        private TableEntry readEntry(DxfEntryTemplate template)
        {
            TableEntry table = null;

            //Get the entry
            switch (template.TableName)
            {
            case DxfFileToken.TableAppId:
                table = new AppId(template);
                break;

            case DxfFileToken.TableBlockRecord:
                table = new BlockRecord(template);
                break;

            case DxfFileToken.TableDimstyle:
                table = new DimensionStyle(template);
                break;

            case DxfFileToken.TableLayer:
                table = new Layer(template);
                break;

            case DxfFileToken.TableLinetype:
                table = new LineType(template);
                break;

            case DxfFileToken.TableStyle:
                table = new Style(template);
                break;

            case DxfFileToken.TableUcs:
                table = new UCS(template);
                break;

            case DxfFileToken.TableView:
                table = new View(template);
                break;

            case DxfFileToken.TableVport:
                table = new VPort(template);
                break;

            default:
                Debug.Fail($"Unhandeled table {template.Name}.");
                break;
            }

            //Jump the SubclassMarker
            m_reader.ReadNext();

            Dictionary <DxfCode, object> map = table?.GetCadObjectMap() ?? new Dictionary <DxfCode, object>();

            while (m_reader.LastDxfCode != DxfCode.Start)
            {
                //Check if the dxf code is registered
                if (map.ContainsKey(m_reader.LastDxfCode))
                {
                    //Set the value
                    map[m_reader.LastDxfCode] = m_reader.LastValue;
                }

                m_reader.ReadNext();
            }

            //Build the table based on the map
            table?.Build(map);

            return(table);
        }