internal void NoAwaitingConnections() { foreach (GraphElement e in FConnectables) { IConnectable c = e.Connectable; c.AwaitingConnection = false; } }
// 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); }
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); }
public virtual bool CanOutputTo(IConnectable input) { if (!AllowMultipleOutputs && this.Outputs.Any()) { return(false); } return(true); }
/// <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); } }
public void setConnectable(IConnectable start, IConnectable end) { this.start = start; this.end = end; this.start.attach(this); this.end.attach(this); this.updateConnectLine(); }
private void DrawingEnded() { FGraphEditor.LinkRoot.Remove(FTempPath); FTempPathStarted = false; FTempPath = null; FStartingConnectable = null; FGraphEditor.NoAwaitingConnections(); }
public override bool CanOutputTo(IConnectable input) { if (this.OutputTo <IClassTypeNode>() != null) { return(false); } return(base.CanOutputTo(input)); }
/// <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); } }
public override bool CanInputFrom(IConnectable output) { if (IsStruct && GetType().IsInstanceOfType(output)) { return(false); } return(base.CanInputFrom(output)); }
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); }
/// <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; } }
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); }
public void InitConnectable(IConnectable connectable) { if (connectable is UIElement) { UIElement element = connectable as UIElement; element.GotFocus += element_GotFocus; element.LostFocus += element_LostFocus; } }
public override void OnConnectedToInput(IConnectable input) { base.OnConnectedToInput(input); if (RelatedTypeNode != null) { InvertApplication.Log("OnConnectedToInput"); //RelatedType = RelatedTypeNode.Identifier; } }
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; } }
/// <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)); } }
/// <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); } }
public NodeInfo GetNodeContaining(IConnectable item) { var idx = GetNodeIndex(item); if (idx != -1) { return(Nodes[idx]); } return(null); }
/// <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(); }
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; } }
public static void RegisterIdentificable(Identificable identificable) { identificables.Add(identificable.Identificator, identificable); IConnectable connectable = identificable as IConnectable; if (connectable != null) { connectables.Add(connectable); } }
/// <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); } }
protected virtual void OnConnected(IConnectable to) { var handler = Connected; if (null == handler) { return; } handler(this, new ConnectedEventArgs(to)); }
/// <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; }
// ======================================== // method // ======================================== public void Connect(IConnectable connectable) { if (_kind == ConnectionAnchorKind.Source) { _owner.Source = connectable; } else { _owner.Target = connectable; } }
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); }
public bool TryGetConnectable(out IConnectable connectable) { connectable = null; if (_connectable == null) { return(false); } connectable = _connectable; return(true); }
public void Connect(IEmulationElement connectee, IConnectable connector) { try { ((dynamic)connector).AttachTo((dynamic)connectee); connections.Add(connector, connectee); } catch (RuntimeBinderException) { ThrowConnectionException(connectee.GetType(), connector.GetType()); } }
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); }
public IEnumerable<IEmulationElement> GetObjectsConnectedTo(IConnectable obj) { return connections.GetAllForLeft(obj).ToList(); }
public void Disconnect(IConnectable item) { }
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) { }
/// <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); }
/// <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); }
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); }
private void SubscribeOutputSocket(IConnectable socket) { socket.Connected += OutputSocketOnConnected; socket.Disconnected += OutputSocketOnDisconnected; }
private void Connect(NodeSocket from, IConnectable to) { if (!InputSockets.Contains(from) && !OutputSockets.Contains(from)) return; from.Connect(to); }
public PortServiceServant(IConnectable connector, PortProfile prof) { _connector = connector; _profile = prof; _profile.PortRef = this; }
public ConnectedEventArgs(IConnectable other) { Other = other; }
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); }
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 }
public void UpdateConnectable(IConnectable connectable) { if (connectable.FlowDirection == FlowDirection.In) { _inTreeView.UpdateConnectable (connectable); } else if (connectable.FlowDirection == FlowDirection.Out) { _outTreeView.UpdateConnectable (connectable); } }
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; } }
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); }
protected virtual void OnDisconnected(IConnectable from) { var handler = Disconnected; if (null == handler) return; handler(this, new ConnectedEventArgs(from)); }
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); }
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); }
protected virtual void OnConnected(IConnectable to) { var handler = Connected; if (null == handler) return; handler(this, new ConnectedEventArgs(to)); }