internal IfcQuantityWeightTransient(MeasureResource.IfcMeasureWithUnit measure)
        {
            var value = measure.ValueComponent;

            _unit = measure.UnitComponent as Ifc4.Interfaces.IIfcNamedUnit;
            if (!(value is MeasureResource.IfcMassMeasure))
            {
                return;
            }
            _weightValue = new IfcMassMeasure((MeasureResource.IfcMassMeasure)value);
        }
Ejemplo n.º 2
0
        private static void ProcessItems(CostModel model, List <TPolozka> polozky, CostItem parent, Dictionary <string, ClassificationItem> map)
        {
            if (polozky == null)
            {
                return;
            }
            foreach (var polozka in polozky)
            {
                var item = new CostItem(model)
                {
                    Name        = polozka.Nazev,
                    Identifier  = polozka.Cislo,
                    Description = polozka.PPOPIS,
                    Type        = polozka.Typ.ToString()
                };

                // unit cost. There might be more than one or it can be modeled as a hierarchy with operators
                var unitCost = new CostValue(model)
                {
                    Value = System.Convert.ToDouble(polozka.JCena)
                };
                // in the base case there is just one
                item.UnitValues.Add(unitCost);

                // Quantities have measure type and unit, if it is not cost
                AddQuantity(model, item, polozka.MJ, System.Convert.ToDouble(polozka.Mnozstvi));

                // additional properties can be stored in custom property sets
                item["CZ_CostItem"] = new PropertySet(model);
                item["CZ_CostItem"]["JHmotnost"]           = new IfcMassMeasure(System.Convert.ToDouble(polozka.JHmotnost));
                item["CZ_CostItem"]["JDemontazniHmotnost"] = new IfcMassMeasure(System.Convert.ToDouble(polozka.JDemontazniHmotnost));
                item["CZ_CostItem"]["SazbaDPH"]            = new IfcRatioMeasure(System.Convert.ToDouble(polozka.SazbaDPH) / 100);
                item["CZ_CostItem"]["ObchNazev"]           = new IfcIdentifier(polozka.ObchNazev);
                item["CZ_CostItem"]["ObchNazevAN"]         = new IfcBoolean(polozka.ObchNazevAN);
                item["CZ_CostItem"]["PoradoveCislo"]       = new IfcInteger(polozka.PoradoveCislo);
                parent.Children.Add(item);

                // Deprecated: using IFC GlobalId
                // item["CZ_CostItem"]["UID"] = new IfcIdentifier(polozka.UID);

                // assign classification item if defined
                if (
                    !string.IsNullOrWhiteSpace(polozka.PolozkaZatrideniUID) &&
                    map.TryGetValue(polozka.PolozkaZatrideniUID, out ClassificationItem ci))
                {
                    item.ClassificationItems.Add(ci);
                }
            }
        }
Ejemplo n.º 3
0
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
             base.IfcParse(propIndex, value);
             break;
         case 3:
             _weightValue = value.RealVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Ejemplo n.º 4
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 3:
                _weightValue = value.RealVal;
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Ejemplo n.º 5
0
 public IfcQuantityWeight(IfcLabel __Name, IfcText?__Description, IfcNamedUnit __Unit, IfcMassMeasure __WeightValue, IfcLabel?__Formula)
     : base(__Name, __Description, __Unit)
 {
     this._WeightValue = __WeightValue;
     this._Formula     = __Formula;
 }