Esempio n. 1
0
        /// <summary>
        /// Check that an IFCData is properly formatted to potentially be an IfcSegmentIndexSelect.
        /// </summary>
        /// <param name="segment"></param>
        /// <returns>The type of IfcSegmentIndexSelect, or null if invalid.</returns>
        /// <remarks>The calling function is responsible for logging errors.</remarks>
        private string ValidateSegment(IFCData segment)
        {
            if (segment.PrimitiveType != IFCDataPrimitiveType.Aggregate)
            {
                return(null);
            }

            if (!segment.HasSimpleType())
            {
                return(null);
            }

            return(segment.GetSimpleType());
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the unit type from an IFC data.
        /// </summary>
        /// <param name="data">The IFC data.</param>
        /// <param name="defaultType">The default value, if no type is found.</param>
        /// <param name="propertyType">The string value of the simple type, returned for logging purposes.</param>
        /// <returns>The unit type.</returns>
        public static UnitType GetUnitTypeFromData(IFCData data, UnitType defaultType, out string propertyType)
        {
            UnitType unitType = UnitType.UT_Undefined;

            if (data.HasSimpleType())
            {
                propertyType = data.GetSimpleType();
                if (!MeasureCache.TryGetValue(propertyType, out unitType))
                {
                    unitType = defaultType;
                }
            }
            else
            {
                propertyType = "";
                unitType     = defaultType;
            }

            return(unitType);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the unit type from an IFC data.
        /// </summary>
        /// <param name="data">The IFC data.</param>
        /// <param name="defaultSpec">The default spec, if no spec is found.</param>
        /// <param name="propertyType">The string value of the simple type, returned for logging purposes.</param>
        /// <returns>The unit type.</returns>
        public static ForgeTypeId GetUnitTypeFromData(IFCData data, ForgeTypeId defaultSpec, out string propertyType)
        {
            ForgeTypeId specTypeId = new ForgeTypeId();

            if (data.HasSimpleType())
            {
                propertyType = data.GetSimpleType();
                if (!MeasureCache.TryGetValue(propertyType, out specTypeId))
                {
                    specTypeId = defaultSpec;
                }
            }
            else
            {
                propertyType = "";
                specTypeId   = defaultSpec;
            }

            return(specTypeId);
        }
        /// <summary>
        /// Gets the unit type from an IFC data.
        /// </summary>
        /// <param name="data">The IFC data.</param>
        /// <param name="defaultType">The default value, if no type is found.</param>
        /// <param name="propertyType">The string value of the simple type, returned for logging purposes.</param>
        /// <returns>The unit type.</returns>
        public static UnitType GetUnitTypeFromData(IFCData data, UnitType defaultType, out string propertyType)
        {
            UnitType unitType = UnitType.UT_Undefined;

            if (data.HasSimpleType())
            {
                propertyType = data.GetSimpleType();
                if (!MeasureCache.TryGetValue(propertyType, out unitType))
                    unitType = defaultType;
            }
            else
            {
                propertyType = "";
                unitType = defaultType;
            }

            return unitType;
        }