public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: base.IfcParse(propIndex, value); break; case 1: base.IfcParse(propIndex, value); break; case 2: base.IfcParse(propIndex, value); break; case 3: base.IfcParse(propIndex, value); break; case 4: _relatingObject = (IfcObjectDefinition)value.EntityVal; break; case 5: _relatedObjects.Add((IfcObjectDefinition)value.EntityVal); break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
/// <summary> /// Adds a Related object if it's type obeys the constraint set by RelatedObjectType or no constraint has been set /// </summary> public bool AddRelatedObject(IfcObjectDefinition obj) { if (_relatedObjectsType.HasValue == false) //you can add it, no contraints applied { _relatedObjects.Add(obj); return(true); } bool addIt = false; switch (_relatedObjectsType.Value) { case IfcObjectType.Product: addIt = (obj is IfcProduct); break; case IfcObjectType.Process: addIt = (obj is IfcProcess); break; case IfcObjectType.Control: addIt = (obj is IfcControl); break; case IfcObjectType.Resource: addIt = (obj is IfcResource); break; case IfcObjectType.Actor: addIt = (obj is IfcActor); break; case IfcObjectType.Group: addIt = (obj is IfcGroup); break; case IfcObjectType.Project: addIt = (obj is IfcProject); break; case IfcObjectType.NotDefined: addIt = true; break; default: //invalid constraint so add it addIt = true; break; } if (addIt) { _relatedObjects.Add(obj); } return(addIt); }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: base.Parse(propIndex, value, nestedIndex); return; case 4: _relatingObject = (IfcObjectDefinition)(value.EntityVal); return; case 5: _relatedObjects.InternalAdd((IfcObjectDefinition)value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }