Ejemplo n.º 1
0
 public void ConnectMda(GridTile current, MDATilePart tilePart)
 {
     //connect to the main MDA which is sent to the backend
     //check if the conveyor is before or after the mda
     if (current.Row < tilePart.Row)
     {
         current.SetNextTile(tilePart.GetMainTile());
     }
     else
     {
         current.SetPreviousTile(tilePart.GetMainTile());
         tilePart.GetMainTile().SetNextTile(current);
     }
 }
Ejemplo n.º 2
0
 public void AddTilePart(MDATilePart t)
 {
     this.tileParts.Add(t);
 }
Ejemplo n.º 3
0
        //my changes
        public bool DrawAComponent(GridTile component, GridTile selectedTile)
        {
            GridTile replace;

            if (selectedTile is EmptyTile)
            {
                if (component is MDATile)
                {
                    MDATile m = (MDATile)component;
                    //replace empty tile with mda
                    // 2 row
                    for (int i = selectedTile.Row; i <= selectedTile.Row + 1; i++)
                    {
                        // 17 column
                        if (selectedTile.Column != 0)
                        {
                            selectedTile.Column = 0;
                        }
                        for (int j = selectedTile.Column; j < selectedTile.Column + 17; j++)
                        {
                            replace = FindTileInRowColumnCoordinates(j, i);
                            if (replace is EmptyTile)
                            {
                                this.gridTiles.Remove(replace);
                                MDATilePart p = new MDATilePart(j, i, tileWidth, tileHeight, m);
                                m.AddTilePart(p);
                                this.gridTiles.Add(p);
                            }
                        }
                    }
                }
                else
                {
                    if (component is CheckInTile)
                    {
                        if (!this.HideAllRowsButOne(component, 0))
                        {
                            return(false);
                        }
                    }
                    else if (component is DropOffTile)
                    {
                        if (!this.HideAllRowsButOne(component, 11))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (component.Row == 0 || component.Row == bottomRow)
                        {
                            return(false);
                        }
                    }
                    this.gridTiles.Remove(selectedTile);
                    this.gridTiles.Add(component);
                }
                if (component is CheckInTile)
                {
                    // send this list to the back-end, reason for sending only the checkins since it is the root so from that the back-end
                    // can retrieve all the node that connected to this check in and create nodes in the back-end accordingly => not necessary to send all the nodes(except the checkins)
                    _simulationSettings.FrontNodes.Add(component);
                }
                return(true);
            }
            return(false);
        }