示例#1
0
        /***************************************************/
        /**** 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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
 /// <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);
 }