コード例 #1
0
ファイル: FlowGraph.cs プロジェクト: rgallini/IntegrationTool
        public List <DesignerItemBase> GetPredecessorNodes(DesignerItemBase designerItem)
        {
            var incomingConnectionSourceIds = GetIncomingConnections(designerItem).Select(t => t.SourceID);
            var predecessorNodes            = DesignerItems.Where(t => incomingConnectionSourceIds.Contains(t.ID));

            return(predecessorNodes.ToList());
        }
コード例 #2
0
ファイル: FlowGraph.cs プロジェクト: rgallini/IntegrationTool
        public DesignerItemBase GetCurrentDesignerItem(Guid designerItemId)
        {
            var currentDesignerItem = DesignerItems.FirstOrDefault(designerItem => designerItem.ID == designerItemId);

            if (currentDesignerItem == null)
            {
                throw new ArgumentOutOfRangeException("A DesignerItem with id " + designerItemId + " does not exist!");
            }

            return(currentDesignerItem);
        }
コード例 #3
0
        private void DeserializeDesignerItems(List <ModuleDescription> moduleDescriptions, XElement root)
        {
            IEnumerable <XElement> itemsXML = root.Elements("DesignerItems").Elements("DesignerItem");

            foreach (XElement itemXML in itemsXML)
            {
                DesignerItemBase item = DeserializeDesignerItem(moduleDescriptions, itemXML);
                item.State = ItemState.NotExecuted;
                DesignerItems.Add(item);
            }
        }
コード例 #4
0
        private void RunSample()
        {
            // Add testing blocks
            this.DesignerItems.Add(new DesignerItem {
                X = 50, Y = 150, Height = 50, Width = 130
            });
            this.DesignerItems.Add(new DesignerItem {
                X = 400, Y = 130, Height = 50, Width = 130
            });
            this.DesignerItems.Add(new DesignerItem {
                X = 440, Y = 50, Height = 50, Width = 150
            });
            this.DesignerItems.Add(new DesignerItem {
                X = 420, Y = 270, Height = 50, Width = 130
            });
            this.DesignerItems.Add(new DesignerItem {
                X = 270, Y = 110, Height = 150, Width = 50
            });

            Stopwatch sw = new Stopwatch();

            sw.Start();

            // Add test route
            var connector = new Connector()
            {
                Source                 = this.DesignerItems[0],
                SourceOrientation      = ConnectorOrientation.Left,
                Destinaton             = this.DesignerItems[3],
                DestinationOrientation = ConnectorOrientation.Right
            };

            var results = this._orthogonalPathFinder.OrthogonalPath(DesignerItems.ToList(), 800, 450, SearchAlgorithm.Dijkstra, connector);

            this.Connections   = new ObservableCollection <Connection>(results.Connections);
            this.Intersections = new ObservableCollection <OrthogonalConnectorRouting.Models.Point>(results.Intersections);

            this.DrawPath(connector);

            sw.Stop();
            Console.WriteLine($"Algorithm time: {sw.ElapsedMilliseconds} ms");
            this.RunTime = sw.ElapsedMilliseconds;
        }
コード例 #5
0
    /// <summary>
    /// Handles notifications when the dragging of the thumb starts.
    /// </summary>
    /// <param name="sender">the sender object</param>
    /// <param name="e">the event arguments</param>
    private void ResizeThumbDragStarted(object sender, DragStartedEventArgs e)
    {
        _designerItem = DataContext as DesignerItem;
        if (_designerItem == null)
        {
            return;
        }
        _designerItem.IsResizing = true;
        _designerItem.IsDragging = true;
        _designerItems           = _designerItem.GetItemsControl();

        _transformOrigin = _designerItem.RenderTransformOrigin;
        var rotateTransform = _designerItem.RenderTransform as RotateTransform;

        if (rotateTransform != null)
        {
            _angle = rotateTransform.Angle * Math.PI / 180.0;
        }
        else
        {
            _angle = 0.0;
        }
    }