Esempio n. 1
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     setAttribute(obj, "Name", Name);
     setAttribute(obj, "Description", Description);
     if (mAppliedValue != null)
     {
         IfcValue value = mAppliedValue as IfcValue;
         if (value != null)
         {
             obj["AppliedValue"] = DatabaseIfc.extract(value);
         }
         else
         {
             obj["AppliedValue"] = mAppliedValue.getJson(this, options);
         }
     }
     if (mUnitBasis > 0)
     {
         obj["UnitBasis"] = UnitBasis.getJson(this, options);
     }
     //todo
     setAttribute(obj, "Category", Category);
     setAttribute(obj, "Condition", Condition);
     if (mArithmeticOperator != IfcArithmeticOperatorEnum.NONE)
     {
         obj["ArithmeticOperator"] = ArithmeticOperator.ToString();
     }
     if (mComponents.Count > 0)
     {
         obj["Components"] = new JArray(Components.ToList().ConvertAll(x => x.getJson(this, options)));
     }
     if (mHasExternalReference.Count > 0)
     {
         obj["HasExternalReference"] = new JArray(HasExternalReference.ToList().ConvertAll(x => x.getJson(this, options)));
     }
     if (mHasConstraintRelationships.Count > 0)
     {
         JArray array = new JArray();
         foreach (IfcResourceConstraintRelationship r in HasConstraintRelationships)
         {
             if (r.mIndex != host.mIndex)
             {
                 array.Add(r.getJson(this, options));
             }
         }
         if (array.Count > 0)
         {
             obj["HasConstraintRelationships"] = array;
         }
     }
 }
Esempio n. 2
0
    {                                                                          //,IfcCompositeProfileDef ,IfcDerivedProfileDef ,IfcParameterizedProfileDef));  IFC2x3 abstract
        internal override void parseJObject(JObject obj)
        {
            base.parseJObject(obj);
            JToken token = obj.GetValue("ProfileType", StringComparison.InvariantCultureIgnoreCase);

            if (token != null)
            {
                Enum.TryParse <IfcProfileTypeEnum>(token.Value <string>(), true, out mProfileType);
            }
            token = obj.GetValue("ProfileName", StringComparison.InvariantCultureIgnoreCase);
            if (token != null)
            {
                ProfileName = token.Value <string>();
            }

            HasExternalReference.AddRange(mDatabase.extractJArray <IfcExternalReferenceRelationship>(obj.GetValue("HasExternalReference", StringComparison.InvariantCultureIgnoreCase) as JArray));
            HasProperties.AddRange(mDatabase.extractJArray <IfcProfileProperties>(obj.GetValue("HasProperties", StringComparison.InvariantCultureIgnoreCase) as JArray));
        }