Пример #1
0
 public ViewElm Read(BinaryReader br)
 {
     // read each field
     Ehdr               = new Elm_hdr().Read(br);
     ComponentCount     = br.ReadUInt32();
     Dummy1             = br.ReadUInt32();
     RMatrix            = new RotMatrix().Read(br);
     ViewportGlobalRect = new DRectangle().Read(br);
     Origin             = new DPoint3d().Read(br);
     Delta              = new DPoint3d().Read(br);
     Y = new double[5];
     for (int i = 0; i < 5; i++)
     {
         Y[i] = br.ReadDouble();
     }
     ActiveZ    = br.ReadDouble();
     PixelRect  = new SRectangle().Read(br);
     Flags      = new ViewFlags().Read(br);
     Dummy4     = br.ReadUInt32();
     ViewNumber = br.ReadUInt32();
     ModelId    = br.ReadUInt32();
     Z          = new UInt32[8];
     for (int i = 0; i < 8; i++)
     {
         Z[i] = br.ReadUInt32();
     }
     Linkages    = V8Linkages.V8GetLinkages(br, Ehdr);
     Name        = V8Linkages.V8GetStringLinkage(Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Name);
     Description = V8Linkages.V8GetStringLinkage(Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Description);
     return(this);
 }
Пример #2
0
        public ViewGroupElm Read(BinaryReader br)
        {
            // read each field
            Ehdr           = new Elm_hdr().Read(br);
            ComponentCount = br.ReadUInt32();
            //Views = new


            Linkages    = V8Linkages.V8GetLinkages(br, Ehdr);
            Name        = V8Linkages.V8GetStringLinkage(Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Name);
            Description = V8Linkages.V8GetStringLinkage(Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Description);
            return(this);
        }
Пример #3
0
 public LevelTableElm Read(BinaryReader br)
 {
     // read each field
     Ehdr             = new Elm_hdr().Read(br);
     LevelId          = br.ReadUInt32();
     ParentId         = br.ReadUInt32();
     Dummy1           = br.ReadUInt32();
     Dummy2           = br.ReadUInt32();
     Linkages         = V8Linkages.V8GetLinkages(br, Ehdr);
     LevelName        = V8Linkages.V8GetStringLinkage(Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Name);
     LevelDescription = V8Linkages.V8GetStringLinkage(Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Description);
     return(this);
 }
Пример #4
0
        public static ModelInfo V8GetModelInfoFromCache(DgnCache cache)
        {
            var modelInfo  = new ModelInfo();
            var modelCache = cache.ModelCache;

            using MemoryStream ms = new(modelCache.Bytes);
            using BinaryReader br = new(ms);

            // what are bytes (ints) at 0x00, 0x04, 0x08 ???
            ms.Seek(0x1004, SeekOrigin.Begin);
            var modelHeaderElm = new ModelHeaderElm().Read(br);

            modelInfo.ModelId          = cache.ModelNum;
            modelInfo.ModelName        = V8Linkages.V8GetStringLinkage(modelHeaderElm.Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Name);
            modelInfo.ModelDescription = V8Linkages.V8GetStringLinkage(modelHeaderElm.Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_Description);
            modelInfo.MasterUnit       = new UnitInfo
            {
                Numerator   = modelHeaderElm.MuNumerator,
                Denominator = modelHeaderElm.MuDenominator,
                Flags       = new UnitFlags
                {
                },
                Label = V8Linkages.V8GetStringLinkage(modelHeaderElm.Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_MastUnitLabel)
            };
            modelInfo.SubUnit = new UnitInfo
            {
                Numerator   = modelHeaderElm.SuNumerator,
                Denominator = modelHeaderElm.SuDenominator,
                Flags       = new UnitFlags
                {
                },
                Label = V8Linkages.V8GetStringLinkage(modelHeaderElm.Linkages, LinkageKeyValuesString.STRING_LINKAGE_KEY_SubUnitLabel)
            };
            modelInfo.StorageUnit = new UnitInfo
            {
                Numerator   = modelHeaderElm.StNumerator,
                Denominator = modelHeaderElm.StDenominator,
                Flags       = new UnitFlags
                {
                },
                //Label =
            };
            modelInfo.UorPerSub                 = modelHeaderElm.UorsPerStorage * (modelHeaderElm.StNumerator / modelHeaderElm.StDenominator) / (modelHeaderElm.SuNumerator / modelHeaderElm.SuDenominator);
            modelInfo.UorPerStorage             = modelHeaderElm.UorsPerStorage;
            modelInfo.UorPerMaster              = modelHeaderElm.UorsPerStorage * (modelHeaderElm.StNumerator / modelHeaderElm.StDenominator) / (modelHeaderElm.MuNumerator / modelHeaderElm.MuDenominator);
            modelInfo.SubPerMaster              = (modelHeaderElm.SuNumerator / modelHeaderElm.SuDenominator) / (modelHeaderElm.MuNumerator / modelHeaderElm.MuDenominator);
            modelInfo.LastModified              = modelHeaderElm.LastModified;
            modelInfo.GlobalOrigin              = modelHeaderElm.GlobalOrigin;
            modelInfo.GridPerRefernce           = modelHeaderElm.GridPerReference;
            modelInfo.UorPerGrid                = modelHeaderElm.Z15;
            modelInfo.GridRatio                 = modelHeaderElm.Z16;
            modelInfo.ModelType                 = (int)(modelHeaderElm.Dummy1 & 0xFFFF0000) >> 16;
            modelInfo.DgnModelType              = (DgnModelType)(modelInfo.ModelType);
            modelInfo.AcsOrigin.X               = modelHeaderElm.Z2;
            modelInfo.AcsOrigin.Y               = modelHeaderElm.Z3;
            modelInfo.AcsOrigin.Z               = modelHeaderElm.Z4;
            modelInfo.AcsRotMatrix.Form3d       = new double[3, 3];
            modelInfo.AcsRotMatrix.Form3d[0, 0] = modelHeaderElm.Z5;
            modelInfo.AcsRotMatrix.Form3d[0, 1] = modelHeaderElm.Z6;
            modelInfo.AcsRotMatrix.Form3d[0, 2] = modelHeaderElm.Z7;
            modelInfo.AcsRotMatrix.Form3d[1, 0] = modelHeaderElm.Z8;
            modelInfo.AcsRotMatrix.Form3d[1, 1] = modelHeaderElm.Z9;
            modelInfo.AcsRotMatrix.Form3d[1, 2] = modelHeaderElm.Z10;
            modelInfo.AcsRotMatrix.Form3d[2, 0] = modelHeaderElm.Z11;
            modelInfo.AcsRotMatrix.Form3d[2, 1] = modelHeaderElm.Z12;
            modelInfo.AcsRotMatrix.Form3d[2, 2] = modelHeaderElm.Z13;

            modelInfo.Rng.Xlowlim  = modelHeaderElm.Y0;
            modelInfo.Rng.Ylowlim  = modelHeaderElm.Y1;
            modelInfo.Rng.Zlowlim  = modelHeaderElm.Y2;
            modelInfo.Rng.Xhighlim = modelHeaderElm.Y3;
            modelInfo.Rng.Yhighlim = modelHeaderElm.Y4;
            modelInfo.Rng.Zhighlim = modelHeaderElm.Y5;
            return(modelInfo);
        }