Esempio n. 1
0
 public void RemoveChild(TransformNode child)
 {
     if (_children == null)
     {
         _children.Remove(child);
     }
 }
Esempio n. 2
0
 public void AddChild(TransformNode child)
 {
     if (_children == null)
     {
         _children = new HashSet <TransformNode>();
     }
     _children.Add(child);
 }
Esempio n. 3
0
 public void AddChild(TransformNode child)
 {
     if (_children == null) _children = new HashSet<TransformNode>();
     _children.Add(child);
 }
Esempio n. 4
0
 public void RemoveChild(TransformNode child)
 {
     if (_children == null)
     {
         _children.Remove(child);
     }
 }
Esempio n. 5
0
 public TransformGraph(XbimModel model)
 {
     _model = model;
     _root  = new TransformNode();
 }
Esempio n. 6
0
        private TransformNode AddNode(IfcObjectPlacement placement, IfcProduct product)
        {
            var lp = placement as IfcLocalPlacement;
            var gp = placement as IfcGridPlacement;

            if (gp != null)
            {
                throw new NotImplementedException("GridPlacement is not implemented");
            }
            if (lp == null)
            {
                return(null);
            }
            TransformNode node;

            if (!_placementNodes.TryGetValue(placement, out node))
            {
                node = new TransformNode(product);
                if (product != null)
                {
                    _productNodes.Add(product.EntityLabel, node);
                }
                var ax3 = lp.RelativePlacement as IfcAxis2Placement3D;
                if (ax3 != null)
                {
                    node.LocalMatrix = ax3.ToMatrix3D();
                }
                else
                {
                    var ax2 = lp.RelativePlacement as IfcAxis2Placement2D;
                    if (ax2 != null)
                    {
                        node.LocalMatrix = ax2.ToMatrix3D();
                    }
                }

                _placementNodes.Add(placement, node);
                if (lp.PlacementRelTo != null)
                {
                    TransformNode parent;
                    if (_placementNodes.TryGetValue(lp.PlacementRelTo, out parent))
                    //we have already processed parent
                    {
                        parent.AddChild(node);
                        node.Parent = parent;
                    }
                    else //make sure placement tree is created
                    {
                        parent = AddNode(lp.PlacementRelTo, null);
                        parent.AddChild(node);
                        node.Parent = parent;
                    }
                }
                else //it is in world coordinate system just add it
                {
                    _root.AddChild(node);
                    node.Parent = _root;
                }
                return(node);
            }

            if (product == null || node.ProductLabel != null)
            {
                return(null);
            }
            node.ProductLabel = product.EntityLabel;
            _productNodes.Add(product.EntityLabel, node);
            return(node);
        }