本文整理匯總了C#中Sledge.DataStructures.MapObjects.MapObject.SetParent方法的典型用法代碼示例。如果您正苦於以下問題:C# MapObject.SetParent方法的具體用法?C# MapObject.SetParent怎麽用?C# MapObject.SetParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sledge.DataStructures.MapObjects.MapObject
的用法示例。
在下文中一共展示了MapObject.SetParent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CopyBase
protected void CopyBase(MapObject o, IDGenerator generator, bool performClone = false)
{
if (performClone && o.ID != ID)
{
var parent = o.Parent;
var setPar = o.Parent != null && o.Parent.Children.ContainsKey(o.ID) && o.Parent.Children[o.ID] == o;
if (setPar) o.SetParent(null);
o.ID = ID;
if (setPar) o.SetParent(parent);
}
o.ClassName = ClassName;
o.Visgroups.AddRange(Visgroups);
o.AutoVisgroups.AddRange(AutoVisgroups);
o.Parent = Parent;
o.Colour = Colour;
o.IsSelected = IsSelected;
o.IsCodeHidden = IsCodeHidden;
o.IsRenderHidden2D = IsRenderHidden2D;
o.IsRenderHidden3D = IsRenderHidden3D;
o.IsVisgroupHidden = IsVisgroupHidden;
o.BoundingBox = BoundingBox.Clone();
o.MetaData = MetaData.Clone();
var children = GetChildren().Select(x => performClone ? x.Clone() : x.Copy(generator));
foreach (var c in children)
{
c.SetParent(o);
}
}