Ejemplo n.º 1
0
 internal void EndInit(IGeometryStoreInitialiser transaction)
 {
     //update the reference counts
     if (transaction == _currentTransaction)
     {
         _currentTransaction.UpdateReferenceCounts();
         _currentTransaction.Commit();
         _currentTransaction.Dispose();
         _currentTransaction = null;
     }
     else
     {
         throw new ArgumentException("The transaction is not the one that is currently running", "transaction");
     }
 }
        internal void EndInit(IGeometryStoreInitialiser transaction)
        {
            _entityInstanceLookup = ShapeInstances.GroupBy(s => s.Value.IfcProductLabel).ToDictionary(s => s.Key, v =>
            {
                return(v.Select(instance => instance.Value).ToList());
            });

            _entityTypeLookup = ShapeInstances.GroupBy(s => (int)s.Value.IfcTypeId).ToDictionary(s => s.Key, v =>
            {
                return(v.Select(instance => instance.Value).ToList());
            });

            _entityStyleLookup = ShapeInstances.GroupBy(s => s.Value.StyleLabel > 0?s.Value.StyleLabel:-s.Value.IfcTypeId).ToDictionary(s => s.Key, v =>
            {
                return(v.Select(instance => instance.Value).ToList());
            });
            _geometryShapeLookup = ShapeInstances.GroupBy(s => s.Value.ShapeGeometryLabel).ToDictionary(s => s.Key, v =>
            {
                return(v.Select(instance => instance.Value).ToList());
            });
            _styles     = new HashSet <int>(EntityStyleLookup.Where(s => s.Key > 0).Select(s => s.Key));
            _contextIds = new HashSet <int>((ShapeInstances.Select(s => s.Value.RepresentationContext)).Distinct());

            var counts = ShapeInstances.Values.GroupBy(
                i => i.ShapeGeometryLabel,
                (label, instances) => new
            {
                Label = label,
                Count = instances.Count()
            });

            foreach (var item in counts)
            {
                ShapeGeometries[item.Label].ReferenceCount = item.Count;
            }
        }