public int AddObject(IModelObject modelObject) { ObjectsCount++; modelObject.SetID(ObjectsCount); Objects.Add(new KeyValuePair <int, IModelObject>(modelObject.GetID(), modelObject)); return(modelObject.GetID()); }
public int AddObject(IModelObject modelObject) { if (!ObjectsByPosition.ContainsKey(modelObject.GetPosition())) { ObjectsCount++; modelObject.SetID(ObjectsCount); modelObject.Parent = this; ObjectsByID.Add(new KeyValuePair <int, IModelObject>(modelObject.GetID(), modelObject)); ObjectsByPosition.Add(modelObject.GetPosition(), modelObject); return(modelObject.GetID()); } else { throw new Exception("Duplicate Position Object."); } }
public void RemoveObject(IModelObject modelObject) { Objects.Remove(modelObject.GetID()); }
public void RemoveObject(IModelObject modelObject) { ObjectsByID.Remove(modelObject.GetID()); ObjectsByPosition.Remove(modelObject.GetPosition()); }