public void Remove(FacilityObject obj)
 {
     if (_layers[obj.ObjectLayer].Type == obj.Type)
     {
         Remove(obj.ObjectLayer);
     }
 }
 public void Put(FacilityObject obj)
 {
     if (obj.ObjectLayer == ObjectLayer.Unknown)
     {
         throw new InvalidOperationException($"Cannot place object with Unknown object layer: '{obj.Type}'");
     }
     Put(obj.ObjectLayer, obj);
 }
Пример #3
0
        public override void LinkTo(FacilityObject obj)
        {
            if (obj is ValuableFacilityObject)
            {
                LinkTo((ValuableFacilityObject)obj);
                return;
            }

            base.LinkTo(obj);
        }
Пример #4
0
        public virtual void LinkTo(FacilityObject obj)
        {
            if (ReferenceEquals(obj, this) || LinkedObjs.Contains(obj))
            {
                return;
            }

            LinkedObjs.Add(obj);
            if (!obj.LinkedObjs.Contains(this))
            {
                obj.LinkTo(this);
            }
            LinkedObjs.ForEach(x => x.LinkTo(obj));
        }
Пример #5
0
 protected bool Equals(FacilityObject other)
 {
     return(string.Equals(Type, other.Type) &&
            (Orientation == other.Orientation) &&
            (ObjectLayer == other.ObjectLayer));
 }
 public static FacilityPortal FromObject(FacilityObject obj)
 {
     return(new FacilityPortal {
         Type = obj.Type, ObjectLayer = obj.ObjectLayer, Orientation = obj.Orientation
     });
 }
 public bool Contains(FacilityObject obj)
 {
     return(_layers.Any(x => x.Value.Equals(obj)));
 }
 private void Put(ObjectLayer objLayer, FacilityObject obj)
 {
     _layers[objLayer] = obj;
     NotifySubscribers(this);
 }
 public void Remove(ObjectLayer layer)
 {
     _layers[layer] = new FacilityObject();
     NotifySubscribers(this);
 }