/// <summary>
        /// Create a label property, or retrieve from cache.
        /// </summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="propertyName">The name of the property.</param>
        /// <param name="value">The value of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created or cached property handle.</returns>
        public static IFCAnyHandle CreateElectricalCurrentMeasurePropertyFromCache(IFCFile file, string propertyName, double value, PropertyValueType valueType)
        {
            // We have a partial cache here - we will only cache multiples of 15 degrees.
            bool canCache = false;
            double ampsDiv5 = Math.Floor(value / 5.0 + 0.5);
            double integerAmps = ampsDiv5 * 5.0;
            if (MathUtil.IsAlmostEqual(value, integerAmps))
            {
                canCache = true;
                value = integerAmps;
            }

            IFCAnyHandle propertyHandle;
            if (canCache)
            {
                propertyHandle = ExporterCacheManager.PropertyInfoCache.ElectricalCurrentCache.Find(propertyName, value);
                if (propertyHandle != null)
                    return propertyHandle;
            }

            propertyHandle = CreateElectricalCurrentMeasureProperty(file, propertyName, value, valueType);

            if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
            {
                ExporterCacheManager.PropertyInfoCache.ElectricalCurrentCache.Add(propertyName, value, propertyHandle);
            }

            return propertyHandle;
        }
        // Token: 0x060008D9 RID: 2265 RVA: 0x0001C950 File Offset: 0x0001AB50
        private void UpdatePropertyValueList(DependencyProperty dp, PropertyValueType valueType, object value)
        {
            int num = -1;

            for (int i = 0; i < this.PropertyValues.Count; i++)
            {
                if (this.PropertyValues[i].Property == dp)
                {
                    num = i;
                    break;
                }
            }
            if (num >= 0)
            {
                PropertyValue value2 = this.PropertyValues[num];
                value2.ValueType         = valueType;
                value2.ValueInternal     = value;
                this.PropertyValues[num] = value2;
                return;
            }
            this.PropertyValues.Add(new PropertyValue
            {
                ValueType     = valueType,
                ChildName     = "~Self",
                Property      = dp,
                ValueInternal = value
            });
        }
 public PropertyDefinition(string name, string displayName = null, PropertyValueType valueType = PropertyValueType.String, string defaultUnit = null)
 {
     Name        = name;
     DisplayName = name;
     ValueType   = valueType;
     DefaultUnit = defaultUnit;
 }
        protected virtual void SetValue(PropertyValueType valueType, object value)
        {
            switch (valueType)
            {
            case PropertyValueType.LongText:
                this.LongTextValue = Convert.ToString(value);
                break;

            case PropertyValueType.ShortText:
                this.ShortTextValue = Convert.ToString(value);
                break;

            case PropertyValueType.Number:
                this.DecimalValue = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                break;

            case PropertyValueType.DateTime:
                this.DateTimeValue = Convert.ToDateTime(value, CultureInfo.InvariantCulture);
                break;

            case PropertyValueType.Boolean:
                this.BooleanValue = Convert.ToBoolean(value);
                break;

            case PropertyValueType.Integer:
                this.IntegerValue = Convert.ToInt32(value);
                break;

            default:
                throw new NotSupportedException();
            }
        }
        internal static object smethod_2(PropertyValueType A_0)
        {
            int num = 12;

            switch (A_0)
            {
            case PropertyValueType.Boolean:
                return(false);

            case PropertyValueType.Date:
                return(System.DateTime.MinValue);

            case PropertyValueType.Double:
                return(0.0);

            case PropertyValueType.Int:
                return(0);

            case PropertyValueType.String:
                return(string.Empty);

            case PropertyValueType.ByteArray:
                return(Class85.byte_0);

            case PropertyValueType.StringArray:
                return(new string[0]);

            case PropertyValueType.ObjectArray:
                return(new object[0]);

            case PropertyValueType.Other:
                return(null);
            }
            throw new InvalidOperationException(BookmarkStart.b("朱娳崵嘷唹䬻倽怿㉁㙃⥅㡇⽉㹋㩍⥏牑⁓⽕⡗㽙牛", num));
        }
Example #6
0
 /// <summary>
 /// Creates the ListFormPropertyElement
 /// </summary>
 /// <param name="property">Property containing this element</param>
 /// <param name="PropValue">Element value</param>
 public ListFormPropertyElement(ListFormProperty property, string PropValue)
 {
     Document           = property.Document;
     Node               = Document.CreateNode("list-value", "form");
     _propertyValueType = property.PropertyValueType;
     Value              = PropValue;
 }
        private ActionScope InitializeScope(int formID, int actionID, Dictionary <int, string> operandID_Value)
        {
            FormInstance       formInstance = new FormMetaBLL().GetFormMetaDescriptions(formID);
            BaseActionInstance action       = formInstance.GetEventAction(actionID);

            if (action == null)
            {
                throw new FormGenerationException(string.Format(
                                                      "Action not found in form actions (ActionID = {0}, FormID = {1})",
                                                      actionID,
                                                      formInstance.Form.FormID
                                                      ));
            }

            List <OperandValue> operandValues = new List <OperandValue>();

            foreach (int operandID in operandID_Value.Keys)
            {
                string            serializedValue = operandID_Value[operandID];
                PropertyValueType valueType       = formInstance.GetOperandValueType(operandID);
                OperandValue      operand         = new OperandValue(operandID, valueType, serializedValue);
                operandValues.Add(operand);
            }

            return(new ActionScope(action, formInstance, operandValues));
        }
