diff --git a/src/dhmap.js b/src/dhmap.js index 81c757c..163c6b4 100644 --- a/src/dhmap.js +++ b/src/dhmap.js @@ -125,10 +125,18 @@ var dhmap = {}; // Draw a network switch. Defaults to amber colour function renderSwitch(object, dry) { - object.width = object.width + 1.7; - object.height = object.height + 1.7; - object.x1 = object.x1 - 1; - object.y1 = object.y1 - 0.7; + if(object.horizontal) { + object.width = object.width + 1.7; + object.height = object.height + 1.7; + object.x1 = object.x1 - 0.7 - (object.width/2); + object.y1 = object.y1 - 0.7; + } else { + y_offset = object.height/2 + object.width = object.width + 1.7; + object.height = object.height + 1.7; + object.x1 = object.x1 - 0.7; + object.y1 = object.y1 - 0.7 - (object.height/2); + } switches[object.name] = object; renderRectangle(object, dhmap.colour.UNKNOWN, false, dry); } diff --git a/src/ipplan2dhmap.py b/src/ipplan2dhmap.py index 0d85ace..eb63e0f 100755 --- a/src/ipplan2dhmap.py +++ b/src/ipplan2dhmap.py @@ -15,7 +15,7 @@ c.execute( 'SELECT name, horizontal, "table" AS class, hall, x1, y1, x2, y2, width, height FROM table_coordinates' - ' UNION SELECT sc.name, 0 AS horizontal, "switch" AS class, tc.hall hall, sc.x + 5 AS x1, sc.y + 5 AS y1, sc.x + 5 AS x2,' + ' UNION SELECT sc.name, tc.horizontal AS horizontal, "switch" AS class, tc.hall hall, sc.x + 5 AS x1, sc.y + 5 AS y1, sc.x + 5 AS x2,' ' sc.y + 5 AS y1, 5 AS width, 5 AS height ' ' FROM switch_coordinates sc ' ' INNER JOIN table_coordinates tc ON sc.table_name = tc.name'