コード例 #1
0
        //Set the map modification object type
        internal void setMapModObjectType()
        {
            if (mapModName.Equals("rectangle"))
            {
                mapModObject = new System.Windows.Shapes.Rectangle();
                mapModObject.StrokeThickness = 3;
            }

            if (mapModName.Equals("circle"))
            {
                mapModObject = new System.Windows.Shapes.Ellipse();
                mapModObject.StrokeThickness = 3;
            }

            if (mapModName.Equals("ramp") || mapModName.Equals("camp") || mapModName.Equals("stairs"))
            {
                mapModObject = new System.Windows.Shapes.Rectangle();
                ImageBrush mapModImg = new ImageBrush();
                MapMods    mapModi   = (MapMods)Enum.Parse(typeof(MapMods), mapModName);
                mapModImg.ImageSource = TechnicalServices.getImage(mapModi);
                mapModObject.Fill     = mapModImg;
            }

            if (mapModName.Equals("text"))
            {
                textInput = MainWindow.getAdditionalTextInput();

                if (textInput == null || textInput.Equals(""))
                {
                    textInput = "Enter text";
                }
                else
                {
                    textInput = MainWindow.getAdditionalTextInput();
                }

                System.Drawing.Font   font   = new System.Drawing.Font("Times New Roman", 35.0f);
                System.Drawing.Bitmap bitmap = DrawText(textInput, font, System.Drawing.Color.Black, System.Drawing.Color.Transparent);

                ToBitmapImage(bitmap);
                BitmapImage bitmapimg = ToBitmapImage(bitmap);
                mapModObject = new System.Windows.Shapes.Rectangle();
                ImageBrush mapModImg = new ImageBrush();
                mapModImg.ImageSource = bitmapimg;
                mapModObject.Fill     = mapModImg;
            }

            if (mapModName.Equals("line"))
            {
                return;
            }
        }
コード例 #2
0
        //Filling up the page with the information on the team
        private void PopulateInfo()
        {
            equipmentStackPanel.Children.RemoveRange(1, equipmentStackPanel.Children.Count - 1);

            teamName.Name = team.getName();
            if (team.getName().Length == 1)
            {
                teamName.Text = TechnicalServices.getPhoneticLetter(team.getName());
            }
            else
            {
                teamName.Text = team.getName();
            }

            ImageBrush img = new ImageBrush();

            img.ImageSource   = TechnicalServices.getImage(team.getHighestLevelOfTraining());
            teamTraining.Fill = img;

            List <Equipment> equipmentList = team.getEquipmentList();

            foreach (Equipment eq in equipmentList)
            {
                EquipmentIcon equip = new EquipmentIcon(team, this, 27, eq);
                equip.setImage(TechnicalServices.getImage(eq.getEquipmentType()));
                equipmentStackPanel.Children.Add(equip);
            }

            TeamMember member   = null;
            int        position = 0;

            while ((member = team.getMember(position++)) != null)
            {
                Grid memberLine = (Grid)informations.Children[position];
                memberLine.Visibility = System.Windows.Visibility.Visible;
                member.setNameGrid(memberLine);

                Label memberName = (Label)memberLine.Children[0];
                memberName.Content = member.getName();
                memberName.ToolTip = DepartureTimeToString(member);

                Rectangle  memberTraining = (Rectangle)memberLine.Children[1];
                ImageBrush img2           = new ImageBrush();
                img2.ImageSource    = TechnicalServices.getImage(member.getTrainingLevel());
                memberTraining.Fill = img2;
            }
        }
コード例 #3
0
        public InterventionPin(Intervention intervention, MapSectionPage mapSection) : base(intervention, mapSection, size)
        {
            this.intervention = intervention;             //Providing a link to the team that this pin represents

            //Setting the image and text of the pin
            base.setImage(TechnicalServices.getImage("intervention"));
            base.setText(intervention.getInterventionNumber().ToString());

            //Setting the intervention pin  of all team pins that are intervening on this pin
            foreach (TeamPin teamPin in getInterveningTeamsPin())
            {
                teamPin.setInterventionPin(this);
            }

            //Register as an observer to the intervention instance so that any modification to it are reflected on the map, e.g. addition of a team
            intervention.RegisterInstanceObserver(this);
        }
コード例 #4
0
        public EquipmentPin(Equipment equipment, MapSectionPage mapSection) : base(equipment, mapSection, size)
        {
            this.equipment = equipment;                                              //Providing a link to the equipment that this pin represents

            base.setImage(TechnicalServices.getImage(equipment.getEquipmentType())); //Setting background image

            //Adding contect menu so that the user can delete the equipment
            MenuItem menuItem = new MenuItem();

            menuItem.Uid    = "MenuItem_EquipmentPin_Delete";
            menuItem.Header = ETD.Properties.Resources.MenuItem_EquipmentPin_Delete;
            menuItem.Click += DeleteEquipment_Click;

            ContextMenu contextMenu = new ContextMenu();

            contextMenu.Items.Add(menuItem);

            this.ContextMenu = contextMenu;
        }
コード例 #5
0
ファイル: TeamPin.cs プロジェクト: zukoj/SOEN490-ETD
        //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());
                }
            }
        }
コード例 #6
0
 public MapModPin(MapMod mapMod, AdditionalInfoPage aiSection, double width, double height)
     : base(mapMod, aiSection, aiSection.ActualWidth, aiSection.ActualHeight)
 {
     base.setImage(TechnicalServices.getImage(mapMod.getMapModType())); //Setting the image of the map modification pin
     mapModification = mapMod;                                          //Providing a link to the map that this pin represents
 }