Skip to content

Commit

Permalink
README added
Browse files Browse the repository at this point in the history
  • Loading branch information
iGEL committed Dec 15, 2023
1 parent 4cb0c60 commit b0b00e2
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## Signals!

![Build Status](https://github.com/github/docs/actions/workflows/build-deploy.yml/badge.svg?branch=main)

This is a toy project written in [ClojureScript](https://clojurescript.org/).
It renders some German railway signals as SVG. You can [try it yourself](https://igel.github.io/signals/)!

![](https://media1.giphy.com/media/l1KVb2dUcmuGG4tby/giphy.gif)

[![](/example.webp)](https://igel.github.io/signals/)

### Setup

To be written :scream:

### Usage in your own project

The project is still being developed, so it can't yet be used from JavaScript
directly. But you can use the signals from cljs.

```cljs
(def !distant (atom {:type :distant
:system :ks
:distant {:aspect :stop}}))
(def !combination (atom {:type :combination
:system :hv-light
:distant {:aspect :proceed}
:main {:aspect :stop}}))
(def !main (atom {:type :main
:system :hv-semaphore
:main {:aspect :proceed}}))
```

Any of those signals can be displayed with calling

```cljs
TODO
```

You can configure signals by adding features to the top level, to the
`:distant` or `:main` part of the signal.

| Attribute | where | Description |
| -------------------- | ------------------ | ------------------------------------------------------------------------------- |
| `:system` | top level | Type of the signal system, can be `:ks`, `:hv-light`, `:hv-semaphore`, or `:hl` |
| `:type` | top level | Type of the signal, can be `:distant`, `:main`, or `:combination` |
| `:aspect` | `:distant`/`:main` | The aspect of the signal, valid values are `:proceed`, `:stop`, `:stop+sh1`, `:stop+zs1`, or `:stop+zs7` |
| `:speed-limit` | `:distant`/`:main` | The current speed limit. Only displayed with a `:zs3`/`:zs3v` or `:slow-speed-lights` and `:proceed` aspect |
| `:slow-speed-lights` | `:distant`/`:main` | A vector of possible speeds. For `:hv-light` & `:hv-semaphore`, only `40` is supported, for `:hl`, it can be `40`, `60` and `100`. `:ks` ignores this |
| `:zs3` | `:main` | Does the signal have a zs3? Possible values are `nil` (no zs3), `:display` or `:sign`. Ignored for `:hl` |
| `:zs3v` | `:distant` | Same as `:zs3`, but for distant signals |
| `:sh1?` | `:main` | Boolean, set to `true` when the signal when it's capable to display a `Sh1`/`Ra12` aspect |
| `:zs1?` | `:main` | Boolean, set to `true` if the signal has a Zs1 |
| `:zs7?` | `:main` | Boolean, set to `true` when the signal has a Zs7 |
| `:distant-addition` | `:distant` | Can be `nil` (nothing), `:repeater` (if this is a repeater), or `:shortened-break-path` when the break path is shortened |

Example:
```cljs
(swap! !combination #(-> %1
(assoc-in [:main :aspect] :stop+sh1)
(assoc-in [:main :sh1?] true)
(assoc-in [:main :zs1?] true)
(assoc-in [:main :slow-speed-lights] [40])
(assoc-in [:main :speed-limit] 40)
(assoc-in [:distant :aspect] :proceed)
(assoc-in [:distant :distant-addition] :shortened-break-path)))
```
Binary file added example.webp
Binary file not shown.

0 comments on commit b0b00e2

Please sign in to comment.