Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <summary>
        /// Does a top-level check to see if this entity may be equivalent to otherEntity.
        /// </summary>
        /// <param name="otherEntity">The other IFCEntity.</param>
        /// <returns>True if they are equivalent, false if they aren't, null if not enough information.</returns>
        /// <remarks>This isn't intended to be an exhaustive check, and isn't implemented for all types.  This is intended
        /// to be used by derived classes.</remarks>
        public override bool?MaybeEquivalentTo(IFCEntity otherEntity)
        {
            bool?maybeEquivalentTo = base.MaybeEquivalentTo(otherEntity);

            if (maybeEquivalentTo.HasValue)
            {
                return(maybeEquivalentTo.Value);
            }

            if (!(otherEntity is IFCPresentationLayerAssignment))
            {
                return(false);
            }

            IFCPresentationLayerAssignment other = otherEntity as IFCPresentationLayerAssignment;

            if (!IFCNamingUtil.SafeStringsAreEqual(Name, other.Name))
            {
                return(false);
            }

            if (!IFCNamingUtil.SafeStringsAreEqual(Description, other.Description))
            {
                return(false);
            }

            if (!IFCNamingUtil.SafeStringsAreEqual(Identifier, other.Identifier))
            {
                return(false);
            }

            return(null);
        }
Exemple #3
0
        /// <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 (!Equals(Item, other.Item))
            {
                return(false);
            }

            IList <IFCPresentationStyle> otherStyles = other.Styles;

            if (Styles == null && otherStyles == null)
            {
                return(null);
            }

            // If only one is null, they are not equal.
            if (Styles == null || otherStyles == null)
            {
                return(false);
            }

            int thisCount  = Styles.Count;
            int otherCount = otherStyles.Count;

            if (thisCount != otherCount)
            {
                return(false);
            }

            // This could miss the case where the styles are the same but in different
            // orders.  At the moment, that would just lead to a spurious warning.
            for (int ii = 0; ii < thisCount; ii++)
            {
                if (!Equals(Styles[ii], otherStyles[ii]))
                {
                    return(false);
                }
            }

            return(null);
        }
Exemple #4
0
        /// <summary>
        /// Does a top-level check to see if this entity is equivalent to otherEntity.
        /// </summary>
        /// <param name="otherEntity">The other IFCEntity.</param>
        /// <returns>True if they are equivalent, false if they aren't.</returns>
        /// <remarks>This isn't intended to be an exhaustive check, and isn't implemented for all types.  This is intended
        /// to make a final decision, and will err on the side of deciding that entities aren't equivalent.</remarks>
        public override bool IsEquivalentTo(IFCEntity otherEntity)
        {
            bool?maybeEquivalentTo = MaybeEquivalentTo(otherEntity);

            if (maybeEquivalentTo.HasValue)
            {
                return(maybeEquivalentTo.Value);
            }

            // If it passes all of the Maybe tests and doesn't come back false, good enough.
            return(true);
        }
Exemple #5
0
        /// <summary>
        /// Does a top-level check to see if this entity is equivalent to otherEntity.
        /// </summary>
        /// <param name="otherEntity">The other IFCEntity.</param>
        /// <returns>True if they are equivalent, false if they aren't.</returns>
        /// <remarks>This isn't intended to be an exhaustive check, and isn't implemented for all types.  This is intended
        /// to make a final decision, and will err on the side of deciding that entities aren't equivalent.</remarks>
        virtual public bool IsEquivalentTo(IFCEntity otherEntity)
        {
            bool?maybeEquivalentTo = MaybeEquivalentTo(otherEntity);

            if (maybeEquivalentTo.HasValue)
            {
                return(maybeEquivalentTo.Value);
            }

            // If we couldn't determine that they were the same, assume that they aren't.
            return(false);
        }
        /// <summary>
        /// Create an IFCEllipse object from a handle of type IfcEllipse
        /// </summary>
        /// <param name="ifcEllipse">The IFC handle</param>
        /// <returns>The IFCEllipse object</returns>
        public static IFCEllipse ProcessIFCEllipse(IFCAnyHandle ifcEllipse)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcEllipse))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcEllipse);
                return(null);
            }

            IFCEntity ellipse = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcEllipse.StepId, out ellipse))
            {
                ellipse = new IFCEllipse(ifcEllipse);
            }

            return(ellipse as IFCEllipse);
        }
