public static ConnectionViewModel Connect(SceneViewModel scene, ConnectionPointViewModel connectionPoint1, ConnectionPointViewModel connectionPoint2) { var connection = new ConnectionViewModel(scene, connectionPoint1, connectionPoint2); connectionPoint1.Connections.Add(connection); connectionPoint2.Connections.Add(connection); return(connection); }
public ConnectionPointViewModel AddConnectionPoint() { var ellipse = new Ellipse(Body.TopLeft + new Vector2(4, 0), new Vector2(1, 1), 0); var connectionPoint = new ConnectionPointViewModel(this, ellipse); ConnectionPoints.Add(connectionPoint); Add(connectionPoint); return(connectionPoint); }
protected ConnectionViewModel(SceneViewModel scene, ConnectionPointViewModel connectionPoint1, ConnectionPointViewModel connectionPoint2) : base(new PolyLine(VertexArray.Create(new Vector2[] { connectionPoint1.Ellipse.BoundingCircle.Center, connectionPoint2.Ellipse.BoundingCircle.Center }))) { Scene = scene; ConnectionPoint1 = connectionPoint1; ConnectionPoint2 = connectionPoint2; CollisionDetectionEnabled = false; Calculate(); }