DBFahrerKaterchen3 commited on
Commit
b37effe
·
verified ·
1 Parent(s): d34e5a2

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +526 -242
index.html CHANGED
@@ -1,264 +1,548 @@
1
  <!DOCTYPE html>
2
  <html lang="de">
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Minifahrplan Linie 91</title>
7
- <style>
8
- * {
9
- box-sizing: border-box;
10
- }
11
- body {
12
- font-family: Arial, Helvetica, sans-serif;
13
- background-color: #f4f4f4;
14
- padding: 20px;
15
- display: flex;
16
- justify-content: center;
17
- align-items: flex-start;
18
- margin: 0;
19
- }
20
- .minifahrplan {
21
- width: 100%;
22
- max-width: 480px;
23
- background: #ffffff;
24
- border: 2px solid #000;
25
- box-shadow: 4px 4px 10px rgba(0,0,0,0.15);
26
- border-radius: 4px;
27
- overflow: hidden;
28
- }
29
- .header {
30
- background-color: #d31227;
31
- color: white;
32
- padding: 12px;
33
- display: flex;
34
- justify-content: space-between;
35
- align-items: center;
36
- }
37
- .line-badge {
38
- background-color: white;
39
- color: #d31227;
40
- font-size: 28px;
41
- font-weight: bold;
42
- padding: 4px 12px;
43
- border-radius: 4px;
44
- line-height: 1;
45
- }
46
- .title-box {
47
- text-align: right;
48
- }
49
- .route-title {
50
- font-size: 14px;
51
- font-weight: bold;
52
- text-transform: uppercase;
53
- margin: 0;
54
- }
55
- .sub-title {
56
- font-size: 11px;
57
- margin: 2px 0 0 0;
58
- }
59
-
60
- /* Direction Switcher */
61
- .direction-toggle {
62
- display: flex;
63
- background: #b00e1f;
64
- border-bottom: 1px solid #000;
65
- }
66
- .dir-btn {
67
- flex: 1;
68
- background: transparent;
69
- border: none;
70
- color: rgba(255, 255, 255, 0.7);
71
- padding: 8px 4px;
72
- font-size: 11px;
73
- font-weight: bold;
74
- cursor: pointer;
75
- transition: background 0.2s, color 0.2s;
76
- }
77
- .dir-btn.active {
78
- background: #ffffff;
79
- color: #d31227;
80
- }
81
- .dir-btn:hover:not(.active) {
82
- background: rgba(0,0,0,0.1);
83
- color: white;
84
- }
85
 
