Exemplo n.º 1
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
 {
     base.setJSON(obj, host, processed);
     setAttribute(obj, "Name", Name);
     setAttribute(obj, "Description", Description);
     if (mAppliedValueIndex > 0)
     {
         obj["AppliedValue"] = mDatabase[mAppliedValueIndex].getJson(this, processed);
     }
     else if (mAppliedValueValue != null)
     {
         obj["AppliedValue"] = DatabaseIfc.extract(mAppliedValueValue);
     }
     if (mUnitBasis > 0)
     {
         obj["UnitBasis"] = UnitBasis.getJson(this, processed);
     }
     //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, processed)));
     }
     if (mHasExternalReferences.Count > 0)
     {
         obj["HasExternalReferences"] = new JArray(HasExternalReferences.ToList().ConvertAll(x => x.getJson(this, processed)));
     }
     if (mHasConstraintRelationships.Count > 0)
     {
         JArray array = new JArray();
         foreach (IfcResourceConstraintRelationship r in HasConstraintRelationships)
         {
             if (r.mIndex != host.mIndex)
             {
                 array.Add(r.getJson(this, processed));
             }
         }
         if (array.Count > 0)
         {
             obj["HasConstraintRelationships"] = array;
         }
     }
 }
Exemplo 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>();
            }

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