less copy protection, more size visualization
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

129 行
3.2 KiB

  1. function makeBuilding(name, height, image) {
  2. views = {
  3. building: {
  4. attributes: {
  5. height: {
  6. name: "Height",
  7. power: 1,
  8. type: "length",
  9. base: height
  10. }
  11. },
  12. image: image,
  13. name: "building"
  14. },
  15. };
  16. return makeEntity(name, "Building", views);
  17. }
  18. function makeBuildings() {
  19. const results = [];
  20. results.push({
  21. name: "Burj Khalifa",
  22. constructor: () => makeBuilding(
  23. "Burj Khalifa",
  24. math.unit(829.8, "meter"),
  25. { source: "./media/buildings/burj-khalifa.svg" }
  26. )
  27. });
  28. results.push({
  29. name: "Canton Tower",
  30. constructor: () => makeBuilding(
  31. "Canton Tower",
  32. math.unit(604, "meter"),
  33. { source: "./media/buildings/canton-tower.svg" }
  34. )
  35. });
  36. results.push({
  37. name: "CN Tower",
  38. constructor: () => makeBuilding(
  39. "CN Tower",
  40. math.unit(553.3, "meter"),
  41. { source: "./media/buildings/cn-tower.svg" }
  42. )
  43. });
  44. results.push({
  45. name: "Taipei 101",
  46. constructor: () => makeBuilding(
  47. "Taipei 101",
  48. math.unit(509.2, "meter"),
  49. { source: "./media/buildings/taipei-101.svg" }
  50. )
  51. });
  52. results.push({
  53. name: "Empire State Building",
  54. constructor: () => makeBuilding(
  55. "Empire State Building",
  56. math.unit(443.2, "meter"),
  57. { source: "./media/buildings/empire-state-building.svg" }
  58. )
  59. });
  60. results.push({
  61. name: "Eiffel Tower",
  62. constructor: () => makeBuilding(
  63. "Eiffel Tower",
  64. math.unit(324, "meter"),
  65. { source: "./media/buildings/eiffel-tower.svg" }
  66. )
  67. });
  68. results.push({
  69. name: "Chrysler Building",
  70. constructor: () => makeBuilding(
  71. "Chrysler Building",
  72. math.unit(318.9, "meter"),
  73. { source: "./media/buildings/chrysler-building.svg" }
  74. )
  75. });
  76. results.push({
  77. name: "Two-Story Home",
  78. constructor: () => makeBuilding(
  79. "House",
  80. math.unit(25, "feet"),
  81. { source: "./media/buildings/house.svg" }
  82. )
  83. });
  84. results.push({
  85. name: "Mobile Home",
  86. constructor: () => makeBuilding(
  87. "Mobile Home",
  88. math.unit(10, "feet"),
  89. { source: "./media/buildings/mobile-home.svg" }
  90. )
  91. });
  92. results.push({
  93. name: "Mailbox",
  94. constructor: () => makeBuilding(
  95. "Mailbox",
  96. math.unit(5.1, "feet"),
  97. { source: "./media/buildings/mailbox.svg" }
  98. )
  99. });
  100. results.push({
  101. name: "Gateway Arch",
  102. constructor: () => makeBuilding(
  103. "Gateway Arch",
  104. math.unit(630, "feet"),
  105. { source: "./media/buildings/gateway-arch.svg" }
  106. )
  107. });
  108. results.sort((b1, b2) => {
  109. e1 = b1.constructor();
  110. e2 = b2.constructor();
  111. return -math.subtract(e1.views[e1.defaultView].height, e2.views[e2.defaultView].height).value;
  112. });
  113. return results;
  114. }