- Create a new webscene
- Add a Building Scene layer and add the suffix
Building:
in front of it's name - Save the webscene, give it a nice title and copy the webscene id. You will need it in a few next steps
- Clone the git repository in your local machine and then go into the folder:
git clone https://github.com/Esri/building-viewer
cd BSL-Demo-App
- Remove the
.git
repository referencerm -rf .git
- Install dependency:
npm run install
- Compile the code:
npm run build
- Start the server:
npm run server
- Open your browser and enter the local address
http://localhost:8888/
. You should see now the Building Viewer running:
- Open
src/config.tsx
in your favorite code editor - Delete all the content except the two first obscure lines
- Now you need to define 2 parameters in the config to get started:
- The
websceneId
of the webscene you created above
- The
export const websceneId = "YOUR WEBSCENE ID HERE";
*Note that you may to also export on which portal this webscene resides if different from the ArcGis's portal: `export const portalUrl = "https://your-portal-url.com";`*
2. The `sections` you'd like to have in your Building Viewer (see documentation about sections). Let's start with only one section, the home page:
// first import the section:
import HomeSection = require("./sections/HomeSection");
// then export the `sections` parameter:
export const sections = [
new HomeSection({})
];
- Recompile the code (note that the Building Viewer ships with a little util that watch files and recompile for you. Just run
npm run dev
in a differnet terminal window) - You should see your building in the Building Viewer now if you reload your webviewer:
The title of the home page is the title of your scene. If you would like to change it, you can simply update the title of the scene.
- First, the view of the building when opening the Building Viewer isn't really Building appealing. Let's change this.
- Go back to your webscene
- Navigate to a view that please you
- Save a slide with name "Overview"
- Save your webscene and reload the demo Building Viewer. You should have a better view when you enter the Building Viewer:
- Let's add some description on the left side:
- Go back to your webscene and go to "Properties"
- Add your text in the webscene description
- Save the webscene and reload the demo Building Viewer. You should now see your text on the left side:
- Let's add different point of views for the user to appreciate the building in all corners:
- Go back to your webscene and go to "Slides"
- Move your view to the location you would like
- Create a new slide
- Repeat as much as you want, and then save your scene
- Reload the demo app, you should see now some points of view:
- Let's add the opening hours:
- Go now to the file
src/config.tsx
- Import the necessary classes:
- Go now to the file
import {Timetable, DayTimetable} from "./widgets/Timetable/Timetable";
import Collection = require("esri/core/Collection");
3. Add the timetable to the home section, and add all your opening hours for every day:
new HomeSection({
timetable: new Timetable({
dates: new Collection([
new DayTimetable({
opens: "8:00",
closes: "20:00"
}),
new DayTimetable({
opens: "8:00",
closes: "20:00"
}),
new DayTimetable({
opens: "8:00",
closes: "20:00"
}),
new DayTimetable({
opens: "8:00",
closes: "20:00"
}),
new DayTimetable({
opens: "8:00",
closes: "20:00"
}),
new DayTimetable({
opens: "10:00",
closes: "17:00"
}),
new DayTimetable({
opens: "10:00",
closes: "17:00"
})
])
})
})
4. Save your file, recompile the typsecrip and reload the app
5. You should now see the time table on the bottom left of the home page:
- Change the ground colour
- The design of the Building Viewer has been set to work well with darker colours. Let's change the background for a dark solid colour
- Go back to your webscene and click on "Ground". Choose a good ground colour
- Go to the basemap gallery, and check "No basemap".
- Save your webscene (as the initial state) and reloads the Building Viewer:
- Finally, let's add city buildings:
- If you have the city as Building Scene Layer, you can add it to your webscene and name it "City model".
- Save your webscene and reload the Building Viewer, you should see now the surroundings building:
Note that all others layers or configuration of your webscene will appear in your demo app.
To go beyond and add more section, please read the sections documentation. You can always check the naming conventions for a quick look at the different layer and slide names.