This project allows a creator to create a simple road map quickly. This project was created due to a personal city project where I wanted to map out all the roads however there were no simple solutions available online to do this quickly.
- draw roads, highways and motorways
- custom widths
- draw Route Number labels
- draw Road name labels
- custom colours
- Map parser and reading map files
- Define custom road types, colours and label colours.
- allow user to specify map to load
- easily switch between maps
- GUI
- Move map position by dragging mouse
- Use mouse wheel and keys
=
, and-
to zoom - Show real x,y coordinate of current mouse position
- Touchbar support
- Themes
- Graphical map editor
- Logic
- A* Pathfinding
You will need to add these projects to this project to compile and run.
<dependency>
<groupId>com.thizzer.jtouchbar</groupId>
<artifactId>jtouchbar</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
This program currently only reads the map.cities
file to generate maps. To create a custom map, create a new file called this in the root directory of this project.
Because this project was designed to stay personal, the parser is very strict and gives very vague errors. If you encounter an error, check that your file is 100% correct (The parsing itself is pretty robust if its done correctly. It will 99% be a syntax error).
All data is in a map
object:
// This is a comment
/*
This is a multiline comment
*/
map your_map_name {
map data
}
All parameters like [this]
are optional, but recommended.
You must define your road types before you can use them. This sets the road color, default width, route label background and foreground.
To do this, use the def
keyword:
def <typename> = new Road(red_val, green_val, blue_val, [default width], [label bg], [label fg]);
The red_val
green_val
blue_val
are all integer values between 0->255 that define the road colour.
The default width
defines the default width of the road when the [width]
parameter isn't specified.
label bg
label fg
can be one of 4 values:
- BLUE
- GREEN
- WHITE
- BLACK
To make a road, after your road definitions, the syntax is:
<type>(number_str, road_name_str, [width], (start_x, start_y), (next_x, next_y), [(next_x, next_y)...]);
(Where <type>
is your <typename>
)
You can have as many points for a road as you want.
map example_map {
// Define a new road type called motorway
def motorway = new Road(252, 190, 33, 6, BLUE, WHITE);
// create a new road segment of type motorway
motorway("M1", "M1 Motorway", 12, (32, -787), (32, 100), (68, 100), (-47, 100));
}
+ Added Javadoc
+ Simplified Codebase; removed redundant code+ Added Touchbar support
+ Added Menu Bar
+ Added ability to load and switch custom maps
+ Added Road names to roads
+ Fixed road outlines to not draw inside the same road at corners.
+ Changed map parser to allow for custom road declarations, colours and label colours
First release.
+ Added Roads (Predefined motorway, highway, route and local types).
+ Reading and parsing map data from file.
+ Route Numbering.
+ Prints In game coordinate for mouse position.
+ Allows input from mouse and keyboard for zoom and movement