Beispiel #1
0
        private static void HandleSpace(IIfcSpace space, FeatureCollection features, double longitude, double latitude)
        {
            var geom  = (IfcExtrudedAreaSolid)space.Representation.Representations[0].Items[0];
            var depth = geom.Depth;

            if (geom.SweptArea is IfcArbitraryClosedProfileDef)
            {
                var sweptArea = (IfcArbitraryClosedProfileDef)geom.SweptArea;
                if (sweptArea.OuterCurve is IfcPolyline)
                {
                    var outercurve = (IfcPolyline)sweptArea.OuterCurve;
                    var line       = outercurve.Points;

                    var points = new List <IPosition>();
                    foreach (var pnt in line)
                    {
                        var newp = AddDelta(longitude, latitude, pnt.X / 1000, pnt.Y / 1000);
                        points.Add(new Position(newp.y, newp.x));
                    }
                    var featureProperties = new Dictionary <string, object> {
                    };
                    var ls   = new LineString(points);
                    var feat = new Feature(ls, featureProperties);
                    features.Features.Add(feat);
                }
            }
        }
Beispiel #2
0
        /***************************************************/

        public static IEnumerable <IBHoMObject> FromIfc(this IIfcSpace element, Discipline discipline, IfcSettings settings)
        {
            switch (discipline)
            {
            default:
                return(new List <IBHoMObject> {
                    element.SpaceFromIfc(settings)
                });
            }
        }
        public IEnumerable <IIfcZone> GetZones(IIfcSpace space)
        {
            HashSet <IIfcZone> zones;

            if (_spaceZones.TryGetValue(space, out zones))
            {
                return(zones);
            }
            return(Enumerable.Empty <IIfcZone>());
        }
Beispiel #4
0
        private static IIfcBuildingStorey GetFloor(IIfcSpace space)
        {
            return
                //get all objectified relations which model decomposition by this space
                (space.Decomposes

                 //select decomposed objects (these might be either other space or building storey)
                 .Select(r => r.RelatingObject)

                 //get only storeys
                 .OfType <IIfcBuildingStorey>()

                 //get the first one
                 .FirstOrDefault());
        }
Beispiel #5
0
        /***************************************************/
        /****              Public Methods               ****/
        /***************************************************/

        public static Space SpaceFromIfc(this IIfcSpace element, IfcSettings settings)
        {
            if (element == null)
            {
                BH.Engine.Reflection.Compute.RecordError("The IFC element could not be converted because it was null.");
                return(null);
            }

            settings = settings.DefaultIfNull();

            //TODO: refine this!
            return(new Space {
                Name = element.Name
            });
        }
Beispiel #6
0
        private static void WriteSpaceRow(IIfcSpace space, ISheet sheet, ICellStyle areaStyle, ICellStyle volumeStyle)
        {
            var row = sheet.CreateRow(sheet.LastRowNum + 1);

            var name = space.Name;

            row.CreateCell(0).SetCellValue(name);

            var floor = GetFloor(space);

            row.CreateCell(1).SetCellValue(floor?.Name);

            var area = GetArea(space);

            if (area != null)
            {
                var cell = row.CreateCell(2);
                cell.CellStyle = areaStyle;

                //there is no guarantee it is a number if it came from property and not from a quantity
                if (area.UnderlyingSystemType == typeof(double))
                {
                    cell.SetCellValue((double)(area.Value));
                }
                else
                {
                    cell.SetCellValue(area.ToString());
                }
            }

            var volume = GetVolume(space);

            if (volume != null)
            {
                var cell = row.CreateCell(3);
                cell.CellStyle = volumeStyle;

                //there is no guarantee it is a number if it came from property and not from a quantity
                if (volume.UnderlyingSystemType == typeof(double))
                {
                    cell.SetCellValue((double)(volume.Value));
                }
                else
                {
                    cell.SetCellValue(volume.ToString());
                }
            }
        }
Beispiel #7
0
        //private IfcSpace _ifcSpace;

        public SpaceType(IIfcSpace ifcSpace, CoBieLiteHelper helper)
            : this()
        {
            // _ifcSpace = ifcSpace;
            externalEntityName     = helper.ExternalEntityName(ifcSpace);
            externalID             = helper.ExternalEntityIdentity(ifcSpace);
            externalSystemName     = helper.ExternalSystemName(ifcSpace);
            SpaceName              = ifcSpace.Name;
            SpaceCategory          = helper.GetClassification(ifcSpace);
            SpaceDescription       = ifcSpace.Description;
            SpaceSignageName       = helper.GetCoBieAttribute <StringValueType>("SpaceSignageName", ifcSpace).StringValue;
            SpaceUsableHeightValue = helper.GetCoBieAttribute <DecimalValueType>("SpaceUsableHeightValue", ifcSpace);
            SpaceGrossAreaValue    = helper.GetCoBieAttribute <DecimalValueType>("SpaceGrossAreaValue", ifcSpace);
            SpaceNetAreaValue      = helper.GetCoBieAttribute <DecimalValueType>("SpaceNetAreaValue", ifcSpace);

            //Zone Assignment
            var zones = helper.GetZones(ifcSpace);

            if (zones != null)
            {
                var ifcZones = zones.ToArray();
                SpaceZoneAssignments = new ZoneAssignmentCollectionType {
                    ZoneAssignment = new List <ZoneKeyType>(ifcZones.Length)
                };
                for (int i = 0; i < ifcZones.Length; i++)
                {
                    var zoneAssignment = new ZoneKeyType();
                    zoneAssignment.ZoneCategory        = helper.GetClassification(ifcZones[i]);
                    zoneAssignment.ZoneName            = ifcZones[i].Name;
                    zoneAssignment.externalIDReference = helper.ExternalEntityIdentity(ifcZones[i]);
                    SpaceZoneAssignments.Add(zoneAssignment);
                }
            }
            //Attributes
            var ifcAttributes = helper.GetAttributes(ifcSpace);

            if (ifcAttributes != null && ifcAttributes.Any())
            {
                SpaceAttributes = new AttributeCollectionType {
                    Attribute = ifcAttributes
                }
            }
            ;

            //TODO:
            //Space Issues
            //Space Documents
        }
Beispiel #8
0
 public SpaceKeyType(IIfcSpace ifcSpace, CoBieLiteHelper helper)
     : this()
 {
     FloorName = helper.SpaceFloorLookup[ifcSpace].Name;
     SpaceName = ifcSpace.Name;
 }
Beispiel #9
0
 private decimal GetAreaDecimal(IIfcSpace space)
 {
     return(Convert.ToDecimal(GetArea(space).Value));
 }