当前位置: 首页>>代码示例>>C#>>正文


C# IFigure.AsEnumerable方法代码示例

本文整理汇总了C#中IFigure.AsEnumerable方法的典型用法代码示例。如果您正苦于以下问题:C# IFigure.AsEnumerable方法的具体用法?C# IFigure.AsEnumerable怎么用?C# IFigure.AsEnumerable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFigure的用法示例。


在下文中一共展示了IFigure.AsEnumerable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectionChangedEventArgs

 public SelectionChangedEventArgs(IFigure singleSelection)
     : this(singleSelection.AsEnumerable())
 {
 }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:4,代码来源:Drawing.cs

示例2: DeleteExecutedEventArgs

 public DeleteExecutedEventArgs(IFigure deletedFigure)
     : this(deletedFigure.AsEnumerable())
 {
 }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:4,代码来源:Drawing.cs

示例3: FigureCoordinatesChangedEventArgs

 public FigureCoordinatesChangedEventArgs(IFigure singleFigure)
     : this(singleFigure.AsEnumerable())
 {
 }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:4,代码来源:Drawing.cs

示例4: MouseDown

        public override void MouseDown(object sender, MouseButtonEventArgs e)
        {
            #if !SILVERLIGHT
            if (e.ClickCount == 2)
            {
                Drawing.CoordinateSystem.ZoomExtend();
                return;
            }
            #endif
            offsetFromFigureLeftTopCorner = Coordinates(e, false, false, false);
            oldCoordinates = offsetFromFigureLeftTopCorner;
            coordinatesOnMouseDown = offsetFromFigureLeftTopCorner;
            startedMoving = false;

            moving = new List<IMovable>();
            IEnumerable<IFigure> roots = null;
            bool isLocked = false;

            found = Drawing.Figures.HitTest(offsetFromFigureLeftTopCorner);

            IMovable oneMovable = found as IMovable;
            if (oneMovable != null)
            {
                if (!found.Locked)
                {
                    if (oneMovable is IPoint)
                    {
                        // when we drag a point, we want it to snap to the cursor
                        // so that the point center is directly under the tip of the mouse
                        offsetFromFigureLeftTopCorner = new Point();
                        oldCoordinates = oneMovable.Coordinates;
                    }
                    else
                    {
                        // however when we drag other stuff (such as text labels)
                        // we want the mouse to always touch the part of the draggable
                        // where it first touched during MouseDown
                        // we don't want the draggable to "snap" to the cursor like points do
                        offsetFromFigureLeftTopCorner = offsetFromFigureLeftTopCorner.Minus(oneMovable.Coordinates);
                    }
                    roots = DependencyAlgorithms.FindRoots(f => f.Dependents, found);
                    if (roots.All(root => (!root.Locked)))
                    {
                        moving.Add(oneMovable);
                        roots = found.AsEnumerable();
                    }
                    else
                    {
                        isLocked = true;
                    }
                }
                else
                {
                    isLocked = true;
                }
            }
            else if (found != null && !found.Locked)
            {
                if (!found.Locked)
                {
                    roots = DependencyAlgorithms.FindRoots(f => f.Dependencies, found);
                    if (roots.All(root => root is IMovable))
                    {
                        if (roots.All(root => ((IMovable)root).AllowMove()))
                        {
                            moving.AddRange(roots.OfType<IMovable>());
                        }
                        else
                        {
                            isLocked = true;
                        }
                    }
                }
                else
                {
                    isLocked = true;
                }
            }

            if (roots != null)
            {
                toRecalculate = DependencyAlgorithms.FindDescendants(f => f.Dependents, roots);
                toRecalculate.Reverse();
            }
            else
            {
                toRecalculate = null;
            }

            if (moving.IsEmpty() && !isLocked && !Drawing.CoordinateGrid.Locked)
            {
                moving.Add(Drawing.CoordinateSystem);
                //var allFigures = Drawing.Figures.GetAllFiguresRecursive();
                //roots = DependencyAlgorithms.FindRoots(f => f.Dependencies, allFigures);
                //moving.AddRange(roots.OfType<IMovable>());
                //roots = null;
                toRecalculate = null; // Figures;
            }
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:99,代码来源:Dragger.cs


注:本文中的IFigure.AsEnumerable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。