CalculateData() public method

public CalculateData ( object value = null ) : void
value object
return void
Esempio n. 1
0
        public Connector(VplControl hostCanvas, Port startPort, Port endPort)
        {
            HostCanvas = hostCanvas;

            Path = new Path();

            srtEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            endEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            Panel.SetZIndex(Path, 2);
            Panel.SetZIndex(srtEllipse, startPort.ParentNode.Id + 1);
            Panel.SetZIndex(endEllipse, endPort.ParentNode.Id + 1);

            Path.Style = HostCanvas.FindResource("VplConnectorStyle") as Style;

            StartPort = startPort;
            EndPort = endPort;

            Canvas.SetLeft(srtEllipse, StartPort.Origin.X - srtEllipse.ActualWidth/2);
            Canvas.SetTop(srtEllipse, StartPort.Origin.Y - srtEllipse.ActualHeight/2);

            Canvas.SetLeft(endEllipse, EndPort.Origin.X - endEllipse.ActualWidth/2);
            Canvas.SetTop(endEllipse, EndPort.Origin.Y - endEllipse.ActualHeight/2);

            StartBezierPoint = new BindingPoint(StartPort.Origin.X, StartPort.Origin.Y);
            EndBezierPoint = new BindingPoint(EndPort.Origin.X, EndPort.Origin.Y);

            startPort.DataChanged += endPort.StartPort_DataChanged;

            StartPort.Origin.PropertyChanged += Origin_PropertyChanged;
            EndPort.Origin.PropertyChanged += Origin_PropertyChanged;

            StartPort.ParentNode.PropertyChanged += Origin_PropertyChanged;
            EndPort.ParentNode.PropertyChanged += Origin_PropertyChanged;

            ObserveNode(StartPort.ParentNode);
            ObserveNode(EndPort.ParentNode);

            startPort.ConnectedConnectors.Add(this);
            endPort.ConnectedConnectors.Add(this);

            endPort.CalculateData(startPort.Data);

            DefinePath();

            HostCanvas.Children.Add(Path);
            HostCanvas.Children.Add(srtEllipse);
            HostCanvas.Children.Add(endEllipse);
        }
Esempio n. 2
0
        public Connector(VplControl hostCanvas, Port startPort, Port endPort)
        {
            HostCanvas = hostCanvas;

            Path = new Path();

            srtEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            endEllipse = new Ellipse
            {
                Style = hostCanvas.FindResource("VplEllipseConnStyle") as Style
            };

            Panel.SetZIndex(Path, 2);
            Panel.SetZIndex(srtEllipse, startPort.ParentNode.Id + 1);
            Panel.SetZIndex(endEllipse, endPort.ParentNode.Id + 1);

            Path.Style = HostCanvas.FindResource("VplConnectorStyle") as Style;

            StartPort = startPort;
            EndPort   = endPort;

            Canvas.SetLeft(srtEllipse, StartPort.Origin.X - srtEllipse.ActualWidth / 2);
            Canvas.SetTop(srtEllipse, StartPort.Origin.Y - srtEllipse.ActualHeight / 2);

            Canvas.SetLeft(endEllipse, EndPort.Origin.X - endEllipse.ActualWidth / 2);
            Canvas.SetTop(endEllipse, EndPort.Origin.Y - endEllipse.ActualHeight / 2);

            StartBezierPoint = new BindingPoint(StartPort.Origin.X, StartPort.Origin.Y);
            EndBezierPoint   = new BindingPoint(EndPort.Origin.X, EndPort.Origin.Y);

            startPort.DataChanged += endPort.StartPort_DataChanged;

            StartPort.Origin.PropertyChanged += Origin_PropertyChanged;
            EndPort.Origin.PropertyChanged   += Origin_PropertyChanged;

            StartPort.ParentNode.PropertyChanged += Origin_PropertyChanged;
            EndPort.ParentNode.PropertyChanged   += Origin_PropertyChanged;

            ObserveNode(StartPort.ParentNode);
            ObserveNode(EndPort.ParentNode);

            startPort.ConnectedConnectors.Add(this);
            endPort.ConnectedConnectors.Add(this);

            endPort.CalculateData(startPort.Data);

            DefinePath();

            HostCanvas.Children.Add(Path);
            HostCanvas.Children.Add(srtEllipse);
            HostCanvas.Children.Add(endEllipse);
        }