Example #8
0
 /// <summary>
 /// This method should only be called in a context where you know that your entity is relevant both before and after
 /// </summary>
 private bool ValuesChanged(int[] propertyIds, [email protected]_PropertySchemaType propertySchemaType)
 {
     if (propertySchemaType == COMPLETE_ALL_TOKENS)
     {
         // In the case of indexes were all entries must have all indexed tokens, one of the properties must have changed for us to generate a change.
         foreach (int propertyId in propertyIds)
         {
             if (_knownProperties.get(propertyId).type == Changed)
             {
                 return(true);
             }
         }
         return(false);
     }
     else
     {
         // In the case of indexes were we index incomplete index entries, we need to update as long as _anything_ happened to one of the indexed properties.
         foreach (int propertyId in propertyIds)
         {
             PropertyValueType type = _knownProperties.get(propertyId).type;
             if (type != UnChanged && type != NoValue)
             {
                 return(true);
             }
         }
         return(false);
     }
 }
    public void ChangeValue(PropertyValueType type, float changeValue)
    {
        if (type <= PropertyValueType.Count)
        {
            if (mPropertyValue[(int)type] + changeValue < mPropertyValueMax[(int)type] && mPropertyValue[(int)type] + changeValue >= 0)
            {
                mPropertyValue[(int)type] += changeValue;
            }
            else if (mPropertyValue[(int)type] + changeValue >= mPropertyValueMax[(int)type])
            {
                mPropertyValue[(int)type] = mPropertyValueMax[(int)type];
            }
            else if (mPropertyValue[(int)type] + changeValue <= 0)
            {
                mPropertyValue[(int)type] = 0;
            }
        }
        float value = (mPropertyValue[(int)type] * 1.0f) / mPropertyValueMax[(int)type];;

        switch (type)
        {
        case PropertyValueType.Hp:
            GameRoot.BattleUIMgrInScene.hpSlider.value = mPropertyValue[(int)type] * 1.0f / mPropertyValueMax[(int)type];
            break;

        case PropertyValueType.Mp:
            GameRoot.BattleUIMgrInScene.mpSilder.value = mPropertyValue[(int)type] * 1.0f / mPropertyValueMax[(int)type];
            break;
        }
    }
Example #10
0
        public IPropertyType AddPropertyType([Required] string name, PropertyValueType type)
        {
            IPropertyType result = null;

            if (GetPropertyType(name) == null)
            {
                var propertyTypeInterface = type.GetEnumType();
                if (propertyTypeInterface != null)
                {
                    var implementation = Assembly.GetExecutingAssembly().DefinedTypes
                                         .FirstOrDefault(x => x.ImplementedInterfaces.Contains(propertyTypeInterface));

                    if (implementation != null)
                    {
                        result = Activator.CreateInstance(implementation, name, this) as IPropertyType;
                    }
                }

                if (result != null)
                {
                    if (_propertyTypes == null)
                    {
                        _propertyTypes = new List <IPropertyType>();
                    }

                    _propertyTypes.Add(result);
                    Dirty.IsDirty = true;

                    PropertyTypeAdded?.Invoke(this, result);
                }
            }

            return(result);
        }
 public void ChangeMaxValue(PropertyValueType type, int changeValue)
 {
     if (type <= PropertyValueType.Count)
     {
         mPropertyValueMax[(int)type] = changeValue;
     }
 }
 public float GetValue(PropertyValueType type)
 {
     if (type <= PropertyValueType.Count)
     {
         return(mPropertyValue[(int)type]);
     }
     return(0);
 }
Example #13
0
 private CaseTemplateProperty CreateCaseSubjectProperty(string name, PropertyValueType valueType)
 {
     return(new CaseTemplateProperty
     {
         Name = name,
         ValueType = (int)valueType
     });
 }
 public DataDescriptorField(string Name, PropertyValueType Type, bool IsHidden, string Category, bool Editable)
 {
     FieldName    = Name;
     FieldType    = Type;
     CategoryName = Category;
     Hidden       = IsHidden;
     IsEditable   = Editable;
 }
Example #15
0
 /// <summary>
 /// Creates the SingleFormProperty
 /// </summary>
 /// <param name="document">Document containing the form</param>
 /// <param name="propValueType">Type of the property value</param>
 /// <param name="propName">Property name</param>
 /// <param name="propValue">Property value</param>
 public SingleFormProperty(IDocument document, PropertyValueType propValueType, string propName, string propValue)
 {
     Document          = document;
     Node              = new XElement(Ns.Form + "property");
     PropertyValueType = propValueType;
     Name              = propName;
     Value             = propValue;
 }
Example #16
0
 /// <summary>
 /// Creates the SingleFormProperty
 /// </summary>
 /// <param name="document">Document containing the form</param>
 /// <param name="PropValueType">Type of the property value</param>
 /// <param name="PropName">Property name</param>
 /// <param name="PropValue">Property value</param>
 public SingleFormProperty(IDocument document, PropertyValueType PropValueType, string PropName, string PropValue)
 {
     Document          = document;
     Node              = document.CreateNode("property", "form");
     PropertyValueType = PropValueType;
     Name              = PropName;
     Value             = PropValue;
 }
Example #17
0
 /// <summary>
 /// Create a Frequency measure property from the element's parameter.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="exporterIFC">The ExporterIFC.</param>
 /// <param name="elem">The Element.</param>
 /// <param name="revitParameterName">The name of the parameter.</param>
 /// <param name="ifcPropertyName">The name of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateFrequencyPropertyFromElement(IFCFile file, ExporterIFC exporterIFC, Element elem,
     string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
 {
     double propertyValue;
     if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
         return CreateFrequencyProperty(file, ifcPropertyName, propertyValue, valueType);
     return null;
 }
Example #18
0
 public Property(string name, PropertyValueType valueType)
 {
     Name      = name;
     ValueType = valueType;
     AdvertisementProperties = new List <AdvertisementProperty>();
     CategoryProperties      = new List <CategoryProperty>();
     PropertyValues          = new List <PropertyValue>();
     isImportant             = false;
 }
Example #19
0
        /// <summary>
        /// Creates the ListFormProperty
        /// </summary>
        /// <param name="document">Main document</param>
        /// <param name="propValueType">Property value type</param>
        public ListFormProperty(IDocument document, PropertyValueType propValueType)
        {
            Document          = document;
            Node              = new XElement(Ns.Form + "list-property");
            PropertyValueType = propValueType;

            _propertyValues           = new ListFormPropertyElemCollection();
            _propertyValues.Inserted += PropertyValuesCollection_Inserted;
            _propertyValues.Removed  += PropertyValuesCollection_Removed;
        }
