function makeBuilding(name, height, image) { views = { building: { attributes: { height: { name: "Height", power: 1, type: "length", base: height } }, image: image, name: "building" }, }; return makeEntity({ name: name }, views); } function makeSkyscraper(name, image) { views = { building: { attributes: { height: { name: "Height", power: 1, type: "length", base: math.unit(1, "meter") } }, image: image, name: "building" }, }; const sizes = []; sizes.push({ name: "Short", height: math.unit(15, "stories") }); sizes.push({ name: "Medium", height: math.unit(40, "stories"), default: true }); sizes.push({ name: "Supertall", height: math.unit(350, "meters") }); sizes.push({ name: "Megatall", height: math.unit(650, "meters") }); const entity = makeEntity({ name: name }, views, sizes); return entity; } function makeBuildings() { const results = []; results.push({ name: "Two-Story Home", constructor: () => makeBuilding( "Two-Story Home", math.unit(25, "feet"), { source: "./media/buildings/house.svg" } ) }); results.push({ name: "Mobile Home", constructor: () => makeBuilding( "Mobile Home", math.unit(10, "feet"), { source: "./media/buildings/mobile-home.svg" } ) }); results.push({ name: "Mailbox", constructor: () => makeBuilding( "Mailbox", math.unit(5.1, "feet"), { source: "./media/buildings/mailbox.svg" } ) }); results.push({ name: "Bus Stop", constructor: () => makeBuilding( "Bus Stop", math.unit(8, "feet"), { source: "./media/buildings/bus-stop.svg" } ) }); results.push( { name: "Wide Skyscraper", constructor: () => makeSkyscraper( "Wide Skyscraper", { source: "./media/buildings/skyscrapers/wide.svg" } ) } ); results.push( { name: "Skyscraper", constructor: () => makeSkyscraper( "Skyscraper", { source: "./media/buildings/skyscrapers/medium.svg" } ) } ); results.push( { name: "Slender Skyscraper", constructor: () => makeSkyscraper( "Slender Skyscraper", { source: "./media/buildings/skyscrapers/slender.svg" } ) } ); results.push( { name: "Narrow Skyscraper", constructor: () => makeSkyscraper( "Narrow Skyscraper", { source: "./media/buildings/skyscrapers/narrow.svg" } ) } ); results.push( makeHeight( [ ["four-lane-highway", 27.432, "meters"], ["sidewalk", 24, "feet"] ], "Roads", "", "buildings" ) ) results.push( makeHeight( [ ["compact-parking-space", 16 + 4/12, "feet"], ["crosswalk", 26.25, "feet"], ["line", 26.25, "feet"], ["broken-line", 50, "feet"], ["dotted-line", 39, "feet"], ], "Road Markings", "", "buildings" ) ) results.push( makeHeight( [ ["residential", 12, "feet"], ["freeway", 50, "feet"] ], "Street Lamps", "", "buildings" ) ) results.push( makeHeight( [ ["badminton-court", 13.4, "meters"], ["basketball-court", 28, "meters"], ["bocce-court", 27.5, "meters"], ["bowling-lane", 23.8, "meters"], ["football-field", 160, "feet"], ["ice-hockey", 30, "meters"], ["netball-court", 30.5, "meters"], ["olympic-swimming-pool", 25, "meters"], ["snooker-table", 3.7, "meters"], ["squash-court", 9.8, "meters"], ["table-tennis", 2.79, "meters"], ["tennis-court", 23.8, "meters"], ["volleyball-court", 21.6, "meters"], ], "Sports Fields", "", "buildings" ) ) results.push( makeHeight( [ ["small", 51.8, "meters"], ["medium", 108.1, "meters"], ["large", 141.7, "meters"], ["extra-large", 190.2, "meters"] ], "Wind Turbines", "", "buildings" ) ) results.push({ name: "Gas Station", constructor: () => makeBuilding( "Gas Station", math.unit(6.78, "meters"), { source: "./media/buildings/gas-station.svg" } ) }); results.push({ name: "Staircase", constructor: () => makeBuilding( "Staircase", math.unit(12.956, "feet"), { source: "./media/buildings/staircase.svg" } ) }); results.push( makeHeight( [ ["residential", 83, "inches"], ["garage-door", 7.5, "feet"], ["double-garage-door", 7.5, "feet"], ["small-private-hangar", 10.5, "feet"], ], "Doorways", "", "buildings" ) ) results.push( makeHeight( [ ["akashi-kaikyō-bridge", 283, "meters"], ["chaotianmen-bridge", 160, "meters"], ["forth-bridge", 100, "meters"], ["golden-gate-bridge", 230, "meters"], ["millau-viaduct", 421, "meters"], ["rialto-bridge", 17, "meters"], ["russky-bridge", 306, "meters"], ["sydney-harbour-bridge", 129, "meters"], ["tower-bridge", 65, "meters"], ["trajan's-bridge", 40, "meters"], ], "Bridges", "", "buildings" ) ) results.push( makeHeight( [ ["channel-tunnel", 6.23, "meters"], ["crossrail", 5.08, "meters"], ["victoria-line", 3.24, "meters"], ], "Tunnels", "", "buildings" ), ) const dataHouses = [ { name: "Shotgun House", sides: { "Front": { height: math.unit(3.968526840209961, "meters") }, "Side": { height: math.unit(3.968526840209961, "meters") }, "Top": { height: math.unit(9.709759712219238, "meters") }, "Angled": { height: math.unit(3.968526840209961, "meters") } } } ] results.push({ name: "Houses", constructor: () => makeAutoVehicleGroup( dataHouses, "Houses", "buildings" ) }) results.sort((b1, b2) => { e1 = b1.constructor(); e2 = b2.constructor(); return e1.name.localeCompare(e2.name) }); return results; }