예제 #1
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                IGmlDiagramObject gmlDiagramObjectItem = item.As <IGmlDiagramObject>();

                if (((gmlDiagramObjectItem != null) &&
                     this._parent.GmlDiagramObjects.Remove(gmlDiagramObjectItem)))
                {
                    return(true);
                }
                IDiagram diagramItem = item.As <IDiagram>();

                if (((diagramItem != null) &&
                     this._parent.Diagrams.Remove(diagramItem)))
                {
                    return(true);
                }
                if ((this._parent.Location == item))
                {
                    this._parent.Location = null;
                    return(true);
                }
                IPositionPoint positionPointItem = item.As <IPositionPoint>();

                if (((positionPointItem != null) &&
                     this._parent.PositionPoints.Remove(positionPointItem)))
                {
                    return(true);
                }
                return(false);
            }
예제 #2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IGmlDiagramObject gmlDiagramObjectsCasted = item.As <IGmlDiagramObject>();

                if ((gmlDiagramObjectsCasted != null))
                {
                    this._parent.GmlDiagramObjects.Add(gmlDiagramObjectsCasted);
                }
                IDiagram diagramsCasted = item.As <IDiagram>();

                if ((diagramsCasted != null))
                {
                    this._parent.Diagrams.Add(diagramsCasted);
                }
                if ((this._parent.Location == null))
                {
                    ILocation locationCasted = item.As <ILocation>();
                    if ((locationCasted != null))
                    {
                        this._parent.Location = locationCasted;
                        return;
                    }
                }
                IPositionPoint positionPointsCasted = item.As <IPositionPoint>();

                if ((positionPointsCasted != null))
                {
                    this._parent.PositionPoints.Add(positionPointsCasted);
                }
            }
예제 #3
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.Position == null))
     {
         IPositionPoint positionCasted = item.As <IPositionPoint>();
         if ((positionCasted != null))
         {
             this._parent.Position = positionCasted;
             return;
         }
     }
 }
예제 #4
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                if ((this._parent.Position == null))
                {
                    IPositionPoint positionCasted = item.As <IPositionPoint>();
                    if ((positionCasted != null))
                    {
                        this._parent.Position = positionCasted;
                        return;
                    }
                }
                IPowerSystemResource powerSystemResourcesCasted = item.As <IPowerSystemResource>();

                if ((powerSystemResourcesCasted != null))
                {
                    this._parent.PowerSystemResources.Add(powerSystemResourcesCasted);
                }
            }