Exemplo n.º 1
0
        protected override TToObject Mapping(AssetInfoType assetInfoType, TToObject ifcElement)
        {
            ifcElement.Name        = assetInfoType.AssetName;
            ifcElement.Description = assetInfoType.AssetDescription;

            #region Attributes

            if (assetInfoType.AssetAttributes != null)
            {
                foreach (var attribute in assetInfoType.AssetAttributes)
                {
                    Exchanger.ConvertAttributeTypeToIfcObjectProperty(ifcElement, attribute);
                }
            }
            #endregion

            #region Space Assignments

            if (assetInfoType.AssetSpaceAssignments != null && assetInfoType.AssetSpaceAssignments.Any())
            {
                foreach (var spaceAssignment in assetInfoType.AssetSpaceAssignments)
                {
                    var ifcSpace = Exchanger.GetIfcSpace(spaceAssignment);
                    if (ifcSpace == null)
                    {
                        throw new Exception("Space " + spaceAssignment.FloorName + " - " + spaceAssignment.SpaceName + " cannot be found");
                    }

                    ifcSpace.AddElement(ifcElement);
                }
            }
            #endregion

            return(ifcElement);
        }
Exemplo n.º 2
0
 static void UpdateHoveredAssetType(string hoveredAssetPath, bool showingUsedAssets)
 {
     if (hoveredAssetPath.IsInStreamingAssetsFolder())
     {
         _hoveredAssetType = AssetInfoType.InStreamingAssetsFolder;
     }
     else if (hoveredAssetPath.IsInPackagesFolder())
     {
         _hoveredAssetType = AssetInfoType.InAPackage;
     }
     else if (hoveredAssetPath.IsInResourcesFolder())
     {
         _hoveredAssetType = AssetInfoType.InAResourcesFolder;
     }
     else if (hoveredAssetPath.IsSceneFile() && showingUsedAssets)
     {
         _hoveredAssetType = AssetInfoType.ASceneInBuild;
     }
     else
     {
         _hoveredAssetType = AssetInfoType.None;
     }
 }
Exemplo n.º 3
0
        private bool ValidateAttributes(AssetTypeInfoType typeRequirements, AssetTypeInfoType type, AssetInfoType asset)
        {
            //get requirements
            var requirements =
                typeRequirements.AssetTypeAttributes.Where(
                    a => a.propertySetName != null && a.propertySetName.StartsWith("[required]"));

            //merge instance and type attributes
            var attrs = asset.AssetAttributes;

            attrs.AddRange(type.AssetTypeAttributes);

            //clear and fill in only required ones
            asset.AssetAttributes = new AttributeCollectionType();
            var allValid = true;

            foreach (var requirement in requirements)
            {
                //create new instance
                var attr = new AttributeType
                {
                    AttributeName                 = requirement.AttributeName,
                    AttributeCategory             = "Check",
                    AttributeDescription          = requirement.AttributeDescription,
                    propertySetName               = requirement.propertySetName,
                    propertySetExternalIdentifier = requirement.propertySetExternalIdentifier
                };

                //add value if defined
                //prefix [F] if no value is defined or [T] if it is defined
                //this will be used to report validation result
                var valAttr = attrs.FirstOrDefault(a => a.AttributeName == requirement.AttributeName);
                if (valAttr != null && valAttr.AttributeValue != null && valAttr.AttributeValue.Item != null)
                {
                    var prefix  = "[T]";
                    var valType = valAttr.AttributeValue.Item as ValueBaseType;
                    if (valType != null && !valType.HasValue())
                    {
                        allValid = false;
                        prefix   = "[F]";
                    }

                    attr.AttributeValue = valAttr.AttributeValue;
                    attr.AttributeName  = prefix + attr.AttributeName;
                }
                else
                {
                    allValid           = false;
                    attr.AttributeName = "[F]" + attr.AttributeName;
                }

                asset.AssetAttributes.Add(attr);
            }

            asset.AssetName = (allValid ? "[T]" : "[F]") + asset.AssetName;
            return(allValid);
        }
Exemplo n.º 4
0
        TAsset MapAsset <TAsset>(AssetInfoType assetInfoType) where TAsset : IfcElement
        {
            var assetInfoTypeMapping = Exchanger.GetOrCreateMappings <MappingAssetInfoTypeToIfcElement <TAsset> >();

            return(assetInfoTypeMapping.AddMapping(assetInfoType, assetInfoTypeMapping.GetOrCreateTargetObject(assetInfoType.externalID)));
        }