Beispiel #1
0
 public DxfSectionReaderBase(
     IDxfStreamReader reader,
     DxfDocumentBuilder builder,
     NotificationEventHandler notification = null)
 {
     this._reader       = reader;
     this._builder      = builder;
     this._notification = notification;
 }
Beispiel #2
0
        /// <inheritdoc/>
        public override CadDocument Read()
        {
            this._document = new CadDocument(false);
            this._builder  = new DxfDocumentBuilder(this._document, this.OnNotificationHandler);

            this._reader = this._reader ?? this.getReader();

            while (this._reader.LastValueAsString != DxfFileToken.EndOfFile)
            {
                if (this._reader.LastValueAsString != DxfFileToken.BeginSection)
                {
                    this._reader.ReadNext();
                    continue;
                }
                else
                {
                    this._reader.ReadNext();
                }

                switch (this._reader.LastValueAsString)
                {
                case DxfFileToken.HeaderSection:
                    this._document.Header = this.ReadHeader();
                    break;

                case DxfFileToken.ClassesSection:
                    this._document.Classes = this.readClasses();
                    break;

                case DxfFileToken.TablesSection:
                    this.readTables();
                    break;

                case DxfFileToken.BlocksSection:
                    this.readBlocks();
                    break;

                case DxfFileToken.EntitiesSection:
                    this.readEntities();
                    break;

                case DxfFileToken.ObjectsSection:
                    this.readObjects();
                    break;

                default:
                    this.OnNotificationHandler(this, new NotificationEventArgs($"Section not implemented {this._reader.LastValueAsString}"));
                    break;
                }

                this._reader.ReadNext();
            }

            this._builder.BuildDocument();

            return(this._document);
        }
 public DxfObjectsSectionReader(IDxfStreamReader reader, DxfDocumentBuilder builder, NotificationEventHandler notification = null)
     : base(reader, builder, notification)
 {
 }