示例#1
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:
            case 9:
            case 10:
            case 11:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 12:
                _elevation = value.RealVal;
                return;

            case 13:
                _height = value.RealVal;
                return;

            case 14:
                _facility = (CobieFacility)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
示例#2
0
        private void CompareTrees(CobieFacility facilityLeft, CobieFacility facilityRight)
        {
            Assert.AreEqual(facilityLeft.ExternalId, facilityRight.ExternalId);
            Assert.AreEqual(facilityLeft.AltExternalId, facilityRight.AltExternalId);
            Assert.AreEqual(facilityLeft.Name, facilityRight.Name);

            Assert.AreEqual(facilityLeft.Floors.Count(), facilityRight.Floors.Count(), "Floor count mismatch");

            if (facilityLeft.Floors.Count() == facilityRight.Floors.Count())
            {
                for (int i = 0; i < facilityLeft.Floors.Count(); ++i)
                {
                    var floorLeft  = facilityLeft.Floors.ElementAt(i);
                    var floorRight = facilityLeft.Floors.ElementAt(i);

                    CompareTrees(floorLeft, floorRight);
                }
            }
        }
示例#3
0
        private void AddFloorsAndSpaces(CobieFacility facility)
        {
            var model  = facility.Model;
            var floorA = model.Instances.New <CobieFloor>(f =>
            {
                f.Name      = "Base Floor";
                f.Facility  = facility;
                f.Height    = 4500;
                f.Elevation = 0;
                f.Created   = facility.Created;
                GenerateAttributes(f, 23);
            });

            var floorB = model.Instances.New <CobieFloor>(f =>
            {
                f.Name      = "First Floor";
                f.Facility  = facility;
                f.Height    = 3500;
                f.Elevation = 4700;
                f.Created   = facility.Created;
                GenerateAttributes(f, 12);
            });

            foreach (var name in _rHeroNames)
            {
                var sName = name + "'s Hall";
                var name1 = name;
                model.Instances.New <CobieSpace>(s =>
                {
                    s.Name  = sName;
                    s.Floor = _rHeroNames.IndexOf(name1) < 5 ? floorA : floorB;
                    GenerateAttributes(s, 10);
                    GenerateComponents(s, 15);
                });
            }
        }
示例#4
0
        /// <summary>
        /// This method searches through the facilities to look
        /// for properties inside the property sets of Assets
        /// to look for values that match Regex classification
        /// formats, set out in the DataReader. It then adds any
        /// values that match the Regular Expression as a category
        /// of assets which conforms with the Schema.
        /// </summary>
        private void AddClassificationsToAssets(CobieFacility facility)
        {
            var dataReader = new ClassificationMappingReader();//DataReader Object which will create and populate the mappings table.

            //Get Each AssetType
            foreach (var type in facility.Model.Instances.OfType <CobieType>())
            {
                //Get Each Asset
                foreach (var component in type.Components)
                {
                    //Get Each Property
                    foreach (var attribute in component.Attributes)
                    {
                        if (attribute.Value == null || component.Categories.Count != 0)
                        {
                            continue;
                        }
                        //Get the Inferred Classifications

                        var inferredClassifications = FindInferredClassifications(attribute.Value.ToString(), dataReader);

                        foreach (var ic in inferredClassifications)
                        {
                            var uniclassMatch = false;
                            var nbsMatch      = false;
                            var nrmMatch      = false;

                            foreach (var cat in component.Categories)
                            {
                                if (ic.UniclassCode != null && cat.Value == ic.UniclassCode)
                                {
                                    uniclassMatch = true;
                                }
                                if (ic.NbsCode != null && cat.Value == ic.NbsCode)
                                {
                                    nbsMatch = true;
                                }
                                if (ic.NrmCode != null && cat.Value == ic.NrmCode)
                                {
                                    nrmMatch = true;
                                }
                            }
                            //Add the Classifications as categories if they exist.
                            if (ic.UniclassCode != null && !uniclassMatch)
                            {
                                var uniClass = GetCategory(ic.UniclassCode, ic.UniclassDescription);
                                uniClass.Classification = GetClassification(Uniclass2015Name);
                                component.Categories.Add(uniClass);
                            }
                            if (ic.NbsCode != null && !nbsMatch)
                            {
                                var nbs = GetCategory(ic.NbsCode, ic.NbsDescription);
                                nbs.Classification = GetClassification(NBSReferenceName);
                                component.Categories.Add(nbs);
                            }
                            if (ic.NrmCode != null && !nrmMatch)
                            {
                                var nrm = GetCategory(ic.NrmCode, ic.NrmDescription);
                                nrm.Classification = GetClassification(NRMReferenceName);
                                component.Categories.Add(nrm);
                            }
                        }
                    }
                }
            }
        }
示例#5
0
 /// <summary>
 /// This is the constructor for the Classifier Class
 /// </summary>
 public void Classify(CobieFacility facility)
 {
     AddClassificationsToAssets(facility);
 }