internal AppId(DxfEntryTemplate template) : base(template) { if (string.IsNullOrEmpty(template.TableName)) { throw new ArgumentNullException(nameof(template.TableName), "App id must have a name."); } }
internal TableEntry(DxfEntryTemplate template) { //TableName = template.TableName; Name = template.Name; Handle = template.Handle; OwnerHandle = template.OwnerHandle; }
internal Layer(DxfEntryTemplate template) : base(template) { if (string.IsNullOrEmpty(template.Name)) { throw new ArgumentNullException(nameof(template.Name), "Layer must have a name."); } }
private List <TableEntry> readEntries() { List <TableEntry> entries = new List <TableEntry>(); //Read all the entries until the end of the table while (m_reader.LastValueAsString != DxfFileToken.EndTable) { DxfEntryTemplate template = new DxfEntryTemplate(); //Read the common entry data while (m_reader.LastDxfCode != DxfCode.Subclass) { switch (m_reader.LastCode) { //Entity type (table name) case 0: template.TableName = m_reader.LastValueAsString; break; //Handle (all except DIMSTYLE) case 5: //Handle(all except DIMSTYLE) case 105: template.Handle = m_reader.LastValueAsHandle; break; //Start of application - defined group case 102: //TODO: read dictionary groups for entities do { m_reader.ReadNext(); }while (m_reader.LastDxfCode != DxfCode.ControlString); break; //Soft - pointer ID / handle to owner BLOCK_RECORD object case 330: template.OwnerHandle = m_reader.LastValueAsHandle; break; default: Debug.Fail($"Unhandeled dxf code {m_reader.LastCode} at line {m_reader.Line}."); break; } m_reader.ReadNext(); } Debug.Assert(m_reader.LastValueAsString == DxfSubclassMarker.TableRecord); m_reader.ReadNext(); TableEntry entry = readEntry(template); entries.Add(entry); } return(entries); }
internal UCS(DxfEntryTemplate template) : base(template) { }
internal DimensionStyle(DxfEntryTemplate template) : base(template) { }
internal VPort(DxfEntryTemplate template) : base(template) { }
internal View(DxfEntryTemplate template) : base(template) { }
internal LineType(DxfEntryTemplate template) : base(template) { }
internal Style(DxfEntryTemplate template) : base(template) { }
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); }