Skip to content

GUI application that lets users create maps with roads and locations, and find the shortest path between any two points. Built with OCaml Graphics, and includes unit tests using the OUnit framework.

Notifications You must be signed in to change notification settings

bkhalil3/RouteBuilder

Repository files navigation

RouteBuilder: OCaml-based Interactive Map Editor

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.


Prerequisites

Before running the project, ensure you have the following installed:

  1. OCaml and Dune Follow the installation instructions for OCaml and Dune from the CS 3110 textbook: CS 3110 Installation Guide

  2. 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


Installation for Different OS:

macOS:

  1. Install XQuartz: XQuartz
  2. After installation, log out and log back in.
  3. Reinstall all previously installed packages via opam:
opam switch
opam switch reinstall <version>  # e.g., 4.10.0
  1. Update opam and install the graphics package:
opam update
opam upgrade
opam install graphics
  1. Build the project:
opam install core batteries  # If required
make play

Linux:

  1. Ensure that X11 window manager is installed (most distributions include it by default).
  2. Follow the same steps as macOS for opam and graphics installation.

Windows (via Cygwin):

  1. Install Cygwin with X11 support: Cygwin
  2. Follow the same steps as macOS for opam and graphics installation.

How to Use

  1. Editing the Map:
  • Press the Edit button to enter editing mode.
  • Press Done to exit editing mode.
  1. 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.
  1. 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.

Running the Project

Once everything is set up, you can run the project using the following command:

make play

This will launch the map editor where you can add roads and locations interactively.

About

GUI application that lets users create maps with roads and locations, and find the shortest path between any two points. Built with OCaml Graphics, and includes unit tests using the OUnit framework.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages