aboutsummaryrefslogtreecommitdiff
path: root/share/library
diff options
context:
space:
mode:
Diffstat (limited to 'share/library')
-rw-r--r--share/library/Misc/meters.lua63
-rw-r--r--share/library/Misc/voltage-source.lua16
2 files changed, 21 insertions, 58 deletions
diff --git a/share/library/Misc/meters.lua b/share/library/Misc/meters.lua
index 6cd4045..c086c1b 100644
--- a/share/library/Misc/meters.lua
+++ b/share/library/Misc/meters.lua
@@ -5,79 +5,48 @@ local names_A =
cs = "Ampérmetr"
}
-local names_mA =
-{
- en = "Milliammeter",
- cs = "Miliampérmetr"
-}
-
local names_V =
{
en = "Voltmeter",
cs = "Voltmetr"
}
-local names_ohm =
-{
- en = "Ohmmeter",
- cs = "Ohmmetr"
-}
-
-local names_W =
-{
- en = "Wattmeter",
- cs = "Wattmetr"
-}
-
-- Render area in base units (X1, Y1, X2, Y2)
-local area = {-3, -2, 3, 2}
+local area = {-2, -2, 2, 2}
-- Terminal points
-local terminals = {{-3, 0}, {3, 0}}
+local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
-- Rendering
-local render = function (cr, name)
+local render_A = function (cr)
-- The circle
cr.arc (0, 0, 2, 0, math.pi * 2)
- -- The contact
- cr.move_to (-3, 0)
- cr.line_to (-2, 0)
+ -- The letter A
+ cr.move_to (-0.4, 0.5)
+ cr.line_to (0, -0.5)
+ cr.line_to (0.4, 0.5)
- cr.move_to (2, 0)
- cr.line_to (3, 0)
+ cr.move_to (-0.3, 0.25)
+ cr.line_to (0.3, 0.25)
cr.stroke ()
-
- cr.move_to (0, 0)
- cr.show_text (name)
-end
-
-local render_A = function (cr)
- render (cr, "A")
-end
-
-local render_mA = function (cr)
- render (cr, "mA")
end
local render_V = function (cr)
- render (cr, "V")
-end
+ -- The circle
+ cr.arc (0, 0, 2, 0, math.pi * 2)
-local render_ohm = function (cr)
- render (cr, "Ω")
-end
+ -- The letter V
+ cr.move_to (-0.4, -0.5)
+ cr.line_to (0, 0.5)
+ cr.line_to (0.4, -0.5)
-local render_W = function (cr)
- render (cr, "W")
+ cr.stroke ()
end
-- Register the symbols
logdiag.register ("Ammeter", names_A, area, terminals, render_A)
-logdiag.register ("Milliammeter", names_mA, area, terminals, render_mA)
logdiag.register ("Voltmeter", names_V, area, terminals, render_V)
-logdiag.register ("Ohmmeter", names_ohm, area, terminals, render_ohm)
-logdiag.register ("Wattmeter", names_W, area, terminals, render_W)
diff --git a/share/library/Misc/voltage-source.lua b/share/library/Misc/voltage-source.lua
index 7460305..9b33dc7 100644
--- a/share/library/Misc/voltage-source.lua
+++ b/share/library/Misc/voltage-source.lua
@@ -12,23 +12,17 @@ local names_dc =
}
-- Render area in base units (X1, Y1, X2, Y2)
-local area = {-3, -2, 3, 2}
+local area_ac = {-2, -2, 2, 2}
+local area_dc = {-2, -2, 3, 2}
-- Terminal points
-local terminals = {{-3, 0}, {3, 0}}
+local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
-- Rendering
local render = function (cr)
-- The circle
cr.arc (0, 0, 2, 0, math.pi * 2)
- -- The terminals
- cr.move_to (-3, 0)
- cr.line_to (-2, 0)
-
- cr.move_to (2, 0)
- cr.line_to (3, 0)
-
cr.stroke ()
end
@@ -66,7 +60,7 @@ local render_dc = function (cr)
end
-- Register the symbol
-logdiag.register ("ACSource", names_ac, area, terminals, render_ac)
-logdiag.register ("DCSource", names_dc, area, terminals, render_dc)
+logdiag.register ("ACSource", names_ac, area_ac, terminals, render_ac)
+logdiag.register ("DCSource", names_dc, area_dc, terminals, render_dc)