RouteBuilder is an interactive map editor built using OCaml and the Dune build system. It allows users to create roads and locations on a map, with a simple UI for editing and adding new elements. This project leverages OCaml's graphics package for rendering and interaction.
Before running the project, ensure you have the following installed:
-
OCaml and Dune Follow the installation instructions for OCaml and Dune from the CS 3110 textbook: CS 3110 Installation Guide
-
OCaml Graphics Library To use the graphics functionality, you need to install the OCaml graphics package. Follow the tutorial provided by the Yale-NUS College module on Data Structures and Algorithms: OCaml Graphics Demo on GitHub
macOS:
- Install XQuartz: XQuartz
- After installation, log out and log back in.
- Reinstall all previously installed packages via opam:
opam switch
opam switch reinstall <version> # e.g., 4.10.0- Update opam and install the graphics package:
opam update
opam upgrade
opam install graphics- Build the project:
opam install core batteries # If required
make playLinux:
- Ensure that X11 window manager is installed (most distributions include it by default).
- Follow the same steps as macOS for opam and graphics installation.
Windows (via Cygwin):
- Install Cygwin with X11 support: Cygwin
- Follow the same steps as macOS for opam and graphics installation.
- Editing the Map:
- Press the Edit button to enter editing mode.
- Press Done to exit editing mode.
- Adding Roads:
- In edit mode, press the Add Road button.
- Click on two points to define the start and end of the road.
- Name the road when prompted, then press Enter.
- The road will appear as a line with the street name.
- Adding Locations:
- In edit mode, press the Add Location button.
- Click on a point to define the location (must have at least one road on the map).
- Name the location and select a category when prompted.
- The location will appear as a circle with the name and category, placed on the nearest road to the clicked point.
Once everything is set up, you can run the project using the following command:
make playThis will launch the map editor where you can add roads and locations interactively.