Ejemplo n.º 1
0
        /// <summary>
        /// A <see cref="LayoutExecutor"/> that is used during the drag and drop operation.
        /// </summary>
        /// <remarks>
        /// First, all nodes and edges are pushed back into place before the drag started. Then space
        /// is made for the component at its current position. The animation morphs all elements to the
        /// calculated positions.
        /// </remarks>
        private LayoutExecutor CreateDraggingLayoutExecutor()
        {
            var layout = new GivenCoordinatesStage(
                clearAreaLayout = new ClearAreaLayout {
                ComponentAssignmentStrategy = ComponentAssignmentStrategy.Customized,
                ClearAreaStrategy           = ClearAreaStrategy.PreserveShapes
            });

            var layoutData = new CompositeLayoutData(
                resetToOriginalGraphStageData,
                new ClearAreaLayoutData {
                ComponentIds = { Mapper = components }
            });

            var items = new List <IModelItem>();

            items.AddRange(Component.Nodes);
            items.AddRange(Component.Edges);
            clearAreaLayout.ConfigureAreaOutline(items, 10);

            return(new LayoutExecutor(graphControl, layout)
            {
                LayoutData = layoutData,
                RunInThread = true,
                Duration = TimeSpan.FromMilliseconds(150)
            });
        }
 /// <summary>
 /// Creates a <see cref="ILayoutAlgorithm"/> used while dragging and finishing the gesture.
 /// </summary>
 private ILayoutAlgorithm CreateDraggingLayout()
 {
     return(new GivenCoordinatesStage(
                clearAreaLayout = new ClearAreaLayout {
         ComponentAssignmentStrategy = ComponentAssignmentStrategy.Single,
         ClearAreaStrategy = ClearAreaStrategy.PreserveShapes,
         ConsiderEdges = true
     }));
 }
 /// <summary>
 /// Creates a <see cref="ILayoutAlgorithm"/> used while dragging and finishing the gesture.
 /// </summary>
 private ILayoutAlgorithm CreateDraggingLayout()
 {
     return(new GivenCoordinatesStage(
                clearAreaLayout = new ClearAreaLayout {
         ComponentAssignmentStrategy = options.ComponentAssignmentStrategy,
         ClearAreaStrategy = options.ClearAreaStrategy,
         ConsiderEdges = options.ConsiderEdges
     }));
 }