Exemple #7
0
        /// <summary>
        /// Create an IFCLine object from a handle of type IfcLine
        /// </summary>
        /// <param name="ifcLine">The IFC handle</param>
        /// <returns>The IFCLine object</returns>
        public static IFCLine ProcessIFCLine(IFCAnyHandle ifcLine)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcLine))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcBSplineCurveWithKnots);
                return(null);
            }

            IFCEntity line = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcLine.StepId, out line))
            {
                line = new IFCLine(ifcLine);
            }

            return(line as IFCLine);
        }
        /// <summary>
        /// Create an IFCTrimmedCurve object from a handle of type IfcTrimmedCurve
        /// </summary>
        /// <param name="ifcTrimmedCurve">The IFC handle</param>
        /// <returns>The IFCTrimmedCurve object</returns>
        public static IFCTrimmedCurve ProcessIFCTrimmedCurve(IFCAnyHandle ifcTrimmedCurve)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcTrimmedCurve))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcTrimmedCurve);
                return(null);
            }

            IFCEntity trimmedCurve = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcTrimmedCurve.StepId, out trimmedCurve))
            {
                trimmedCurve = new IFCTrimmedCurve(ifcTrimmedCurve);
            }

            return(trimmedCurve as IFCTrimmedCurve);
        }
Exemple #9
0
        /// <summary>
        /// Create an IFCCircle from a handle of type IfcCircle
        /// </summary>
        /// <param name="ifcCircle">The IFC handle</param>
        /// <returns>The IFCCircle object</returns>
        public static IFCCircle ProcessIFCCircle(IFCAnyHandle ifcCircle)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcCircle))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcCircle);
                return(null);
            }

            IFCEntity circle = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcCircle.StepId, out circle))
            {
                circle = new IFCCircle(ifcCircle);
            }

            return(circle as IFCCircle);
        }
Exemple #10
0
        /// <summary>
        /// Create an IFCOffsetCurve2D object from a handle of type IfcOffsetCurve2D
        /// </summary>
        /// <param name="ifcOffsetCurve2D">The IFC handle</param>
        /// <returns>The IFCOffsetCurve2D object</returns>
        public static IFCOffsetCurve2D ProcessIFCOffsetCurve2D(IFCAnyHandle ifcOffsetCurve2D)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcOffsetCurve2D))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcOffsetCurve2D);
                return(null);
            }

            IFCEntity offsetCurve2D = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcOffsetCurve2D.StepId, out offsetCurve2D))
            {
                offsetCurve2D = new IFCOffsetCurve2D(ifcOffsetCurve2D);
            }

            return(offsetCurve2D as IFCOffsetCurve2D);
        }
Exemple #11
0
        /// <summary>
        /// Create an IFCPolyline object from a handle of type IfcPolyline
        /// </summary>
        /// <param name="ifcPolyline">The IFC handle</param>
        /// <returns>The IFCPolyline object</returns>
        public static IFCPolyline ProcessIFCPolyline(IFCAnyHandle ifcPolyline)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcPolyline))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcPolyline);
                return(null);
            }

            IFCEntity polyline = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcPolyline.StepId, out polyline))
            {
                polyline = new IFCPolyline(ifcPolyline);
            }

            return(polyline as IFCPolyline);
        }
        /// <summary>
        /// Create an IFCRationalBSplineSurfaceWithKnots object from the handle of type IfcRationalBSplineSurfaceWithKnots
        /// </summary>
        /// <param name="IFCRationalBSplineSurfaceWithKnots">The IFC handle</param>
        /// <returns>The IFCRationalBSplineSurfaceWithKnots object</returns>
        public static IFCRationalBSplineSurfaceWithKnots ProcessIFCRationalBSplineSurfaceWithKnots(IFCAnyHandle ifcRationalBSplineSurfaceWithKnots)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcRationalBSplineSurfaceWithKnots))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcRationalBSplineSurfaceWithKnots);
                return(null);
            }

            IFCEntity rationalBSplineSurfaceWithKnots = null;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcRationalBSplineSurfaceWithKnots.StepId, out rationalBSplineSurfaceWithKnots))
            {
                rationalBSplineSurfaceWithKnots = new IFCRationalBSplineSurfaceWithKnots(ifcRationalBSplineSurfaceWithKnots);
            }

            return(rationalBSplineSurfaceWithKnots as IFCRationalBSplineSurfaceWithKnots);
        }
