Esempio n. 1
0
 public ShapeCollection CreatePaths(PathData pathdata, double inc)
 {
     ShapeCollection pc = new ShapeCollection();
     pc.PatternName = pathdata.Name;
     pc.AddShape(Path(pathdata, inc));
     return pc;
 }
Esempio n. 2
0
 /// <summary>
 /// In this class the second parameter is the number of paths
 /// </summary>
 /// <param name="pathdata"></param>
 /// <param name="increment"></param>
 /// <returns></returns>
 public ShapeCollection CreatePaths(PathData pathdata, double increment)
 {
     ShapeCollection pc = new ShapeCollection();
     pc.PatternName = pathdata.Name;
     if (pathdata.PathType == PatternType.barrel)
     {
         Barrel b = pathdata as Barrel;
         RadialOffsetPath path = b.OutlineAsOffsets((int)(1/increment));
         Polygon poly = CreatePolygonFrom(path, b.ToolPosition);
         (poly.RenderTransform as CompositeTransform).Rotation = b.Phase;
         pc.AddShape(poly);
     }
     return pc;
 }
Esempio n. 3
0
        public ShapeCollection CreatePaths(PathData p, double increment)
        {
           
            ShapeCollection pc = new ShapeCollection();
            if (p == null || !(p is LatticeData)) return pc;
            ld = p as LatticeData;
            
            rowHeight = ld.Layout.Height / (ld.Rows - 1);
            colWidth = ld.Layout.Width / (ld.Columns - 1);
            //Shape s = MkPath(0, 0, increment);
            //if (s != null)
            //    pc.AddShape(s);
            if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY == 0))
            {
                pc.AddShape(MkPath(0, 0, increment));
            }
            else if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY > 0))
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    Shape s = MkPath(0, indy, increment);
                    if (s != null)
                        pc.AddShape(s);
                }
            }
            else if ((ld.Layout.RepeatX > 0) && (ld.Layout.RepeatY == 0))
            {
                for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                {
                    Shape s = MkPath(indx, 0, increment);
                    if (s != null)
                        pc.AddShape(s);
                }
            }
            else
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                    {
                        Shape s = MkPath(indx, indy, increment);
                        if (s != null)
                            pc.AddShape(s);
                    }
                }

            }
            return pc;
        }
Esempio n. 4
0
        public ShapeCollection CreatePaths(PathData p, double increment)
        {
           
            ShapeCollection pc = new ShapeCollection();
            if (p == null || !(p is LatticeData)) return pc;
            ld = p as LatticeData;
            repeatAngle = 360.0 / ld.Layout.RepeatX;
            colAngle = (repeatAngle - ld.Layout.Margin) / (ld.Columns - 1);

            rowHeight = ld.Layout.Height / (ld.Rows - 1);
            colWidth = ld.Layout.Width / (ld.Columns - 1);
            origin = new Point(ld.Layout.ToolPosition, 0);

            if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY == 0))
            {
                pc.AddShape(MkPath(0, 0, increment));
            }
            else if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY > 0))
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    pc.AddShape(MkPath(0, indy, increment));
                }
            }
            else if ((ld.Layout.RepeatX > 0) && (ld.Layout.RepeatY == 0))
            {
                for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                {
                    pc.AddShape(MkPath(indx, 0, increment));
                }
            }
            else
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                    {
                        pc.AddShape(MkPath(indx, indy, increment));
                    }
                }
            }

            //for (int indx = 0; indx < ld.Layout.RepeatX; indx++)
            //{
            //    pc.AddShape(MkPath(indx,increment));
            //}
            return pc;
        }
Esempio n. 5
0
 public ShapeCollection CreatePaths (PathData pathdata, double inc)
 {
     //Debug.WriteLine("BazelyEngine CreatePaths");
     ShapeCollection pc = new ShapeCollection();
     pc.PatternName = pathdata.Name;
     Polygon poly = Path(pathdata, inc);
     try
     {
         pc.AddShape(poly);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
     //Debug.WriteLine("End BazelyEngine CreatePaths");
     return pc;
 }
Esempio n. 6
0
        public ShapeCollection CreatePaths(PathData pd, double increment)
        {
            bd = pd as BraidData;
            ShapeCollection pc = new ShapeCollection();
            pc.PatternName = pd.Name;
            repeatAngle = 2 * Math.PI / bd.Repeats;
            colAngle = (repeatAngle - rad * bd.Margin) / bd.Perms.Count ;

            rowHeight = bd.Width / (bd.NumStrands - 1);
            colWidth = bd.Length / bd.Perms.Count;
            origin = new Point(bd.ToolPosition, 0);

            for (int indx = 0; indx < bd.Repeats; indx++)
            {
                pc.AddShape(MkPath(indx, increment));
            }
            return pc;
           
        }
Esempio n. 7
0
 public ShapeCollection Path(double inc)
 {
     ShapeCollection pc = new ShapeCollection();
     pc.AddShape(Outline(inc));
     return pc;
 }
Esempio n. 8
0
 public void CleanUp()
 {
     if (_currentPath != null)
         _currentPath.CollectionChanged -= CurrentPath_CollectionChanged;
     _currentPath = null;
     PathDisplayCanvas.Children.Clear();
 }
Esempio n. 9
0
 public void CreatePaths()
 {
     //Debug.WriteLine("In ViewModel.CreatePaths with Increment {0}", Increment);
     if (_currentPathData == null)
     {
         //Debug.WriteLine("Exit Viewmodel.CreatePaths as null path data");
         return;
     }
     _currentPath = _pathEngine.CreatePaths(_currentPathData, Increment);
     NumPoints =  CurrentPath.NumPoints;
  }
Esempio n. 10
0
        public void CreateData()
        {
            BazeleyPatterns = new ObservableCollection<BazelyChuck>();
            _lastBazleyPattern = null;
            RossPatterns = new ObservableCollection<RossData>();
            _currentPath = new ShapeCollection();
            _lastRossPattern = null;
            WheelsPatterns = new ObservableCollection<WheelsData>();
            _lastWheelsPattern = null;
            BarrelPatterns = new ObservableCollection<Barrel>();
            _lastBarrelPattern = null;
            LatticePatterns = new ObservableCollection<LatticeData>();
            _lastLatticePattern = null;
            BraidPatterns = new ObservableCollection<BraidData>();
            _lastBraidPattern = null;

            CreateBazelyData();
            CreateRossData();
            CreateWheelsData();
            CreateBarrelData();
            CreateLatticeData();
            CreateBraidData();
            NeedsInitialising = false;
        }