Exemplo n.º 1
0
        internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
        {
            base.SetXML(xml, host, processed);
            setAttribute(xml, "Name", Name);
            setAttribute(xml, "Description", Description);
            if (mAppliedValueIndex > 0 && (host == null || host.mIndex != mAppliedValueIndex))
            {
                xml.AppendChild(mDatabase[mAppliedValueIndex].GetXML(xml.OwnerDocument, "AppliedValue", this, processed));
            }
            else if (mAppliedValueValue != null)
            {
                xml.AppendChild(convert(xml.OwnerDocument, mAppliedValueValue, "AppliedValue"));
            }
            if (mUnitBasis > 0)
            {
                xml.AppendChild(UnitBasis.GetXML(xml.OwnerDocument, "UnitBasis", this, processed));
            }
            //todo
            setAttribute(xml, "Category", Category);
            setAttribute(xml, "Condition", Condition);
            if (mArithmeticOperator != IfcArithmeticOperatorEnum.NONE)
            {
                xml.SetAttribute("ArithmeticOperator", mArithmeticOperator.ToString().ToLower());
            }
            if (mComponents.Count > 0)
            {
                XmlElement element = xml.OwnerDocument.CreateElement("Components");
                xml.AppendChild(element);
                foreach (IfcAppliedValue v in Components)
                {
                    element.AppendChild(v.GetXML(xml.OwnerDocument, "", this, processed));
                }
            }

            if (mHasExternalReferences.Count > 0)
            {
                XmlElement element = xml.OwnerDocument.CreateElement("HasExternalReferences");
                xml.AppendChild(element);
                foreach (IfcExternalReferenceRelationship r in HasExternalReferences)
                {
                    element.AppendChild(r.GetXML(xml.OwnerDocument, "", this, processed));
                }
            }
            if (mHasConstraintRelationships.Count > 0)
            {
                XmlElement element = xml.OwnerDocument.CreateElement("HasConstraintRelationships");
                foreach (IfcResourceConstraintRelationship r in HasConstraintRelationships)
                {
                    if (r.mIndex != host.mIndex)
                    {
                        element.AppendChild(r.GetXML(xml.OwnerDocument, "", this, processed));
                    }
                }
                if (element.HasChildNodes)
                {
                    xml.AppendChild(element);
                }
            }
        }
Exemplo n.º 2
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     setAttribute(obj, "Name", Name);
     setAttribute(obj, "Description", Description);
     if (mAppliedValue != null)
     {
         IfcValue value = mAppliedValue as IfcValue;
         if (value != null)
         {
             obj["AppliedValue"] = DatabaseIfc.extract(value);
         }
         else
         {
             obj["AppliedValue"] = mAppliedValue.getJson(this, options);
         }
     }
     if (mUnitBasis > 0)
     {
         obj["UnitBasis"] = UnitBasis.getJson(this, options);
     }
     //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, options)));
     }
     if (mHasExternalReference.Count > 0)
     {
         obj["HasExternalReference"] = new JArray(HasExternalReference.ToList().ConvertAll(x => x.getJson(this, options)));
     }
     if (mHasConstraintRelationships.Count > 0)
     {
         JArray array = new JArray();
         foreach (IfcResourceConstraintRelationship r in HasConstraintRelationships)
         {
             if (r.mIndex != host.mIndex)
             {
                 array.Add(r.getJson(this, options));
             }
         }
         if (array.Count > 0)
         {
             obj["HasConstraintRelationships"] = array;
         }
     }
 }
        public string AsString()
        {
            StringBuilder value = new StringBuilder();

            if (!string.IsNullOrEmpty(Description))
            {
                value.Append(Description);
                value.Append(", ");
            }

            if (AppliedValue != null)//not nullable should be? incorrect name?
            {
                value.Append("AppliedValue: ");
                if (AppliedValue is IfcRatioMeasure)
                {
                    var ifcRatioMeasure = (IfcRatioMeasure)AppliedValue;
                    value.Append(string.Format("{0,0:N2}", ifcRatioMeasure.Value));
                }
                if (AppliedValue is IfcMonetaryMeasure)
                {
                    IfcMonetaryMeasure ifcMonetaryMeasure = (IfcMonetaryMeasure)AppliedValue;
                    value.Append(string.Format("{0,0:N2}", ifcMonetaryMeasure.Value));
                }
                var unit = AppliedValue as IfcMeasureWithUnit;
                if (unit != null)
                {
                    value.Append(unit.AsString());
                }
                value.Append(", ");
            }

            if (UnitBasis != null) //not nullable should be?
            {
                value.Append("UnitBase: ");
                value.Append(UnitBasis.AsString());
                value.Append(", ");
            }
            if (ApplicableDate != null) //not nullable should be?
            {
                value.Append("ApplicableDate: ");
                value.Append(ApplicableDate.ToString());
                value.Append(", ");
            }
            if (FixedUntilDate != null) //not nullable should be?
            {
                value.Append("FixedUntilDate: ");
                value.Append(FixedUntilDate.ToString());
                value.Append(", ");
            }

            return(value.ToString());
        }
Exemplo n.º 4
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(AppliedValue != null ? AppliedValue.ToStepValue() : "$");
            parameters.Add(UnitBasis != null ? UnitBasis.ToStepValue() : "$");
            parameters.Add(ApplicableDate != null ? ApplicableDate.ToStepValue() : "$");
            parameters.Add(FixedUntilDate != null ? FixedUntilDate.ToStepValue() : "$");
            parameters.Add(Category != null ? Category.ToStepValue() : "$");
            parameters.Add(Condition != null ? Condition.ToStepValue() : "$");
            parameters.Add(ArithmeticOperator.ToStepValue());
            parameters.Add(Components != null ? Components.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }