Example #1
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     if (xml.HasAttribute("RefLatitude"))
     {
         string[] fields = xml.Attributes["RefLatitude"].Value.Split(" ".ToCharArray());
         RefLatitude = new IfcCompoundPlaneAngleMeasure(int.Parse(fields[0]), int.Parse(fields[1]), int.Parse(fields[2]), (fields.Length > 3 ? int.Parse(fields[3]) : 0));
     }
     if (xml.HasAttribute("RefLongitude"))
     {
         string[] fields = xml.Attributes["RefLongitude"].Value.Split(" ".ToCharArray());
         RefLongitude = new IfcCompoundPlaneAngleMeasure(int.Parse(fields[0]), int.Parse(fields[1]), int.Parse(fields[2]), (fields.Length > 3 ? int.Parse(fields[3]) : 0));
     }
     if (xml.HasAttribute("RefElevation"))
     {
         RefElevation = double.Parse(xml.Attributes["RefElevation"].Value);
     }
     if (xml.HasAttribute("LandTitleNumber"))
     {
         LandTitleNumber = xml.Attributes["LandTitleNumber"].Value;
     }
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "SiteAddress") == 0)
         {
             SiteAddress = mDatabase.ParseXml <IfcPostalAddress>(child as XmlElement);
         }
     }
 }
Example #2
0
        /// <summary>
        ///  Erzeugt Site in Project
        /// </summary>
        /// <param name="model">           Projct </param>
        /// <param name="name">            Bezeichnung der Site </param>
        /// <param name="placement">       Ursprung </param>
        /// <param name="refLatitude">     Breitengrad </param>
        /// <param name="refLongitude">    Längengrad </param>
        /// <param name="refElevation">    Höhe </param>
        /// <param name="compositionType"> Bei einer Site nicht ändern </param>
        /// <returns>  </returns>
        private static IfcSite createSite(IfcStore model,
                                          string name,
                                          Axis2Placement3D placement = null,
                                          double?refLatitude         = null,
                                          double?refLongitude        = null,
                                          double?refElevation        = null,
                                          IfcElementCompositionEnum compositionType = IfcElementCompositionEnum.ELEMENT)
        {
            using (var txn = model.BeginTransaction("Create Site"))
            {
                var site = model.Instances.New <IfcSite>(s =>
                {
                    s.Name            = name;
                    s.CompositionType = compositionType;
                    if (refLatitude.HasValue)
                    {
                        s.RefLatitude = IfcCompoundPlaneAngleMeasure.FromDouble(refLatitude.Value);
                    }
                    if (refLongitude.HasValue)
                    {
                        s.RefLongitude = IfcCompoundPlaneAngleMeasure.FromDouble(refLongitude.Value);
                    }
                    s.RefElevation = refElevation;

                    placement         = placement ?? Axis2Placement3D.Standard;
                    s.ObjectPlacement = createLocalPlacement(model, placement);
                });

                txn.Commit();
                return(site);
            }
        }
Example #3
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 9:
                if (!_refLatitude.HasValue)
                {
                    _refLatitude = new IfcCompoundPlaneAngleMeasure();
                }
                var refLatitude = _refLatitude.Value;
                IfcCompoundPlaneAngleMeasure.Add(ref refLatitude, value.IntegerVal);
                _refLatitude = refLatitude;
                return;

            case 10:
                if (!_refLongitude.HasValue)
                {
                    _refLongitude = new IfcCompoundPlaneAngleMeasure();
                }
                var refLongitude = _refLongitude.Value;
                IfcCompoundPlaneAngleMeasure.Add(ref refLongitude, value.IntegerVal);
                _refLongitude = refLongitude;
                return;

            case 11:
                _refElevation = value.RealVal;
                return;

            case 12:
                _landTitleNumber = value.StringVal;
                return;

            case 13:
                _siteAddress = (IfcPostalAddress)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Example #4
0
        /// <summary>
        ///  Erzeugt Site in Project
        /// </summary>
        /// <param name="model">           Projct </param>
        /// <param name="name">            Bezeichnung der Site </param>
        /// <param name="placement">       Ursprung </param>
        /// <param name="refLatitude">     Breitengrad </param>
        /// <param name="refLongitude">    Längengrad </param>
        /// <param name="refElevation">    Höhe </param>
        /// <param name="compositionType"> Bei einer Site nicht ändern </param>
        /// <returns>  </returns>
        private static IfcSite createSite(IfcStore model,
                                          string name,
                                          Axis2Placement3D placement = null,
                                          double?refLatitude         = null,
                                          double?refLongitude        = null,
                                          double?refElevation        = null,
                                          IfcElementCompositionEnum compositionType = IfcElementCompositionEnum.ELEMENT)
        {
            //Serilog.Log.Logger = new LoggerConfiguration()
            //   .MinimumLevel.Debug()
            //   .WriteTo.File(System.Configuration.ConfigurationManager.AppSettings["LogFilePath"])
            //   .CreateLogger();
            using (var txn = model.BeginTransaction("Create Site"))
            {
                var site = model.Instances.New <IfcSite>(s =>
                {
                    s.Name            = name;
                    s.CompositionType = compositionType;
                    if (refLatitude.HasValue)
                    {
                        s.RefLatitude = IfcCompoundPlaneAngleMeasure.FromDouble(refLatitude.Value);
                    }
                    if (refLongitude.HasValue)
                    {
                        s.RefLongitude = IfcCompoundPlaneAngleMeasure.FromDouble(refLongitude.Value);
                    }
                    s.RefElevation = refElevation;

                    placement         = placement ?? Axis2Placement3D.Standard;
                    s.ObjectPlacement = createLocalPlacement(model, placement);
                });
                txn.Commit();
                //Log.Information("IfcSite created");
                return(site);
            }
        }