Exemple #13
0
        /// <summary>
        /// Does a top-level check to see if this entity may be equivalent to otherEntity.
        /// </summary>
        /// <param name="otherEntity">The other IFCEntity.</param>
        /// <returns>True if they are equivalent, false if they aren't, null if not enough information.</returns>
        /// <remarks>This isn't intended to be an exhaustive check, and isn't implemented for all types.  This is intended
        /// to be used by derived classes.</remarks>
        virtual public bool?MaybeEquivalentTo(IFCEntity otherEntity)
        {
            if (otherEntity == null)
            {
                return(false);
            }

            // If the entities have the same Id, they are definitely the same object.  If they don't, they could
            // still be considered equivalent, so we won't disqualify them.
            if (Id == otherEntity.Id)
            {
                return(true);
            }

            if (EntityType != otherEntity.EntityType)
            {
                return(false);
            }

            return(null);
        }
Exemple #14
0
        override protected void Process(IFCAnyHandle item)
        {
            base.Process(item);

            Name = IFCImportHandleUtil.GetOptionalStringAttribute(item, "Name", null);

            Description = IFCImportHandleUtil.GetOptionalStringAttribute(item, "Description", null);

            Identifier = IFCImportHandleUtil.GetOptionalStringAttribute(item, "Identifier", null);

            IList <IFCAnyHandle> assignedItems = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(item, "AssignedItems");

            foreach (IFCAnyHandle assignedItem in assignedItems)
            {
                // We do NOT process items here.  We only use already created representations and representation items.
                IFCEntity entity = null;
                if (!IFCImportFile.TheFile.EntityMap.TryGetValue(assignedItem.StepId, out entity))
                {
                    continue;
                }

                if (IFCAnyHandleUtil.IsSubTypeOf(assignedItem, IFCEntityType.IfcRepresentation))
                {
                    (entity as IFCRepresentation).PostProcessLayerAssignment(this);
                }
                else if (IFCAnyHandleUtil.IsSubTypeOf(assignedItem, IFCEntityType.IfcRepresentationItem))
                {
                    (entity as IFCRepresentationItem).PostProcessLayerAssignment(this);
                }

                if (entity != null)
                {
                    AssignedItems.Add(entity);
                }
                else
                {
                    Importer.TheLog.LogUnhandledSubTypeError(assignedItem, "IfcLayeredItem", false);
                }
            }
        }
        /// <summary>
        /// Create an IFCBSplineSurfaceWithKnots object from the handle of type IfcBSplineSurfaceWithKnots
        /// </summary>
        /// <param name="ifcBSplineSurfaceWithKnots">The IFC handle</param>
        /// <returns>The IFCBSplineSurfaceWithKnots object</returns>
        public static IFCBSplineSurfaceWithKnots ProcessIFCBSplineSurfaceWithKnots(IFCAnyHandle ifcBSplineSurfaceWithKnots)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBSplineSurfaceWithKnots))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcBSplineSurfaceWithKnots);
                return(null);
            }

            IFCEntity bSplineSurface = null;

            if (IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBSplineSurfaceWithKnots.StepId, out bSplineSurface))
            {
                return(bSplineSurface as IFCBSplineSurfaceWithKnots);
            }

            if (IFCAnyHandleUtil.IsSubTypeOf(ifcBSplineSurfaceWithKnots, IFCEntityType.IfcRationalBSplineSurfaceWithKnots))
            {
                return(IFCRationalBSplineSurfaceWithKnots.ProcessIFCRationalBSplineSurfaceWithKnots(ifcBSplineSurfaceWithKnots));
            }

            return(new IFCBSplineSurfaceWithKnots(ifcBSplineSurfaceWithKnots));
        }
        /// <summary>
        /// Does a top-level check to see if this entity is equivalent to otherEntity.
        /// </summary>
        /// <param name="otherEntity">The other IFCEntity.</param>
        /// <returns>True if they are equivalent, false if they aren't, null if not enough information.</returns>
        /// <remarks>This isn't intended to be an exhaustive check, and isn't implemented for all types.  This is intended
        /// to be used by derived classes.</remarks>
        public override bool?MaybeEquivalentTo(IFCEntity otherEntity)
        {
            bool?maybeEquivalentTo = base.MaybeEquivalentTo(otherEntity);

            if (maybeEquivalentTo.HasValue)
            {
                return(maybeEquivalentTo.Value);
            }

            if (!(otherEntity is IFCPresentationLayerWithStyle))
            {
                return(false);
            }

            IFCPresentationLayerWithStyle other = otherEntity as IFCPresentationLayerWithStyle;

            if (!IFCEntity.AreIFCEntityListsEquivalent(LayerStyles, other.LayerStyles))
            {
                return(false);
            }

            return(null);
        }