Esempio n. 1
0
        /// <summary>
        /// Dessine le drapeau associé au belligérant.
        /// </summary>
        private void DessineDrapeau()
        {
            Graphics outilsGraphiques = Graphics.FromImage(this.drapeauInterne);

            Pen traceurContour = new Pen(Color.Black, 2);

            Geographie.Enumerations.EBelligerant nationalite = Geographie.Convertisseurs.DepuisEBelligerantAbrege(this.NomBelligerant);
            if (nationalite == Geographie.Enumerations.EBelligerant.Palavin)
            {
                traceurContour = new Pen(Color.Red, 2);
            }

            outilsGraphiques.DrawRectangle(traceurContour, 0, 0, this.emplacementDrapeau.Width, this.emplacementDrapeau.Height);

            Color couleur = Convertisseurs.VersCouleur(nationalite);
            Brush traceur = new SolidBrush(couleur);

            outilsGraphiques.FillRectangle(traceur, 1, 1, this.emplacementDrapeau.Width - 2, this.emplacementDrapeau.Height - 2);

            outilsGraphiques.Dispose();
        }
Esempio n. 2
0
        /// <summary>
        /// Trace une ligne entre les deux régions indiquées.
        /// </summary>
        /// <param name="pointilles">Indique si la ligne doit être en pointillés ou non.</param>
        /// <param name="typeBout">Type de bout (flèche, carré) souhaité pour la ligne.</param>
        /// <param name="pointDepart">Point où débute le trait.</param>
        /// <param name="pointArrivee">Point où se termine le trait.</param>
        /// <param name="belligerant">Identificateur du belligérant associé à l'ordre.</param>
        /// <param name="carte">Image représentant la carte.</param>
        /// <param name="outilsGraphiques">Outils graphiques utilisés pour effectuer le dessin.</param>
        private static void TraceLigne(
            Boolean pointilles,
            LineCap typeBout,
            Point pointDepart,
            Point pointArrivee,
            EBelligerant belligerant,
            Image carte,
            Graphics outilsGraphiques)
        {
            Color couleur = Convertisseurs.VersCouleur(belligerant);
            Color couleurBis;

            if (belligerant == EBelligerant.Mélinde)
            {
                couleurBis = Color.Black;
            }
            else if (belligerant == EBelligerant.Palavin)
            {
                couleurBis = Color.Red;
            }
            else
            {
                couleurBis = couleur;
            }

            Pen traceur    = new Pen(couleur, 2.0F);
            Pen traceurBis = new Pen(couleurBis, 3.0F);

            traceur.EndCap    = typeBout;
            traceurBis.EndCap = typeBout;
            if (pointilles == true)
            {
                traceur.DashStyle    = DashStyle.Dash;
                traceurBis.DashStyle = DashStyle.Dash;
            }

            outilsGraphiques.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            outilsGraphiques.DrawLine(traceurBis, pointDepart, pointArrivee);
            outilsGraphiques.DrawLine(traceur, pointDepart, pointArrivee);
        }
Esempio n. 3
0
        /// <summary>
        /// Affilie un centre à un belligérant.
        /// </summary>
        /// <param name="region">Région dont le centre est à affilier.</param>
        /// <param name="occupation">Occupation du centre.</param>
        /// <param name="carte">Image représentant la carte.</param>
        /// <param name="outilsGraphiques">Outils graphiques utilisés pour effectuer le dessin.</param>
        public static void AffilieCentre(Centre region, OccupationCentre occupation, Image carte, Graphics outilsGraphiques)
        {
            if (region.EstUnCentre == true)
            {
                /// Les centres mesurent 7x7 pixels.
                Pen traceurContour = new Pen(Color.Black);
                if (occupation.PossesseurCentre == EBelligerant.Palavin)
                {
                    traceurContour = new Pen(Color.Red);
                }

                outilsGraphiques.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
                outilsGraphiques.DrawRectangle(traceurContour, region.CoordonneesCentre.X, region.CoordonneesCentre.Y, 7, 7);

                Color couleur = Convertisseurs.VersCouleur(occupation.PossesseurCentre);
                Brush traceur = new SolidBrush(couleur);
                outilsGraphiques.FillRectangle(traceur, region.CoordonneesCentre.X + 1, region.CoordonneesCentre.Y + 1, 6, 6);
            }
            else
            {
                throw new Exception(String.Format("La région {0} ne contient pas de centre.", region.Nom));
            }
        }