public C_Point(int r, int c, int x, int y, DrawTool drawTool) { this.X = x; this.Y = y; PointF = new System.Drawing.PointF(x, y); GridView = new GrideView(r, c, x, y, drawTool); }
public GrideView Copy() { GrideView _news = new GrideView(); _news.Cl = this.Cl; _news.Row = this.Row; _news.Node = this.Node.Copy(); _news.drawTool = this.drawTool; return(_news); }
public bool SimulateSetState(bool isBlanck, int state, Node node) { if (node == null) { return(false); } GrideView _view = _grideViews.Where(x => x.Node.cpoint.X == node.cpoint.X && x.Node.cpoint.Y == node.cpoint.Y).SingleOrDefault(); if (_view != null) { return(_view.Node.SetState(isBlanck, state)); } return(false); }
public Node GetNextNode(Node node, Position position, bool?isBlanck, int state) { GrideView view = null; int x = node.X; int y = node.Y; int i = 1; switch (position) { case Position.T: view = _grideViews.Where(z => y - i >= minY && z.Node.Y == y - i && z.Node.X == x && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.D: view = _grideViews.Where(z => y + i <= maxY && z.Node.Y == y + i && z.Node.X == x && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.L: view = _grideViews.Where(z => x - i >= minX && z.Node.X == x - i && z.Node.Y == y && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.R: view = _grideViews.Where(z => x + i <= maxX && z.Node.X == x + i && z.Node.Y == y && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.TL: view = _grideViews.Where(z => y - i >= minY && z.Node.Y == y - i && x - i >= minX && z.Node.X == x - i && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.TR: view = _grideViews.Where(z => y - i >= minY && z.Node.Y == y - i && x + i <= maxX && z.Node.X == x + i && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.DL: view = _grideViews.Where(z => y + i <= maxY && z.Node.Y == y + i && x - i >= minX && z.Node.X == x - i && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; case Position.DR: view = _grideViews.Where(z => y + i <= maxY && z.Node.Y == y + i && x + i <= maxX && z.Node.X == x + i && z.Node.State == state && z.Node.IsBlanck == isBlanck).SingleOrDefault(); break; } if (view != null) { return(view.Node.Copy()); } return(null); }