86
- .info-bar {
87
- background-color: #eee;
88
- padding: 6px 12px;
89
- font-size: 11px;
90
- border-bottom: 1px solid #ccc;
91
- font-weight: bold;
92
- text-align: center;
93
- }
94
- table {
95
- width: 100%;
96
- border-collapse: collapse;
97
- font-size: 11px;
98
- }
99
- th {
100
- background: #333;
101
- color: white;
102
- text-align: left;
103
- padding: 6px 6px;
104
- font-size: 10px;
105
- }
106
- td {
107
- padding: 5px 6px;
108
- border-bottom: 1px solid #e0e0e0;
109
- }
110
- tr:nth-child(even) {
111
- background-color: #f9f9f9;
112
- }
113
- /* Hover effect for better readability */
114
- tbody tr:hover {
115
- background-color: #f0f4f8 !important;
116
- }
117
- .station-name { font-weight: normal; }
118
- .bold-station { font-weight: bold; }
119
- .time-col {
120
- text-align: center;
121
- font-weight: bold;
122
- color: #555;
123
- }
124
- .icon { text-align: center; font-weight: bold; }
125
- .symbol-yes { color: #2e7d32; }
126
- .symbol-no { color: #c62828; }
127
- .symbol-opt { color: #ef6c00; }
128
-
129
- .footer {
130
- padding: 10px 12px;
131
- background-color: #fafafa;
132
- border-top: 1px solid #ccc;
133
- font-size: 10px;
134
- color: #444;
135
- }
136
- .footer ul { margin: 4px 0 0 0; padding-left: 14px; }
137
- .footer li { margin-bottom: 3px; }
138
-
139
- /* Print Stylesheet */
140
- @media print {
141
- body { background: none; padding: 0; }
142
- .minifahrplan { box-shadow: none; border: 1px solid #000; width: 100%; }
143
- .direction-toggle { display: none; }
144
- }
145
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  </head>
147
  <body>
148
 
149
- <div class="minifahrplan">
150
- <div class="header">
151
- <div class="line-badge">91</div>
152
- <div class="title-box">
153
- <div class="route-title">Minifahrplan</div>
154
- <div id="route-direction-text" class="sub-title">Neue Vahr Nord &#10142; Schwanewede</div>
155
- </div>
156
- </div>
157
 
158
- <!-- Direction Switcher Buttons -->
159
- <div class="direction-toggle">
160
- <button class="dir-btn active" onclick="switchDirection('outbound')">HIN: Schwanewede</button>
161
- <button class="dir-btn" onclick="switchDirection('inbound')">RÜCK: Neue Vahr Nord</button>
162
  </div>
163
 
164
- <div class="info-bar">
165
- Takt: 20-Min-Takt (Tag) / 30-Min-Takt (Nacht) | 24h-Betrieb
 
 
 
 
166
  </div>
167
 
168
- <!-- Direction 1: Outbound -->
169
- <table id="table-outbound">
170
- <thead>
171
- <tr>
172
- <th>Haltestelle</th>
173
- <th style="text-align:center">+Min</th>
174
- <th style="text-align:center">Regel</th>
175
- <th style="text-align:center">Nacht/Sonder<sup>*</sup></th>
176
- <th style="text-align:center">Schule<sup>S</sup></th>
177
- </tr>
178
- </thead>
179
- <tbody>
180
- <tr><td class="bold-station">Neue Vahr Nord</td><td class="time-col">00</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
181
- <tr><td class="station-name">Stresemannstr.</td><td class="time-col">02</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
182
- <tr><td class="station-name">Am Brück</td><td class="time-col">04</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
183
- <tr><td class="station-name">Klugenhagener Str.</td><td class="time-col">06</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
184
- <tr><td class="station-name">Neuenkirchener Weg</td><td class="time-col">08</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
185
- <tr><td class="bold-station">Bf Turnerstr.</td><td class="time-col">10</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
186
- <tr><td class="station-name">Kleine Siedlung</td><td class="time-col">12</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
187
- <tr><td class="bold-station">Bf Lauenbrück</td><td class="time-col">14</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
188
- <tr><td class="station-name">Wuhletal Nord / Wuhletaler Str.</td><td class="time-col">16</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no">|</td></tr>
189
- <tr style="background:#fff3e0;"><td class="bold-station">Wuhletal Süd</td><td class="time-col">19</td><td class="icon symbol-no">|</td><td class="icon symbol-opt">&#9679;</td><td class="icon symbol-yes"><b>06:35</b></td></tr>
190
- <tr style="background:#fff3e0;"><td class="station-name">Parkstr.</td><td class="time-col">21</td><td class="icon symbol-no">|</td><td class="icon symbol-opt">&#9679;</td><td class="icon symbol-yes">06:37</td></tr>
191
- <tr style="background:#fff3e0;"><td class="station-name">Niederstr.</td><td class="time-col">23</td><td class="icon symbol-no">|</td><td class="icon symbol-opt">&#9679;</td><td class="icon symbol-no">|</td></tr>
192
- <tr><td class="station-name">Nienhimmler Str.</td><td class="time-col">18/—</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"><b>X</b></td><td class="icon symbol-no"><b>X</b></td></tr>
193
- <tr><td class="bold-station">Jenaer Str.</td><td class="time-col">20/25</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes"><b>06:41</b></td></tr>
194
- <tr><td class="station-name">Grasberger Str.</td><td class="time-col">22/27</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
195
- <tr><td class="station-name">Hagenbecker Str.</td><td class="time-col">24/29</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
196
- <tr><td class="station-name">Heinrich-Hertz-Straße</td><td class="time-col">26/31</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
197
- <tr><td class="station-name">Quartier 2</td><td class="time-col">28/33</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
198
- <tr><td class="bold-station">Bf Farge</td><td class="time-col">30/35</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-opt"><b>Ziel (:05)</b></td><td class="icon symbol-no"> </td></tr>
199
- <tr><td class="station-name">Rönnebecker Str.</td><td class="time-col">32/37</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
200
- <tr><td class="station-name">Kreinsloger Str.</td><td class="time-col">34/39</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
201
- <tr><td class="station-name">Eggestedter Str.</td><td class="time-col">36/41</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-no"> </td></tr>
202
- <tr style="background:#e8f5e9;"><td class="bold-station">Schwanewede</td><td class="time-col">38/43</td><td class="icon symbol-yes"><b>&#10142; 92</b></td><td class="icon symbol-yes"><b>&#10142; 92</b></td><td class="icon symbol-no"> </td></tr>
203
- </tbody>
204
- </table>
205
-
206
- <!-- Direction 2: Inbound (Hidden by default) -->
207
- <table id="table-inbound" style="display: none;">
208
- <thead>
209
- <tr>
210
- <th>Haltestelle</th>
211
- <th style="text-align:center">+Min</th>
212
- <th style="text-align:center">Regel</th>
213
- <th style="text-align:center">Nacht/Sonder</th>
214
- </tr>
215
- </thead>
216
- <tbody>
217
- <tr style="background:#e8f5e9;"><td class="bold-station">Schwanewede</td><td class="time-col">00</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
218
- <tr><td class="station-name">Eggestedter Str.</td><td class="time-col">02</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
219
- <tr><td class="station-name">Kreinsloger Str.</td><td class="time-col">04</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
220
- <tr><td class="station-name">Rönnebecker Str.</td><td class="time-col">06</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
221
- <tr><td class="bold-station">Bf Farge</td><td class="time-col">08</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
222
- <tr><td class="bold-station">Jenaer Str.</td><td class="time-col">18</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
223
- <tr><td class="bold-station">Bf Lauenbrück</td><td class="time-col">24</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
224
- <tr><td class="bold-station">Bf Turnerstr.</td><td class="time-col">28</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
225
- <tr style="background:#e8f5e9;"><td class="bold-station">Neue Vahr Nord</td><td class="time-col">38</td><td class="icon symbol-yes">&#9679;</td><td class="icon symbol-yes">&#9679;</td></tr>
226
- </tbody>
227
- </table>
228
-
229
- <div class="footer">
230
- <b>Zeichenerklärung:</b>
231
- <ul>
232
- <li><b>+Min:</b> Fahrzeit in Minuten ab Start (Regelstrecke / Umleitung über Wuhletal Süd).</li>
233
- <li><b>*</b> Umleitung über Parkstr., Niederstr. & Wuhletal Süd (+5 Min Fahrzeit).</li>
234
- <li><b>X</b> Halt entfällt bei Umleitungs- und Schulfahrten.</li>
235
- <li><b>S</b> Nur an Schultagen ab Wuhletal Süd (06:35) bis Jenaer Str. (06:41).</li>
236
- </ul>
237
  </div>
238
  </div>
239
 
240
  <script>
241
- function switchDirection(dir) {
242
- const outboundTable = document.getElementById('table-outbound');
243
- const inboundTable = document.getElementById('table-inbound');
244
- const titleText = document.getElementById('route-direction-text');
245
- const buttons = document.querySelectorAll('.dir-btn');
246
-
247
- if (dir === 'outbound') {
248
- outboundTable.style.display = 'table';
249
- inboundTable.style.display = 'none';
250
- titleText.innerHTML = 'Neue Vahr Nord &#10142; Schwanewede';
251
- buttons[0].classList.add('active');
252
- buttons[1].classList.remove('active');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  } else {
254
- outboundTable.style.display = 'none';
255
- inboundTable.style.display = 'table';
256
- titleText.innerHTML = 'Schwanewede &#10142; Neue Vahr Nord';
257
- buttons[0].classList.remove('active');
258
- buttons[1].classList.add('active');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  }
 
260
  }
261
- </script>
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  </body>
264
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="de">
3
  <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ESTW Simulation</title>
7
+ <style>
8
+ :root {
9
+ --bg-color: #121619;
10
+ --panel-bg: #1e252b;
11
+ --track-gray: #555e68;
12
+ --track-yellow: #f1c40f;
13
+ --track-red: #e74c3c;
14
+ --text-color: #ecf0f1;
15
+ --accent-blue: #2980b9;
16
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
+ body {
19
+ margin: 0;
20
+ padding: 15px;
21
+ background-color: var(--bg-color);
22
+ color: var(--text-color);
23
+ font-family: 'Consolas', 'Courier New', monospace;
24
+ user-select: none;
25
+ }
26
+
27
+ h1 {
28
+ margin: 0 0 10px 0;
29
+ font-size: 18px;
30
+ color: #bdc3c7;
31
+ text-transform: uppercase;
32
+ letter-spacing: 1px;
33
+ }
34
+
35
+ #container {
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 15px;
39
+ max-width: 1300px;
40
+ margin: 0 auto;
41
+ }
42
+
43
+ /* Stellwerk Display */
44
+ #canvas-container {
45
+ background-color: #080a0c;
46
+ border: 2px solid #2c3e50;
47
+ border-radius: 4px;
48
+ position: relative;
49
+ box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
50
+ overflow: hidden;
51
+ }
52
+
53
+ canvas {
54
+ display: block;
55
+ cursor: pointer;
56
+ }
57
+
58
+ /* Control Panel */
59
+ #controls {
60
+ background-color: var(--panel-bg);
61
+ border: 1px solid #34495e;
62
+ border-radius: 4px;
63
+ padding: 12px;
64
+ display: flex;
65
+ gap: 15px;
66
+ align-items: center;
67
+ justify-content: space-between;
68
+ }
69
+
70
+ .button-group {
71
+ display: flex;
72
+ gap: 10px;
73
+ align-items: center;
74
+ }
75
+
76
+ button {
77
+ background-color: #2c3e50;
78
+ color: #fff;
79
+ border: 1px solid #455a64;
80
+ padding: 8px 16px;
81
+ font-family: inherit;
82
+ font-size: 13px;
83
+ font-weight: bold;
84
+ border-radius: 3px;
85
+ cursor: pointer;
86
+ transition: all 0.15s ease;
87
+ }
88
+
89
+ button:hover {
90
+ background-color: #34495e;
91
+ border-color: #78909c;
92
+ }
93
+
94
+ button.active {
95
+ background-color: #d35400 !important;
96
+ border-color: #e67e22 !important;
97
+ box-shadow: 0 0 8px rgba(211, 84, 0, 0.8);
98
+ }
99
+
100
+ .status-box {
101
+ font-size: 12px;
102
+ color: #95a5a6;
103
+ background-color: #121619;
104
+ padding: 6px 12px;
105
+ border-radius: 3px;
106
+ border: 1px solid #2c3e50;
107
+ }
108
+
109
+ /* Log Section */
110
+ #log-container {
111
+ background-color: #000;
112
+ border: 1px solid #2c3e50;
113
+ border-radius: 4px;
114
+ height: 120px;
115
+ overflow-y: auto;
116
+ padding: 8px;
117
+ font-size: 12px;
118
+ color: #2ecc71;
119
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.9);
120
+ }
121
+
122
+ .log-entry {
123
+ margin-bottom: 3px;
124
+ }
125
+ .log-time {
126
+ color: #7f8c8d;
127
+ }
128
+ .log-warn {
129
+ color: #e67e22;
130
+ }
131
+ </style>
132
  </head>
