/***************************************************/ /**** Public Local Methods ****/ /***************************************************/ public IBHoMObject GetShallowClone(bool newGuid = false) { BHoMObject obj = (BHoMObject)this.MemberwiseClone(); if (CustomData != null) { obj.CustomData = new Dictionary <string, object>(CustomData); } else { obj.CustomData = new Dictionary <string, object>(); } if (Tags != null) { obj.Tags = new HashSet <string>(Tags); } else { obj.Tags = new HashSet <string>(); } if (newGuid) { obj.BHoM_Guid = Guid.NewGuid(); } return(obj); }
/// <summary> /// Adds a BHoM Object to the project /// </summary> /// <param name="value"></param> public void AddObject(BH.oM.Base.BHoMObject value) { if (m_Objects.ContainsKey(value.BHoM_Guid)) { return; } m_Objects.Add(value.BHoM_Guid, value); }
/// <summary>Returns a BHoM by unique identifier</summary> public BH.oM.Base.BHoMObject GetObject(string id) { BH.oM.Base.BHoMObject result = null; Guid guid = new Guid(); if (Guid.TryParse(id, out guid)) { m_Objects.TryGetValue(guid, out result); } return(result); }
/// <summary>Returns a BHoM by unique identifier</summary> public BH.oM.Base.BHoMObject GetObject(Guid id) { BH.oM.Base.BHoMObject result = null; m_Objects.TryGetValue(id, out result); return(result); }