Example #20
0
        /// <summary>
        /// Creates the ListFormProperty
        /// </summary>
        /// <param name="document">Main document</param>
        /// <param name="PropValueType">Property value type</param>
        public ListFormProperty(IDocument document, PropertyValueType PropValueType)
        {
            Document          = document;
            Node              = document.CreateNode("list-property", "form");
            PropertyValueType = PropValueType;

            _propertyValues           = new ListFormPropertyElemCollection();
            _propertyValues.Inserted += PropertyValuesCollection_Inserted;
            _propertyValues.Removed  += PropertyValuesCollection_Removed;
        }
 //只给血条用
 public void ChangeValue(PropertyValueType type, int changeValue, float deltaTime)
 {
     if (type <= PropertyValueType.Count)
     {
         hpRiseNumber = hpRiseNumber + changeValue;
         currentTime  = 0f;
         lastAddTime  = 0f;
         maxTime      = deltaTime;
         deltaAddHp   = hpRiseNumber / deltaTime;
     }
 }
    /// <summary>
    /// This function is called by the base editor to display normal custom inspector gui.
    /// </summary>
    protected override void CustomInspectorGUI()
    {
        base.CustomInspectorGUI();

        VisAddForceTrigger trigger = target as VisAddForceTrigger;

        if (trigger == null)
        {
            return;
        }

        trigger.controllerValue = (ControllerSourceValue)EditorGUILayout.EnumPopup("\tController Source Value", (Enum)trigger.controllerValue);

        PropertyValueType rules = PropertyValueType.NormalRange;

        if (trigger.randomValue)
        {
            rules = PropertyValueType.RandomRange;
        }
        else if (trigger.invertValue)
        {
            rules = PropertyValueType.InvertedRange;
        }

        rules = (PropertyValueType)EditorGUILayout.EnumPopup("\tProperty Value Type", (Enum)rules);
        if (rules == PropertyValueType.NormalRange || rules == PropertyValueType.InvertedRange)
        {
            trigger.minControllerValue = EditorGUILayout.FloatField("\t\tMin Controller Value", trigger.minControllerValue);
            trigger.maxControllerValue = EditorGUILayout.FloatField("\t\tMax Controller Value", trigger.maxControllerValue);
        }
        trigger.minForceValue = EditorGUILayout.FloatField("\t\tMin Force Value", trigger.minForceValue);
        trigger.maxForceValue = EditorGUILayout.FloatField("\t\tMax Force Value", trigger.maxForceValue);

        if (rules == PropertyValueType.NormalRange)
        {
            trigger.invertValue = false;
            trigger.randomValue = false;
        }
        else if (rules == PropertyValueType.InvertedRange)
        {
            trigger.invertValue = true;
            trigger.randomValue = false;
        }
        else if (rules == PropertyValueType.RandomRange)
        {
            trigger.invertValue = false;
            trigger.randomValue = true;
        }

        trigger.forceMode = (ForceMode)EditorGUILayout.EnumPopup("\tForce Mode", (Enum)trigger.forceMode);
        EditorGUIUtility.LookLikeControls();
        trigger.forceDirection = EditorGUILayout.Vector3Field("\tForce Direction", trigger.forceDirection);
        EditorGUIUtility.LookLikeInspector();
    }
Example #23
0
        /// <summary>
        /// Creates a property from element or its type's parameter.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="element">The element.</param>
        /// <param name="elementType">The element type, if it is appropriate to look in it for value.</param>
        /// <returns>The property handle.</returns>
        IFCAnyHandle CreatePropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, string owningPsetName, Element element, Element elementType,
                                                       PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType, string propertyName)
        {
            string localizedRevitParameterName = LocalizedRevitParameterName(ExporterCacheManager.LanguageType);
            string revitParameterName          = RevitParameterName;

            IFCAnyHandle propHnd = null;

            if (localizedRevitParameterName != null)
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    localizedRevitParameterName = localizedRevitParameterName + "[Type]";
                    propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                                propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            revitParameterName, propertyName, RevitBuiltInParameter,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    revitParameterName = revitParameterName + "[Type]";
                    propHnd            = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                           revitParameterName, propertyName, RevitBuiltInParameter,
                                                                                           propertyType, valueType, propertyEnumerationType);
                }
                //When querying values from ProjectInfo we need to try alternative parameter names too.
                //These names are constructed as shown below.
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ProjectInfo))
                {
                    revitParameterName = owningPsetName + "." + revitParameterName;
                    propHnd            = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                           revitParameterName, propertyName, RevitBuiltInParameter,
                                                                                           propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (elementType != null))
            {
                return(CreatePropertyFromElementOrSymbol(file, exporterIFC, owningPsetName, elementType, null,
                                                         propertyType, valueType, propertyEnumerationType, propertyName));
            }
            return(propHnd);
        }
Example #24
0
 private static bool smethod_9(PropertyValueType A_0)
 {
     switch (A_0)
     {
     case PropertyValueType.Boolean:
     case PropertyValueType.Date:
     case PropertyValueType.Float:
     case PropertyValueType.Double:
     case PropertyValueType.Int:
     case PropertyValueType.String:
         return(true);
     }
     return(false);
 }
        private static object ConvertValue(PropertyValueType valueType, object value)
        {
            object result;

            switch (valueType)
            {
            case PropertyValueType.LongText:
                result = Convert.ToString(value);
                break;

            case PropertyValueType.ShortText:
                result = Convert.ToString(value);
                break;

            case PropertyValueType.Number:
                try
                {
                    result = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                }
                catch
                {
                    result = Convert.ToString(value, CultureInfo.InstalledUICulture);
                }

                break;

            case PropertyValueType.DateTime:
                result = Convert.ToDateTime(value, CultureInfo.InvariantCulture);
                break;

            case PropertyValueType.Boolean:
                result = Convert.ToBoolean(value);
                break;

            case PropertyValueType.Integer:
                result = Convert.ToInt32(value);
                break;

            case PropertyValueType.GeoPoint:
                result = Convert.ToString(value);
                break;

            default:
                throw new NotSupportedException();
            }

            return(result);
        }
 /// <summary>
 /// Create a label property.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateElectricalCurrentMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     switch (valueType)
     {
         case PropertyValueType.EnumeratedValue:
             {
                 IList<IFCData> valueList = new List<IFCData>();
                 valueList.Add(IFCDataUtil.CreateAsElectricalCurrentMeasure(value));
                 return IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
             }
         case PropertyValueType.SingleValue:
             return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, IFCDataUtil.CreateAsElectricalCurrentMeasure(value), null);
         default:
             throw new InvalidOperationException("Missing case!");
     }
 }