133
  <body>
134
 
135
+ <div id="container">
136
+ <h1>ESTW - Bedienplatz Simulation</h1>
 
 
 
 
 
 
137
 
138
+ <div id="canvas-container">
139
+ <canvas id="estwCanvas" width="1250" height="520"></canvas>
 
 
140
  </div>
141
 
142
+ <div id="controls">
143
+ <div class="button-group">
144
+ <button id="btnFasha" onclick="toggleFasha()">FaSHa (Fahrstraßenhilfsauflösung)</button>
145
+ <button onclick="resetSelection()" style="background-color: #7f8c8d;">Selection Reset</button>
146
+ </div>
147
+ <div class="status-box" id="statusText">System bereit. Start-Ziel-Bedienung aktiv.</div>
148
  </div>
149
 
150
+ <div id="log-container" id="logBox">
151
+ <div class="log-entry"><span class="log-time">[SYSTEM]</span> Stellwerk initialisiert. Alle Signale auf Hp0.</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  </div>
153
  </div>
154
 
155
  <script>
156
+ const canvas = document.getElementById('estwCanvas');
157
+ const ctx = canvas.getContext('2d');
158
+
159
+ let fashaActive = false;
160
+ let selectedStart = null;
161
+
162
+ // Audio Beep
163
+ function playBeep() {
164
+ try {
165
+ const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
166
+ const osc = audioCtx.createOscillator();
167
+ osc.type = 'sine';
168
+ osc.frequency.setValueAtTime(600, audioCtx.currentTime);
169
+ osc.connect(audioCtx.destination);
170
+ osc.start();
171
+ osc.stop(audioCtx.currentTime + 0.08);
172
+ } catch(e){}
173
+ }
174
+
175
+ function log(msg, type = 'normal') {
176
+ const logBox = document.getElementById('log-container');
177
+ const time = new Date().toLocaleTimeString();
178
+ const entry = document.createElement('div');
179
+ entry.className = 'log-entry ' + (type === 'warn' ? 'log-warn' : '');
180
+ entry.innerHTML = `<span class="log-time">[${time}]</span> ${msg}`;
181
+ logBox.appendChild(entry);
182
+ logBox.scrollTop = logBox.scrollHeight;
183
+ }
184
+
185
+ // Interaktive Elemente
186
+ const buttons = {
187
+ // Zielknöpfe Gleise (Links)
188
+ GL1: { x: 50, y: 310, radius: 10, type: 'ziel', name: 'Gl. 1' },
189
+ GL2: { x: 50, y: 220, radius: 10, type: 'ziel', name: 'Gl. 2' },
190
+ GL3: { x: 50, y: 130, radius: 10, type: 'ziel', name: 'Gl. 3' },
191
+
192
+ // Zielknöpfe BÜ-Schilder (Rechts)
193
+ BP: { x: 1200, y: 50, radius: 10, type: 'ziel', name: 'BP' },
194
+ LND: { x: 1200, y: 470, radius: 10, type: 'ziel', name: 'LND' },
195
+
196
+ // Startsignale
197
+ A: { x: 1060, y: 410, radius: 12, type: 'signal', name: 'A', dir: 'west' },
198
+ F: { x: 1060, y: 100, radius: 12, type: 'signal', name: 'F', dir: 'west' },
199
+ P1: { x: 340, y: 310, radius: 12, type: 'signal', name: 'P1', dir: 'east' },
200
+ P2: { x: 300, y: 220, radius: 12, type: 'signal', name: 'P2', dir: 'east' },
201
+ P3: { x: 200, y: 130, radius: 12, type: 'signal', name: 'P3', dir: 'east' }
202
+ };
203
+
204
+ // Fahrstraßen-Zustand
205
+ let routes = {
206
+ A: null,
207
+ F: null,
208
+ P1: null,
209
+ P2: null,
210
+ P3: null
211
+ };
212
+
213
+ // Definition aller gültigen Fahrstraßen
214
+ const validRoutes = {
215
+ 'A->GL1': { start: 'A', ziel: 'GL1', path: ['A', 'W_LND', 'W_MID2', 'W_MID1', 'GL1'] },
216
+ 'A->GL2': { start: 'A', ziel: 'GL2', path: ['A', 'W_LND', 'W_MID2', 'W_MID1', 'W_P3', 'GL2'] },
217
+ 'A->GL3': { start: 'A', ziel: 'GL3', path: ['A', 'W_LND', 'W_MID2', 'W_MID1', 'W_P3', 'GL3'] },
218
+
219
+ 'F->GL1': { start: 'F', ziel: 'GL1', path: ['F', 'W_BP', 'W_MID2', 'W_MID1', 'GL1'] },
220
+ 'F->GL2': { start: 'F', ziel: 'GL2', path: ['F', 'W_BP', 'W_MID2', 'W_MID1', 'W_P3', 'GL2'] },
221
+ 'F->GL3': { start: 'F', ziel: 'GL3', path: ['F', 'W_BP', 'W_MID2', 'W_MID1', 'W_P3', 'GL3'] },
222
+
223
+ 'P1->BP': { start: 'P1', ziel: 'BP', path: ['P1', 'W_MID1', 'W_MID2', 'W_BP', 'BP'] },
224
+ 'P1->LND': { start: 'P1', ziel: 'LND', path: ['P1', 'W_MID1', 'W_MID2', 'W_LND', 'LND'] },
225
+
226
+ 'P2->BP': { start: 'P2', ziel: 'BP', path: ['P2', 'W_P3', 'W_MID1', 'W_MID2', 'W_BP', 'BP'] },
227
+ 'P2->LND': { start: 'P2', ziel: 'LND', path: ['P2', 'W_P3', 'W_MID1', 'W_MID2', 'W_LND', 'LND'] },
228
+
229
+ 'P3->BP': { start: 'P3', ziel: 'BP', path: ['P3', 'W_P3', 'W_MID1', 'W_MID2', 'W_BP', 'BP'] },
230
+ 'P3->LND': { start: 'P3', ziel: 'LND', path: ['P3', 'W_P3', 'W_MID1', 'W_MID2', 'W_LND', 'LND'] }
231
+ };
232
+
233
+ function toggleFasha() {
234
+ fashaActive = !fashaActive;
235
+ document.getElementById('btnFasha').classList.toggle('active', fashaActive);
236
+ document.getElementById('statusText').innerText = fashaActive ?
237
+ "FaSHa AKTIV: Klicke auf ein Startsignal zum Auflösen." :
238
+ "System bereit. Start-Ziel-Bedienung aktiv.";
239
+ playBeep();
240
+ }
241
+
242
+ function resetSelection() {
243
+ selectedStart = null;
244
+ if (fashaActive) toggleFasha();
245
+ document.getElementById('statusText').innerText = "Auswahl zurückgesetzt.";
246
+ draw();
247
+ }
248
+
249
+ // Click Handling
250
+ canvas.addEventListener('click', function(e) {
251
+ const rect = canvas.getBoundingClientRect();
252
+ const x = e.clientX - rect.left;
253
+ const y = e.clientY - rect.top;
254
+
255
+ for (let key in buttons) {
256
+ const btn = buttons[key];
257
+ const dist = Math.hypot(btn.x - x, btn.y - y);
258
+ if (dist <= btn.radius + 5) {
259
+ handleButtonClick(key, btn);
260
+ return;
261
+ }
262
+ }
263
+ });
264
+
265
+ function handleButtonClick(key, btn) {
266
+ playBeep();
267
+
268
+ if (fashaActive) {
269
+ if (btn.type === 'signal') {
270
+ if (routes[key]) {
271
+ log(`FaSHa: Fahrstraße ab Signal ${key} aufgelöst.`, 'warn');
272
+ routes[key] = null;
273
+ toggleFasha();
274
+ } else {
275
+ log(`FaSHa Fehler: Keine Fahrstraße an Signal ${key} eingestellt.`, 'warn');
276
+ }
277
+ } else {
278
+ log(`FaSHa Fehler: Bitte ein Startsignal wählen!`, 'warn');
279
+ }
280
+ draw();
281
+ return;
282
+ }
283
+
284
+ // Normales Start-Ziel-Schalten
285
+ if (!selectedStart) {
286
+ if (btn.type === 'signal') {
287
+ selectedStart = key;
288
+ document.getElementById('statusText').innerText = `Startsignal ${key} gewählt. Bitte Zielknopf wählen.`;
289
+ log(`Startsignal ${key} ausgewählt.`);
290
+ } else {
291
+ log(`Fehler: Zuerst ein Startsignal wählen!`, 'warn');
292
+ }
293
  } else {
294
+ if (btn.type === 'ziel') {
295
+ const routeKey = `${selectedStart}->${key}`;
296
+ if (validRoutes[routeKey]) {
297
+ if (!routes[selectedStart]) {
298
+ routes[selectedStart] = validRoutes[routeKey];
299
+ log(`Fahrstraße ${selectedStart} -> ${btn.name} eingestellt. Signal ${selectedStart} zeigt Hp2.`);
300
+ selectedStart = null;
301
+ document.getElementById('statusText').innerText = "Fahrstraße erfolgreich eingestellt.";
302
+ } else {
303
+ log(`Fehler: Fahrstraße ab Signal ${selectedStart} ist bereits eingelaufen!`, 'warn');
304
+ selectedStart = null;
305
+ }
306
+ } else {
307
+ log(`Ungültige Fahrstraße: ${selectedStart} -> ${btn.name}`, 'warn');
308
+ selectedStart = null;
309
+ }
310
+ } else if (btn.type === 'signal') {
311
+ selectedStart = key;
312
+ document.getElementById('statusText').innerText = `Startsignal auf ${key} geändert.`;
313
+ }
314
  }
315
+ draw();
316
  }
 
