public void RemoveChild(TransformNode child) { if (_children == null) { _children.Remove(child); } }
public void AddChild(TransformNode child) { if (_children == null) { _children = new HashSet <TransformNode>(); } _children.Add(child); }
public void AddChild(TransformNode child) { if (_children == null) _children = new HashSet<TransformNode>(); _children.Add(child); }
public TransformGraph(XbimModel model) { _model = model; _root = new TransformNode(); }
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); }