private Color getColor(TypeElementBiome typeElementBiome) { switch (typeElementBiome) { case TypeElementBiome.Arbre: return(Color.DarkGreen); case TypeElementBiome.Eau: //return Color.MediumAquamarine; return(Color.FromArgb(28, 132, 220)); case TypeElementBiome.Pierre: return(Color.Gray); case TypeElementBiome.Sable: return(Color.SandyBrown); case TypeElementBiome.Terre: //return Color.Brown; return(Color.FromArgb(114, 71, 21)); default: return(Color.Black); } }
private Color getColorElement(int x, int y) { TypeElementBiome t = this.Elements[x][y].ElementBiome; switch (t) { case TypeElementBiome.Vide: return(Color.Black); //Transparent; case TypeElementBiome.Terre: return(Color.Brown); case TypeElementBiome.Eau: return(Color.Blue); case TypeElementBiome.Sable: return(Color.SandyBrown); case TypeElementBiome.Pierre: return(Color.DarkGray); case TypeElementBiome.Arbre: return(Color.Green); case TypeElementBiome.Maison: case TypeElementBiome.Route: return(Color.White); default: throw new ArgumentOutOfRangeException(); } }
private static Color GetColor(TypeElementBiome typeElementBiome) { switch (typeElementBiome) { case TypeElementBiome.Arbre: return(Color.DarkGreen); case TypeElementBiome.Eau: return(Color.MediumAquamarine); case TypeElementBiome.Pierre: return(Color.Gray); case TypeElementBiome.Sable: return(Color.SandyBrown); case TypeElementBiome.Terre: return(Color.Brown); default: return(Color.Black); } }
public Coordonnees getPostionElement(TypeElementBiome typeElement, Coordonnees centre) { if (this.Elements[centre.X][centre.Y].ElementBiome == typeElement) { return(centre); } int rayonMax = Math.Max(this.Hauteur / 2, this.Largeur / 2); int rayonCarre; int y; int x1, x2, y1, y2; Coordonnees res = null; // DEBUG //StreamWriter sw = new StreamWriter(@".\Debug_getPostionElement.txt", false); //double tempsTotal = 0; //double tempsCalculRayonCarre = 0; //double tempsCalculY = 0; //double tempsRechercheDansTableauElements = 0; //DateTime debutGlobal, debutCalculRayonCarre, debutCalculY, debutRechercheTableau; //sw.WriteLine("Rayon;Etape;Temps"); //debutGlobal = DateTime.Now; // ----- for (int rayon = 1; rayon < rayonMax; rayon++) { // DEBUG //debutCalculRayonCarre = DateTime.Now; // ----- rayonCarre = rayon * rayon; // DEBUG //tempsCalculRayonCarre = DateTime.Now.Subtract(debutCalculRayonCarre).TotalMilliseconds; //sw.WriteLine("{0};Calcul R²;{1:0.000000}", rayon, tempsCalculRayonCarre); // ----- for (int x = 0; x <= rayon; x++) { // DEBUG //debutCalculY = DateTime.Now; // ----- // x² + y² = R² y = (int)Math.Sqrt(rayonCarre - (x * x)); // DEBUG //tempsCalculY = DateTime.Now.Subtract(debutCalculY).TotalMilliseconds; //sw.WriteLine(";Calcul Y;;{0:0.000000}", tempsCalculY); //debutRechercheTableau = DateTime.Now; // ----- x1 = centre.X - x; x2 = centre.X + x; y1 = centre.Y - y; y2 = centre.Y + y; if (x1 > 0 && y1 > 0 && this.Elements[x1][y1].ElementBiome == typeElement) { res = new Coordonnees(x1, y1); } else if (x1 > 0 && y2 < this.Hauteur && this.Elements[x1][y2].ElementBiome == typeElement) { res = new Coordonnees(x1, y2); } else if (x2 < this.Largeur && y1 > 0 && this.Elements[x2][y1].ElementBiome == typeElement) { res = new Coordonnees(x2, y1); } else if (x2 < this.Largeur && y2 < this.Hauteur && this.Elements[x2][y2].ElementBiome == typeElement) { res = new Coordonnees(x2, y2); } // DEBUG //tempsRechercheDansTableauElements = DateTime.Now.Subtract(debutRechercheTableau).TotalMilliseconds; //sw.WriteLine(";Recherche;;{0:0.000000}", tempsRechercheDansTableauElements); // ----- if (res != null) { break; } } // DEBUG //sw.WriteLine(""); //sw.Flush(); // ----- if (res != null) { break; } } // DEBUG //tempsTotal = DateTime.Now.Subtract(debutGlobal).TotalMilliseconds; //sw.WriteLine("TOTAL;{0:0.000}", tempsTotal); //sw.WriteLine(); //if (res != null) // sw.WriteLine("Point trouvé;{0}:{1}", res.X, res.Y); //else // sw.WriteLine("Rien trouvé", tempsTotal); //sw.Flush(); //sw.Close(); // ----- return(res); }
/// <summary> /// Constructeur. /// </summary> /// <param name="elementBiome">Le type d'élément biome représenté.</param> public ElementCarte(TypeElementBiome elementBiome) { this.ElementBiome = elementBiome; this.Altitude = 0; }