/// <summary> /// Return a document object list, in case IfcDocumentInformation.DocumentReferences more than one file /// </summary> /// <param name="ifcDocumentSelect"></param> /// <returns></returns> public List <Document> MappingMulti(IIfcDocumentSelect ifcDocumentSelect) { if (UsedNames == null) { UsedNames = new List <string>(); } List <Document> docList = new List <Document>(); if (Helper == null) { Helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper; } //process IfcDocumentReference first if (ifcDocumentSelect is IIfcDocumentReference) { var ifcDocumentReference = ifcDocumentSelect as IIfcDocumentReference; if (ifcDocumentReference.ReferencedDocument != null) { docList.Add(ConvertToDocument(ifcDocumentReference, ifcDocumentReference.ReferencedDocument));//ReferenceToDocument is a SET [0:1] return(docList); } } //must be IfcDocumentInformation var ifcDocumentInformation = ifcDocumentSelect as IIfcDocumentInformation; foreach (IIfcDocumentReference ifcDocumentReference in ifcDocumentInformation.HasDocumentReferences) { docList.Add(ConvertToDocument(ifcDocumentReference, ifcDocumentInformation)); } //Do the children files var childDocList = GetChildDocs(ifcDocumentInformation); //link child documents to first document in the list var linkDoc = docList.FirstOrDefault(); if (linkDoc != null) { linkDoc.Documents = childDocList; } else //no docs to link too, then just add to the root document list { docList.Concat(childDocList); } return(docList); }
/// <summary> /// Return a document object list, in case IfcDocumentInformation.DocumentReferences more than one file /// </summary> /// <param name="source"></param> /// <returns></returns> public List <CobieDocument> MappingMulti(IIfcDocumentSelect source) { if (UsedNames == null) { UsedNames = new List <string>(); } var docList = new List <CobieDocument>(); if (Helper == null) { Helper = ((IfcToCoBieExpressExchanger)Exchanger).Helper; } //process IfcDocumentReference first var documentReference = source as IIfcDocumentReference; if (documentReference != null) { var ifcDocumentReference = documentReference; if (ifcDocumentReference.ReferencedDocument != null) { docList.Add(ConvertToDocument(ifcDocumentReference, ifcDocumentReference.ReferencedDocument));//ReferenceToDocument is a SET [0:1] return(docList); } } //must be IfcDocumentInformation var information = source as IIfcDocumentInformation; if (information != null) { docList.AddRange(information.HasDocumentReferences.Select(reference => ConvertToDocument(reference, information))); } //Do the children files var childDocList = GetChildDocs(information); //link child documents to first document in the list //var linkDoc = docList.FirstOrDefault(); //if (linkDoc != null) //{ // linkDoc.Documents = childDocList; //} //else //no docs to link too, then just add to the root document list docList = docList.Concat(childDocList).ToList(); return(docList); }
/// <summary> /// Required by Interface /// </summary> /// <param name="source"></param> /// <param name="target"></param> /// <returns></returns> protected override Document Mapping(IIfcDocumentSelect source, Document target) { throw new NotImplementedException(); //see MappingMulti method }
/// <summary> /// Required by Interface /// </summary> /// <param name="source"></param> /// <param name="target"></param> /// <returns></returns> protected override List <CobieDocument> Mapping(IIfcDocumentSelect source, List <CobieDocument> target) { target.Clear(); target.AddRange(MappingMulti(source)); return(target); }