Example #1
0
        public void GPSCreation2Test()
        {
            GPSLocation gps = new GPSLocation(10.12, 21.21, 51.12, 18.192);

            Assert.AreEqual(10.12, gps.getLattitude());
            Assert.AreEqual(21.21, gps.getLongitude());
            Assert.AreEqual(51.12, gps.getX());
            Assert.AreEqual(18.192, gps.getY());
        }
Example #2
0
        //Callback when the team instance has changed
        public void Update()
        {
            //Redraw the background image and text
            base.Children.Clear();
            base.setImage(TechnicalServices.getImage(team, team.getStatus()));
            base.setText(team.getName());             //Although the text doesn't change, we have to redraw it for it not to be hidden by the image

            //Making the appropriate movement with the information provided by GPS
            if (this != draggedPin && team.getStatus() != Statuses.intervening && gpsLocation != null && GPSLocation.gpsConfigured == true && GPSServices.connectedToServer && gpsLocation.PhoneOnline())
            {
                setPinPosition(gpsLocation.getX(), gpsLocation.getY());                 //Move the team
                CollisionDetectionAndResolution(true);

                //Updating arrow if any for it to point from the current teams position to its destination
                if (destinationArrowDictionnary.ContainsKey(team) && destinationArrowDictionnary[team] != null)
                {
                    destinationArrowDictionnary[team].ChangeStart(getX(), getY());
                }
            }
        }
Example #3
0
        //Callback when the intervention instance has changed
        public void Update()
        {
            //If teams are assigned to this intervention draw the border
            if (intervention.getInterveningTeamList().Count > 0)
            {
                if (interventionContainer == null)
                {
                    //Create the border if it doesn't exist yet
                    interventionContainer = new InterventionContainer(this, mapSection);
                    mapSection.Canvas_map.Children.Add(interventionContainer);
                }

                //Place all the pins in the appropriate place and make sure that it is not colliding with anything
                interventionContainer.PlaceAll();
                interventionContainer.CollisionDetectionAndResolution(false);
            }

            //Have the intervention track the position of a team intervening on it so that it moves instead of the team
            if (GPSLocation.gpsConfigured == true)
            {
                if (gpsLocation == null)
                {
                    SelectGPSLocation();
                }
                else if (GPSServices.connectedToServer && gpsLocation.PhoneOnline())
                {
                    //Move the intervention pin using the GPS location of one of its intervening teams
                    setPinPosition(gpsLocation.getX(), gpsLocation.getY());
                    CollisionDetectionAndResolution(false);                     //False to avoid collision with its own intervention border

                    //Updating arrow if any for it to point from the current interventions position to its destination
                    if (destinationArrowDictionnary.ContainsKey(intervention) && destinationArrowDictionnary[intervention] != null)
                    {
                        destinationArrowDictionnary[intervention].ChangeStart(getX(), getY());
                    }
                }
            }
        }
Example #4
0
        public void GPSGetY()
        {
            GPSLocation gps = new GPSLocation(10.12, 21.21, 51.12, 18.192);

            Assert.AreEqual(18.192, gps.getY());
        }