less copy protection, more size visualization
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

80 lignes
2.8 KiB

  1. function makeCity(name, height) {
  2. views = {
  3. city: {
  4. attributes: {
  5. height: {
  6. name: "Highest Point",
  7. power: 1,
  8. type: "length",
  9. base: height
  10. }
  11. },
  12. image: {
  13. source: "./media/cities/city_" + name.replace(/ /g, "-").toLowerCase() + ".svg"
  14. },
  15. name: "City"
  16. },
  17. };
  18. return makeEntity({ name: name }, views);
  19. }
  20. function addCity(name, height) {
  21. return {
  22. name: name,
  23. constructor: () => makeCity(name, height)
  24. }
  25. }
  26. function makeCities() {
  27. const results = [];
  28. // USA
  29. results.push(addCity("Los Angeles", math.unit(1018, "feet")));
  30. results.push(addCity("New York City", math.unit(1454, "feet")));
  31. results.push(addCity("Washington", math.unit(555, "feet")));
  32. results.push(addCity("Chicago", math.unit(1451, "feet")));
  33. results.push(addCity("Phoenix", math.unit(483, "feet")));
  34. results.push(addCity("San Diego", math.unit(500, "feet")));
  35. results.push(addCity("Houston", math.unit(1002, "feet")));
  36. results.push(addCity("San Francisco", math.unit(1070, "feet")));
  37. results.push(addCity("Atlanta", math.unit(1023, "feet")));
  38. results.push(addCity("Dallas", math.unit(915, "feet")));
  39. results.push(addCity("Boston", math.unit(790, "feet")));
  40. results.push(addCity("Seattle", math.unit(605, "feet")));
  41. results.push(addCity("San Antonio", math.unit(750, "feet")));
  42. results.push(addCity("St Louis", math.unit(630, "feet")));
  43. results.push(addCity("Kansas City", math.unit(624, "feet")));
  44. results.push(addCity("Philadelphia", math.unit(973, "feet")));
  45. results.push(addCity("Jacksonville", math.unit(620, "feet")));
  46. results.push(addCity("Detroit", math.unit(727, "feet")));
  47. results.push(addCity("Indianapolis", math.unit(830, "feet")));
  48. results.push(addCity("Columbus", math.unit(629, "feet")));
  49. // Canada
  50. results.push(addCity("Toronto", math.unit(1814, "feet")));
  51. results.push(addCity("Montreal", math.unit(743, "feet")));
  52. results.push(addCity("Vancouver", math.unit(659, "feet")));
  53. results.push(addCity("Ottawa", math.unit(367, "feet")));
  54. results.push(addCity("Mississauga", math.unit(518, "feet")));
  55. results.push(addCity("Edmonton", math.unit(646, "feet")));
  56. results.push(addCity("Winnipeg", math.unit(420, "feet")));
  57. results.push(addCity("Calgary", math.unit(626, "feet")));
  58. // Mexico
  59. results.push(addCity("Mexico City", math.unit(807, "feet")));
  60. results.push(addCity("Guadalajara", math.unit(705, "feet")));
  61. results.push(addCity("Puebla", math.unit(650, "feet")));
  62. results.push(addCity("Tijuana", math.unit(334, "feet")));
  63. results.sort((b1, b2) => {
  64. return b1.name.localeCompare(b2.name);
  65. });
  66. return results;
  67. }