protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed) { base.setJSON(obj, host, processed); if (mIsDefinedBy.Count > 0) { obj["IsDefinedBy"] = new JArray(IsDefinedBy.ToList().ConvertAll(x => x.getJson(this, processed))); } }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); if (mIsDefinedBy.Count > 0) { obj["IsDefinedBy"] = new JArray(IsDefinedBy.ToList().ConvertAll(x => x.getJson(this, options))); } }
public override string WhereRule() { if (IsDefinedBy.OfType <IfcRelDefinesByType>().Count() > 1) { return ("WR1 IfcObject: Only maximum of one relationship to an underlying type (by an RelDefinesByType relationship) should be given for an object instance.\n"); } return(""); }
/// <summary> /// Returns the first quantity in the property set pSetName of name qName /// </summary> /// <typeparam name="TQType"></typeparam> /// <param name="pSetName"></param> /// <param name="qName"></param> /// <returns></returns> public TQType GetQuantity <TQType>(string pSetName, string qName) where TQType : IIfcPhysicalQuantity { var propSets = IsDefinedBy.SelectMany(r => r.RelatingPropertyDefinition.PropertySetDefinitions); var rel = propSets.FirstOrDefault(r => r is IfcElementQuantity && r.Name == pSetName); if (rel == null) { return(default(TQType)); } var eQ = rel as IfcElementQuantity; return(eQ == null ? default(TQType) : eQ.Quantities.OfType <TQType>().FirstOrDefault(q => q.Name == qName)); }
/// <summary> /// Tests the express where-clause specified in param 'clause' /// </summary> /// <param name="clause">The express clause to test</param> /// <returns>true if the clause is satisfied.</returns> public bool ValidateClause(IfcObjectClause clause) { var retVal = false; try { switch (clause) { case IfcObjectClause.WR1: retVal = Functions.SIZEOF(IsDefinedBy.Where(temp => Functions.TYPEOF(temp).Contains("IFC2X3.IFCRELDEFINESBYTYPE"))) <= 1; break; } } catch (Exception ex) { var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc2x3.Kernel.IfcObject>(); log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcObject.{0}' for #{1}.", clause, EntityLabel), ex); } return(retVal); }
/// <summary> /// Returns the first quantity that matches the quantity name /// </summary> /// <typeparam name="TQType"></typeparam> /// <param name="qName"></param> /// <returns></returns> public TQType GetQuantity <TQType>(string qName) where TQType : IIfcPhysicalQuantity { var qSets = IsDefinedBy.SelectMany(r => r.RelatingPropertyDefinition.PropertySetDefinitions).OfType <IIfcElementQuantity>(); return(qSets.SelectMany(qset => qset.Quantities).OfType <TQType>().FirstOrDefault(q => q.Name == qName)); }
public IIfcElementQuantity GetElementQuantity(string pSetName, bool caseSensitive = true) { var qSets = IsDefinedBy.SelectMany(r => r.RelatingPropertyDefinition.PropertySetDefinitions).OfType <IfcElementQuantity>(); return(qSets.FirstOrDefault(qset => string.Compare(pSetName, qset.Name, !caseSensitive) == 0)); }