コード例 #1
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
        }
コード例 #2
0
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        //private IfcBuildingStorey _ifcBuildingStorey;


        public FloorType(IfcBuildingStorey ifcBuildingStorey, CoBieLiteHelper helper)
            : this()
        {
            //   _ifcBuildingStorey = ifcBuildingStorey;
            externalEntityName = helper.ExternalEntityName(ifcBuildingStorey);
            externalID         = helper.ExternalEntityIdentity(ifcBuildingStorey);
            externalSystemName = helper.ExternalSystemName(ifcBuildingStorey);
            FloorName          = ifcBuildingStorey.Name;
            FloorCategory      = helper.GetClassification(ifcBuildingStorey);
            FloorDescription   = ifcBuildingStorey.Description;
            //set the fall backs

            if (ifcBuildingStorey.Elevation.HasValue)
            {
                FloorElevationValue = new DecimalValueType
                {
                    DecimalValue          = ifcBuildingStorey.Elevation.Value,
                    DecimalValueSpecified = true
                };
                //TODO: work out if the units can change
                //FloorElevationValue.UnitName =
            }
            FloorHeightValue = helper.GetCoBieAttribute <DecimalValueType>("FloorHeightValue", ifcBuildingStorey);
            //var heightProperty = ifcBuildingStorey.GetTotalHeightProperty();
            //if (heightProperty != null)
            //{
            //    FloorHeightValue = new DecimalValueType
            //    {
            //        DecimalValue = heightProperty.LengthValue,
            //        DecimalValueSpecified = true,
            //        UnitName = heightProperty.Unit.GetName()
            //    };
            //}

            var spaces    = ifcBuildingStorey.GetSpaces();
            var ifcSpaces = spaces as IList <IfcSpace> ?? spaces.ToList();

            if (ifcSpaces.Any())
            {
                Spaces = new SpaceCollectionType {
                    Space = new List <SpaceType>(ifcSpaces.Count)
                };
                for (var i = 0; i < ifcSpaces.Count; i++)
                {
                    Spaces.Add(new SpaceType(ifcSpaces[i], helper));
                }
            }

            //Attributes
            var ifcAttributes = helper.GetAttributes(ifcBuildingStorey);

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

            //TODO:
            //Space Issues
            //Space Documents
        }
コード例 #3
0
        public AssetTypeInfoType(IIfcTypeObject ifcTypeObject, CoBieLiteHelper helper)
            : this()
        {
            externalEntityName = helper.ExternalEntityName(ifcTypeObject);
            externalID         = helper.ExternalEntityIdentity(ifcTypeObject);
            externalSystemName = helper.ExternalSystemName(ifcTypeObject);
            AssetTypeName      = ifcTypeObject.Name;
            AssetTypeCategory  = helper.GetClassification(ifcTypeObject);
            string accCategoryString = helper.GetCoBieProperty("AssetTypeAccountingCategory", ifcTypeObject);
            AssetPortabilitySimpleType accCategoryEnum;

            if (Enum.TryParse(accCategoryString, true, out accCategoryEnum))
            {
                AssetTypeAccountingCategory = accCategoryEnum;
            }
            else
            {
                CoBieLiteHelper.Logger.WarnFormat("AssetTypeAccountingCategory: An illegal value of [{0}] has been passed for the category of #{1}={2}. It has been replaced with a value of 'Item'", accCategoryString, ifcTypeObject.EntityLabel, ifcTypeObject.GetType().Name);
                AssetTypeAccountingCategory = AssetPortabilitySimpleType.Item;
            }
            if (string.IsNullOrWhiteSpace(AssetTypeCategory)) //try the asset assignment
            {
                IIfcAsset ifcAsset;
                if (helper.AssetAsignments.TryGetValue(ifcTypeObject, out ifcAsset))
                {
                    AssetTypeCategory = helper.GetCoBieAttribute <StringValueType>("AssetTypeAccountingCategory", ifcAsset).StringValue;
                }
            }
            AssetTypeDescription             = ifcTypeObject.Description;
            AssetTypeModelNumber             = helper.GetCoBieProperty("AssetTypeModelNumber", ifcTypeObject);
            AssetTypeReplacementCostValue    = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeReplacementCostValue", ifcTypeObject);
            AssetTypeExpectedLifeValue       = helper.GetCoBieAttribute <IntegerValueType>("AssetTypeExpectedLifeValue", ifcTypeObject);
            AssetTypeNominalLength           = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeNominalLength", ifcTypeObject);
            AssetTypeNominalWidth            = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeNominalWidth", ifcTypeObject);
            AssetTypeNominalHeight           = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeNominalHeight", ifcTypeObject);
            AssetTypeAccessibilityText       = helper.GetCoBieProperty("AssetTypeAccessibilityText", ifcTypeObject);
            AssetTypeColorCode               = helper.GetCoBieProperty("AssetTypeColorCode", ifcTypeObject);
            AssetTypeConstituentsDescription = helper.GetCoBieProperty("AssetTypeConstituentsDescription", ifcTypeObject);
            AssetTypeFeaturesDescription     = helper.GetCoBieProperty("AssetTypeFeaturesDescription", ifcTypeObject);
            AssetTypeGradeDescription        = helper.GetCoBieProperty("AssetTypeGradeDescription", ifcTypeObject);
            AssetTypeMaterialDescription     = helper.GetCoBieProperty("AssetTypeMaterialDescription", ifcTypeObject);
            AssetTypeShapeDescription        = helper.GetCoBieProperty("AssetTypeShapeDescription", ifcTypeObject);
            AssetTypeSizeDescription         = helper.GetCoBieProperty("AssetTypeSizeDescription", ifcTypeObject);
            AssetTypeSustainabilityPerformanceDescription = helper.GetCoBieProperty("AssetTypeSustainabilityPerformanceDescription", ifcTypeObject);

            //The Assets
            List <IIfcElement> allAssetsofThisType;

            if (helper.DefiningTypeObjectMap.TryGetValue(ifcTypeObject, out allAssetsofThisType)) //should always work
            {
                Assets = new AssetCollectionType {
                    Asset = new List <AssetInfoType>(allAssetsofThisType.Count)
                };
                foreach (IIfcElement t in allAssetsofThisType)
                {
                    Assets.Add(new AssetInfoType(t, helper));
                }
            }
            else
            {
                //just in case we have a problem
                CoBieLiteHelper.Logger.ErrorFormat("Asset Type: Failed to locate Asset Type #{0}={1}", ifcTypeObject.EntityLabel, ifcTypeObject.GetType().Name);
            }

            //Attributes
            var ifcAttributes = helper.GetAttributes(ifcTypeObject);

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