static PluggableGuide()
        {
#if XBOX
            Provider = new RealGuideProvider();
#else
            Provider = new WindowsSafeGuideProvider();
#endif
        }
Esempio n. 2
0
        public IEnumerable <Guideline> InvalidateSnappedGuidelines(IGuideProvider target)
        {
            SnapItems.Clear();

            foreach (Guideline gl in GetSnappedGuidelines(target))
            {
                if (gl.SnappedGuideline == null)
                {
                    continue;
                }

                yield return(gl);

                if (!gl.IsVisible)
                {
                    continue;
                }

                if (gl.IsVertical)
                {
                    SnapItems.Add(
                        new Guideline(
                            new Point(
                                gl.Point1.X,
                                Math.Min(gl.Point1.Y, gl.SnappedGuideline.Point1.Y)),
                            new Point(
                                gl.Point1.X,
                                Math.Max(gl.Point2.Y, gl.SnappedGuideline.Point2.Y))));
                }
                else
                {
                    SnapItems.Add(
                        new Guideline(
                            new Point(
                                Math.Min(gl.Point1.X, gl.SnappedGuideline.Point1.X),
                                gl.Point1.Y),
                            new Point(
                                Math.Max(gl.Point2.X, gl.SnappedGuideline.Point2.X),
                                gl.Point2.Y)));
                }
            }

            this.InvalidateVisual();
        }
Esempio n. 3
0
        public IEnumerable <Guideline> GetSnappedGuidelines(IGuideProvider target)
        {
            foreach (IGuideProvider provider in Items.Except(new[] { target }))
            {
                if (provider is FrameworkElement frameworkElement &&
                    !frameworkElement.IsVisible)
                {
                    continue;
                }

                foreach (Guideline gl in provider.GetGuidableLines()
                         .Where(gl =>
                {
                    return(target.GetGuidableLines()
                           .Count(tGl =>
                    {
                        double length = Guideline.Distance(gl, tGl);

                        if (length == -1)
                        {
                            return false;
                        }

                        if (length <= this.Fit(SnapThreshold))
                        {
                            gl.SnappedGuideline = tGl;
                            return true;
                        }

                        return false;
                    }) > 0);
                }).
                         OrderBy(gl =>
                {
                    return(Guideline.Distance(gl, gl.SnappedGuideline));
                }))
                {
                    yield return(gl);
                }
            }
        }
Esempio n. 4
0
 public StandardVelocityProvider()
 {
     LocalGuiderProvider        = new PBestGuideProvider();
     NeighbourhoodGuideProvider = new NBestGuideProvider();
 }
        static PluggableGuide () {
#if XBOX
            Provider = new RealGuideProvider();
#else
            Provider = new WindowsSafeGuideProvider();
#endif
        }
 public ExtendedVelocityProvider()
 {
     LocalGuideProvider         = new PBestGuideProvider();
     NeighbourhoodGuideProvider = new NBestGuideProvider();
     AdditionalGuideProvider    = new CenterBasedGuideProvider();
 }
Esempio n. 7
0
 public void Remove(IGuideProvider layer)
 {
     Items.Remove(layer);
 }
Esempio n. 8
0
 public void Add(IGuideProvider layer)
 {
     Items.Add(layer);
 }