public void AddRole(IfcActorRole newRole) { Roles.Add(newRole); }
public IfcRelAssignsToActor(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcObjectDefinition[] __RelatedObjects, IfcObjectTypeEnum?__RelatedObjectsType, IfcActor __RelatingActor, IfcActorRole __ActingRole) : base(__GlobalId, __OwnerHistory, __Name, __Description, __RelatedObjects, __RelatedObjectsType) { this.RelatingActor = __RelatingActor; this.ActingRole = __ActingRole; }
public IfcApprovalActorRelationship(IfcActorSelect __Actor, IfcApproval __Approval, IfcActorRole __Role) { this._Actor = __Actor; this._Approval = __Approval; this._Role = __Role; }
public IfcRelOccupiesSpaces(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcObjectDefinition[] __RelatedObjects, IfcObjectTypeEnum?__RelatedObjectsType, IfcActor __RelatingActor, IfcActorRole __ActingRole) : base(__GlobalId, __OwnerHistory, __Name, __Description, __RelatedObjects, __RelatedObjectsType, __RelatingActor, __ActingRole) { }
/// <summary> /// Fill sheet rows for Contact sheet /// </summary> /// <returns>COBieSheet</returns> public override COBieSheet <COBieContactRow> Fill() { ProgressIndicator.ReportMessage("Starting Contacts..."); ClearEMails(); //clear the email dictionary for a new file conversion //create new sheet COBieSheet <COBieContactRow> contacts = new COBieSheet <COBieContactRow>(Constants.WORKSHEET_CONTACT); IEnumerable <string> cobieContacts = Model.Instances.OfType <IfcPropertySingleValue>().Where(psv => psv.Name == "COBieCreatedBy" || psv.Name == "COBieTypeCreatedBy").GroupBy(psv => psv.NominalValue).Select(g => g.First().NominalValue.ToString()); IEnumerable <IfcPersonAndOrganization> ifcPersonAndOrganizations = Model.Instances.OfType <IfcPersonAndOrganization>(); ProgressIndicator.Initialise("Creating Contacts", ifcPersonAndOrganizations.Count() + cobieContacts.Count()); List <IfcOrganizationRelationship> ifcOrganizationRelationships = null; foreach (IfcPersonAndOrganization ifcPersonAndOrganization in ifcPersonAndOrganizations) { ProgressIndicator.IncrementAndUpdate(); //check we do not have a default email address, if skip it as we want the validation warning string email = GetTelecomEmailAddress(ifcPersonAndOrganization); if (email == Constants.DEFAULT_EMAIL) { continue; } COBieContactRow contact = new COBieContactRow(contacts); // get person and organization IfcOrganization ifcOrganization = ifcPersonAndOrganization.TheOrganization; IfcPerson ifcPerson = ifcPersonAndOrganization.ThePerson; contact.Email = email; //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcPersonAndOrganization, IfcPerson or IfcOrganization contact.CreatedBy = GetTelecomEmailAddress(Model.IfcProject.OwnerHistory); contact.CreatedOn = GetCreatedOnDateAsFmtString(Model.IfcProject.OwnerHistory); IfcActorRole ifcActorRole = null; if (ifcPerson.Roles != null) { ifcActorRole = ifcPerson.Roles.FirstOrDefault(); } if (ifcOrganization.Roles != null) { ifcActorRole = ifcOrganization.Roles.FirstOrDefault(); } if ((ifcActorRole != null) && (!string.IsNullOrEmpty(ifcActorRole.UserDefinedRole))) { contact.Category = ifcActorRole.UserDefinedRole.ToString(); } else { contact.Category = DEFAULT_STRING; } contact.Company = (string.IsNullOrEmpty(ifcOrganization.Name)) ? DEFAULT_STRING : ifcOrganization.Name.ToString(); contact.Phone = GetTelecomTelephoneNumber(ifcPersonAndOrganization); contact.ExtSystem = DEFAULT_STRING; // TODO: Person is not a Root object so has no Owner. What should this be? contact.ExtObject = "IfcPersonAndOrganization"; if (!string.IsNullOrEmpty(ifcPerson.Id)) { contact.ExtIdentifier = ifcPerson.Id; } //get department string department = ""; if (ifcPerson.Addresses != null) { department = ifcPerson.Addresses.PostalAddresses.Select(dept => dept.InternalLocation).Where(dept => !string.IsNullOrEmpty(dept)).FirstOrDefault(); } if (string.IsNullOrEmpty(department)) { if (ifcOrganizationRelationships == null) { ifcOrganizationRelationships = Model.Instances.OfType <IfcOrganizationRelationship>().ToList(); } IfcOrganization ifcRelOrganization = ifcOrganizationRelationships .Where(Or => Or.RelatingOrganization.EntityLabel == ifcOrganization.EntityLabel && Or.RelatedOrganizations.Last() != null) .Select(Or => Or.RelatedOrganizations.Last()) .LastOrDefault(); if (ifcRelOrganization != null) { department = ifcRelOrganization.Name.ToString(); } } if (string.IsNullOrEmpty(department)) { department = ifcOrganization.Description.ToString(); //only place to match example files } contact.Department = (string.IsNullOrEmpty(department)) ? contact.Company : department; contact.OrganizationCode = (string.IsNullOrEmpty(ifcOrganization.Id)) ? DEFAULT_STRING : ifcOrganization.Id.ToString(); contact.GivenName = (string.IsNullOrEmpty(ifcPerson.GivenName)) ? DEFAULT_STRING : ifcPerson.GivenName.ToString(); contact.FamilyName = (string.IsNullOrEmpty(ifcPerson.FamilyName)) ? DEFAULT_STRING : ifcPerson.FamilyName.ToString(); if (ifcPerson.Addresses != null) { GetContactAddress(contact, ifcPerson.Addresses); } else { GetContactAddress(contact, ifcOrganization.Addresses); } contacts.AddRow(contact); } foreach (string email in cobieContacts) { ProgressIndicator.IncrementAndUpdate(); COBieContactRow contact = new COBieContactRow(contacts); contact.Email = email; //lets default the creator to that user who created the project for now, no direct link to OwnerHistory on IfcPersonAndOrganization, IfcPerson or IfcOrganization contact.CreatedBy = GetTelecomEmailAddress(Model.IfcProject.OwnerHistory); contact.CreatedOn = GetCreatedOnDateAsFmtString(Model.IfcProject.OwnerHistory); contact.Category = DEFAULT_STRING; contact.Company = DEFAULT_STRING; contact.Phone = DEFAULT_STRING; contact.ExtSystem = DEFAULT_STRING; contact.ExtObject = "IfcPropertySingleValue"; contact.Department = DEFAULT_STRING; contact.OrganizationCode = DEFAULT_STRING; contact.GivenName = DEFAULT_STRING; contact.FamilyName = DEFAULT_STRING; contact.Street = DEFAULT_STRING; contact.PostalBox = DEFAULT_STRING; contact.Town = DEFAULT_STRING; contact.StateRegion = DEFAULT_STRING; contact.PostalCode = DEFAULT_STRING; contact.Country = DEFAULT_STRING; contacts.AddRow(contact); } ProgressIndicator.Finalise(); contacts.OrderBy(s => s.Email); return(contacts); }
public void CreatePersonAndOrganization(COBieContactRow row, IfcPersonAndOrganization ifcPersonAndOrganization = null) { if (!Contacts.ContainsKey(row.Email)) //should filter on merge also unless Contacts is reset { IfcPerson ifcPerson = Model.Instances.New <IfcPerson>(); IfcOrganization ifcOrganization = Model.Instances.New <IfcOrganization>(); if (ifcPersonAndOrganization == null) { ifcPersonAndOrganization = Model.Instances.New <IfcPersonAndOrganization>(); } Contacts.Add(row.Email, ifcPersonAndOrganization); //build a list to reference for History objects //add email IfcTelecomAddress ifcTelecomAddress = Model.Instances.New <IfcTelecomAddress>(); if (ValidateString(row.Email)) { if (ifcTelecomAddress.ElectronicMailAddresses == null) { ifcTelecomAddress.SetElectronicMailAddress(row.Email); //create the LabelCollection and set to ElectronicMailAddresses field } else { ifcTelecomAddress.ElectronicMailAddresses.Add(row.Email); //add to existing collection } } //IfcPersonAndOrganization has no OwnerHistory so our COBie is extracting this from IfcProject so do nothing here //add Role from Category if (ValidateString(row.Category)) { IfcActorRole ifcActorRole = Model.Instances.New <IfcActorRole>(); ifcActorRole.RoleString = row.Category; if (ifcPerson.Roles == null) { ifcPerson.SetRoles(ifcActorRole);//create the ActorRoleCollection and set to Roles field } else { ifcPerson.Roles.Add(ifcActorRole);//add to existing collection } } //add Company if (ValidateString(row.Company)) { ifcOrganization.Name = row.Company; } else { ifcOrganization.Name = "Unknown"; //is not an optional field so fill with unknown value } //add Phone if (ValidateString(row.Phone)) { if (ifcTelecomAddress.TelephoneNumbers == null) { ifcTelecomAddress.SetTelephoneNumbers(row.Phone);//create the LabelCollection and set to TelephoneNumbers field } else { ifcTelecomAddress.TelephoneNumbers.Add(row.Phone);//add to existing collection } } //External System, as no history object we have to allow this to default to DEFAUL_STRING, so do nothing here //External Object is retrieved from object type IfcPersonAndOrganization so do nothing here //add External Identifier if (ValidateString(row.ExtIdentifier)) { ifcPerson.Id = row.ExtIdentifier; } //add Department IfcPostalAddress ifcPostalAddress = Model.Instances.New <IfcPostalAddress>(); if (ValidateString(row.Department)) { ifcPostalAddress.InternalLocation = row.Department; } //add Organization code if (ValidateString(row.OrganizationCode)) { ifcOrganization.Id = row.OrganizationCode; } //add GivenName if (ValidateString(row.GivenName)) { ifcPerson.GivenName = row.GivenName; } //add Family Name if (ValidateString(row.FamilyName)) { ifcPerson.FamilyName = row.FamilyName; } //add Street if (ValidateString(row.Street)) { ifcPostalAddress.SetAddressLines(row.Street.Split(',')); } //add PostalBox if (ValidateString(row.PostalBox)) { ifcPostalAddress.PostalBox = row.PostalBox; } //add Town if (ValidateString(row.Town)) { ifcPostalAddress.Town = row.Town; } //add StateRegion if (ValidateString(row.StateRegion)) { ifcPostalAddress.Region = row.StateRegion; } //add PostalCode if (ValidateString(row.PostalCode)) { ifcPostalAddress.PostalCode = row.PostalCode; } //add Country if (ValidateString(row.Country)) { ifcPostalAddress.Country = row.Country; } //add addresses into IfcPerson object //add Telecom Address if (ifcPerson.Addresses == null) { ifcPerson.SetTelecomAddresss(ifcTelecomAddress);//create the AddressCollection and set to Addresses field } else { ifcPerson.Addresses.Add(ifcTelecomAddress);//add to existing collection } // Add postal address if (ifcPerson.Addresses == null) { ifcPerson.SetPostalAddresss(ifcPostalAddress);//create the AddressCollection and set to Addresses field } else { ifcPerson.Addresses.Add(ifcPostalAddress);//add to existing collection } //add the person and the organization objects ifcPersonAndOrganization.ThePerson = ifcPerson; ifcPersonAndOrganization.TheOrganization = ifcOrganization; } }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: case 5: base.IfcParse(propIndex, value); break; case 6: _relatingActor = value.EntityVal as IfcActor; break; case 7: _actingRole = value.EntityVal as IfcActorRole; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public virtual void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _actor = (IfcActorSelect) value.EntityVal; break; case 1: _approval = (IfcApproval) value.EntityVal; break; case 2: _role = (IfcActorRole) value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
/// <summary> /// Map IfcActroRole to RoleFilter, if no match the RoleFilter.Unknown returned /// </summary> /// <param name="actorRole">IfcActorRole</param> /// <returns>RoleFilter</returns> private static RoleFilter MapActorRole(IfcActorRole actorRole) { var role = actorRole.Role; var userDefined = actorRole.UserDefinedRole; if (role == IfcRole.UserDefined) { RoleFilter filterRole; if (Enum.TryParse(userDefined, out filterRole)) { return filterRole; } } else { if (role == IfcRole.Architect) return RoleFilter.Architectural; if (role == IfcRole.MechanicalEngineer) return RoleFilter.Mechanical; if (role == IfcRole.ElectricalEngineer) return RoleFilter.Electrical; } //Unhandled IfcRole //IfcRole.Supplier IfcRole.Manufacturer IfcRole.Contractor IfcRole.Subcontractor IfcRole.StructuralEngineer //IfcRole.CostEngineer IfcRole.Client IfcRole.BuildingOwner IfcRole.BuildingOperator IfcRole.ProjectManager //IfcRole.FacilitiesManager IfcRole.CivilEngineer IfcRole.ComissioningEngineer IfcRole.Engineer IfcRole.Consultant //IfcRole.ConstructionManager IfcRole.FieldConstructionManager IfcRole.Owner IfcRole.Reseller return RoleFilter.Unknown; }