Example #27
0
        /// <summary>
        /// Gets the CLR type for the specified property value type
        /// </summary>
        /// <param name="propertyValueType"></param>
        /// <returns></returns>
        public static Type GetClrType(PropertyValueType propertyValueType)
        {
            switch (propertyValueType)
            {
            case PropertyValueType.Blob:
                return(typeof(byte[]));

            case PropertyValueType.Boolean:
                return(typeof(bool));

            case PropertyValueType.Byte:
                return(typeof(byte));

            case PropertyValueType.Clob:
                return(typeof(char[]));

            case PropertyValueType.DateTime:
                return(typeof(DateTime));

            case PropertyValueType.Double:
                return(typeof(double));

            case PropertyValueType.Feature:
                return(typeof(IFeature[]));

            case PropertyValueType.Geometry:
                return(typeof(IGeometry));

            case PropertyValueType.Int16:
                return(typeof(short));

            case PropertyValueType.Int32:
                return(typeof(int));

            case PropertyValueType.Int64:
                return(typeof(long));

            //case PropertyValueType.Raster:
            case PropertyValueType.Single:
                return(typeof(float));

            case PropertyValueType.String:
                return(typeof(string));
            }
            throw new ArgumentException();
        }
 // Token: 0x06000790 RID: 1936 RVA: 0x00017840 File Offset: 0x00015A40
 internal override void Seal()
 {
     if (base.IsSealed)
     {
         return;
     }
     base.ProcessSettersCollection(this._setters);
     if (this._conditions.Count > 0)
     {
         this._conditions.Seal(ValueLookupType.DataTrigger);
     }
     base.TriggerConditions = new TriggerCondition[this._conditions.Count];
     for (int i = 0; i < base.TriggerConditions.Length; i++)
     {
         if (this._conditions[i].SourceName != null && this._conditions[i].SourceName.Length > 0)
         {
             throw new InvalidOperationException(SR.Get("SourceNameNotSupportedForDataTriggers"));
         }
         base.TriggerConditions[i] = new TriggerCondition(this._conditions[i].Binding, LogicalOp.Equals, this._conditions[i].Value);
     }
     for (int j = 0; j < this.PropertyValues.Count; j++)
     {
         PropertyValue propertyValue = this.PropertyValues[j];
         propertyValue.Conditions = base.TriggerConditions;
         PropertyValueType valueType = propertyValue.ValueType;
         if (valueType != PropertyValueType.Trigger)
         {
             if (valueType != PropertyValueType.PropertyTriggerResource)
             {
                 throw new InvalidOperationException(SR.Get("UnexpectedValueTypeForDataTrigger", new object[]
                 {
                     propertyValue.ValueType
                 }));
             }
             propertyValue.ValueType = PropertyValueType.DataTriggerResource;
         }
         else
         {
             propertyValue.ValueType = PropertyValueType.DataTrigger;
         }
         this.PropertyValues[j] = propertyValue;
     }
     base.Seal();
 }
Example #29
0
        /// <summary>
        /// Creates a property from element or its type's parameter.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="element">The element.</param>
        /// <param name="elementType">The element type, if it is appropriate to look in it for value.</param>
        /// <returns>The property handle.</returns>
        IFCAnyHandle CreatePropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element element, Element elementType,
                                                       PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType, string propertyName)
        {
            string localizedRevitParameterName = LocalizedRevitParameterName(ExporterCacheManager.LanguageType);
            string revitParameterName          = RevitParameterName;

            IFCAnyHandle propHnd = null;

            if (localizedRevitParameterName != null)
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    localizedRevitParameterName = localizedRevitParameterName + "[Type]";
                    propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                                propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            revitParameterName, propertyName, RevitBuiltInParameter,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    revitParameterName = revitParameterName + "[Type]";
                    propHnd            = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                           revitParameterName, propertyName, RevitBuiltInParameter,
                                                                                           propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (elementType != null))
            {
                return(CreatePropertyFromElementOrSymbol(file, exporterIFC, elementType, null,
                                                         propertyType, valueType, propertyEnumerationType, propertyName));
            }
            return(propHnd);
        }
Example #30
0
        //private Element ElementTypeToUseBasedOnInstanceType(Element defaultElementType, IFCAnyHandle handle)
        //{
        //IFCEntityType handleEntityType = IFCAnyHandleUtil.GetEntityType(handle);
        //if (PropertyUtil.EntitiesWithNoRelatedType.Contains(handleEntityType))
        //return defaultElementType;
        //return null;
        //}

        /// <summary>
        /// Process to create element property.
        /// </summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="owningPsetName">Name of Property Set this entry belongs to .</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element of which this property is created for.</param>
        /// <param name="elementType">The element type of which this property is created for.</param>
        /// <param name="handle">The handle for which this property is created for.</param>
        /// <returns>The created property handle.</returns>
        public IFCAnyHandle ProcessEntry(IFCFile file, ExporterIFC exporterIFC, string owningPsetName, IFCExtrusionCreationData extrusionCreationData,
                                         Element element, ElementType elementType, IFCAnyHandle handle,
                                         PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType, string propertyName)
        {
            IFCAnyHandle propHnd = null;

            if (ParameterNameIsValid)
            {
                propHnd = CreatePropertyFromElementOrSymbol(file, exporterIFC, owningPsetName, element, elementType,
                                                            propertyType, valueType, propertyEnumerationType, propertyName);
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
            {
                propHnd = CreatePropertyFromCalculator(file, exporterIFC, extrusionCreationData, element, elementType, handle,
                                                       propertyType, valueType, propertyEnumerationType, propertyName);
            }
            return(propHnd);
        }
        /// <summary>
        /// Create a label property.
        /// </summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="propertyName">The name of the property.</param>
        /// <param name="value">The value of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created property handle.</returns>
        public static IFCAnyHandle CreatePositivePlaneAngleMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
        {
            // Ensure it is positive.  Don't throw, but should tell user.
            if (value <= MathUtil.Eps())
                return null;

            switch (valueType)
            {
                case PropertyValueType.EnumeratedValue:
                    {
                        IList<IFCData> valueList = new List<IFCData>();
                        valueList.Add(IFCDataUtil.CreateAsPositivePlaneAngleMeasure(value));
                        return IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
                    }
                case PropertyValueType.SingleValue:
                    return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, IFCDataUtil.CreateAsPositivePlaneAngleMeasure(value), null);
                default:
                    throw new InvalidOperationException("Missing case!");
            }
        }
 protected static IFCAnyHandle CreateCommonProperty(IFCFile file, string propertyName, IFCData valueData, PropertyValueType valueType, string unitTypeKey)
 {
     switch (valueType)
     {
         case PropertyValueType.EnumeratedValue:
             {
                 IList<IFCData> valueList = new List<IFCData>();
                 valueList.Add(valueData);
                 return IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
             }
         case PropertyValueType.SingleValue:
             {
                 if (unitTypeKey != null)
                     return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, valueData, ExporterCacheManager.UnitsCache[unitTypeKey]);
                 else
                     return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, valueData, null);
             }
         default:
             throw new InvalidOperationException("Missing case!");
     }
 }
        private void UpdatePropertyValueList(DependencyProperty dp, PropertyValueType valueType, object value)
        {
            int count = -1;
            int i     = 0;

            while (i < this.PropertyValues.Count)
            {
                if (this.PropertyValues[i].Property != dp)
                {
                    i++;
                }
                else
                {
                    count = i;
                    break;
                }
            }
            if (count < 0)
            {
                PropertyValue propertyValue = new PropertyValue();
                propertyValue.ValueType     = valueType;
                propertyValue.ChildName     = null;
                propertyValue.Property      = dp;
                propertyValue.ValueInternal = value;
                lock (this.synchronized)
                {
                    this.PropertyValues.Add(propertyValue);
                }
            }
            else
            {
                lock (this.synchronized)
                {
                    PropertyValue item = this.PropertyValues[count];
                    item.ValueType             = valueType;
                    item.ValueInternal         = value;
                    this.PropertyValues[count] = item;
                }
            }
        }
