internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "RelatedDefinitions") == 0) { List <IfcDefinitionSelect> ds = new List <IfcDefinitionSelect>(); foreach (XmlNode cn in child.ChildNodes) { IfcDefinitionSelect d = mDatabase.ParseXml <IfcDefinitionSelect>(cn as XmlElement); if (d != null) { ds.Add(d); } } RelatedDefinitions = ds; } else if (string.Compare(name, "RelatingContext") == 0) { RelatingContext = mDatabase.ParseXml <IfcContext>(child as XmlElement); } } }
public static string GetName(this IfcDefinitionSelect definition, string lang) { var lib = GetLib(definition, lang); if (lib == null) { return(null); } return(lib.Name); }
public static string GetDescription(this IfcDefinitionSelect definition, string lang) { var lib = GetLib(definition, lang); if (lib == null) { return(null); } return(lib.Description); }
public static IIfcDocumentSelect AddDocument(this IfcDefinitionSelect definition, string name, string identification, Uri location) { var i = definition.Model.Instances; var doc = i.New <IfcDocumentReference>(d => { d.Identification = identification; d.Name = name; d.Location = location.ToString(); }); definition.AddDocument(doc); return(doc); }
private static IIfcLibraryReference GetLib(IfcDefinitionSelect definition, string lang) { var libs = GetLibs(definition); if (libs == null) { return(null); } if (libs.TryGetValue(lang, out IIfcLibraryReference lib)) { return(lib); } return(null); }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); JArray array = new JArray(); IfcDefinitionSelect d = host as IfcDefinitionSelect; if (d == null || !mRelatedObjects.Contains(d)) { foreach (IfcDefinitionSelect ds in mRelatedObjects) { array.Add((ds as BaseClassIfc).getJson(this, options)); } obj["RelatedObjects"] = array; } }
private static void AddOrSet(IfcDefinitionSelect definition, string lang, IIfcLibraryReference lib) { if (!cache.TryGetValue(definition, out Dictionary <string, IIfcLibraryReference> libs)) { libs = new Dictionary <string, IIfcLibraryReference>(); cache.Add(definition, libs); } if (libs.ContainsKey(lang)) { libs[lang] = lib; } else { libs.Add(lang, lib); } }
private static Dictionary <string, IIfcLibraryReference> GetLibs(IfcDefinitionSelect definition) { if (cache.TryGetValue(definition, out Dictionary <string, IIfcLibraryReference> libs)) { return(libs); } if (model == definition.Model) { return(null); } // create new cache CreateCache(definition.Model); // try retrieve from current cache return(GetLibs(definition)); }
public static IEnumerable <IIfcDocumentSelect> GetDocuments(this IfcDefinitionSelect definition) { if (cache.TryGetValue(definition, out List <IIfcDocumentSelect> docs)) { return(docs.AsReadOnly()); } if (model == definition.Model) { return(Enumerable.Empty <IIfcDocumentSelect>()); } // create new cache CreateCache(definition.Model); // try retrieve from current cache return(GetDocuments(definition)); }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "RelatedObjects") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcDefinitionSelect o = mDatabase.ParseXml <IfcDefinitionSelect>(cn as XmlElement); if (o != null) { RelatedObjects.Add(o); } } } } }
public static void AddDocument(this IfcDefinitionSelect definition, IfcDocumentSelect doc) { var i = definition.Model.Instances; i.New <IfcRelAssociatesDocument>(r => { r.RelatedObjects.Add(definition); r.RelatingDocument = doc; }); if (cache.TryGetValue(definition, out List <IIfcDocumentSelect> docs)) { docs.Add(doc); } else { docs = new List <IIfcDocumentSelect> { doc }; cache.Add(definition, docs); } }
public static void SetDescription(this IfcDefinitionSelect definition, string lang, string description) { var lib = GetLib(definition, lang); if (lib != null) { lib.Description = description; return; } var i = definition.Model.Instances; i.New <IfcRelAssociatesLibrary>(r => { r.RelatedObjects.Add(definition); r.RelatingLibrary = i.New <IfcLibraryReference>(libRef => { libRef.Description = description; libRef.Language = lang; libRef.Identification = dictionaryIdentifier; AddOrSet(definition, lang, libRef); }); }); }
public IfcRelAssociatesDocument(IfcDefinitionSelect related, IfcDocumentSelect document) : base(related) { mRelatingDocument = document.Index; }
public void AddDeclared(IfcDefinitionSelect o) { if (mDeclares.Count == 0) { IfcRelDeclares d = new IfcRelDeclares(this, o); } else mDeclares[0].AddRelated(o); }
internal IfcRelAssociates(IfcDefinitionSelect related) : base(related.Model) { mRelatedObjects.Add(related.Index); }
internal void RemoveRelated(IfcDefinitionSelect d) { mRelatedDefinitions.Remove(d.Index); d.HasContext = null; }
internal void AddRelated(IfcDefinitionSelect d) { mRelatedDefinitions.Add(d.Index); d.HasContext = this; }
public IfcRelAssociatesConstraint(IfcDefinitionSelect related, string intent, IfcConstraint c) : base(related) { if (!string.IsNullOrEmpty(intent)) mIntent = intent.Replace("'", ""); mRelatingConstraint = c.Index; }
internal void unassign(IfcDefinitionSelect d) { mRelatedObjects.Remove(d.Index); d.HasAssociations.Remove(this); }
internal void addAssociation(IfcDefinitionSelect obj) { mRelatedObjects.Add(obj.Index); obj.HasAssociations.Add(this); }
public IfcRelDeclares(IfcContext c, IfcDefinitionSelect def) : this(c, new List<IfcDefinitionSelect>() { def }) { }
internal void associate(IfcDefinitionSelect d) { if (mDocumentRefForObjects.Count == 0) { new IfcRelAssociatesDocument(this); } mDocumentRefForObjects[0].addAssociation(d); }