예제 #1
0
        public ComparisonResult GetResidualsFromRevision <T>(IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var result = new ComparisonResult(null, this);

            result.Candidates.AddRange(revisedModel.Instances.Where <T>(r => !_processed.Contains(r) && r.Name != null));
            return(result);
        }
예제 #2
0
        public ComparisonResult GetResidualsFromRevision <T>(IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var result = new ComparisonResult(null, this);
            var prods  = _prodBBsB.Keys.Where(p => !_processedFromB.Contains(p) && typeof(T).IsAssignableFrom(p.GetType()));

            result.Candidates.AddRange(prods);
            return(result);
        }
예제 #3
0
 public IEnumerable <ComparisonResult> Compare <T>(IO.XbimModel baseline, IO.XbimModel revised) where T : Ifc2x3.Kernel.IfcRoot
 {
     foreach (var b in baseline.Instances.OfType <T>())
     {
         yield return(Compare <T>(b, revised));
     }
     yield return(GetResidualsFromRevision <T>(revised));
 }
        public ComparisonResult GetResidualsFromRevision <T>(IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var result         = new ComparisonResult(null, this);
            var isNotProcessed = new Func <IfcRoot, bool>(r => { return(!_processed.Contains(r)); });
            var isInCache      = new Func <IfcRoot, bool>(r => { return(_cache.Where(c => c.Root == r).FirstOrDefault() != null); });

            result.Candidates.AddRange(revisedModel.Instances.Where <T>(r => isNotProcessed(r) && isInCache(r)));
            return(result);
        }
예제 #5
0
        public ComparisonResult Compare <T>(T baseline, IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var result     = new ComparisonResult(baseline, this);
            var candidates = revisedModel.Instances.Where <T>(r => r.GlobalId == baseline.GlobalId);

            foreach (var c in candidates)
            {
                result.Candidates.Add(c);
                if (!_processed.Contains(c))
                {
                    _processed.Add(c);
                }
            }
            return(result);
        }
예제 #6
0
        public ComparisonResult Compare <T>(T baseline, IO.XbimModel revisedModel) where T : IfcRoot
        {
            //it doesn't make a sense to search for a match when original is not defined
            if (baseline.Name == null)
            {
                return(null);
            }

            var result     = new ComparisonResult(baseline, this);
            var candidates = revisedModel.Instances.Where <T>(r => r.Name == baseline.Name);

            foreach (var c in candidates)
            {
                result.Candidates.Add(c);
                if (!_processed.Contains(c))
                {
                    _processed.Add(c);
                }
            }
            return(result);
        }
예제 #7
0
        public ComparisonResult Compare <T>(T baseline, IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var baseModel = baseline.ModelOf;

            if (baseModel == revisedModel)
            {
                throw new ArgumentException("Baseline should be from the different model than revised model.");
            }

            //this comparison makes a sense only for IfcObjectDefinition and it's descendants
            var objDef = baseline as IfcObjectDefinition;

            if (objDef == null)
            {
                return(null);
            }

            var baseHashed = _cacheBase.Where(b => b.IfcObjectDefinition == objDef).FirstOrDefault();

            if (baseHashed == null)
            {
                return(null);                    //there is nothing to compare.
            }
            //hash filter
            var candidateHashes = _cacheRevision.Where(h => h.GetHashCode() == baseHashed.GetHashCode());

            //precise filter
            candidateHashes = candidateHashes.Where(h => h.Equals(baseHashed));

            //create result
            var result = new ComparisonResult(baseline, this);

            foreach (var candidate in candidateHashes)
            {
                result.Candidates.Add(candidate.IfcObjectDefinition);
                _processed.Add(candidate.IfcObjectDefinition);
            }
            return(result);
        }
예제 #8
0
        public ComparisonResult Compare <T>(T baseline, IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var product = baseline as IfcProduct;

            //it doesn't make a sense to inspect geometry of anything that isn't product
            if (product == null)
            {
                return(null);
            }

            //find octree node of the product
            var node = _tree.Find(product);

            //product doesn't have a geometry if it was not found in the octree
            if (node == null)
            {
                return(null);
            }
#if DEBUG
            var candidates = GetCandidatesFromNode(product, node).ToList();
#else
            var candidates = GetCandidatesFromNode(product, node);
#endif

            var result = new ComparisonResult(baseline, this);
            foreach (var candidate in candidates)
            {
                //compare hash of the geometry
                if (CompareHashes(product, candidate))
                {
                    //precise geometry check should go here

                    result.Candidates.Add(candidate);
                    _processedFromB.Add(candidate);
                }
            }
            return(result);
        }
        public ComparisonResult Compare <T>(T baseline, IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            if (!_possibleTypes.Contains(typeof(T)))
            {
                return(null);
            }
            var val = baseline.GetType().GetProperty(_attrName).GetValue(baseline, null);

            if (val == null)
            {
                return(null);
            }

            var result = new ComparisonResult(baseline, this);
            var hashed = new AttributeHasedRoot(baseline, (IfcSimpleValue)val);

            foreach (var item in _cache.Where(r => r.GetHashCode() == hashed.GetHashCode()))
            {
                result.Candidates.Add(item.Root);
                _processed.Add(item.Root);
            }
            return(result);
        }
        public ComparisonResult Compare <T>(T baseline, IO.XbimModel revisedModel) where T : Ifc2x3.Kernel.IfcRoot
        {
            var matSel = baseline.GetMaterial();

            if (matSel == null)
            {
                return(null);
            }

            var result    = new ComparisonResult(baseline, this);
            var matHashed = new MaterialHash(baseline, matSel);
            var hashes    = _cache.Where(m => m.GetHashCode() == matHashed.GetHashCode());

            foreach (var h in hashes)
            {
                if ((h.Root is IfcObject && baseline is IfcObject) || (h.Root is IfcTypeObject && baseline is IfcTypeObject))
                {
                    result.Candidates.Add(h.Root);
                    _processed.Add(h.Root);
                }
            }
            return(result);
        }
 public ModelGeometry.Scene.XbimMeshLayer <WpfMeshGeometry3D, WpfMaterial> GetLayer(string LayerKey, IO.XbimModel model, ModelGeometry.Scene.XbimScene <WpfMeshGeometry3D, WpfMaterial> scene)
 {
     return(new XbimMeshLayer <WpfMeshGeometry3D, WpfMaterial>(model, _colour)
     {
         Name = LayerKey
     });
 }
예제 #12
0
 public ModelGeometry.Scene.XbimMeshLayer <WpfMeshGeometry3D, WpfMaterial> GetLayer(string LayerKey, IO.XbimModel model, ModelGeometry.Scene.XbimScene <WpfMeshGeometry3D, WpfMaterial> scene)
 {
     if (LayerKey == "Even")
     {
         XbimColour colour = new XbimColour("Red", 1.0, 0.0, 0.0, 1);
         return(new XbimMeshLayer <WpfMeshGeometry3D, WpfMaterial>(model, colour)
         {
             Name = LayerKey
         });
     }
     else
     {
         XbimColour colour = new XbimColour("Green", 0.0, 1.0, 0.0, 1);
         return(new XbimMeshLayer <WpfMeshGeometry3D, WpfMaterial>(model, colour)
         {
             Name = LayerKey
         });
     }
 }