private IfcClassificationReference GetOrCreateClassificationReference(string code, string name, IfcClassification source) { if (code == null) return null; IfcClassificationReference classification = _model.Instances.Where<IfcClassificationReference>(s => s.ItemReference == code).FirstOrDefault(); if (classification == null) classification = _model.Instances.New<IfcClassificationReference>(s => { s.ItemReference = code; }); if (name != null) classification.Name = name; if (source != null) classification.ReferencedSource = source; return classification; }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: base.IfcParse(propIndex, value); break; case 3: _referencedSource = (IfcClassification) value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
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: _referencedSource = (IfcClassification)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: base.IfcParse(propIndex, value); break; case 3: _referencedSource = (IfcClassification)value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public override bool Equals(object obj) { // Check for null if (obj == null) { return(false); } // Check for type if (this.GetType() != obj.GetType()) { return(false); } // Cast as IfcRoot IfcClassification root = (IfcClassification)obj; return(this == root); }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: _notation = (IfcClassificationNotationFacet)(value.EntityVal); return; case 1: _itemOf = (IfcClassification)(value.EntityVal); return; case 2: _title = value.StringVal; return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
public void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _notation = (IfcClassificationNotationFacet)value.EntityVal; break; case 1: _itemOf = (IfcClassification)value.EntityVal; break; case 2: _title = value.StringVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _notation = (IfcClassificationNotationFacet) value.EntityVal; break; case 1: _itemOf = (IfcClassification) value.EntityVal; break; case 2: _title = value.StringVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
private void ParseCSV(string data, CsvLineParser parser, IfcClassification source) { TextReader csvReader = new StringReader(data); //header line string line = csvReader.ReadLine(); CsvLineParser lineParser = parser; lineParser.ParseHeader(line); //get first line of data line = csvReader.ReadLine(); while (line != null) { //parse line Line parsedLine = lineParser.ParseLine(line); //create IFC object IfcSystem system = GetOrCreateSystem(parsedLine.Code, parsedLine.Description); var classification = GetOrCreateClassificationReference(parsedLine.Code, parsedLine.Description, source); //set up hierarchy if (system == null) continue; IfcSystem parentSystem = GetOrCreateSystem(parsedLine.ParentCode); if (parentSystem != null) parentSystem.AddObjectToGroup(system); //read new line to be processed in the next step line = csvReader.ReadLine(); } }