317
 
318
+ // Zeichnen des ESTW Gleisbildes
319
+ function draw() {
320
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
321
+
322
+ // Gleise Zeichnen
323
+ drawTracks();
324
+
325
+ // Signale Zeichnen
326
+ drawSignal(buttons.A, routes.A ? 'Hp2' : 'Hp0');
327
+ drawSignal(buttons.F, routes.F ? 'Hp2' : 'Hp0');
328
+ drawSignal(buttons.P1, routes.P1 ? 'Hp2' : 'Hp0');
329
+ drawSignal(buttons.P2, routes.P2 ? 'Hp2' : 'Hp0');
330
+ drawSignal(buttons.P3, routes.P3 ? 'Hp2' : 'Hp0');
331
+
332
+ // Zielknöpfe
333
+ drawZielButton(buttons.GL1);
334
+ drawZielButton(buttons.GL2);
335
+ drawZielButton(buttons.GL3);
336
+ drawZielButton(buttons.BP);
337
+ drawZielButton(buttons.LND);
338
+
339
+ // Selection Halo
340
+ if (selectedStart) {
341
+ const btn = buttons[selectedStart];
342
+ ctx.strokeStyle = '#f39c12';
343
+ ctx.lineWidth = 3;
344
+ ctx.beginPath();
345
+ ctx.arc(btn.x, btn.y, btn.radius + 6, 0, Math.PI * 2);
346
+ ctx.stroke();
347
+ }
348
+ }
349
+
350
+ function drawTracks() {
351
+ // Basis-Gleisnetzwerk
352
+ ctx.lineWidth = 4;
353
+ ctx.strokeStyle = '#555e68';
354
+
355
+ // Gleis 3, 2, 1 Hauptstränge
356
+ drawLine(50, 130, 200, 130); // Gl 3
357
+ drawLine(50, 220, 300, 220); // Gl 2
358
+ drawLine(50, 310, 340, 310); // Gl 1
359
+
360
+ // Weiche P3 Zusammenführung (Gl3 -> Gl2)
361
+ drawLine(200, 130, 280, 220);
362
+
363
+ // Gl2 & Gl1 Weiterführung
364
+ drawLine(300, 220, 600, 220);
365
+ drawLine(340, 310, 600, 310);
366
+
367
+ // Trapez-Verbindungen
368
+ drawLine(520, 310, 600, 220);
369
+ drawLine(600, 220, 680, 220);
370
+ drawLine(600, 310, 680, 220);
371
+
372
+ // Streckenverzweigungen Ost
373
+ drawLine(680, 220, 780, 310); // nach LND
374
+ drawLine(780, 310, 1200, 470); // LND Ast
375
+
376
+ drawLine(680, 220, 780, 220); // nach BP
377
+ drawLine(780, 220, 1200, 50); // BP Ast
378
+
379
+ // Prellböcke links
380
+ drawBumper(40, 130);
381
+ drawBumper(40, 220);
382
+ drawBumper(40, 310);
383
+
384
+ // Aktive Fahrstraßen Gelb Gestrichelt hervorheben
385
+ for (let rKey in routes) {
386
+ if (routes[rKey]) {
387
+ drawActiveRoute(routes[rKey]);
388
+ }
389
+ }
390
+ }
391
+
392
+ function drawLine(x1, y1, x2, y2, color = '#555e68', dashed = false) {
393
+ ctx.beginPath();
394
+ ctx.strokeStyle = color;
395
+ ctx.lineWidth = 4;
396
+ if (dashed) ctx.setLineDash([8, 6]);
397
+ else ctx.setLineDash([]);
398
+ ctx.moveTo(x1, y1);
399
+ ctx.lineTo(x2, y2);
400
+ ctx.stroke();
401
+ ctx.setLineDash([]);
402
+ }
403
+
404
+ function drawActiveRoute(route) {
405
+ const yellow = '#f1c40f';
406
+ const path = route.path;
407
+
408
+ if (route.start === 'A') {
409
+ if (path.includes('GL1')) {
410
+ drawLine(1060, 414, 780, 310, yellow, true);
411
+ drawLine(780, 310, 680, 220, yellow, true);
412
+ drawLine(600, 220, 520, 310, yellow, true);
413
+ drawLine(520, 310, 50, 310, yellow, true);
414
+ } else if (path.includes('GL2')) {
415
+ drawLine(1060, 414, 780, 310, yellow, true);
416
+ drawLine(780, 310, 680, 220, yellow, true);
417
+ drawLine(680, 220, 300, 220, yellow, true);
418
+ drawLine(300, 220, 50, 220, yellow, true);
419
+ } else if (path.includes('GL3')) {
420
+ drawLine(1060, 414, 780, 310, yellow, true);
421
+ drawLine(780, 310, 680, 220, yellow, true);
422
+ drawLine(680, 220, 280, 220, yellow, true);
423
+ drawLine(280, 220, 200, 130, yellow, true);
424
+ drawLine(200, 130, 50, 130, yellow, true);
425
+ }
426
+ } else if (route.start === 'F') {
427
+ if (path.includes('GL1')) {
428
+ drawLine(1060, 106, 780, 220, yellow, true);
429
+ drawLine(780, 220, 680, 220, yellow, true);
430
+ drawLine(600, 220, 520, 310, yellow, true);
431
+ drawLine(520, 310, 50, 310, yellow, true);
432
+ } else if (path.includes('GL2')) {
433
+ drawLine(1060, 106, 780, 220, yellow, true);
434
+ drawLine(780, 220, 300, 220, yellow, true);
435
+ drawLine(300, 220, 50, 220, yellow, true);
436
+ } else if (path.includes('GL3')) {
437
+ drawLine(1060, 106, 780, 220, yellow, true);
438
+ drawLine(780, 220, 280, 220, yellow, true);
439
+ drawLine(280, 220, 200, 130, yellow, true);
440
+ drawLine(200, 130, 50, 130, yellow, true);
441
+ }
442
+ } else if (route.start.startsWith('P')) {
443
+ let startX = route.start === 'P1' ? 340 : (route.start === 'P2' ? 300 : 200);
444
+ let startY = route.start === 'P1' ? 310 : (route.start === 'P2' ? 220 : 130);
445
+
446
+ if (route.ziel === 'BP') {
447
+ if (route.start === 'P3') {
448
+ drawLine(200, 130, 280, 220, yellow, true);
449
+ drawLine(280, 220, 780, 220, yellow, true);
450
+ } else if (route.start === 'P2') {
451
+ drawLine(300, 220, 780, 220, yellow, true);
452
+ } else if (route.start === 'P1') {
453
+ drawLine(340, 310, 520, 310, yellow, true);
454
+ drawLine(520, 310, 600, 220, yellow, true);
455
+ drawLine(600, 220, 780, 220, yellow, true);
456
+ }
457
+ drawLine(780, 220, 1200, 50, yellow, true);
458
+ } else if (route.ziel === 'LND') {
459
+ if (route.start === 'P3') {
460
+ drawLine(200, 130, 280, 220, yellow, true);
461
+ drawLine(280, 220, 680, 220, yellow, true);
462
+ } else if (route.start === 'P2') {
463
+ drawLine(300, 220, 680, 220, yellow, true);
464
+ } else if (route.start === 'P1') {
465
+ drawLine(340, 310, 600, 310, yellow, true);
466
+ drawLine(600, 310, 680, 220, yellow, true);
467
+ }
468
+ drawLine(680, 220, 780, 310, yellow, true);
469
+ drawLine(780, 310, 1200, 470, yellow, true);
470
+ }
471
+ }
472
+ }
473
+
474
+ function drawBumper(x, y) {
475
+ ctx.strokeStyle = '#e74c3c';
476
+ ctx.lineWidth = 5;
477
+ ctx.beginPath();
478
+ ctx.moveTo(x, y - 12);
479
+ ctx.lineTo(x, y + 12);
480
+ ctx.stroke();
481
+ }
482
+
483
+ function drawZielButton(btn) {
484
+ ctx.fillStyle = '#2980b9';
485
+ ctx.strokeStyle = '#ecf0f1';
486
+ ctx.lineWidth = 2;
487
+ ctx.beginPath();
488
+ ctx.arc(btn.x, btn.y, btn.radius, 0, Math.PI * 2);
489
+ ctx.fill();
490
+ ctx.stroke();
491
+
492
+ ctx.fillStyle = '#ecf0f1';
493
+ ctx.font = 'bold 11px Consolas';
494
+ ctx.fillText(btn.name, btn.x - 12, btn.y - 16);
495
+ }
496
+
497
+ function drawSignal(btn, state) {
498
+ const isEast = btn.dir === 'east';
499
+
500
+ // Mast
501
+ ctx.strokeStyle = '#bdc3c7';
502
+ ctx.lineWidth = 3;
503
+ ctx.beginPath();
504
+ ctx.moveTo(btn.x, btn.y);
505
+ ctx.lineTo(btn.x, btn.y + (isEast ? 22 : -22));
506
+ ctx.stroke();
507
+
508
+ // Signal-Schirm
509
+ ctx.fillStyle = '#1e252b';
510
+ ctx.strokeStyle = '#7f8c8d';
511
+ ctx.lineWidth = 1.5;
512
+ const boxX = btn.x - 10;
513
+ const boxY = isEast ? btn.y + 22 : btn.y - 42;
514
+ ctx.fillRect(boxX, boxY, 20, 20);
515
+ ctx.strokeRect(boxX, boxY, 20, 20);
516
+
517
+ // Lichter (Hp0: Rot / Hp2: Grün + Gelb)
518
+ if (state === 'Hp0') {
519
+ // Rot oben
520
+ ctx.fillStyle = '#e74c3c';
521
+ ctx.beginPath();
522
+ ctx.arc(btn.x, boxY + 10, 5, 0, Math.PI * 2);
523
+ ctx.fill();
524
+ } else if (state === 'Hp2') {
525
+ // Grün oben
526
+ ctx.fillStyle = '#2ecc71';
527
+ ctx.beginPath();
528
+ ctx.arc(btn.x - 4, boxY + 10, 4, 0, Math.PI * 2);
529
+ ctx.fill();
530
+
531
+ // Gelb unten
532
+ ctx.fillStyle = '#f1c40f';
533
+ ctx.beginPath();
534
+ ctx.arc(btn.x + 4, boxY + 10, 4, 0, Math.PI * 2);
535
+ ctx.fill();
536
+ }
537
+
538
+ // Beschriftung
539
+ ctx.fillStyle = '#f39c12';
540
+ ctx.font = 'bold 12px Consolas';
541
+ ctx.fillText(btn.name, btn.x - 8, isEast ? btn.y - 10 : btn.y + 20);
542
+ }
543
+
544
+ // Initiales Zeichnen
545
+ draw();
546
+ </script>
547
  </body>
548
  </html>