Add separate plus and minus signs.

This commit is contained in:
Přemysl Eric Janouch 2011-03-06 12:27:35 +01:00
parent f821e029d7
commit 01dea6fb2e
3 changed files with 52 additions and 38 deletions

View File

@ -0,0 +1,46 @@
-- Symbol names
local names_plus =
{
en = "Plus sign",
cs = "Znaménko plus",
sk = "Znamienko plus"
}
local names_minus =
{
en = "Minus sign",
cs = "Znaménko mínus",
sk = "Znamienko mínus"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-0.5, -0.5, 0.5, 0.5}
-- Terminal points
local terminals = {}
-- Rendering
local render_plus = function (cr)
-- The plus sign
cr.move_to (0, -0.4)
cr.line_to (0, 0.4)
cr.move_to (-0.4, 0)
cr.line_to (0.4, 0)
cr.stroke ()
end
local render_minus = function (cr)
-- The minus sign
cr.move_to (-0.4, 0)
cr.line_to (0.4, 0)
cr.stroke ()
end
-- Register the symbols
logdiag.register ("SignPlus", names_plus, area, terminals, render_plus)
logdiag.register ("SignMinus", names_minus, area, terminals, render_minus)

View File

@ -14,8 +14,7 @@ local names_dc =
}
-- Render area in base units (X1, Y1, X2, Y2)
local area_ac = {-2, -2, 2, 2}
local area_dc = {-2, -2, 3, 2}
local area = {-2, -2, 2, 2}
-- Terminal points
local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
@ -51,18 +50,11 @@ local render_dc = function (cr)
cr.move_to (0.2, 0.25)
cr.line_to (1, 0.25)
-- Polarity sign
cr.move_to (2.6, -0.6)
cr.line_to (2.6, -1.4)
cr.move_to (2.2, -1)
cr.line_to (3.0, -1)
cr.stroke ()
end
-- Register the symbol
logdiag.register ("ACSource", names_ac, area_ac, terminals, render_ac)
logdiag.register ("DCSource", names_dc, area_dc, terminals, render_dc)
-- Register the symbols
logdiag.register ("ACSource", names_ac, area, terminals, render_ac)
logdiag.register ("DCSource", names_dc, area, terminals, render_dc)

View File

@ -6,16 +6,8 @@ local names =
sk = "Kondenzátor"
}
local names_polar =
{
en = "Polarized capacitor",
cs = "Polarizovaný kondenzátor",
sk = "Polarizovaný kondenzátor"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-2, -1, 2, 1}
local area_polar = {-2, -1.5, 2, 1}
-- Terminal points
local terminals = {{-2, 0}, {2, 0}}
@ -39,23 +31,7 @@ local render = function (cr)
cr.stroke ()
end
local render_polar = function (cr)
render (cr)
-- The plus sign
cr.move_to (-0.6, -1)
cr.line_to (-1.4, -1)
cr.move_to (-1, -1.4)
cr.line_to (-1, -0.6)
cr.stroke ()
end
-- Register the symbol
logdiag.register ("Capacitor",
names, area, terminals, render)
logdiag.register ("CapacitorPolarized",
names_polar, area_polar, terminals, render_polar)
logdiag.register ("Capacitor", names, area, terminals, render)