Пример #1
0
 public ForwardReference(IPersistEntity entity, ReferenceContext context, TableStore store)
 {
     Store   = store;
     _handle = new XbimInstanceHandle(entity);
     Row     = context.CurrentRow;
     Context = context;
 }
Пример #2
0
 public ForwardReference(XbimInstanceHandle handle, ReferenceContext context, TableStore store)
 {
     Store   = store;
     _handle = handle;
     Row     = context.CurrentRow;
     Context = context;
 }
Пример #3
0
        /// <summary>
        /// Create a new entity of the specified type, the entity will be blank, all properties with default values
        /// The entity label will be as specified, an exception will be raised if the label is already in use
        /// </summary>
        /// <param name="type">Type of entity to create, this must support IPersistIfcEntity</param>
        /// <returns>A handle to the entity</returns>
        internal XbimInstanceHandle AddEntity(Type type, int entityLabel)
        {
            var entityType = Model.Metadata.ExpressType(type);
            var h          = new XbimInstanceHandle(Model, entityLabel, entityType.TypeId);

            AddEntity(h.EntityLabel, h.EntityTypeId, null, null, entityType.IndexedClass);
            return(h);
        }
Пример #4
0
        /// <summary>
        /// Create a new entity of the specified type, the entity will be blank, all properties with default values
        /// </summary>
        /// <param name="type">Type of entity to create, this must support IPersistEntity</param>
        /// <returns>A handle to the entity</returns>
        internal XbimInstanceHandle AddEntity(Type type)
        {
            //System.Diagnostics.Debug.Assert(typeof(IPersistEntity).IsAssignableFrom(type));
            var highest     = RetrieveHighestLabel();
            var expressType = Model.Metadata.ExpressType(type);
            var h           = new XbimInstanceHandle(Model, highest + 1, expressType.TypeId);

            AddEntity(h.EntityLabel, h.EntityTypeId, null, null, expressType.IndexedClass);
            return(h);
        }
Пример #5
0
 /// <summary>
 /// For use only on the index table, accesses data from the index only
 /// </summary>
 /// <param name="ih"></param>
 /// <returns></returns>
 public bool TryMoveNextEntityType(out XbimInstanceHandle ih)
 {
     if (Api.TryMoveNext(Sesid, _indexTable))
     {
         ih = new XbimInstanceHandle(Model, Api.RetrieveColumnAsInt32(Sesid, _indexTable, _colIdIdxEntityLabel, RetrieveColumnGrbit.RetrieveFromIndex), Api.RetrieveColumnAsInt16(Sesid, _indexTable, _colIdIdxIfcType, RetrieveColumnGrbit.RetrieveFromIndex));
         return(true);
     }
     else
     {
         ih = new XbimInstanceHandle();
         return(false);
     }
 }
Пример #6
0
        /// <summary>
        /// Trys to move to the first entity of the specified type, assumes the current index has been set to order by type (SetOrderByType)
        /// Secondary keys are specific to the type and defined as IfcAttributes in the class declaration
        /// </summary>
        /// <param name="typeId">the type of entity to look up</param>
        /// <param name="lookupKey">Secondary key on the search</param>
        /// <returns>Returns an instance handle to the first or an empty handle if not found</returns>
        public bool TrySeekEntityType(short typeId, out XbimInstanceHandle ih, int lookupKey)
        {
            Api.MakeKey(Sesid, _indexTable, typeId, MakeKeyGrbit.NewKey);
            Api.MakeKey(Sesid, _indexTable, lookupKey, MakeKeyGrbit.None);
            if (Api.TrySeek(Sesid, _indexTable, SeekGrbit.SeekGE))
            {
                Api.MakeKey(Sesid, _indexTable, typeId, MakeKeyGrbit.NewKey);
                Api.MakeKey(Sesid, _indexTable, lookupKey, MakeKeyGrbit.FullColumnEndLimit);
                if (Api.TrySetIndexRange(Sesid, _indexTable, SetIndexRangeGrbit.RangeUpperLimit | SetIndexRangeGrbit.RangeInclusive))
                {
                    ih = new XbimInstanceHandle(Model, Api.RetrieveColumnAsInt32(Sesid, _indexTable, _colIdIdxEntityLabel, RetrieveColumnGrbit.RetrieveFromIndex), Api.RetrieveColumnAsInt16(Sesid, _indexTable, _colIdIdxIfcType, RetrieveColumnGrbit.RetrieveFromIndex));

                    return(true);
                }
            }
            ih = new XbimInstanceHandle();
            return(false);
        }
Пример #7
0
        public void XbimInstanceHandleSupportsDictionary()
        {
            Dictionary <XbimInstanceHandle, int> d = new Dictionary <XbimInstanceHandle, int>();

            using (var model = IfcStore.Open(@"P1.xbim"))
            {
                var ent = model.Instances.FirstOrDefault();

                var handlefromPointers = new XbimInstanceHandle(model, ent.EntityLabel, ent.ExpressType.TypeId);
                d.Add(handlefromPointers, 1);

                int restored;
                var handlefromEntity = new XbimInstanceHandle(ent);
                var restoredOk       = d.TryGetValue(handlefromEntity, out restored);

                Assert.IsTrue(restoredOk, "The XbimInstanceHandle could not be found in the dictionary");
                Assert.AreEqual(1, restored);
            }
        }
 /// <summary>
 /// Returns the instance that corresponds to this handle
 /// </summary>
 /// <param name="handle"></param>
 /// <returns></returns>
 public IPersistEntity this[XbimInstanceHandle handle]
 {
     get { return(handle.GetEntity()); }
 }
 public ClassificationViewModel(IfcClassificationItem classification)
 {
     xbimModel = classification.ModelOf as XbimModel;
     this.classificationHandle = new XbimInstanceHandle(this.xbimModel, classification.EntityLabel, classification.GetType());
     IEnumerable <ClassificationViewModel> subs = this.SubClassifications; //call this once to preload first level of hierarchy
 }
 public ClassificationViewModel(IfcClassificationItem classification)
 {
     xbimModel = classification.ModelOf as XbimModel;
     this.classificationHandle = new XbimInstanceHandle(this.xbimModel, classification.EntityLabel, classification.GetType());
     IEnumerable<ClassificationViewModel> subs = this.SubClassifications; //call this once to preload first level of hierarchy   
 }
Пример #11
0
 /// <summary>
 /// Trys to move to the first entity of the specified type, assumes the current index has been set to order by type (SetOrderByType)
 /// </summary>
 /// <param name="typeId"></param>
 /// <returns></returns>
 public bool TrySeekEntityType(short typeId, out XbimInstanceHandle ih)
 {
     return(TrySeekEntityType(typeId, out ih, -1));
 }
Пример #12
0
 internal TransformLogEntry(XbimInstanceHandle handle, TransformAction result)
 {
     InstanceHandle  = handle;
     PerformedAction = result;
 }