示例#1
0
        internal static DxfObject FromBuffer(DxfCodePairBufferReader buffer)
        {
            var first = buffer.Peek();

            buffer.Advance();
            DxfObject obj;

            switch (first.StringValue)
            {
            case "ACAD_PROXY_OBJECT":
                obj = new DxfAcadProxyObject();
                break;

            case "ACDBDICTIONARYWDFLT":
                obj = new DxfDictionaryWithDefault();
                break;

            case "ACDBPLACEHOLDER":
                obj = new DxfPlaceHolder();
                break;

            case "DATATABLE":
                obj = new DxfDataTable();
                break;

            case "DICTIONARY":
                obj = new DxfDictionary();
                break;

            case "DICTIONARYVAR":
                obj = new DxfDictionaryVariable();
                break;

            case "DIMASSOC":
                obj = new DxfDimensionAssociativity();
                break;

            case "FIELD":
                obj = new DxfField();
                break;

            case "GEODATA":
                obj = new DxfGeoData();
                break;

            case "GROUP":
                obj = new DxfGroup();
                break;

            case "IDBUFFER":
                obj = new DxfIdBuffer();
                break;

            case "IMAGEDEF":
                obj = new DxfImageDefinition();
                break;

            case "IMAGEDEF_REACTOR":
                obj = new DxfImageDefinitionReactor();
                break;

            case "LAYER_FILTER":
                obj = new DxfLayerFilter();
                break;

            case "LAYER_INDEX":
                obj = new DxfLayerIndex();
                break;

            case "LAYOUT":
                obj = new DxfLayout();
                break;

            case "LIGHTLIST":
                obj = new DxfLightList();
                break;

            case "MATERIAL":
                obj = new DxfMaterial();
                break;

            case "MLEADERSTYLE":
                obj = new DxfMLeaderStyle();
                break;

            case "MLINESTYLE":
                obj = new DxfMLineStyle();
                break;

            case "OBJECT_PTR":
                obj = new DxfObjectPointer();
                break;

            case "PLOTSETTINGS":
                obj = new DxfPlotSettings();
                break;

            case "RASTERVARIABLES":
                obj = new DxfRasterVariables();
                break;

            case "MENTALRAYRENDERSETTINGS":
                obj = new DxfMentalRayRenderSettings();
                break;

            case "RENDERENVIRONMENT":
                obj = new DxfRenderEnvironment();
                break;

            case "RENDERGLOBAL":
                obj = new DxfRenderGlobal();
                break;

            case "SECTIONMANAGER":
                obj = new DxfSectionManager();
                break;

            case "SECTIONSETTINGS":
                obj = new DxfSectionSettings();
                break;

            case "SORTENTSTABLE":
                obj = new DxfSortentsTable();
                break;

            case "SPATIAL_FILTER":
                obj = new DxfSpatialFilter();
                break;

            case "SPATIAL_INDEX":
                obj = new DxfSpatialIndex();
                break;

            case "SUNSTUDY":
                obj = new DxfSunStudy();
                break;

            case "TABLESTYLE":
                obj = new DxfTableStyle();
                break;

            case "UNDERLAYDEFINITION":
                obj = new DxfUnderlayDefinition();
                break;

            case "VBA_PROJECT":
                obj = new DxfVbaProject();
                break;

            case "VISUALSTYLE":
                obj = new DxfVisualStyle();
                break;

            case "WIPEOUTVARIABLES":
                obj = new DxfWipeoutVariables();
                break;

            case "XRECORD":
                obj = new DxfXRecordObject();
                break;

            default:
                SwallowObject(buffer);
                obj = null;
                break;
            }

            if (obj != null)
            {
                obj = obj.PopulateFromBuffer(buffer);
            }

            return(obj);
        }
示例#2
0
        public void WriteSectionSettingsTest()
        {
            var settings = new DxfSectionSettings();
            settings.SectionType = 42;
            var typeSettings = new DxfSectionTypeSettings()
            {
                SectionType = 43,
                IsGenerationOption = true,
                DestinationObjectHandle = 0xFFu,
                DestinationFileName = "file-name",
            };
            typeSettings.SourceObjectHandles.Add(0x100u);
            typeSettings.SourceObjectHandles.Add(0x101u);
            typeSettings.GeometrySettings.Add(new DxfSectionGeometrySettings() { SectionType = 1001 });
            typeSettings.GeometrySettings.Add(new DxfSectionGeometrySettings() { SectionType = 1002 });
            settings.SectionTypeSettings.Add(typeSettings);
            var file = new DxfFile();
            file.Objects.Add(settings);
            VerifyFileContains(file, @"
              0
            SECTIONSETTINGS
              5
            A
            100
            AcDbSectionSettings
             90
            42
             91
            1
              1
            SectionTypeSettings
             90
            43
             91
            1
             92
            2
            330
            100
            330
            101
            331
            FF
              1
            file-name
             93
            2
              2
            SectionGeometrySettings
             90
            1001
             91
            0
             92
            0
             63
            0
              8

              6

             40
            1.0
              1

            370
            0
             70
            0
             71
            0
             72
            0
              2

             41
            0.0
             42
            1.0
             43
            0.0
              3
            SectionGeometrySettingsEnd
             90
            1002
             91
            0
             92
            0
             63
            0
              8

              6

             40
            1.0
              1

            370
            0
             70
            0
             71
            0
             72
            0
              2

             41
            0.0
             42
            1.0
             43
            0.0
              3
            SectionGeometrySettingsEnd
              3
            SectionTypeSettingsEnd
            ");
        }