Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private void ProcessCandidates()
        {
            //get products from the model A as a base set
            foreach (var product in _prodBBsA.Keys)
            {
                var node = _tree.Find(product);
#if DEBUG
                var candidates = GetCandidatesFromNode(product, node).ToList();
#else
                var candidates = GetCandidatesFromNode(product, node);
#endif
                var version = new XbimProductVersion()
                {
                    Old = product
                };
                foreach (var candidate in candidates)
                {
                    version.New.Add(candidate);
                }

                _comparison.Add(version);
            }

            //add to comparison all products from B which are not candidates for anything in A
            foreach (var product in _prodBBsB.Keys)
            {
                if (!_processedFromB.Contains(product))
                {
                    var version = new XbimProductVersion()
                    {
                    };
                    version.New.Add(product);
                    _comparison.Add(version);
                }
            }
        }