This UML Use Case diagram illustrates the primary functionalities of the system (likely a travel planning application) and how an Actor (the User) interacts with it.
- Actor (User): The single actor in the system who initiates all primary use cases.
The Actor can perform the following main actions:
Find RouteAdd CityRemove City
Create Traveler ProfileModify Traveler InfoLoad Traveler ProfileSave Traveler Profile
Load MapExit App
Note
The user can also create a new map when they start adding cities (using the AddCity use case).
The diagram also defines two supporting use cases that are mandatory, included components of other, larger scenarios:
- Included by:
Find Route,Add City,Remove City,Create Traveler Profile, andModify Traveler Info. - Purpose: To ensure that any data entered by the user for these operations (e.g., city names, profile details) is validated for correctness before being processed.
Note
The user will not be able to delete a city if there are no more than 2 of them
- Included by:
Load Traveler Profile,Save Traveler ProfileandLoad Map. - Purpose: To provide robust exception and error handling for operations involving reading or writing the profile file (e.g., "file not found," "access denied").
Important
File Structures
traveler.json
{ "name": "name", "currentLocation": "cityA", "route": ["cityA", "cityB", "cityC"] }map.txt
CityA-CityB, distance CityB-CityC, distance This UML Activity Diagram details the step-by-step flow for the "Find Route" functionality. It shows the process from the initial user input to the final route update, including validation, error handling, and decision loops.
The process starts with the user initiating the action (black start node).
- User Enters Data: The user provides initial data.
- Validate Input (Decision):
- If the data is
Invalid, the system loops back, prompting the user to re-enter the data. - If the data is
Valid, the flow proceeds toLoad map.
- If the data is
- Load Map: The system attempts to load the necessary map data.
- Handle Loading (Decision):
- If loading fails (e.g.,
File not found/invalid loaded data/File is already open), the process moves toView error. - If loading is successful (
Succes loading), the user is prompted toUser enter destantition(enter destination).
- If loading fails (e.g.,
- User Enter Destination: The user inputs their desired destination.
- Validate Destination (Decision):
- If the destination is
Invalid, the process moves toView error. - If the destination is
Valid, the system proceeds toFind path.
- If the destination is
- View Error: An error message is displayed to the user. After this step, the process terminates (moves to the upper end node).
- Find Path: The system attempts to calculate a route based on the valid inputs.
- Handle Path (Decision):
- If a route is
Not found route, the system loops back, prompting the user toUser enter destantitionagain. - If a route is
Found route, the system proceeds toUpdate route.
- If a route is
- Update Route: The calculated route is finalized and displayed or saved.
- End Node: After the route is updated, the process completes.
This UML Sequence Diagram illustrates the order of interactions between different objects in the system when a user performs a series of actions: creating a traveler profile, loading a map, and finding a route.
The sequence of events is as follows:
1.1. The User clicks BtnCreateTraveler_Click() on the :MainForm. 1.2. The :MainForm instantiates a new :Traveler object (message 1.1 Traveler()). 1.3. The :MainForm then calls Create_Traveler_Form() to update the UI (showing a new form). The :Traveler object is returned to the :MainForm.
2.1. The User clicks BtnLoadMap_Click() on the :MainForm. 2.2. The :MainForm calls LoadFromFile() on the :CityGraph object. 2.3. The :CityGraph object loads the map data and returns the [graph] (map data) to the :MainForm.
3.1. The User interacts with the :MainForm to Choose destantition (Choose destination).
4.1. The User clicks BtnGetRoute_Click() on the :MainForm. 4.2. The :MainForm calls PlanRouteTo() on the :Traveler object. 4.3. The :Traveler object, in turn, calls FindShortestPath() on the :CityGraph object. 4.4. The :CityGraph calculates the route and returns the [result route] to the :Traveler object. 4.5. The :Traveler object returns the [result route] to the :MainForm. 4.6. Finally, the :MainForm calls Update_Form() to display the calculated route to the User.


