Exemple #1
0
        public XbimGeometryData TransformBy(XbimMatrix3D matrix)
        {
            XbimMatrix3D t = XbimMatrix3D.FromArray(DataArray2);

            t = XbimMatrix3D.Multiply(t, matrix);
            return(new XbimGeometryData(GeometryLabel, IfcProductLabel, GeometryType, IfcTypeId, ShapeData, t.ToArray(), GeometryHash, StyleLabel, Counter));
        }
Exemple #2
0
        public static XbimRegionCollection FromArray(byte[] bytes)
        {
            var coll = new XbimRegionCollection();
            var ms   = new MemoryStream(bytes);
            var br   = new BinaryReader(ms);

            bool oldVersion = true;
            int  version    = br.ReadInt32();//if version is a negative number, we have a new version model, and therefore have coord data to retrieve. Otherwise version is actually the count
            int  count      = 0;

            if (version < 0)
            {
                count      = br.ReadInt32();
                oldVersion = false;
            }
            else
            {
                count = version;
            }

            for (var i = 0; i < count; i++)
            {
                var region = new XbimRegion
                {
                    Name       = br.ReadString(),
                    Population = br.ReadInt32()
                };
                float x = br.ReadSingle();
                float y = br.ReadSingle();
                float z = br.ReadSingle();
                region.Centre = new XbimPoint3D(x, y, z);
                x             = br.ReadSingle();
                y             = br.ReadSingle();
                z             = br.ReadSingle();
                region.Size   = new XbimVector3D(x, y, z);
                if (!oldVersion)
                {
                    region.WorldCoordinateSystem = XbimMatrix3D.FromArray(br.ReadBytes(CoordSize));
#pragma warning disable CS0618 // Type or member is obsolete
                    region.version = version;
                }
                else
                {
                    region.version = 0;
#pragma warning restore CS0618 // Type or member is obsolete
                }
                coll.Add(region);
            }
            return(coll);
        }