internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); if (xml.HasAttribute("Name")) Name = xml.Attributes["Name"].Value; if (xml.HasAttribute("Description")) Description = xml.Attributes["Description"].Value; foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "AppliedValue") == 0) AppliedValue = mDatabase.ParseXml<IfcAppliedValueSelect>(child as XmlElement); else if (string.Compare(name, "UnitBasis") == 0) UnitBasis = mDatabase.ParseXml<IfcMeasureWithUnit>(child as XmlElement); else if (string.Compare(name, "Components") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcAppliedValue v = mDatabase.ParseXml<IfcAppliedValue>(node as XmlElement); if (v != null) addComponent(v); } } else if (string.Compare(name, "HasExternalReference") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcExternalReferenceRelationship r = mDatabase.ParseXml<IfcExternalReferenceRelationship>(cn as XmlElement); if (r != null) r.RelatedResourceObjects.Add(this); } } else if (string.Compare(name, "HasConstraintRelationships") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcResourceConstraintRelationship r = mDatabase.ParseXml<IfcResourceConstraintRelationship>(cn as XmlElement); if (r != null) r.addRelated(this); } } else if (string.Compare(name, "Name", true) == 0) Name = child.InnerText; else if (string.Compare(name, "Description", true) == 0) Description = child.InnerText; else if (string.Compare(name, "Category", true) == 0) Category = child.InnerText; else if (string.Compare(name, "Condition", true) == 0) Condition = child.InnerText; else if (string.Compare(name, "ArithmeticOperator", true) == 0) Enum.TryParse<IfcArithmeticOperatorEnum>(child.InnerText, true, out mArithmeticOperator); } //todo if (xml.HasAttribute("Category")) Category = xml.Attributes["Category"].Value; if (xml.HasAttribute("Condition")) Condition = xml.Attributes["Condition"].Value; if (xml.HasAttribute("ArithmeticOperator")) Enum.TryParse<IfcArithmeticOperatorEnum>(xml.Attributes["ArithmeticOperator"].Value, true, out mArithmeticOperator); }
internal static void parseFields(IfcAppliedValue a, List<string> arrFields, ref int ipos, Schema schema) { a.mName = arrFields[ipos++].Replace("'", ""); a.mDescription = arrFields[ipos++].Replace("'", ""); string str = arrFields[ipos++]; a.mAppliedValueValue = ParserIfc.parseValue(str); if (a.mAppliedValueValue == null) a.mAppliedValue = ParserSTEP.ParseLink(str); a.mUnitBasis = ParserSTEP.ParseLink(arrFields[ipos++]); a.mApplicableDate = arrFields[ipos++]; a.mFixedUntilDate = arrFields[ipos++]; if (schema != Schema.IFC2x3) { a.mCategory = arrFields[ipos++].Replace("'", ""); a.mCondition = arrFields[ipos++].Replace("'", ""); string s = arrFields[ipos++]; if (s.StartsWith(".")) a.mArithmeticOperator = (IfcArithmeticOperatorEnum)Enum.Parse(typeof(IfcArithmeticOperatorEnum), s.Replace(".", "")); a.mComponents = ParserSTEP.SplitListLinks(arrFields[ipos++]); } }
internal static IfcAppliedValue Parse(string strDef, Schema schema) { IfcAppliedValue v = new IfcAppliedValue(); int ipos = 0; parseFields(v, ParserSTEP.SplitLineFields(strDef), ref ipos, schema); return v; }
internal IfcAppliedValue(IfcAppliedValue v) : base() { mName = v.mName; mDescription = v.mDescription; mAppliedValue = v.mAppliedValue; mAppliedValueValue = v.mAppliedValueValue; mUnitBasis = v.mUnitBasis; mApplicableDate = v.mApplicableDate; mFixedUntilDate = v.mFixedUntilDate; mCategory = v.mCategory; mCondition = v.mCondition; mArithmeticOperator = v.mArithmeticOperator; mComponents.AddRange(v.mComponents); }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); if (xml.HasAttribute("Name")) { Name = xml.Attributes["Name"].Value; } if (xml.HasAttribute("Description")) { Description = xml.Attributes["Description"].Value; } foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "AppliedValue") == 0) { AppliedValue = mDatabase.ParseXml <IfcAppliedValueSelect>(child as XmlElement); if (mAppliedValueIndex == 0) { mAppliedValueValue = extractValue(child.FirstChild); } } else if (string.Compare(name, "UnitBasis") == 0) { UnitBasis = mDatabase.ParseXml <IfcMeasureWithUnit>(child as XmlElement); } else if (string.Compare(name, "Components") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcAppliedValue v = mDatabase.ParseXml <IfcAppliedValue>(node as XmlElement); if (v != null) { addComponent(v); } } } else if (string.Compare(name, "HasExternalReferences") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcExternalReferenceRelationship r = mDatabase.ParseXml <IfcExternalReferenceRelationship>(cn as XmlElement); if (r != null) { r.addRelated(this); } } } else if (string.Compare(name, "HasConstraintRelationships") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcResourceConstraintRelationship r = mDatabase.ParseXml <IfcResourceConstraintRelationship>(cn as XmlElement); if (r != null) { r.addRelated(this); } } } } //todo if (xml.HasAttribute("Category")) { Category = xml.Attributes["Category"].Value; } if (xml.HasAttribute("Condition")) { Condition = xml.Attributes["Condition"].Value; } if (xml.HasAttribute("ArithmeticOperator")) { Enum.TryParse <IfcArithmeticOperatorEnum>(xml.Attributes["ArithmeticOperator"].Value, true, out mArithmeticOperator); } }
internal IfcAppliedValue(DatabaseIfc db, IfcAppliedValue v) : base(db,v) { mName = v.mName; mDescription = v.mDescription; mAppliedValueIndex = v.mAppliedValueIndex; mAppliedValueValue = v.mAppliedValueValue; UnitBasis = db.Factory.Duplicate(v.UnitBasis) as IfcMeasureWithUnit; mApplicableDate = v.mApplicableDate; mFixedUntilDate = v.mFixedUntilDate; mCategory = v.mCategory; mCondition = v.mCondition; mArithmeticOperator = v.mArithmeticOperator; Components = v.Components.ConvertAll(x=>db.Factory.Duplicate(x) as IfcAppliedValue); }
public IfcAppliedValue(IfcAppliedValue component1, IfcArithmeticOperatorEnum op,IfcAppliedValue component2) : base(component1.mDatabase) { Components = new List<IfcAppliedValue>() { component1, component2 }; mArithmeticOperator = op; }