Ejemplo n.º 1
0
        public Position(int wx, int wy, int wz, int x, int y, long positiontime, Person player)
        {
            this.worldx = wx;
            this.worldy = wy;
            this.worldz = wz;

            this.imagex = x;
            this.imagey = y;

            this.instant = DateTime.Now;

            this.positiontime = positiontime;
            
            this.player = player;

            this.clickCreated = true;
        }
Ejemplo n.º 2
0
 public Position() 
 { 
     this.player = new Person();
     this.clickCreated = false;
 }
Ejemplo n.º 3
0
        // Re-mapps the current positions of the players on player switch
        private void switchPlayers_AssignCurrentPosition(Person p)
        {
            switch (p.Current_position)
            {
                case Rally.PlayerPosition.lowerLeft:
                    p.Current_position = Rally.PlayerPosition.lowerRight;
                    break;

                case Rally.PlayerPosition.lowerRight:
                    p.Current_position = Rally.PlayerPosition.lowerLeft;
                    break;

                case Rally.PlayerPosition.upperLeft:
                    p.Current_position = Rally.PlayerPosition.upperRight;
                    break;

                case Rally.PlayerPosition.upperRight:
                    p.Current_position = Rally.PlayerPosition.upperLeft;
                    break;

                default:
                    // should not be reached
                    throw new Exception("DEBUG: PlayerPosition can not be set.");
            }
        }
Ejemplo n.º 4
0
        private void savePosition(int mx, int my)
        {
            togglemode = false;

            PointF drawPoint3D = calibration.Calibrate(mx, my);
            Graphics g = pictureBox_birdview.CreateGraphics();
            g.Clear(Color.LemonChiffon);


            // draw field and line in BirdView again
            Pen field_pen = new Pen(Color.Gray, 1.0f);
            g.DrawRectangle(field_pen, new Rectangle(outwidth, outheight, field_width / cmperpixel, field_height / cmperpixel));
            g.DrawLine(field_pen, outwidth, outheight + ((field_height / cmperpixel) / 2 - 1), outwidth + (field_width / cmperpixel), outheight + (field_height / cmperpixel) / 2 - 1);


            // Draw point in Birdview
            
            int x = (int)drawPoint3D.X;
            int y = (int)drawPoint3D.Y;
            

            // world x and word y
            int wx = (int)(x / (field_width / 800));
            int wy = (int)(y / (field_height / 1600));
            
            Person player = new Person();

            long position_time = 0;
            if (capture_review != null)
            {
                /*
                for (int i = 0; i < List_timestamps.Count-1; i++)
                {

                    String move_identifier = List_timestamps[i].ToString();
                    String videopath = Program.getConfiguration().Mediafolderpath + @"\" + move_identifier + ".mpg";
                    Capture temp = new Capture(videopath);
                    double framecount = temp.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_COUNT);
                    temp.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_POS_FRAMES, framecount);
                    position_time = position_time + (long)temp.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_POS_MSEC);
                }
                 * */
                position_time = position_time + (long)capture_review.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_POS_MSEC);

            }
            if (position_time < 0)
                position_time = 0;


            switch (editing_position)
            {
                case 0:
                    Game.Reviewing_rally.Service_pos = new Position(wx, wy, 0, mx, my, position_time, player);
                    break;
                case 1:
                    Game.Reviewing_rally.Reception_pos = new Position(wx, wy, 0, mx, my, position_time, player);
                    break;
                case 2:
                    Game.Reviewing_rally.Set_pos = new Position(wx, wy, 0, mx, my, position_time, player);
                    break;
                case 3:
                    Game.Reviewing_rally.Approach_pos = new Position(wx, wy, 0, mx, my, position_time, player);
                    break;
                case 4:
                    Game.Reviewing_rally.Takeoff_pos = new Position(wx, wy, 0, mx, my, position_time, player);
                    break;
                case 5:
                    Game.Reviewing_rally.Defence_pos = new Position(wx, wy, 0, mx, my, position_time, player);
                    break;
                default:
                    break;
            }

            updatePositionList(); // display the new tracked positions
            xmlDoc.updateReviewRally(Game.Reviewing_rally);
            pictureBox_reviewercamera.Refresh();
            pictureBox_birdview.Refresh();
        }
Ejemplo n.º 5
0
 public Team(string name, Person player1, Person player2) 
 {
     this.name = name;
     this.player1 = player1;
     this.player2 = player2;
 }
Ejemplo n.º 6
0
        private Person readConfigurationPlayer(XmlNode rootNode, int team, int number)
        {
            Person player = new Person();
            String xpath = "descendant::Spiel/Team"+team+"/Player"+number+"/Player/";

            player.Name = rootNode.SelectSingleNode(xpath+"@Name").InnerText;
            if (rootNode.SelectSingleNode(xpath+"@DefaultPosition").InnerText == "Left")
                player.defaultposition = Person.DefaultPosition.Left;
            else
                player.defaultposition = Person.DefaultPosition.Right;

            if (rootNode.SelectSingleNode(xpath + "@CurrentPosition").InnerText == "lowerLeft")
                player.Current_position = Rally.PlayerPosition.lowerLeft;

            if (rootNode.SelectSingleNode(xpath + "@CurrentPosition").InnerText == "lowerRight")
                player.Current_position = Rally.PlayerPosition.lowerRight;

            if (rootNode.SelectSingleNode(xpath + "@CurrentPosition").InnerText == "upperLeft")
                player.Current_position = Rally.PlayerPosition.upperLeft;

            if (rootNode.SelectSingleNode(xpath + "@CurrentPosition").InnerText == "upperRight")
                player.Current_position = Rally.PlayerPosition.upperRight;

            return player;

        }
Ejemplo n.º 7
0
        private XmlNode newPlayerNode(Person player)
        {
            XmlNode playernode = xmlDoc.CreateElement("Player");
            
            XmlAttribute player_attribute = xmlDoc.CreateAttribute("Name");
            player_attribute.InnerText = player.Name;
            playernode.Attributes.Append(player_attribute);

            player_attribute = xmlDoc.CreateAttribute("DefaultPosition");
            player_attribute.InnerText = player.defaultposition.ToString();
            playernode.Attributes.Append(player_attribute);

            player_attribute = xmlDoc.CreateAttribute("CurrentPosition");
            player_attribute.InnerText = player.Current_position.ToString();
            playernode.Attributes.Append(player_attribute);

            
            return playernode;
        }