/// <summary> /// Does a top-level check to see if this styled item may be equivalent to another styled item. /// </summary> /// <param name="otherEntity">The other styled item.</param> /// <returns>False if they don't have the same handles, null otherwise.</returns> public override bool?MaybeEquivalentTo(IFCEntity otherEntity) { bool?maybeEquivalentTo = base.MaybeEquivalentTo(otherEntity); if (maybeEquivalentTo.HasValue) { return(maybeEquivalentTo.Value); } if (!(otherEntity is IFCStyledItem)) { return(false); } IFCStyledItem other = otherEntity as IFCStyledItem; if (!IFCRoot.Equals(Item, other.Item)) { return(false); } if (!IFCRoot.Equals(Styles, other.Styles)) { return(false); } return(null); }
/// <summary> /// Check if two IFCEntity lists are equal. /// </summary> /// <param name="list1">The first list.</param> /// <param name="list2">The second list.</param> /// <returns>True if they are equal, false otherwise.</returns> /// <remarks>The is not intended to be an exhaustive check.</remarks> static public bool AreIFCEntityListsEquivalent <T>(IList <T> list1, IList <T> list2) where T : IFCEntity { int numItems = list1.Count; if (numItems != list2.Count) { return(false); } for (int ii = 0; ii < numItems; ii++) { if (!IFCRoot.Equals(list1[ii], list2[ii])) { return(false); } } return(true); }
/// <summary> /// True if two IFCRoots have the same id, or are both null. /// </summary> /// <param name="first">The first IFCRoot.</param> /// <param name="second">The second IFCRoot.</param> /// <returns>True if two IFCRoots have the same id, or are both null, or false otherwise.</returns> public static bool Equals(IFCRoot first, IFCRoot second) { if (first == null) { if (second != null) { return(false); } } else if (second == null) { return(false); // first != null, otherwise we are in first case above. } else { if (first.Id != second.Id) { return(false); } } return(true); }
/// <summary> /// Add an error message to the log file indicating an inability to create a Revit element from an IFCRoot. /// Used when the main Revit element could be created, but an associated element could not (example: a View for a Level). /// </summary> /// <param name="root">The IFCRoot object.</param> public void LogAssociatedCreationError(IFCRoot root, Type classType) { LogError(root.Id, "couldn't create associated Revit element(s) of type " + classType.ToString(), false); }
/// <summary> /// True if two IFCRoots have the same id, or are both null. /// </summary> /// <param name="first">The first IFCRoot.</param> /// <param name="second">The second IFCRoot.</param> /// <returns>True if two IFCRoots have the same id, or are both null, or false otherwise.</returns> public static bool Equals(IFCRoot first, IFCRoot second) { if (first == null) { if (second != null) return false; } else if (second == null) { return false; // first != null, otherwise we are in first case above. } else { if (first.Id != second.Id) return false; } return true; }
/// <summary> /// Add an error message to the log file indicating an inability to create a Revit element from an IFCRoot. /// Used when the main Revit element could be created, but an associated element could not (example: a View for a Level). /// </summary> /// <param name="root">The IFCRoot object.</param> public void LogAssociatedCreationError(IFCRoot root, Type classType) { if (LoggingEnabled && m_LogFile != null) LogError(root.Id, "couldn't create associated Revit element(s) of type " + classType.ToString(), false); }