Exemplo n.º 1
0
 internal void NoAwaitingConnections()
 {
     foreach (GraphElement e in FConnectables)
     {
         IConnectable c = e.Connectable;
         c.AwaitingConnection = false;
     }
 }
Exemplo n.º 2
0
 // The constructor creates a Connection from the source to the destination
 public Connection(IConnectable source, string sourceOutput, IConnectable destination, string destinationInput, Color typeColor)
 {
     Source           = source;
     SourceOutput     = sourceOutput;
     Destination      = destination;
     DestinationInput = destinationInput;
     ConnectionType   = ConnectionTypeFactory.GetType(typeColor);
 }
Exemplo n.º 3
0
 public virtual bool CanInputFrom(IConnectable output)
 {
     if (!AllowMultipleInputs && this.Inputs.Any())
     {
         return(false);
     }
     return(true);
 }
        public IConnection Connect(IConnectable destination, string outputName, string inputName, Color type)
        {
            var connection = ConnectionFactory.Create(this, outputName, destination, inputName, type);

            connection.Connect();

            return(connection);
        }
Exemplo n.º 5
0
 public virtual bool CanOutputTo(IConnectable input)
 {
     if (!AllowMultipleOutputs && this.Outputs.Any())
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 6
0
 /// <summary>
 ///     Enables a connectable so that it can be used
 /// </summary>
 /// <param name="toDisable">The connectable to enable</param>
 public void DisableConnectable(IConnectable toDisable)
 {
     lock (_tickLock)
     {
         toDisable.Enabled = false;
         OnBlockDisabled?.Invoke(this, toDisable);
     }
 }
Exemplo n.º 7
0
 public void setConnectable(IConnectable start, IConnectable end)
 {
     this.start = start;
     this.end   = end;
     this.start.attach(this);
     this.end.attach(this);
     this.updateConnectLine();
 }
Exemplo n.º 8
0
 private void DrawingEnded()
 {
     FGraphEditor.LinkRoot.Remove(FTempPath);
     FTempPathStarted     = false;
     FTempPath            = null;
     FStartingConnectable = null;
     FGraphEditor.NoAwaitingConnections();
 }
Exemplo n.º 9
0
 public override bool CanOutputTo(IConnectable input)
 {
     if (this.OutputTo <IClassTypeNode>() != null)
     {
         return(false);
     }
     return(base.CanOutputTo(input));
 }
Exemplo n.º 10
0
 /// <summary>
 ///     Enables a connectable so that it can be used
 /// </summary>
 /// <param name="toEnable">The connectable to enable</param>
 public void EnableConnectable(IConnectable toEnable)
 {
     lock (_tickLock)
     {
         toEnable.Enabled = true;
         OnBlockEnabled?.Invoke(this, toEnable);
     }
 }
Exemplo n.º 11
0
        public override bool CanInputFrom(IConnectable output)
        {
            if (IsStruct && GetType().IsInstanceOfType(output))
            {
                return(false);
            }

            return(base.CanInputFrom(output));
        }
Exemplo n.º 12
0
 public static Point[] ComputeOptimalConnection(IConnectable SourceElement, IConnectable TargetElement)
 {
     Point[] points = new Point[2];
     points[0] = RectangleRectangleCenterIntersection(
         SourceElement.GetBounds(), TargetElement.GetBounds(), true, SourceElement.BoundsAngle);
     points[1] = RectangleRectangleCenterIntersection(
         TargetElement.GetBounds(), SourceElement.GetBounds(), true, TargetElement.BoundsAngle);
     return(points);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Connects the control <param name="visualParentInPSMTree"/> via <see cref="PSM_ComponentConnector"/> control.
 /// </summary>
 public void InitializeConnector(IConnectable visualParentInPSMTree)
 {
     if (visualParentInPSMTree != null)
     {
         Connector = new PSM_ComponentConnector(XCaseCanvas, visualParentInPSMTree, this,
                                                ((PSMElementViewHelper)ViewHelper).ConnectorViewHelper);
         Connector.Junction.SelectionOwner = this;
     }
 }
Exemplo n.º 14
0
 public TECHardwiredConnection(Guid guid, IConnectable child, TECController controller, TECHardwiredProtocol protocol) : base(guid)
 {
     this.IsTypical  = false;
     Child           = child;
     ConnectionTypes = new ObservableCollection <TECConnectionType>(protocol.ConnectionTypes);
     ConnectionTypes.CollectionChanged += connectionTypesCollectionChanged;
     ParentController = controller;
     child.SetParentConnection(this);
 }
Exemplo n.º 15
0
 public void InitConnectable(IConnectable connectable)
 {
     if (connectable is UIElement)
     {
         UIElement element = connectable as UIElement;
         element.GotFocus  += element_GotFocus;
         element.LostFocus += element_LostFocus;
     }
 }
Exemplo n.º 16
0
 public override void OnConnectedToInput(IConnectable input)
 {
     base.OnConnectedToInput(input);
     if (RelatedTypeNode != null)
     {
         InvertApplication.Log("OnConnectedToInput");
         //RelatedType = RelatedTypeNode.Identifier;
     }
 }
Exemplo n.º 17
0
    public void Connect(GameObject go)
    {
        var connectable = go.GetComponentInChildren <IConnectable>();

        if (connectable == null)
        {
            return;
        }
        _connectable = connectable;
    }
 protected override void ApplyConnection(IGraphData graph, IConnectable output, IConnectable input)
 {
     //base.ApplyConnection(graph, output, input);
     var typedItem = output as ITypedItem;
     
     if (typedItem != null)
     {
         typedItem.RelatedType = input.Identifier;
     }
 }
Exemplo n.º 19
0
 /// <summary>
 ///  非同期で処理を実行します。
 /// </summary>
 /// <typeparam name="TIn">接続子の引数の型です。</typeparam>
 /// <typeparam name="TOut">接続子の戻り値の型です。</typeparam>
 /// <param name="connectable"><see cref="ExapisSOP.ConnectionModel.IConnectable{TIn, TOut}"/>インターフェースを実装したオブジェクトです。</param>
 /// <param name="arg">処理の実行に必要な引数です。</param>
 /// <returns>戻り値を含む非同期操作を表すオブジェクトです。</returns>
 /// <exception cref="System.ArgumentNullException"/>
 public static async Task <TOut> RunAsync <TIn, TOut>(this IConnectable <TIn, TOut> connectable, TIn arg)
 {
     if (connectable == null)
     {
         throw new ArgumentNullException(nameof(connectable));
     }
     using (var connector = connectable.GetConnector()) {
         return(await connector.RunAsync(arg));
     }
 }
Exemplo n.º 20
0
            /// <summary>
            /// End of the connnection is released from <paramref name="connectable"/> and set to
            /// the current mouse position over the canvas.
            /// </summary>
            /// <param name="connectable"></param>
            public void ConnectableItemMouseLeave(IConnectable connectable)
            {
                Mouse.SetCursor(Cursors.Arrow);
                ItemDraggedOver = null;

                if (InConnectionDrag && draggedPoint != null /*&& connectable != draggedConnection.SourceElement*/)
                {
                    draggedConnection.ReconnectTargetElement(draggedPoint);
                }
            }
Exemplo n.º 21
0
        public NodeInfo GetNodeContaining(IConnectable item)
        {
            var idx = GetNodeIndex(item);

            if (idx != -1)
            {
                return(Nodes[idx]);
            }
            return(null);
        }
Exemplo n.º 22
0
        /// <summary>
        ///     Creates a line that connects two blocks
        /// </summary>
        /// <param name="A">The first block to connect (from output)</param>
        /// <param name="B">The second block to connect (from input)</param>
        public void ConnectBlocks(IConnectable A, IConnectable B)
        {
            var newConnection = new DrawableConnector(_core, A, B);

            _renderables.Add(newConnection.Z, newConnection);
            (_objectMapping[A] as IDrawableIConnectable)?.MappedObjects.Add(newConnection);

            // Trigger a re-draw
            Render();
        }
Exemplo n.º 23
0
        protected virtual void OnDisconnected(IConnectable from)
        {
            var handler = Disconnected;

            if (null == handler)
            {
                return;
            }
            handler(this, new ConnectedEventArgs(from));
        }
        protected override void ApplyConnection(IGraphData graph, IConnectable output, IConnectable input)
        {
            //base.ApplyConnection(graph, output, input);
            var typedItem = output as ITypedItem;

            if (typedItem != null)
            {
                typedItem.RelatedType = input.Identifier;
            }
        }
Exemplo n.º 25
0
    public static void RegisterIdentificable(Identificable identificable)
    {
        identificables.Add(identificable.Identificator, identificable);
        IConnectable connectable = identificable as IConnectable;

        if (connectable != null)
        {
            connectables.Add(connectable);
        }
    }
Exemplo n.º 26
0
 /// <summary>
 ///  非同期で処理を実行します。
 /// </summary>
 /// <param name="connectable"><see cref="ExapisSOP.ConnectionModel.IConnectable"/>インターフェースを実装したオブジェクトです。</param>
 /// <param name="arg">処理の実行に必要な引数です。</param>
 /// <returns>非同期操作を表すオブジェクトです。</returns>
 /// <exception cref="System.ArgumentNullException"/>
 public static async Task RunAsync(this IConnectable connectable, object arg)
 {
     if (connectable == null)
     {
         throw new ArgumentNullException(nameof(connectable));
     }
     using (var connector = connectable.GetConnector()) {
         await connector.RunAsync(arg);
     }
 }
Exemplo n.º 27
0
        protected virtual void OnConnected(IConnectable to)
        {
            var handler = Connected;

            if (null == handler)
            {
                return;
            }
            handler(this, new ConnectedEventArgs(to));
        }
Exemplo n.º 28
0
 /// <summary>
 ///  処理を実行します。
 /// </summary>
 /// <param name="connectable"><see cref="ExapisSOP.ConnectionModel.IConnectable"/>インターフェースを実装したオブジェクトです。</param>
 /// <param name="arg">処理の実行に必要な引数です。</param>
 /// <exception cref="System.ArgumentNullException"/>
 public static void Run(this IConnectable connectable, object arg)
 {
     if (connectable == null)
     {
         throw new ArgumentNullException(nameof(connectable));
     }
     using (var connector = connectable.GetConnector()) {
         connector.Run(arg);
     }
 }
 public virtual bool CanConnect(IConnectable output, IConnectable input)
 {
     if (CanConnect(output.GetType(), input.GetType()))
     {
         if (output.CanOutputTo(input) && input.CanInputFrom(output))
         {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 30
0
 // ========================================
 // method
 // ========================================
 public void Connect(IConnectable connectable)
 {
     if (_kind == ConnectionAnchorKind.Source)
     {
         _owner.Source = connectable;
     }
     else
     {
         _owner.Target = connectable;
     }
 }
Exemplo n.º 31
0
 public virtual bool CanConnect(IConnectable output, IConnectable input)
 {
     if (CanConnect(output.GetType(), input.GetType()))
     {
         if (output.CanOutputTo(input) && input.CanInputFrom(output))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 32
0
    public bool TryGetConnectable(out IConnectable connectable)
    {
        connectable = null;
        if (_connectable == null)
        {
            return(false);
        }

        connectable = _connectable;
        return(true);
    }
Exemplo n.º 33
0
 public void Connect(IEmulationElement connectee, IConnectable connector)
 {
     try
     {
         ((dynamic)connector).AttachTo((dynamic)connectee);
         connections.Add(connector, connectee);
     } 
     catch (RuntimeBinderException)
     {
         ThrowConnectionException(connectee.GetType(), connector.GetType());
     }
 }
Exemplo n.º 34
0
 public void Disconnect(IConnectable connector, IEmulationElement connectee)
 {
     try
     {
         ((dynamic)connector).DetachFrom((dynamic)connectee);
         connections.RemovePair(connector, connectee);
     }
     catch(RuntimeBinderException)
     {
         ThrowConnectionException(connectee.GetType(), connector.GetType(), true);
     }
 }
        public void connect(IConnectable door)
        {
            if (door == null)
                return;

            PlaceableTeleporterDoor tDoor = door as PlaceableTeleporterDoor;
            if (tDoor == null)
                return;

            if (mDestination != null)
                disconnect(mDestination.getID());

            if (mIsSelected)
                tDoor.highlight(Color.yellow);
            mDestination = tDoor;
        }
        public void connect(IConnectable connection)
        {
            if (connection == null)
                return;

            IConnectable searcher;
            if (mConnections.TryGetValue(connection.getID(), out searcher))
            {
                mConnections.Remove(connection.getID());

                if (mIsSelected)
                    searcher.unlight();
            }
            else
            {
                mConnections.Add(connection.getID(), connection);

                if (mIsSelected)
                    connection.highlight(Color.yellow);
            }
        }
        //[Browsable(false)]
        ////[InputSlot("Base Class", OrderIndex = -1)]
        //public BaseClassReference BaseReference
        //{
        //    get { return _baseReference ?? (_baseReference = new BaseClassReference() { Node = this }); }
        //    set { _baseReference = value; }
        //}

        public override bool CanInputFrom(IConnectable output)
        {
            return base.CanInputFrom(output);
        }
        public override bool CanOutputTo(IConnectable input)
        {
            if (input == this) return false;
            if (this.GetType() != input.GetType()) return false;
            if (BaseNodes.Any(p => p == input)) return false;

            return base.CanOutputTo(input);
        }
 public override void OnConnectedToInput(IConnectable input)
 {
     base.OnConnectedToInput(input);
     
 }
Exemplo n.º 40
0
 public IEnumerable<IEmulationElement> GetObjectsConnectedTo(IConnectable obj)
 {
     return connections.GetAllForLeft(obj).ToList();
 }
Exemplo n.º 41
0
 public void Disconnect(IConnectable item)
 {
 }
Exemplo n.º 42
0
		public void SetEvent (ProviderEventType type, IConnectable strategy)
		{
			IConnectable value;
			
			if (events.TryGetValue (type, out value) == true) {			
				value.Disconnect ();
				events.Remove (type);
			}

			if (strategy != null) {
				events [type] = strategy;
				strategy.Connect ();
			}
		}
 public void ConnectionApplying(IGraphData graph, IConnectable output, IConnectable input)
 {
     
 }
Exemplo n.º 44
0
 /// <summary>
 /// Removes all connections to an input
 /// </summary>
 /// <param name="input"></param>
 public void ClearInput(IConnectable input)
 {
     Repository.RemoveAll<ConnectionData>(_ => _.InputIdentifier == input.Identifier);
     //        ConnectedItems.RemoveAll(p => p.InputIdentifier == input.Identifier);
 }
Exemplo n.º 45
0
        /// <summary>
        /// Removes a connection from this graph
        /// </summary>
        /// <param name="output">The output of the connection.</param>
        /// <param name="input">The input of the connection.</param>
        public void RemoveConnection(IConnectable output, IConnectable input)
        {
            if (output == null) throw new ArgumentNullException("output");
            if (input == null) throw new ArgumentNullException("input");
            Repository.RemoveAll<ConnectionData>(p => p != null && p.OutputIdentifier == output.Identifier && p.InputIdentifier == input.Identifier);

            output.OnOutputConnectionRemoved(input);
            input.OnInputConnectionRemoved(output);
            //        ConnectedItems.RemoveAll(p => p.OutputIdentifier == output.Identifier && p.InputIdentifier == input.Identifier);
        }
Exemplo n.º 46
0
 public void Disconnect(IConnectable item)
 {
     if (ReferenceEquals(item, Node))
     {
         DisconnectAll();
         if (null != Node)
             Node.LayoutUpdated -= NodeOnLayoutUpdated;
     }
     else
     {
         var connector = connectors.FirstOrDefault(x => ReferenceEquals(item, x));
         if (null == connector) return;
         connectors.Remove(connector);
         connector.Disconnect(this);
     }
     OnDisconnected(item);
 }
Exemplo n.º 47
0
 private void SubscribeOutputSocket(IConnectable socket)
 {
     socket.Connected += OutputSocketOnConnected;
     socket.Disconnected += OutputSocketOnDisconnected;
 }
Exemplo n.º 48
0
 private void Connect(NodeSocket from, IConnectable to)
 {
     if (!InputSockets.Contains(from) && !OutputSockets.Contains(from)) return;
     from.Connect(to);
 }
Exemplo n.º 49
0
 public PortServiceServant(IConnectable connector, PortProfile prof)
 {
     _connector = connector;
     _profile = prof;
     _profile.PortRef = this;
 }
Exemplo n.º 50
0
 public ConnectedEventArgs(IConnectable other)
 {
     Other = other;
 }
Exemplo n.º 51
0
        public void Connect(IConnectable to)
        {
            var con = to as Connector;
            if (null == con) return;
            if (connectors.Contains(con))
            {
                OnConnected(to);
                return;
            }
            var type = SocketType;
            if (SocketType.Unknown == type) return;
            if (SocketType.Input == type)
                Disconnect();

            connectors.Add(con);
            con.Connect(this);
            OnConnected(to);
        }
Exemplo n.º 52
0
 public void Disconnect(IEmulationElement connectee, IConnectable connector)
 {
     Disconnect(connector, connectee);
 }
 public void ConnectionApplied(IGraphData g, IConnectable output, IConnectable input)
 {
     //#if UNITY_EDITOR
     //var projectService = InvertApplication.Container.Resolve<WorkspaceService>();
     //foreach (var graph in projectService.CurrentWorkspace.Graphs)
     //{
     //    if (graph.Identifier == g.Identifier)
     //    {
     //        UnityEditor.EditorUtility.SetDirty(graph as UnityEngine.Object);
     //    }
     //}
     //#endif
 }
Exemplo n.º 54
0
 public void UpdateConnectable(IConnectable connectable)
 {
     if (connectable.FlowDirection == FlowDirection.In) {
         _inTreeView.UpdateConnectable (connectable);
     } else if (connectable.FlowDirection == FlowDirection.Out) {
         _outTreeView.UpdateConnectable (connectable);
     }
 }
Exemplo n.º 55
0
 public void Connect(IConnectable to)
 {
     var socket = to as NodeSocket;
     if (null == socket) return;
     var type = socket.SocketType;
     switch (type)
     {
         case SocketType.Input:
             ConnectOutputEndPoint(socket);
             break;
         case SocketType.Output:
             ConnectInputEndPoint(socket);
             break;
     }
 }
Exemplo n.º 56
0
 public void Connect(IConnectable to)
 {
     var node = to as Node;
     if (null != node)
     {
         Connect(node);
         return;
     }
     var socket = to as NodeSocket;
     if (null == socket) return;
     var type = socket.SocketType;
     var other = SocketType.Input == type ? GetFreeOutputSocket() : GetFreeInputSocket();
     Connect(other, socket);
 }
Exemplo n.º 57
0
 protected virtual void OnDisconnected(IConnectable from)
 {
     var handler = Disconnected;
     if (null == handler) return;
     handler(this, new ConnectedEventArgs(from));
 }
Exemplo n.º 58
0
 public void Disconnect(IConnectable item)
 {
     if (!ReferenceEquals(item, InputNode) &&
         !ReferenceEquals(item, OutputNode) &&
         !ReferenceEquals(item, inputSocket) &&
         !ReferenceEquals(item, outputSocket)) return;
     if (dragType == DragEndPoint.Unknown)
     {
         Delete();
         OnDisconnected(inputSocket);
         OnDisconnected(outputSocket);
     }
     else if (ReferenceEquals(item, inputSocket))
         OnDisconnected(inputSocket);
     else if (ReferenceEquals(item, outputSocket))
         OnDisconnected(outputSocket);
 }
Exemplo n.º 59
0
        public void AddConnection(IConnectable output, IConnectable input)
        {


            if (!output.AllowMultipleOutputs)
            {
                ClearOutput(output);
            }
            if (!input.AllowMultipleInputs)
            {
                ClearInput(input);
            }

            var connect = new ConnectionData();
            connect.OutputIdentifier = output.Identifier;
            connect.InputIdentifier = input.Identifier;
            Repository.Add(connect);
            output.OnConnectedToInput(input);
            input.OnConnectedFromOutput(output);
        }
Exemplo n.º 60
0
 protected virtual void OnConnected(IConnectable to)
 {
     var handler = Connected;
     if (null == handler) return;
     handler(this, new ConnectedEventArgs(to));
 }