Esempio n. 1
0
 public RobotSensors(Map map)
 {
     this.GPS = new GPS(map);
      this.Thermometer = new Thermometer(map);
      this.Ultrasonic = new Ultrasonic(map);
      this.Webcam = new Webcam(map);
      this.Scale = new Scale(map);
 }
Esempio n. 2
0
        public GPS(Map map)
        {
            this.Map = map;

             directionDict.Add(Components.Direction.North, new Point(-1, 0));
             directionDict.Add(Components.Direction.East, new Point(0, 1));
             directionDict.Add(Components.Direction.West, new Point(0, -1));
             directionDict.Add(Components.Direction.South, new Point(1, 0));
        }
Esempio n. 3
0
 /// <summary>
 /// Crea e inicializa un nuevo mapa.
 /// </summary>
 private void CreateMap()
 {
     newMapDialog = new DlgNewMap(cellList);
      if (cellList.Count > 0 && newMapDialog.ShowDialog() == DialogResult.OK)
      {
     map = new Map(newMapDialog.NewMapHeight, newMapDialog.NewMapWidth, cellList[newMapDialog.DefaultCellIndex]);
     ResizeBox();
      }
 }
Esempio n. 4
0
        public Motor(Map map, Robot managedRobot)
        {
            Map = map;
             ManagedRobot = managedRobot;
             managedRobot.MoveOrTurn += map.OnSomethingMoves;

             directionDict.Add(Direction.North, new Point(-1, 0));
             directionDict.Add(Direction.East, new Point(0, 1));
             directionDict.Add(Direction.West, new Point(0, -1));
             directionDict.Add(Direction.South, new Point(1, 0));
        }
Esempio n. 5
0
 public Scale(Map map)
 {
     this.Map = map;
 }
Esempio n. 6
0
 public Thermometer(Map map)
 {
     this.Map = map;
 }
Esempio n. 7
0
 public FormManual(Map map, FormMain mainForm)
 {
     InitializeComponent();
      this.map = map;
      this.mainForm = mainForm;
 }
Esempio n. 8
0
        /// <summary>
        /// Carga un mapa de disco.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenMap_Click(object sender, EventArgs e)
        {
            if (openMapDialog.ShowDialog() == DialogResult.OK)
             {
            IFormatter formatter = new BinaryFormatter();
            Stream stream = new FileStream(openMapDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            map = (Map)formatter.Deserialize(stream);
            stream.Close();

            Size = new Size(map[0, 0].Image.Width * map.GetLength(1) + 9, map[0, 0].Image.Height * map.GetLength(0) + menuToolbar.Height + statusStrip.Height + mainToolStrip.Height + 32);

            map.Movement += MapSomethingMoved;
            map.Interaction += UpdateStatusText;
            map.Interaction += MapSomethingMoved;
            map.Robot.Motor.UnableToLoad += Robot_UnableToLoad;
            map.Robot.Motor.UnableToUnload += Robot_UnableToUnload;
            map.Robot.Motor.UnableToMove += Robot_UnableToMove;

            this.statusLabel.Text = "Event messages will appear here.";
            pboxCanvas.Image = null;
            pboxCanvas.Invalidate();
            statusStrip.Visible = true;
             }
        }
Esempio n. 9
0
        /// <summary>
        /// Carga un mapa de disco para modificarlo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuOpenMap_Click(object sender, EventArgs e)
        {
            if (openMapDialog.ShowDialog() == DialogResult.OK){
            IFormatter formatter = new BinaryFormatter();
            Stream stream = new FileStream(openMapDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            map = (Map) formatter.Deserialize(stream);
            stream.Close();

            cellList = map.FieldPalette;
            itemList = map.ItemPalette;

            UpdateCellList();
            UpdateItemList();
             }
             ResizeBox();
             pboxGrid.Invalidate();
        }
Esempio n. 10
0
 /// <summary>
 /// Cierra el mapa actual.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void menuCloseMap_Click(object sender, EventArgs e)
 {
     map = null;
      pboxGrid.Invalidate();
 }
Esempio n. 11
0
 public Webcam(Map map)
 {
     this.Map = map;
 }
Esempio n. 12
0
        /// <summary>
        /// "Posiciona" al robot en un mapa (inicializa sus sensores, etc.).
        /// </summary>
        /// <param name="map">El mapa donde se va a colocar el robot.</param>
        /// <param name="where">Donde exactamente se va a ubicar.</param>
        public void PlaceInMap(Map map, Point where)
        {
            if (map.HasRobot){
            map[where.X, where.Y].Item = this;
            if (map[where.X, where.Y].Item != this || (map.RobotLocation.X == where.X && map.RobotLocation.Y == where.Y))
               return;
            else{
               map[map.RobotLocation.X, map.RobotLocation.Y].Item = null;
               map.RobotLocation = new Point(where.X,where.Y);
            }
             }
             else{
            map[where.X, where.Y].Item = this;
            map.RobotLocation = new Point(where.X, where.Y);
             }

             this.Motor = new Motor(map,this);
             this.Sensors = new Sensors.RobotSensors(map);
        }