Example #34
0
        /// <summary>
        ///     Given a set of values for the PropertyValue struct, put that in
        /// to the PropertyValueList, overwriting any existing entry.
        /// </summary>
        private void UpdatePropertyValueList(
            DependencyProperty dp,
            PropertyValueType valueType,
            object value)
        {
            // Check for existing value on dp
            int existingIndex = -1;

            for (int i = 0; i < PropertyValues.Count; i++)
            {
                if (PropertyValues[i].Property == dp)
                {
                    existingIndex = i;
                    break;
                }
            }

            if (existingIndex >= 0)
            {
                // Overwrite existing value for dp
                PropertyValue propertyValue = PropertyValues[existingIndex];
                propertyValue.ValueType     = valueType;
                propertyValue.ValueInternal = value;
                // Put back modified struct
                PropertyValues[existingIndex] = propertyValue;
            }
            else
            {
                // Store original data
                PropertyValue propertyValue = new PropertyValue();
                propertyValue.ValueType     = valueType;
                propertyValue.ChildName     = StyleHelper.SelfName;
                propertyValue.Property      = dp;
                propertyValue.ValueInternal = value;

                PropertyValues.Add(propertyValue);
            }
        }
Example #35
0
    /// <summary>
    /// This function is called by the base editor to display normal custom inspector gui.
    /// </summary>
    protected override void CustomInspectorGUI()
    {
        base.CustomInspectorGUI();

        VisBasePropertyModifier modifier = target as VisBasePropertyModifier;

        if (modifier == null)
        {
            return;
        }

        modifier.controllerSourceValue = (ControllerSourceValue)EditorGUILayout.EnumPopup("  Controller Source Value", (Enum)modifier.controllerSourceValue);

        PropertyValueType rules = PropertyValueType.NormalRange;

        if (modifier.invertValue)
        {
            rules = PropertyValueType.InvertedRange;
        }

        rules = (PropertyValueType)EditorGUILayout.EnumPopup("  Property Value Type", (Enum)rules);
        if (rules == PropertyValueType.NormalRange || rules == PropertyValueType.InvertedRange)
        {
            modifier.minControllerValue = EditorGUILayout.FloatField("    Min Controller Value", modifier.minControllerValue);
            modifier.maxControllerValue = EditorGUILayout.FloatField("    Max Controller Value", modifier.maxControllerValue);
        }
        modifier.minPropertyValue = EditorGUILayout.FloatField("    Min Property Value", modifier.minPropertyValue);
        modifier.maxPropertyValue = EditorGUILayout.FloatField("    Max Property Value", modifier.maxPropertyValue);

        if (rules == PropertyValueType.NormalRange)
        {
            modifier.invertValue = false;
        }
        else if (rules == PropertyValueType.InvertedRange)
        {
            modifier.invertValue = true;
        }
    }
