public JObject getJson(BaseClassIfc host, SetJsonOptions options) { bool common = isCommon; JObject obj = new JObject(); if (!string.IsNullOrEmpty(mGlobalId)) { if (options.Encountered.Contains(mGlobalId)) { obj["href"] = mGlobalId; return(obj); } else { options.Encountered.Add(mGlobalId); } } obj["type"] = StepClassName; if (common || (options.SerializeAllGlobalIds && !string.IsNullOrEmpty(mGlobalId)) || this is IfcGeometricRepresentationContext || this is NamedObjectIfc) { if (string.IsNullOrEmpty(mGlobalId)) { mGlobalId = ParserIfc.EncodeGuid(Guid.NewGuid()); options.Encountered.Add(mGlobalId); } if (options.SerializeAllGlobalIds && !string.IsNullOrEmpty(mGlobalId)) { obj["id"] = mGlobalId; } } setJSON(obj, host, options); if (options.Style == SetJsonOptions.JsonStyle.Repository) { if (common) { return(writeRepositoryCommon(obj, options, "")); } else { IfcRelationship relationship = this as IfcRelationship; if (relationship != null) { if (this is IfcRelAssociates || this is IfcRelDefinesByType) { return(this.writeRepositoryCommon(obj, options)); } else { IfcRelDefinesByProperties properties = this as IfcRelDefinesByProperties; if (properties != null && properties.RelatedObjects.Count > 1) { return(this.writeRepositoryCommon(obj, options)); } } } } } return(obj); }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); if (xml.HasAttribute("ObjectType")) { ObjectType = xml.Attributes["ObjectType"].Value; } foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "IsTypedBy") == 0) { mIsTypedBy = mDatabase.ParseXml <IfcRelDefinesByType>(child as XmlElement); } if (string.Compare(name, "IsDefinedBy") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcRelDefinesByProperties rd = mDatabase.ParseXml <IfcRelDefinesByProperties>(node as XmlElement); if (rd != null) { rd.assign(this); } } } } }
protected IfcObject(DatabaseIfc db, IfcObject o, bool downStream) : base(db, o,downStream)//, bool downStream) : base(db, o, downStream) { mObjectType = o.mObjectType; foreach (IfcRelDefinesByProperties rdp in o.mIsDefinedBy) { IfcRelDefinesByProperties drdp = db.Factory.Duplicate(rdp) as IfcRelDefinesByProperties; drdp.Assign(this); } if(o.mIsTypedBy != null) IsTypedBy = db.Factory.Duplicate(o.mIsTypedBy,false) as IfcRelDefinesByType; }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "HasAssignments") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcRelAssigns ra = mDatabase.ParseXml <IfcRelAssigns>(node as XmlElement); if (ra != null) { ra.RelatedObjects.Add(this); } } } else if (string.Compare(name, "IsNestedBy") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcRelNests rn = mDatabase.ParseXml <IfcRelNests>(node as XmlElement); if (rn != null) { rn.RelatingObject = this; } } } else if (string.Compare(name, "IsDecomposedBy") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcRelAggregates ra = mDatabase.ParseXml <IfcRelAggregates>(node as XmlElement); if (ra != null) { ra.RelatingObject = this; } } } else if (string.Compare(name, "HasAssociations") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcRelAssociates ra = mDatabase.ParseXml <IfcRelAssociates>(node as XmlElement); if (ra != null) { ra.RelatedObjects.Add(this); } } } else if (string.Compare(name, "IsDefinedBy") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcRelDefinesByProperties rd = mDatabase.ParseXml <IfcRelDefinesByProperties>(node as XmlElement); if (rd != null) { rd.RelatedObjects.Add(this); } } } } }
internal static IfcRelDefinesByProperties Parse(string str) { IfcRelDefinesByProperties d = new IfcRelDefinesByProperties(); int pos = 0; d.parseString(str, ref pos); d.mRelatedObjects = ParserSTEP.StripListLink(str, ref pos);// splitListSTPLinks(arrFields[ipos++]); d.mRelatingPropertyDefinition = ParserSTEP.StripLink(str, ref pos);//.parseSTPLink(arrFields[ipos++]); return d; }
internal IfcRelDefinesByProperties(IfcRelDefinesByProperties d) : base(d) { mRelatedObjects = new List<int>(d.mRelatedObjects.ToArray()); mRelatingPropertyDefinition = d.mRelatingPropertyDefinition; }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); if (xml.HasAttribute("ObjectType")) { ObjectType = xml.Attributes["ObjectType"].Value; } if (xml.HasAttribute("LongName")) { LongName = xml.Attributes["LongName"].Value; } if (xml.HasAttribute("Phase")) { Phase = xml.Attributes["Phase"].Value; } foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "RepresentationContexts") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcRepresentationContext rc = mDatabase.ParseXml <IfcRepresentationContext>(cn as XmlElement); if (rc != null) { addRepresentationContext(rc); } } } else if (string.Compare(name, "UnitsInContext") == 0) { UnitsInContext = mDatabase.ParseXml <IfcUnitAssignment>(child as XmlElement); } else if (string.Compare(name, "IsDefinedBy") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcRelDefinesByProperties rd = mDatabase.ParseXml <IfcRelDefinesByProperties>(cn as XmlElement); if (rd != null) { rd.AddRelated(this); } } } else if (string.Compare(name, "Declares") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcRelDeclares rd = mDatabase.ParseXml <IfcRelDeclares>(cn as XmlElement); if (rd != null) { rd.RelatingContext = this; } } } } if (this as IfcProjectLibrary == null || mDatabase.mContext == null) { mDatabase.mContext = this; } }