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; }
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; }
private void CreateLatticeData() { LatticeData l = new LatticeData(1); l.Layout.ToolPosition = 60; l.Rows = 10; l.Columns = 10; l.Layout.RepeatX = 10; l.Layout.RepeatY = 10; l.Layout.Width = 30; l.Layout.Height = 30; l.Layout.Clip = true; l.Layout.ClipRange.Start = 50; l.Layout.ClipRange.End = 200; l.PropertyChanged += l_PropertyChanged; l.Add(new Line2D(0, 0, 5, 0)); l.Add(new Line2D(0, 5, 5, 5)); l.Add(new Line2D(0, 0, 0, 5)); l.Add(new Line2D(5, 0, 5, 5)); l.Add(new Line2D(0, 0, 5, 5)); l.Add(new Line2D(5, 0, 0, 5)); l.LineChanged += l_LineChanged; l.LineRemoved += l_LineChanged; LatticePatterns.Add(l); }
public ViewModel() { NeedsInitialising = true; LastBazleyPattern = new BazelyChuck(); LastRossPattern = new RossData(); LastWheelsPattern = new WheelsData(); LastBarrelPattern = new Barrel(); LastLatticePattern = new LatticeData(); LastBraidPattern = new BraidData(); }