Example #36
0
        /// <summary>
        /// Create a Frequency measure property from the element's or type's parameter.
        /// </summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="elem">The Element.</param>
        /// <param name="revitParameterName">The name of the parameter.</param>
        /// <param name="revitBuiltInParam">The built in parameter to use, if revitParameterName isn't found.</param>
        /// <param name="ifcPropertyName">The name of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created property handle.</returns>
        public static IFCAnyHandle CreateFrequencyPropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element elem,
            string revitParameterName, BuiltInParameter revitBuiltInParam, string ifcPropertyName, PropertyValueType valueType)
        {
            IFCAnyHandle propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, revitParameterName, ifcPropertyName, valueType);
            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
                return propHnd;

            if (revitBuiltInParam != BuiltInParameter.INVALID)
            {
                string builtInParamName = LabelUtils.GetLabelFor(revitBuiltInParam);
                propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, builtInParamName, ifcPropertyName, valueType);
                if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
                    return propHnd;
            }

            // For Symbol
            Document document = elem.Document;
            ElementId typeId = elem.GetTypeId();
            Element elemType = document.GetElement(typeId);
            if (elemType != null)
                return CreateFrequencyPropertyFromElementOrSymbol(file, exporterIFC, elemType, revitParameterName, revitBuiltInParam, ifcPropertyName, valueType);
            else
                return null;
        }
        /// <summary>Create a real property, using a cached value if possible.</summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="propertyName">The name of the property.</param>
        /// <param name="value">The value of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created or cached property handle.</returns>
        public static IFCAnyHandle CreateRealPropertyFromCache(IFCFile file, double scale, string propertyName, double value, PropertyValueType valueType)
        {
            double? adjustedValue = CanCacheDouble(scale, value);
            bool canCache = adjustedValue.HasValue;
            if (canCache)
            {
                value = adjustedValue.GetValueOrDefault();
            }

            IFCAnyHandle propertyHandle;
            if (canCache)
            {
                propertyHandle = ExporterCacheManager.PropertyInfoCache.RealCache.Find(propertyName, value);
                if (propertyHandle != null)
                    return propertyHandle;
            }

            propertyHandle = CreateRealProperty(file, propertyName, value, valueType);

            if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
            {
                ExporterCacheManager.PropertyInfoCache.RealCache.Add(propertyName, value, propertyHandle);
            }

            return propertyHandle;
        }
		/// <summary>
		/// Creates the ListFormPropertyElement
		/// </summary>
		/// <param name="property">Property containing this element</param>
		public ListFormPropertyElement(ListFormProperty property)
		{
			Document = property.Document;
			Node = Document.CreateNode("list-value", "form");
			_propertyValueType = property.PropertyValueType;
		}
 /// <summary>
 /// Add property value to product
 /// </summary>
 private void AddProperty(CatalogProduct product, string propertyName, object value, PropertyValueType propertyValueType)
 {
     var property = _catalogProperties.FirstOrDefault(x => x.Name == propertyName);
     if (property != null)
     {
         var propertyValue = new PropertyValue
         {
             PropertyId = property.Id,
             PropertyName = property.Name,
             Value = value,
             ValueType = propertyValueType
         };
         if (product.PropertyValues == null)
         {
             product.PropertyValues = new List<PropertyValue>();
         }
         product.PropertyValues.Add(propertyValue);
     }
 }
 /// <summary>
 /// Create a label property.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateElectricalVoltageMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     IFCData electricalVoltageData = IFCDataUtil.CreateAsElectricalVoltageMeasure(value);
     return CreateCommonProperty(file, propertyName, electricalVoltageData, valueType, null);
 }
 /// <summary>Create a PowerMeasure property.</summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreatePowerProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     IFCData powerData = IFCDataUtil.CreateAsPowerMeasure(value);
     return CreateCommonProperty(file, propertyName, powerData, valueType, null);
 }
 /// <summary>Create an IlluminanceMeasure property.</summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateIlluminanceProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     IFCData illuminanceData = IFCDataUtil.CreateAsIlluminanceMeasure(value);
     return CreateCommonProperty(file, propertyName, illuminanceData, valueType, null);
 }
        // This function is static to make sure that no properties are used directly from the entry.
        private static IFCAnyHandle CreatePropertyFromElementOrSymbolBase(IFCFile file, ExporterIFC exporterIFC, Element element,
            string revitParamNameToUse, string ifcPropertyName, BuiltInParameter builtInParameter,
            PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType)
        {
            IFCAnyHandle propHnd = null;

            switch (propertyType)
            {
                case PropertyType.Text:
                    {
                        propHnd = PropertyUtil.CreateTextPropertyFromElementOrSymbol(file, element, revitParamNameToUse, builtInParameter, ifcPropertyName, valueType, propertyEnumerationType);
                        break;
                    }
                case PropertyType.Label:
                    {
                        propHnd = PropertyUtil.CreateLabelPropertyFromElementOrSymbol(file, element, revitParamNameToUse, builtInParameter, ifcPropertyName, valueType, propertyEnumerationType);
                        break;
                    }
                case PropertyType.Identifier:
                    {
                        propHnd = PropertyUtil.CreateIdentifierPropertyFromElementOrSymbol(file, element, revitParamNameToUse, builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Boolean:
                    {
                        propHnd = PropertyUtil.CreateBooleanPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Logical:
                    {
                        propHnd = PropertyUtil.CreateLogicalPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Integer:
                    {
                        propHnd = PropertyUtil.CreateIntegerPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Real:
                    {
                        propHnd = PropertyUtil.CreateRealPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Length:
                    {
                        propHnd = PropertyUtil.CreateLengthMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.PositiveLength:
                    {
                        propHnd = PropertyUtil.CreatePositiveLengthMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.NormalisedRatio:
                    {
                        propHnd = PropertyUtil.CreateNormalisedRatioPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.PositiveRatio:
                    {
                        propHnd = PropertyUtil.CreatePositiveRatioPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, 
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Ratio:
                    {
                        propHnd = PropertyUtil.CreateRatioPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, ifcPropertyName, 
                            valueType);
                        break;
                    }
                case PropertyType.PlaneAngle:
                    {
                        propHnd = PropertyUtil.CreatePlaneAngleMeasurePropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, 
                            valueType);
                        break;
                    }
                case PropertyType.PositivePlaneAngle:
                    {
                        propHnd = PositivePlaneAnglePropertyUtil.CreatePositivePlaneAngleMeasurePropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName,
                            valueType);
                        break;
                    }
                case PropertyType.Area:
                    {
                        propHnd = PropertyUtil.CreateAreaMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Volume:
                    {
                        propHnd = PropertyUtil.CreateVolumeMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Count:
                    {
                        propHnd = PropertyUtil.CreateCountMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Frequency:
                    {
                        propHnd = FrequencyPropertyUtil.CreateFrequencyPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ElectricalCurrent:
                    {
                        propHnd = ElectricalCurrentPropertyUtil.CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ElectricalVoltage:
                    {
                        propHnd = ElectricalVoltagePropertyUtil.CreateElectricalVoltageMeasurePropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.LuminousFlux:
                    {
                        propHnd = PropertyUtil.CreateLuminousFluxMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Force:
                    {
                        propHnd = FrequencyPropertyUtil.CreateForcePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Pressure:
                    {
                        propHnd = FrequencyPropertyUtil.CreatePressurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ColorTemperature:
                    {
                        propHnd = PropertyUtil.CreateColorTemperaturePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Currency:
                    {
                        propHnd = PropertyUtil.CreateCurrencyPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ElectricalEfficacy:
                    {
                        propHnd = PropertyUtil.CreateElectricalEfficacyPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.LuminousIntensity:
                    {
                        propHnd = PropertyUtil.CreateLuminousIntensityPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Illuminance:
                    {
                        propHnd = PropertyUtil.CreateIlluminancePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter,
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.Power:
                    {
                        propHnd = PropertyUtil.CreatePowerPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, builtInParameter, 
                            ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ThermodynamicTemperature:
                    {
                        propHnd = PropertyUtil.CreateThermodynamicTemperaturePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ThermalTransmittance:
                    {
                        propHnd = PropertyUtil.CreateThermalTransmittancePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.VolumetricFlowRate:
                    {
                        propHnd = PropertyUtil.CreateVolumetricFlowRatePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName, valueType);
                        break;
                    }
                case PropertyType.ClassificationReference:
                    {
                        propHnd = PropertyUtil.CreateClassificationReferencePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                            builtInParameter, ifcPropertyName);
                        break;
                    }
                case PropertyType.LinearVelocity:
                    {
                       propHnd = PropertyUtil.CreateLinearVelocityPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
                           ifcPropertyName, valueType);
                       break;
                    }
                default:
                    throw new InvalidOperationException();
            }

            return propHnd;
        }
        /// <summary>Create a Thermal Transmittance property, using a cached value if possible.</summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="propertyName">The name of the property.</param>
        /// <param name="value">The value of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created or cached property handle.</returns>
        public static IFCAnyHandle CreateThermalTransmittancePropertyFromCache(IFCFile file, string propertyName, double value, PropertyValueType valueType)
        {
            double? adjustedValue = CanCacheThermalTransmittance(value);
            bool canCache = adjustedValue.HasValue;
            if (canCache)
                value = adjustedValue.GetValueOrDefault();

            IFCAnyHandle propertyHandle;
            if (canCache)
            {
                propertyHandle = ExporterCacheManager.PropertyInfoCache.ThermalTransmittanceCache.Find(propertyName, value);
                if (propertyHandle != null)
                    return propertyHandle;
            }

            propertyHandle = CreateThermalTransmittanceProperty(file, propertyName, value, valueType);

            if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
                ExporterCacheManager.PropertyInfoCache.ThermalTransmittanceCache.Add(propertyName, value, propertyHandle);

            return propertyHandle;
        }
 /// <summary>
 /// Create a VolumetricFlowRate measure property from the element's parameter.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="exporterIFC">The ExporterIFC.</param>
 /// <param name="elem">The Element.</param>
 /// <param name="revitParameterName">The name of the parameter.</param>
 /// <param name="ifcPropertyName">The name of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateVolumetricFlowRatePropertyFromElement(IFCFile file, ExporterIFC exporterIFC, Element elem,
     string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
 {
     double propertyValue;
     if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
     {
         double scale = 0.3048;
         propertyValue = propertyValue * scale * scale * scale;
         return CreateVolumetricFlowRateMeasureProperty(file, ifcPropertyName, propertyValue, valueType);
     }
     return null;
 }
 /// <summary>Create a VolumetricFlowRate property.</summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateVolumetricFlowRateMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     IFCData volumetricFlowRateData = IFCDataUtil.CreateAsVolumetricFlowRateMeasure(value);
     return CreateCommonProperty(file, propertyName, volumetricFlowRateData, valueType, null); 
             }
 /// <summary>Create a ThermalTransmittance property.</summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateThermalTransmittanceProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     IFCData thermalTransmittanceData = IFCDataUtil.CreateAsThermalTransmittanceMeasure(value);
     return CreateCommonProperty(file, propertyName, thermalTransmittanceData, valueType, null);
             }
Example #48
0
 /// <summary>Create a FrequencyMeasure property.</summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateFrequencyProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     IFCData frequencyData = IFCDataUtil.CreateAsFrequencyMeasure(value);
     return CreateCommonProperty(file, propertyName, frequencyData, valueType, null);
 }
 /// <summary>
 /// Create a Color Temperature measure property from the element's parameter.  This will be an IfcReal with a custom unit.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="exporterIFC">The ExporterIFC.</param>
 /// <param name="elem">The Element.</param>
 /// <param name="revitParameterName">The name of the parameter.</param>
 /// <param name="ifcPropertyName">The name of the property.  Also, the backup name of the parameter.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateColorTemperaturePropertyFromElement(IFCFile file, ExporterIFC exporterIFC, Element elem,
     string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
 {
     double propertyValue;
     if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
     {
         IFCData colorTemperatureData = IFCDataUtil.CreateAsMeasure(propertyValue, "IfcReal");
         return CreateCommonProperty(file, ifcPropertyName, colorTemperatureData,
             PropertyValueType.SingleValue, "COLORTEMPERATURE");
     }
     return null;
 }
 /// <summary>Create a LuminousIntensityMeasure property.</summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateLuminousIntensityProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
             {
     IFCData luminousIntensityData = IFCDataUtil.CreateAsLuminousIntensityMeasure(value);
     return CreateCommonProperty(file, propertyName, luminousIntensityData, valueType, null);
             }
 /// <summary>
 /// Create an electrical current measure property from the element's or type's parameter.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="elem">The Element.</param>
 /// <param name="revitParameterName">The name of the parameter.</param>
 /// <param name="ifcPropertyName">The name of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(IFCFile file, Element elem, string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
 {
     double propertyValue;
     if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
     {
         return CreateElectricalCurrentMeasurePropertyFromCache(file, ifcPropertyName, propertyValue, valueType);
     }
     // For Symbol
     Document document = elem.Document;
     ElementId typeId = elem.GetTypeId();
     Element elemType = document.GetElement(typeId);
     if (elemType != null)
         return CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(file, elemType, revitParameterName, ifcPropertyName, valueType);
     else
         return null;
 }
 /// <summary>
 /// Create an electrical efficacy custom measure property from the element's parameter.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="exporterIFC">The ExporterIFC.</param>
 /// <param name="elem">The Element.</param>
 /// <param name="revitParameterName">The name of the parameter.</param>
 /// <param name="ifcPropertyName">The name of the property.  Also, the backup name of the parameter.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreateElectricalEfficacyPropertyFromElement(IFCFile file, ExporterIFC exporterIFC, Element elem,
     string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
 {
     double propertyValue;
     if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
     {
         double scale = 0.3048;
         double scaledValue = propertyValue / (scale * scale);
         IFCData electricalEfficacyData = IFCDataUtil.CreateAsMeasure(scaledValue, "IfcReal");
         return CreateCommonProperty(file, ifcPropertyName, electricalEfficacyData,
             PropertyValueType.SingleValue, "LUMINOUSEFFICACY");
     }
     return null;
 }
        /// <summary>
        /// Creates a length measure property or gets one from cache.
        /// </summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="propertyName">The name of the property.</param>
        /// <param name="value">The value of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created property handle.</returns>
        public static IFCAnyHandle CreateLengthMeasurePropertyFromCache(IFCFile file, double scale, string propertyName, double value, PropertyValueType valueType)
        {
            double? adjustedValue = CanCacheDouble(scale, value);
            bool canCache = adjustedValue.HasValue;
            if (canCache)
            {
                value = adjustedValue.GetValueOrDefault();
            }

            IFCAnyHandle propertyHandle;
            if (canCache)
            {
                propertyHandle = ExporterCacheManager.PropertyInfoCache.LengthMeasureCache.Find(propertyName, value);
                if (propertyHandle != null)
                    return propertyHandle;
            }

            switch (valueType)
            {
                case PropertyValueType.EnumeratedValue:
                    {
                        IList<IFCData> valueList = new List<IFCData>();
                        valueList.Add(IFCDataUtil.CreateAsLengthMeasure(value));
                        propertyHandle = IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
                        break;
                    }
                case PropertyValueType.SingleValue:
                    propertyHandle = IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, IFCDataUtil.CreateAsLengthMeasure(value), null);
                    break;
                default:
                    throw new InvalidOperationException("Missing case!");
            }

            if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
            {
                ExporterCacheManager.PropertyInfoCache.LengthMeasureCache.Add(propertyName, value, propertyHandle);
            }

            return propertyHandle;
        }
Example #54
0
        /// <summary>
        ///     After the parameters have been validated, store it in the
        /// PropertyValues collection.
        /// </summary>
        /// <remarks>
        ///     All these will be looked at again (and processed into runtime
        /// data structures) by Style.Seal(). We keep them around even after
        /// that point should we need to serialize this data back out.
        /// </remarks>
        internal void AddToPropertyValues(string childName, DependencyProperty dp, object value, PropertyValueType valueType)
        {
            // Store original data
            PropertyValue propertyValue = new PropertyValue();
            propertyValue.ValueType = valueType;
            propertyValue.Conditions = null;  // Delayed - derived class is responsible for this item.
            propertyValue.ChildName = childName;
            propertyValue.Property = dp;
            propertyValue.ValueInternal = value;

            PropertyValues.Add(propertyValue);
        }
Example #55
0
        /// <summary>
        ///     Given a set of values for the PropertyValue struct, put that in
        /// to the PropertyValueList, overwriting any existing entry. 
        /// </summary>
        private void UpdatePropertyValueList( 
            DependencyProperty dp, 
            PropertyValueType valueType,
            object value) 
        {
            // Check for existing value on dp
            int existingIndex = -1;
            for( int i = 0; i < PropertyValues.Count; i++ ) 
            {
                if( PropertyValues[i].Property == dp ) 
                { 
                    existingIndex = i;
                    break; 
                }
            }

            if( existingIndex >= 0 ) 
            {
                // Overwrite existing value for dp 
                PropertyValue propertyValue = PropertyValues[existingIndex]; 
                propertyValue.ValueType = valueType;
                propertyValue.ValueInternal = value; 
                // Put back modified struct
                PropertyValues[existingIndex] = propertyValue;
            }
            else 
            {
                // Store original data 
                PropertyValue propertyValue = new PropertyValue(); 
                propertyValue.ValueType = valueType;
                propertyValue.ChildName = StyleHelper.SelfName; 
                propertyValue.Property = dp;
                propertyValue.ValueInternal = value;

                PropertyValues.Add(propertyValue); 
            }
        } 
 /// <summary>
 /// Create a positive length measure property.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreatePositiveLengthMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     if (value > MathUtil.Eps())
     {
         IFCData posLengthData = IFCDataUtil.CreateAsPositiveLengthMeasure(value);
         return CreateCommonProperty(file, propertyName, posLengthData, valueType, null);
     }
     return null;
 }
		/// <summary>
		/// Creates the SingleFormProperty
		/// </summary>
		/// <param name="document">Document containing the form</param>
		/// <param name="PropValueType">Type of the property value</param>
		public SingleFormProperty(IDocument document, PropertyValueType PropValueType)
		{
			Document = document;
			Node = document.CreateNode("property", "form");
			PropertyValueType = PropValueType;
		}
        private static IFCAnyHandle CreateRatioMeasurePropertyCommon(IFCFile file, string propertyName, double value, PropertyValueType valueType,
            bool positiveOnly)
        {
            if (positiveOnly && (value <= MathUtil.Eps()))
                return null;

            IFCData ratioData = positiveOnly ? IFCDataUtil.CreateAsPositiveRatioMeasure(value) : IFCDataUtil.CreateAsRatioMeasure(value);
            return CreateCommonProperty(file, propertyName, ratioData, valueType, null);  
        }
			/// <summary>
			/// Creates the ListFormProperty
			/// </summary>
			/// <param name="document">Main document</param>
			/// <param name="PropValueType">Property value type</param>
			public ListFormProperty(IDocument document, PropertyValueType PropValueType)
			{
				Document = document;
				Node = document.CreateNode("list-property", "form");
				PropertyValueType = PropValueType;

				_propertyValues = new ListFormPropertyElemCollection();
				_propertyValues.Inserted += PropertyValuesCollection_Inserted;
				_propertyValues.Removed += PropertyValuesCollection_Removed;
			}
 /// <summary>
 /// Create a positive ratio measure property.
 /// </summary>
 /// <param name="file">The IFC file.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The value of the property.</param>
 /// <param name="valueType">The value type of the property.</param>
 /// <returns>The created property handle.</returns>
 public static IFCAnyHandle CreatePositiveRatioMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
 {
     return CreateRatioMeasurePropertyCommon(file, propertyName, value, valueType, true);
 }