/// <summary>
 /// Initializes a new instance of the <see cref="DiagramConnection" /> class.
 /// </summary>
 /// <param name="origin">The tile origin.</param>
 /// <param name="originConnectorInfo">The connector where connection originates</param>
 /// <param name="pointerId">The pointer identifier.</param>
 public DiagramConnection(ConnectableViewItem origin, ConnectorInfo originConnectorInfo, uint pointerId)
 {
     this.originConnectorInfo = originConnectorInfo;
     this.pathFinder          = new PathFinder();
     this.PointerId           = pointerId;
     this.Origin = origin;
     this.Id     = Guid.NewGuid().ToString("N");
 }
示例#2
0
        /// <summary>
        /// Adds a new connection.
        /// </summary>
        /// <param name="connection">The connection.</param>
        private void AddConnection(TileConnection connection)
        {
            ConnectableViewItem connectableFrom = this.GetConnectable(connection.FromId);

            if (connectableFrom == null)
            {
                return;
            }
            ConnectableViewItem connectableTo = this.GetConnectable(connection.ToId);

            if (connectableTo == null)
            {
                return;
            }


            //From
            HitTestInfo       hitTestInfo         = this.GetHitTestInfo(connection.FromOrientation);
            ConnectorInfo     originConnectorInfo = connectableFrom.CreateDiagramConnection(hitTestInfo);
            DiagramConnection newConnection       = new DiagramConnection(connectableFrom, originConnectorInfo, 0)
            {
                Id             = connection.Id,
                ConnectionType = connection.ConnectionType,
                RoutingMode    = connection.RoutingMode
            };

            newConnection.EditOperationRequested += this.OnConnectionEditRequested;
            //newConnection.CreateConnection(connection.Color, this.scatterView.DiagramSelectedConnectionColor, this.scatterView.DiagramConnectionHighlightColor, connection.Thickness, connection.Opacity);

            //To
            hitTestInfo = this.GetHitTestInfo(connection.ToOrientation);
            ConnectorInfo targetConnectorInfo = connectableTo.CreateDiagramConnection(hitTestInfo);

            //newConnection.CompletePendingConnection(connectableTo, targetConnectorInfo, this.scatterView.ControlTileScale);

            //Adds connection to related tiles
            newConnection.Origin.DiagramConnections.Add(newConnection);
            newConnection.Destination.DiagramConnections.Add(newConnection);

            connection.DiagramConnection = newConnection;

            //this.scatterView.AddVisualConnection(newConnection, false);
        }